Skip to content

Commit 1cea75c

Browse files
authored
Merge pull request #47085 from makortel/runLumiEventAnalyzer
Make all RunLumiEventAnalyzer instances to use `vector<unsigned long long>`
2 parents 7b424a3 + 1f91374 commit 1cea75c

29 files changed

+633
-759
lines changed

FWCore/Framework/test/stubs/RunLumiEventAnalyzer.cc

+7-23
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include "FWCore/ParameterSet/interface/ParameterSet.h"
1010
#include "FWCore/Utilities/interface/EDGetToken.h"
1111
#include "FWCore/Utilities/interface/Exception.h"
12-
#include "FWCore/Utilities/interface/propagate_const.h"
1312

1413
#include <cassert>
1514
#include <vector>
@@ -29,9 +28,9 @@ namespace edmtest {
2928
void endJob();
3029

3130
private:
32-
std::vector<unsigned long long> expectedRunLumisEvents0_;
33-
std::vector<unsigned long long> expectedRunLumisEvents1_;
34-
edm::propagate_const<std::vector<unsigned long long>*> const expectedRunLumisEvents_;
31+
std::vector<unsigned long long> const expectedRunLumisEvents0_;
32+
std::vector<unsigned long long> const expectedRunLumisEvents1_;
33+
std::vector<unsigned long long> const* const expectedRunLumisEvents_;
3534
bool const verbose_;
3635
bool const dumpTriggerResults_;
3736
int const expectedEndingIndex0_;
@@ -42,27 +41,14 @@ namespace edmtest {
4241
};
4342

4443
RunLumiEventAnalyzer::RunLumiEventAnalyzer(edm::ParameterSet const& pset)
45-
: expectedRunLumisEvents0_(),
46-
expectedRunLumisEvents1_(),
44+
: expectedRunLumisEvents0_(pset.getUntrackedParameter<std::vector<unsigned long long>>("expectedRunLumiEvents")),
45+
expectedRunLumisEvents1_(pset.getUntrackedParameter<std::vector<unsigned long long>>("expectedRunLumiEvents1")),
4746
expectedRunLumisEvents_(&expectedRunLumisEvents0_),
4847
verbose_(pset.getUntrackedParameter<bool>("verbose")),
4948
dumpTriggerResults_(pset.getUntrackedParameter<bool>("dumpTriggerResults")),
5049
expectedEndingIndex0_(pset.getUntrackedParameter<int>("expectedEndingIndex")),
5150
expectedEndingIndex1_(pset.getUntrackedParameter<int>("expectedEndingIndex1")),
5251
expectedEndingIndex_(expectedEndingIndex0_) {
53-
if (pset.existsAs<std::vector<unsigned int>>("expectedRunLumiEvents", false)) {
54-
std::vector<unsigned int> temp = pset.getUntrackedParameter<std::vector<unsigned int>>("expectedRunLumiEvents");
55-
expectedRunLumisEvents0_.assign(temp.begin(), temp.end());
56-
} else {
57-
expectedRunLumisEvents0_ = pset.getUntrackedParameter<std::vector<unsigned long long>>("expectedRunLumiEvents");
58-
}
59-
60-
if (pset.existsAs<std::vector<unsigned int>>("expectedRunLumiEvents1", false)) {
61-
std::vector<unsigned int> temp = pset.getUntrackedParameter<std::vector<unsigned int>>("expectedRunLumiEvents1");
62-
expectedRunLumisEvents1_.assign(temp.begin(), temp.end());
63-
} else {
64-
expectedRunLumisEvents1_ = pset.getUntrackedParameter<std::vector<unsigned long long>>("expectedRunLumiEvents1");
65-
}
6652
if (dumpTriggerResults_) {
6753
triggerResultsToken_ = consumes(edm::InputTag("TriggerResults"));
6854
}
@@ -74,10 +60,8 @@ namespace edmtest {
7460
desc.addUntracked<bool>("dumpTriggerResults", false);
7561
desc.addUntracked<int>("expectedEndingIndex", -1);
7662
desc.addUntracked<int>("expectedEndingIndex1", -1);
77-
desc.addNode(edm::ParameterDescription<std::vector<unsigned long long>>("expectedRunLumiEvents", {}, false) xor
78-
edm::ParameterDescription<std::vector<unsigned int>>("expectedRunLumiEvents", {}, false));
79-
desc.addNode(edm::ParameterDescription<std::vector<unsigned long long>>("expectedRunLumiEvents1", {}, false) xor
80-
edm::ParameterDescription<std::vector<unsigned int>>("expectedRunLumiEvents1", {}, false));
63+
desc.addUntracked<std::vector<unsigned long long>>("expectedRunLumiEvents", {});
64+
desc.addUntracked<std::vector<unsigned long long>>("expectedRunLumiEvents1", {});
8165

8266
descriptions.addDefault(desc);
8367
}

FWCore/Integration/test/readSubProcessOutput_cfg.py

+21-25
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,42 @@
22

33
process = cms.Process("READ")
44

5-
process.source = cms.Source("PoolSource",
6-
fileNames = cms.untracked.vstring("file:testSubProcess.root")
7-
)
5+
from IOPool.Input.modules import PoolSource
6+
process.source = PoolSource(fileNames = "file:testSubProcess.root")
87

9-
process.out = cms.OutputModule("PoolOutputModule",
10-
fileName = cms.untracked.string(
11-
'readSubprocessOutput.root'
12-
)
13-
)
8+
from IOPool.Output.modules import PoolOutputModule
9+
process.out = PoolOutputModule(fileName = 'readSubprocessOutput.root')
1410

1511

12+
from FWCore.Framework.modules import TestMergeResults, RunLumiEventAnalyzer
1613
# Reusing some code I used for testing merging, although in this
1714
# context it has nothing to do with merging.
1815
# Here we are checking the event, run, and lumi products
1916
# from the last subprocess in the chain of subprocesses
2017
# are there.
21-
process.testproducts = cms.EDAnalyzer("TestMergeResults",
22-
23-
expectedBeginRunProd = cms.untracked.vint32(
18+
process.testproducts = TestMergeResults(
19+
expectedBeginRunProd = [
2420
10001, 10002, 10003, # end run 1
2521
10001, 10002, 10003, # end run 2
2622
10001, 10002, 10003 # end run 3
27-
),
23+
],
2824

29-
expectedEndRunProd = cms.untracked.vint32(
25+
expectedEndRunProd = [
3026
100001, 100002, 100003, # end run 1
3127
100001, 100002, 100003, # end run 2
3228
100001, 100002, 100003 # end run 3
33-
),
29+
],
3430

35-
expectedBeginLumiProd = cms.untracked.vint32(
31+
expectedBeginLumiProd = [
3632
101, 102, 103 # end run 1 lumi 1
3733
# There are more, but all with the same pattern as the first
38-
),
34+
],
3935

40-
expectedEndLumiProd = cms.untracked.vint32(
36+
expectedEndLumiProd = [
4137
1001, 1002, 1003 # end run 1 lumi 1
42-
),
38+
],
4339

44-
expectedProcessHistoryInRuns = cms.untracked.vstring(
40+
expectedProcessHistoryInRuns = [
4541
'PROD', # Run 1
4642
'PROD2',
4743
'READ',
@@ -51,13 +47,13 @@
5147
'PROD', # Run 3
5248
'PROD2',
5349
'READ'
54-
),
55-
verbose = cms.untracked.bool(True)
50+
],
51+
verbose = True
5652
)
5753

58-
process.test = cms.EDAnalyzer('RunLumiEventAnalyzer',
59-
verbose = cms.untracked.bool(True),
60-
expectedRunLumiEvents = cms.untracked.vuint32(
54+
process.test = RunLumiEventAnalyzer(
55+
verbose = True,
56+
expectedRunLumiEvents = [
6157
1, 0, 0,
6258
1, 1, 0,
6359
1, 1, 1,
@@ -112,7 +108,7 @@
112108
3, 3, 10,
113109
3, 3, 0,
114110
3, 0, 0
115-
)
111+
]
116112
)
117113

118114
process.path1 = cms.Path(process.test*process.testproducts)

FWCore/Integration/test/testGetByWithEmptyRun_cfg.py

+13-12
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,25 @@
77

88
process = cms.Process("PROD3")
99

10-
process.source = cms.Source("PoolSource",
11-
fileNames = cms.untracked.vstring(
10+
from IOPool.Input.modules import PoolSource
11+
process.source = PoolSource(
12+
fileNames = [
1213
'file:testGetByRunsMode.root',
1314
'file:testGetBy1.root'
14-
),
15-
inputCommands=cms.untracked.vstring(
15+
],
16+
inputCommands = [
1617
'keep *',
1718
'drop *_*_*_PROD2'
18-
)
19+
]
1920
)
2021

21-
process.out = cms.OutputModule("PoolOutputModule",
22-
fileName = cms.untracked.string('testGetByWithEmptyRun.root')
23-
)
22+
from IOPool.Output.modules import PoolOutputModule
23+
process.out = PoolOutputModule(fileName = 'testGetByWithEmptyRun.root')
2424

25-
process.test = cms.EDAnalyzer('RunLumiEventAnalyzer',
26-
verbose = cms.untracked.bool(True),
27-
expectedRunLumiEvents = cms.untracked.vuint32(
25+
from FWCore.Framework.modules import RunLumiEventAnalyzer
26+
process.test = RunLumiEventAnalyzer(
27+
verbose = True,
28+
expectedRunLumiEvents = [
2829
1, 0, 0,
2930
1, 0, 0,
3031
1, 0, 0,
@@ -34,7 +35,7 @@
3435
1, 1, 3,
3536
1, 1, 0,
3637
1, 0, 0
37-
)
38+
]
3839
)
3940

4041
process.p1 = cms.Path(process.test)

FWCore/Integration/test/testLooperEventNavigation1_cfg.py

+18-18
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
import FWCore.ParameterSet.Config as cms
66

77
process = cms.Process("TEST")
8-
9-
process.load("FWCore.MessageService.MessageLogger_cfi")
108
process.MessageLogger.cerr.FwkReport.reportEvery = 1000
119
process.MessageLogger.cerr.threshold = 'ERROR'
1210

@@ -15,24 +13,25 @@
1513
Rethrow = FWCore.Framework.test.cmsExceptionsFatalOption_cff.Rethrow
1614
)
1715

18-
process.source = cms.Source("PoolSource",
19-
fileNames = cms.untracked.vstring(
16+
from IOPool.Input.modules import PoolSource
17+
process.source = PoolSource(
18+
fileNames = [
2019
'file:testRunMerge1.root',
2120
'file:testRunMerge2.root'
22-
)
23-
#, processingMode = cms.untracked.string('RunsAndLumis')
24-
#, duplicateCheckMode = cms.untracked.string('checkEachRealDataFile')
25-
, noEventSort = cms.untracked.bool(True)
26-
, inputCommands = cms.untracked.vstring(
21+
]
22+
#, processingMode = 'RunsAndLumis'
23+
#, duplicateCheckMode = 'checkEachRealDataFile'
24+
, noEventSort = True
25+
, inputCommands = [
2726
'keep *',
2827
'drop edmtestThingWithMerge_makeThingToBeDropped1_*_*'
29-
)
28+
]
3029
)
3130

32-
33-
process.test = cms.EDAnalyzer('RunLumiEventAnalyzer',
34-
verbose = cms.untracked.bool(True)
35-
, expectedRunLumiEvents = cms.untracked.vuint32(
31+
from FWCore.Framework.modules import RunLumiEventAnalyzer
32+
process.test = RunLumiEventAnalyzer(
33+
verbose = True
34+
, expectedRunLumiEvents = [
3635
1, 0, 0,
3736
1, 1, 0,
3837
1, 1, 11,
@@ -62,14 +61,15 @@
6261
1, 1, 21,
6362
1, 1, 0,
6463
1, 0, 0
65-
)
64+
]
6665
)
6766

6867
process.looper = cms.Looper("NavigateEventsLooper")
6968

70-
process.out = cms.OutputModule("PoolOutputModule",
71-
fileName = cms.untracked.string('file:testLooperEventNavigation.root'),
72-
fastCloning = cms.untracked.bool(False)
69+
from IOPool.Output.modules import PoolOutputModule
70+
process.out = PoolOutputModule(
71+
fileName = 'testLooperEventNavigation.root',
72+
fastCloning = False
7373
)
7474

7575
process.path1 = cms.Path(process.test)

FWCore/Integration/test/testLooperEventNavigation_cfg.py

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
import FWCore.ParameterSet.Config as cms
22

33
process = cms.Process("TEST")
4-
5-
process.load("FWCore.MessageService.MessageLogger_cfi")
64
process.MessageLogger.cerr.FwkReport.reportEvery = 1000
75
process.MessageLogger.cerr.threshold = 'ERROR'
86

9-
process.source = cms.Source("PoolSource",
10-
fileNames = cms.untracked.vstring(
7+
from IOPool.Input.modules import PoolSource
8+
process.source = PoolSource(
9+
fileNames = [
1110
'file:testRunMerge1.root',
1211
'file:testRunMerge2.root'
13-
)
14-
#, processingMode = cms.untracked.string('RunsAndLumis')
15-
#, duplicateCheckMode = cms.untracked.string('checkEachRealDataFile')
16-
, noEventSort = cms.untracked.bool(False)
17-
, inputCommands = cms.untracked.vstring(
12+
]
13+
#, processingMode = 'RunsAndLumis'
14+
#, duplicateCheckMode = 'checkEachRealDataFile'
15+
, noEventSort = False
16+
, inputCommands = [
1817
'keep *',
1918
'drop edmtestThingWithMerge_makeThingToBeDropped1_*_*'
20-
)
19+
]
2120
)
2221

23-
24-
process.test = cms.EDAnalyzer('RunLumiEventAnalyzer',
25-
verbose = cms.untracked.bool(True)
26-
, expectedRunLumiEvents = cms.untracked.vuint32(
22+
from FWCore.Framework.modules import RunLumiEventAnalyzer
23+
process.test = RunLumiEventAnalyzer(
24+
verbose = True
25+
, expectedRunLumiEvents = [
2726
1, 0, 0,
2827
1, 1, 0,
2928
1, 1, 11,
@@ -53,14 +52,15 @@
5352
1, 1, 21,
5453
1, 1, 0,
5554
1, 0, 0
56-
)
55+
]
5756
)
5857

5958
process.looper = cms.Looper("NavigateEventsLooper")
6059

61-
process.out = cms.OutputModule("PoolOutputModule",
62-
fileName = cms.untracked.string('file:testLooperEventNavigation.root'),
63-
fastCloning = cms.untracked.bool(False)
60+
from IOPool.Output.modules import PoolOutputModule
61+
process.out = PoolOutputModule(
62+
fileName = 'testLooperEventNavigation.root',
63+
fastCloning = False
6464
)
6565

6666
process.path1 = cms.Path(process.test)

FWCore/Integration/test/testRunMergeCOPY1_cfg.py

+14-16
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
import FWCore.ParameterSet.Config as cms
99

1010
process = cms.Process("COPY")
11-
12-
process.load("FWCore.MessageService.MessageLogger_cfi")
1311
process.MessageLogger.cerr.FwkReport.reportEvery = 1000
1412
process.MessageLogger.cerr.threshold = 'ERROR'
1513

@@ -19,20 +17,21 @@
1917
Rethrow = FWCore.Framework.test.cmsExceptionsFatalOption_cff.Rethrow
2018
)
2119

22-
23-
process.source = cms.Source("PoolSource",
24-
fileNames = cms.untracked.vstring(
20+
from IOPool.Input.modules import PoolSource
21+
process.source = PoolSource(
22+
fileNames = [
2523
'file:testRunMergeRecombined.root',
2624
'file:testRunMergeRecombined.root'
27-
)
28-
, duplicateCheckMode = cms.untracked.string('checkEachFile')
29-
, skipEvents = cms.untracked.uint32(3)
30-
, noEventSort = cms.untracked.bool(False)
25+
]
26+
, duplicateCheckMode = 'checkEachFile'
27+
, skipEvents = 3
28+
, noEventSort = False
3129
)
3230

33-
process.test = cms.EDAnalyzer('RunLumiEventAnalyzer',
34-
verbose = cms.untracked.bool(True),
35-
expectedRunLumiEvents = cms.untracked.vuint32(
31+
from FWCore.Framework.modules import RunLumiEventAnalyzer
32+
process.test = RunLumiEventAnalyzer(
33+
verbose = True,
34+
expectedRunLumiEvents = [
3635
1, 0, 0,
3736
1, 1, 0,
3837
1, 1, 4,
@@ -113,7 +112,7 @@
113112
1, 1, 10,
114113
1, 1, 0,
115114
1, 0, 0
116-
)
115+
]
117116
)
118117
# At this point the first input file is done and
119118
# we start with the second input file here.
@@ -205,8 +204,7 @@
205204

206205
process.path1 = cms.Path(process.test)
207206

208-
process.out = cms.OutputModule("PoolOutputModule",
209-
fileName = cms.untracked.string('file:testRunMergeRecombinedCopied1.root')
210-
)
207+
from IOPool.Output.modules import PoolOutputModule
208+
process.out = PoolOutputModule(fileName = 'testRunMergeRecombinedCopied1.root')
211209

212210
process.endpath1 = cms.EndPath(process.out)

0 commit comments

Comments
 (0)