Skip to content

Commit 71cefd4

Browse files
committed
Sync with CMSSW_13_1_X
2 parents 5ebe8d8 + 386ca31 commit 71cefd4

File tree

325 files changed

+112935
-138764
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

325 files changed

+112935
-138764
lines changed

Alignment/OfflineValidation/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Validation
1+
# Aligment/OfflineValidation
22

33
We use the Boost library (Program Options, Filesystem & Property Trees) to deal with the treatment of the config file.
44
Basic idea:
@@ -89,10 +89,10 @@ The python file returns a list of jobs to the `validateAligments.py` which final
8989
- unification of local configuration style based on DMR/PV example
9090
- plotting style options to be implemented
9191
- change marker size for trends
92-
- accept ROOT pre-defined encoding in config (kRed, kDotted, etc.)
92+
- accept ROOT pre-defined encoding in config (`kRed`, `kDotted`, etc.)
9393
- validations to implement:
9494
- PV (only average is missing)
95-
- Zµµ (single + merge)
95+
- Zµµ (trend)
9696
- MTS (single + merge)
9797
- overlap (single + merge + trend)
9898
- ...
@@ -106,13 +106,13 @@ The python file returns a list of jobs to the `validateAligments.py` which final
106106
(list from October 2022)
107107

108108
## DMR validation
109-
For details read `README_DMR.md`
109+
For details read [`README_DMR.md`](https://github.com/cms-sw/cmssw/blob/master/Alignment/OfflineValidation/README_DMR.md)
110110

111111
## PV validation
112-
For details read `README_PV.md`
112+
For details read [`README_PV.md`](https://github.com/cms-sw/cmssw/blob/master/Alignment/OfflineValidation/README_PV.md)
113113

114114
## JetHT validation
115-
For details read `README_JetHT.md`
115+
For details read [`README_JetHT.md`](https://github.com/cms-sw/cmssw/blob/master/Alignment/OfflineValidation/README_JetHT.md)
116116

117117
## General info about IOV/run arguments
118-
For details read `README_IOV.md`
118+
For details read [`README_IOV.md`](https://github.com/cms-sw/cmssw/blob/master/Alignment/OfflineValidation/README_IOV.md)

Alignment/OfflineValidation/README_DMR.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
## DMR validation
2-
3-
#General info
1+
# Track-Hit Residuals Validation (DMR, DRnR, etc.)
2+
3+
## General info
44
```
55
validations:
66
DMR:
@@ -20,7 +20,7 @@ Trends/Averaged job will start if all corresponding merge jobs are done.
2020
Trends and averaged jobs will run in parallel.
2121
Averaged job consists of 3 types of sub-jobs (submission is automatized internally).
2222

23-
#Single DMR jobs:
23+
## Single DMR jobs
2424
Single jobs can be specified per run (IoV as well). In case of MC, IoV is specified to arbitrary 1.
2525

2626
Variable | Default value | Explanation/Options
@@ -38,7 +38,7 @@ usePixelQualityFlag | True | Use pixel quality flag?
3838
cosmicsZeroTesla | False | Is this validation for cosmics with zero magnetic field?
3939
vertexcollection | "offlinePrimaryVertices" | Specify vertex collection to be used.
4040

41-
#Merge DMR job
41+
## Merge DMR job
4242
Its name do not need to match single job name but option `singles` must list all single jobs to be merged.
4343
Needs to be specified in order to run averaged/trends jobs.
4444
DMR merged plot style can be adjusted from global plotting style (see `Alignment/OfflineValidation/test/example_DMR_full.yaml`)
@@ -56,7 +56,7 @@ minimum | 15 | Minimum number of hits requested.
5656
bigtext | false | Legend text size should be enlarged.
5757
moduleid | None | Plot residuals for selected list of module IDs. (debugging)
5858

59-
#Trends DMR job
59+
## Trends DMR job
6060
Its name do not need to match merge neither single job name but option `merges` must list all merge jobs to be put in trend plot.
6161
Trend plot style is defined globally for all trend plots (see `Alignment/OfflineValidation/test/example_DMR_full.yaml`)
6262

@@ -69,7 +69,7 @@ lastRun | 325175 | Specify the last run to be considered.
6969
labels | None | List of string tags to be added in output rootfile.
7070
year | Run2 | Enforce year tag to be included in lumiInputFile option specified in trend style (This is extra measure)
7171

72-
#Averaged DMR job
72+
## Averaged DMR job
7373
Its name do not need to match merge neither single job name but option `merges` must list all merge jobs to be put in averaged distribution.
7474
Each merge job to be passed to averager must consist of data OR MC single jobs exclusively (no mix of Data and MC).
7575
Some style options are accessible from global style config (see `Alignment/OfflineValidation/test/example_DMR_full.yaml`).

Alignment/OfflineValidation/README_IOV.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Following document summarises usage of IOV/run-driven validations.
1+
The following document summarises usage of IOV/run-driven validations.
22

33
## DMR and PV
44

Alignment/OfflineValidation/README_JetHT.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
## JetHT validation
1+
# JetHT validation
22

3-
### Validation analysis - JetHT_cfg.py
3+
## Validation analysis - JetHT_cfg.py
44

55
The vast majority of the time in the JetHT validation goes to running the actual validation analysis. This is done with cmsRun using the JetHT_cfg.py configuration file. To configure the analysis in the all-in-one framework, the following parameters can be set in the json/yaml configuration file:
66

@@ -29,7 +29,7 @@ profilePtBorders | [3,5,10,20,50,100] | List for pT borders used in wide pT bin
2929
TrackerAlignmentRcdFile | "nothing" | Local database file from which the TrackerAlignmentRcd is read. Notice that usual method to set this is reading from the database for each alignment.
3030
TrackerAlignmentErrorFile | "nothing" | Local database file from which the TrackerAlignmentExtendedErrorRcd is read. Notice that usual method to set this is reading from the database for each alignment.
3131

32-
### File merging - addHistograms.sh
32+
## File merging - addHistograms.sh
3333

3434
The addHistograms.sh script is used to merge the root files for jetHT validation. Merging is fast and can easily be done locally in seconds, but the tool is fully integrated to the all-in-one configuration for automated processing.
3535

@@ -61,8 +61,7 @@ Variable | Default value | Explanation
6161
singles | None | An array of single job names that must be finished before plotting can be run.
6262
alignments | None | An array of alignment names for which the files are merged within those alignments. Different alignments are kept separate.
6363

64-
65-
### Plotting - jetHtPlotter
64+
## Plotting - jetHtPlotter
6665

6766
The tool is originally designed to be used standalone, since the plotting the histograms locally does not take more that tens of second at maximum. But the plotter works also together with the all-in-one configuration. The only difference for user is the structure of the configuration file, that changes a bit between standalone and all-in-one usage.
6867

Alignment/OfflineValidation/README_PV.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
## PV validation
1+
# Primary Vertex (PV) Validation
22

3-
#General info
3+
## General info
44
```
55
validations:
66
PV:
@@ -18,7 +18,7 @@ Merge job and trend jobs will only start if all corresponding single jobs are do
1818
Trend and merge jobs can run in parallel.
1919
Averaged jobs are not yet implemented.
2020

21-
#Single PV jobs:
21+
## Single PV jobs
2222
Single jobs can be specified per run (IoV as well). In case of MC, IoV is specified to arbitrary 1.
2323

2424
Variable | Default value | Explanation/Options
@@ -47,7 +47,7 @@ doFPix | True | Do not run validation for FPix if needed
4747
forceBeamSpot | False | Force beam spot
4848
numberOfBins | 48 | Define histogram granularity
4949

50-
#Merge PV job
50+
## Merge PV job
5151
Its name do not need to match single job name but option `singles` must list all single jobs to be merged.
5252
PV merged plot style can be adjusted from global plotting style (see `Alignment/OfflineValidation/test/example_PV_full.yaml`)
5353

@@ -75,7 +75,7 @@ w_dxyEtaNormMax | 1.8 | If not take this...
7575
w_dzEtaNormMax | 1.8 | If not take this...
7676
customrighttitle | "" | Top right title. Reserved word "IOV" will be replaced for given IOV/run in the list.
7777

78-
#Trends PV job
78+
## Trends PV job
7979
Its name do not need to match single job name but option `singles` must list all single jobs to be put in trend plot.
8080
Trend plot style is defined globally for all trend plots (see `Alignment/OfflineValidation/test/example_PV_full.yaml`)
8181

@@ -88,4 +88,3 @@ firstRun | 272930 | Specify starting run to be plotted.
8888
lastRun | 325175 | Specify the last run to be considered.
8989
nWorkers | 20 | Number of threads.
9090
doUnitTest | false | Disable certain settings for unit test.
91-

Alignment/OfflineValidation/bin/JDrawer.h

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -216,22 +216,7 @@ class JDrawer {
216216
/*
217217
* Destructor for JDrawer
218218
*/
219-
~JDrawer() {
220-
if (fCanvas)
221-
delete fCanvas;
222-
if (fSinglePad)
223-
delete fSinglePad;
224-
if (fUpperSplitPad)
225-
delete fUpperSplitPad;
226-
if (fLowerSplitPad)
227-
delete fLowerSplitPad;
228-
if (fLeftRowPad)
229-
delete fLeftRowPad;
230-
if (fMiddleRowPad)
231-
delete fMiddleRowPad;
232-
if (fRightRowPad)
233-
delete fRightRowPad;
234-
}
219+
~JDrawer() = default;
235220

236221
/*
237222
* Draw a histogram to a canvas

Alignment/OfflineValidation/bin/Zmumumerge.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,13 +221,13 @@ void Draw_TH1D_forMultiRootFiles(const vector<TString>& file_names,
221221
for (auto const& filename : file_names | boost::adaptors::indexed(0)) {
222222
file_input[filename.index()] = TFile::Open(filename.value());
223223
th1d_input[filename.index()] = (TH1D*)file_input[filename.index()]->Get(th1d_name);
224+
th1d_input[filename.index()]->SetTitle("");
224225
}
225226

226227
TCanvas* c = new TCanvas();
227228
TLegend* lg = new TLegend(0.2, 0.7, 0.5, 0.95);
228229
c->cd();
229230
gStyle->SetOptStat(0);
230-
th1d_input[0]->SetTitle("");
231231

232232
for (auto const& labelname : label_names | boost::adaptors::indexed(0)) {
233233
th1d_input[labelname.index()]->SetMarkerColor(colors[labelname.index()]);

Alignment/OfflineValidation/bin/jetHtPlotter.cc

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// framework includes
22
#include "FWCore/ParameterSet/interface/FileInPath.h"
3+
#include "FWCore/MessageLogger/interface/MessageLogger.h"
34

45
// C++ includes
56
#include <iostream> // Input/output stream. Needed for cout.
@@ -49,7 +50,7 @@ void drawSingleHistogram(TH1D *histogram[kMaxFiles],
4950
bool logScale,
5051
int color[kMaxFiles]) {
5152
// Create and setup the histogram drawer
52-
JDrawer *drawer = new JDrawer();
53+
const auto &drawer = std::make_unique<JDrawer>();
5354
drawer->SetLogY(logScale);
5455
drawer->SetTopMargin(0.08);
5556

@@ -260,6 +261,11 @@ std::tuple<std::vector<int>, std::vector<double>, std::vector<TString>, std::vec
260261

261262
// Load the iovList
262263
std::ifstream iovList(edm::FileInPath(inputFile).fullPath().c_str());
264+
if (!iovList.good()) {
265+
edm::LogError("jetHTPlotter") << __PRETTY_FUNCTION__ << "\n Input file: " << inputFile
266+
<< " is corrupt or not existing";
267+
return std::make_tuple(iovVector, lumiPerIov, iovNames, iovLegend);
268+
}
263269

264270
// Go through the file line by line. Each line has an IOV boundary and luminosity for this IOV.
265271
while (std::getline(iovList, lineInFile)) {
@@ -646,6 +652,11 @@ void jetHtPlotter(std::string configurationFileName) {
646652
std::vector<TString> iovLegend;
647653

648654
std::tie(iovVector, lumiPerIov, iovNames, iovLegend) = runAndLumiLists(iovAndLumiFile, iovListMode);
655+
// protection against empty input
656+
if (iovVector.empty()) {
657+
edm::LogError("jetHTPlotter") << __PRETTY_FUNCTION__ << "\n The list of input IOVs is empty. Exiting!";
658+
return;
659+
}
649660

650661
// For the IOV legend, remove the two last entries and replace them with user defined names
651662
iovLegend.pop_back();
@@ -815,7 +826,7 @@ void jetHtPlotter(std::string configurationFileName) {
815826
// Draw the plots
816827
// ===============================================
817828

818-
JDrawer *drawer = new JDrawer();
829+
const auto &drawer = std::make_unique<JDrawer>();
819830
TLegend *legend[nMaxLegendColumns];
820831
int columnOrder[nMaxLegendColumns];
821832
bool noIovFound = true;

Alignment/OfflineValidation/plugins/GeneralPurposeTrackAnalyzer.cc

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -995,8 +995,8 @@ class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchR
995995
edm::LogPrint("GeneralPurposeTrackAnalyzer") << "n. tracks: " << itrks << std::endl;
996996
edm::LogPrint("GeneralPurposeTrackAnalyzer") << "*******************************" << std::endl;
997997

998-
int nFiringTriggers = triggerMap_.size();
999-
edm::LogPrint("GeneralPurposeTrackAnalyzer") << "firing triggers: " << nFiringTriggers << std::endl;
998+
int nFiringTriggers = !triggerMap_.empty() ? triggerMap_.size() : 1;
999+
edm::LogPrint("GeneralPurposeTrackAnalyzer") << "firing triggers: " << triggerMap_.size() << std::endl;
10001000
edm::LogPrint("GeneralPurposeTrackAnalyzer") << "*******************************" << std::endl;
10011001

10021002
tksByTrigger_ =
@@ -1028,6 +1028,15 @@ class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchR
10281028
}
10291029

10301030
int nRuns = conditionsMap_.size();
1031+
if (nRuns < 1) {
1032+
edm::LogPrint("GeneralPurposeTrackAnalyzer") << "*******************************"
1033+
<< "\n"
1034+
<< " no run was processed! "
1035+
<< "\n"
1036+
<< "*******************************";
1037+
1038+
return;
1039+
}
10311040

10321041
std::vector<int> theRuns_;
10331042
for (const auto &it : conditionsMap_) {
@@ -1037,11 +1046,12 @@ class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchR
10371046
sort(theRuns_.begin(), theRuns_.end());
10381047
int runRange = theRuns_.back() - theRuns_.front() + 1;
10391048

1040-
edm::LogPrint("GeneralPurposeTrackAnalyzer") << "*******************************" << std::endl;
1041-
edm::LogPrint("GeneralPurposeTrackAnalyzer") << "first run: " << theRuns_.front() << std::endl;
1042-
edm::LogPrint("GeneralPurposeTrackAnalyzer") << "last run: " << theRuns_.back() << std::endl;
1043-
edm::LogPrint("GeneralPurposeTrackAnalyzer") << "considered runs: " << nRuns << std::endl;
1044-
edm::LogPrint("GeneralPurposeTrackAnalyzer") << "*******************************" << std::endl;
1049+
edm::LogPrint("GeneralPurposeTrackAnalyzer") << "*******************************"
1050+
<< "\n"
1051+
<< "first run: " << theRuns_.front() << "\n"
1052+
<< "last run: " << theRuns_.back() << "\n"
1053+
<< "considered runs: " << nRuns << "\n"
1054+
<< "*******************************";
10451055

10461056
modeByRun_ = book<TH1D>("modeByRun",
10471057
"Strip APV mode by run number;;APV mode (-1=deco,+1=peak)",
@@ -1055,6 +1065,8 @@ class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchR
10551065
theRuns_.front() - 0.5,
10561066
theRuns_.back() + 0.5);
10571067

1068+
edm::LogPrint("") << __PRETTY_FUNCTION__ << " line: " << __LINE__ << std::endl;
1069+
10581070
for (const auto &the_r : theRuns_) {
10591071
if (conditionsMap_.find(the_r)->second.first != 0) {
10601072
edm::LogPrint("GeneralPurposeTrackAnalyzer")

Alignment/OfflineValidation/test/testTrackAnalyzers.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ process.add_(cms.Service('TFileService',fileName=cms.string('tesTrackAnalyzer1.r
2727
// REQUIRE_NOTHROW(tester.test());
2828
// }
2929

30-
// SECTION("beginJob and endJob only") {
31-
// edm::test::TestProcessor tester(config);
32-
// REQUIRE_NOTHROW(tester.testBeginAndEndJobOnly());
33-
// }
30+
SECTION("beginJob and endJob only") {
31+
edm::test::TestProcessor tester(config);
32+
REQUIRE_NOTHROW(tester.testBeginAndEndJobOnly());
33+
}
3434

3535
// SECTION("Run with no LuminosityBlocks") {
3636
// edm::test::TestProcessor tester(config);

0 commit comments

Comments
 (0)