Skip to content

Commit

Permalink
Merge pull request #47085 from makortel/runLumiEventAnalyzer
Browse files Browse the repository at this point in the history
Make all RunLumiEventAnalyzer instances to use `vector<unsigned long long>`
  • Loading branch information
cmsbuild authored Jan 13, 2025
2 parents 7b424a3 + 1f91374 commit 1cea75c
Show file tree
Hide file tree
Showing 29 changed files with 633 additions and 759 deletions.
30 changes: 7 additions & 23 deletions FWCore/Framework/test/stubs/RunLumiEventAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/EDGetToken.h"
#include "FWCore/Utilities/interface/Exception.h"
#include "FWCore/Utilities/interface/propagate_const.h"

#include <cassert>
#include <vector>
Expand All @@ -29,9 +28,9 @@ namespace edmtest {
void endJob();

private:
std::vector<unsigned long long> expectedRunLumisEvents0_;
std::vector<unsigned long long> expectedRunLumisEvents1_;
edm::propagate_const<std::vector<unsigned long long>*> const expectedRunLumisEvents_;
std::vector<unsigned long long> const expectedRunLumisEvents0_;
std::vector<unsigned long long> const expectedRunLumisEvents1_;
std::vector<unsigned long long> const* const expectedRunLumisEvents_;
bool const verbose_;
bool const dumpTriggerResults_;
int const expectedEndingIndex0_;
Expand All @@ -42,27 +41,14 @@ namespace edmtest {
};

RunLumiEventAnalyzer::RunLumiEventAnalyzer(edm::ParameterSet const& pset)
: expectedRunLumisEvents0_(),
expectedRunLumisEvents1_(),
: expectedRunLumisEvents0_(pset.getUntrackedParameter<std::vector<unsigned long long>>("expectedRunLumiEvents")),
expectedRunLumisEvents1_(pset.getUntrackedParameter<std::vector<unsigned long long>>("expectedRunLumiEvents1")),
expectedRunLumisEvents_(&expectedRunLumisEvents0_),
verbose_(pset.getUntrackedParameter<bool>("verbose")),
dumpTriggerResults_(pset.getUntrackedParameter<bool>("dumpTriggerResults")),
expectedEndingIndex0_(pset.getUntrackedParameter<int>("expectedEndingIndex")),
expectedEndingIndex1_(pset.getUntrackedParameter<int>("expectedEndingIndex1")),
expectedEndingIndex_(expectedEndingIndex0_) {
if (pset.existsAs<std::vector<unsigned int>>("expectedRunLumiEvents", false)) {
std::vector<unsigned int> temp = pset.getUntrackedParameter<std::vector<unsigned int>>("expectedRunLumiEvents");
expectedRunLumisEvents0_.assign(temp.begin(), temp.end());
} else {
expectedRunLumisEvents0_ = pset.getUntrackedParameter<std::vector<unsigned long long>>("expectedRunLumiEvents");
}

if (pset.existsAs<std::vector<unsigned int>>("expectedRunLumiEvents1", false)) {
std::vector<unsigned int> temp = pset.getUntrackedParameter<std::vector<unsigned int>>("expectedRunLumiEvents1");
expectedRunLumisEvents1_.assign(temp.begin(), temp.end());
} else {
expectedRunLumisEvents1_ = pset.getUntrackedParameter<std::vector<unsigned long long>>("expectedRunLumiEvents1");
}
if (dumpTriggerResults_) {
triggerResultsToken_ = consumes(edm::InputTag("TriggerResults"));
}
Expand All @@ -74,10 +60,8 @@ namespace edmtest {
desc.addUntracked<bool>("dumpTriggerResults", false);
desc.addUntracked<int>("expectedEndingIndex", -1);
desc.addUntracked<int>("expectedEndingIndex1", -1);
desc.addNode(edm::ParameterDescription<std::vector<unsigned long long>>("expectedRunLumiEvents", {}, false) xor
edm::ParameterDescription<std::vector<unsigned int>>("expectedRunLumiEvents", {}, false));
desc.addNode(edm::ParameterDescription<std::vector<unsigned long long>>("expectedRunLumiEvents1", {}, false) xor
edm::ParameterDescription<std::vector<unsigned int>>("expectedRunLumiEvents1", {}, false));
desc.addUntracked<std::vector<unsigned long long>>("expectedRunLumiEvents", {});
desc.addUntracked<std::vector<unsigned long long>>("expectedRunLumiEvents1", {});

descriptions.addDefault(desc);
}
Expand Down
46 changes: 21 additions & 25 deletions FWCore/Integration/test/readSubProcessOutput_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,42 @@

process = cms.Process("READ")

process.source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring("file:testSubProcess.root")
)
from IOPool.Input.modules import PoolSource
process.source = PoolSource(fileNames = "file:testSubProcess.root")

process.out = cms.OutputModule("PoolOutputModule",
fileName = cms.untracked.string(
'readSubprocessOutput.root'
)
)
from IOPool.Output.modules import PoolOutputModule
process.out = PoolOutputModule(fileName = 'readSubprocessOutput.root')


from FWCore.Framework.modules import TestMergeResults, RunLumiEventAnalyzer
# Reusing some code I used for testing merging, although in this
# context it has nothing to do with merging.
# Here we are checking the event, run, and lumi products
# from the last subprocess in the chain of subprocesses
# are there.
process.testproducts = cms.EDAnalyzer("TestMergeResults",

expectedBeginRunProd = cms.untracked.vint32(
process.testproducts = TestMergeResults(
expectedBeginRunProd = [
10001, 10002, 10003, # end run 1
10001, 10002, 10003, # end run 2
10001, 10002, 10003 # end run 3
),
],

expectedEndRunProd = cms.untracked.vint32(
expectedEndRunProd = [
100001, 100002, 100003, # end run 1
100001, 100002, 100003, # end run 2
100001, 100002, 100003 # end run 3
),
],

expectedBeginLumiProd = cms.untracked.vint32(
expectedBeginLumiProd = [
101, 102, 103 # end run 1 lumi 1
# There are more, but all with the same pattern as the first
),
],

expectedEndLumiProd = cms.untracked.vint32(
expectedEndLumiProd = [
1001, 1002, 1003 # end run 1 lumi 1
),
],

expectedProcessHistoryInRuns = cms.untracked.vstring(
expectedProcessHistoryInRuns = [
'PROD', # Run 1
'PROD2',
'READ',
Expand All @@ -51,13 +47,13 @@
'PROD', # Run 3
'PROD2',
'READ'
),
verbose = cms.untracked.bool(True)
],
verbose = True
)

process.test = cms.EDAnalyzer('RunLumiEventAnalyzer',
verbose = cms.untracked.bool(True),
expectedRunLumiEvents = cms.untracked.vuint32(
process.test = RunLumiEventAnalyzer(
verbose = True,
expectedRunLumiEvents = [
1, 0, 0,
1, 1, 0,
1, 1, 1,
Expand Down Expand Up @@ -112,7 +108,7 @@
3, 3, 10,
3, 3, 0,
3, 0, 0
)
]
)

process.path1 = cms.Path(process.test*process.testproducts)
Expand Down
25 changes: 13 additions & 12 deletions FWCore/Integration/test/testGetByWithEmptyRun_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,25 @@

process = cms.Process("PROD3")

process.source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring(
from IOPool.Input.modules import PoolSource
process.source = PoolSource(
fileNames = [
'file:testGetByRunsMode.root',
'file:testGetBy1.root'
),
inputCommands=cms.untracked.vstring(
],
inputCommands = [
'keep *',
'drop *_*_*_PROD2'
)
]
)

process.out = cms.OutputModule("PoolOutputModule",
fileName = cms.untracked.string('testGetByWithEmptyRun.root')
)
from IOPool.Output.modules import PoolOutputModule
process.out = PoolOutputModule(fileName = 'testGetByWithEmptyRun.root')

process.test = cms.EDAnalyzer('RunLumiEventAnalyzer',
verbose = cms.untracked.bool(True),
expectedRunLumiEvents = cms.untracked.vuint32(
from FWCore.Framework.modules import RunLumiEventAnalyzer
process.test = RunLumiEventAnalyzer(
verbose = True,
expectedRunLumiEvents = [
1, 0, 0,
1, 0, 0,
1, 0, 0,
Expand All @@ -34,7 +35,7 @@
1, 1, 3,
1, 1, 0,
1, 0, 0
)
]
)

process.p1 = cms.Path(process.test)
Expand Down
36 changes: 18 additions & 18 deletions FWCore/Integration/test/testLooperEventNavigation1_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import FWCore.ParameterSet.Config as cms

process = cms.Process("TEST")

process.load("FWCore.MessageService.MessageLogger_cfi")
process.MessageLogger.cerr.FwkReport.reportEvery = 1000
process.MessageLogger.cerr.threshold = 'ERROR'

Expand All @@ -15,24 +13,25 @@
Rethrow = FWCore.Framework.test.cmsExceptionsFatalOption_cff.Rethrow
)

process.source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring(
from IOPool.Input.modules import PoolSource
process.source = PoolSource(
fileNames = [
'file:testRunMerge1.root',
'file:testRunMerge2.root'
)
#, processingMode = cms.untracked.string('RunsAndLumis')
#, duplicateCheckMode = cms.untracked.string('checkEachRealDataFile')
, noEventSort = cms.untracked.bool(True)
, inputCommands = cms.untracked.vstring(
]
#, processingMode = 'RunsAndLumis'
#, duplicateCheckMode = 'checkEachRealDataFile'
, noEventSort = True
, inputCommands = [
'keep *',
'drop edmtestThingWithMerge_makeThingToBeDropped1_*_*'
)
]
)


process.test = cms.EDAnalyzer('RunLumiEventAnalyzer',
verbose = cms.untracked.bool(True)
, expectedRunLumiEvents = cms.untracked.vuint32(
from FWCore.Framework.modules import RunLumiEventAnalyzer
process.test = RunLumiEventAnalyzer(
verbose = True
, expectedRunLumiEvents = [
1, 0, 0,
1, 1, 0,
1, 1, 11,
Expand Down Expand Up @@ -62,14 +61,15 @@
1, 1, 21,
1, 1, 0,
1, 0, 0
)
]
)

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

process.out = cms.OutputModule("PoolOutputModule",
fileName = cms.untracked.string('file:testLooperEventNavigation.root'),
fastCloning = cms.untracked.bool(False)
from IOPool.Output.modules import PoolOutputModule
process.out = PoolOutputModule(
fileName = 'testLooperEventNavigation.root',
fastCloning = False
)

process.path1 = cms.Path(process.test)
Expand Down
36 changes: 18 additions & 18 deletions FWCore/Integration/test/testLooperEventNavigation_cfg.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
import FWCore.ParameterSet.Config as cms

process = cms.Process("TEST")

process.load("FWCore.MessageService.MessageLogger_cfi")
process.MessageLogger.cerr.FwkReport.reportEvery = 1000
process.MessageLogger.cerr.threshold = 'ERROR'

process.source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring(
from IOPool.Input.modules import PoolSource
process.source = PoolSource(
fileNames = [
'file:testRunMerge1.root',
'file:testRunMerge2.root'
)
#, processingMode = cms.untracked.string('RunsAndLumis')
#, duplicateCheckMode = cms.untracked.string('checkEachRealDataFile')
, noEventSort = cms.untracked.bool(False)
, inputCommands = cms.untracked.vstring(
]
#, processingMode = 'RunsAndLumis'
#, duplicateCheckMode = 'checkEachRealDataFile'
, noEventSort = False
, inputCommands = [
'keep *',
'drop edmtestThingWithMerge_makeThingToBeDropped1_*_*'
)
]
)


process.test = cms.EDAnalyzer('RunLumiEventAnalyzer',
verbose = cms.untracked.bool(True)
, expectedRunLumiEvents = cms.untracked.vuint32(
from FWCore.Framework.modules import RunLumiEventAnalyzer
process.test = RunLumiEventAnalyzer(
verbose = True
, expectedRunLumiEvents = [
1, 0, 0,
1, 1, 0,
1, 1, 11,
Expand Down Expand Up @@ -53,14 +52,15 @@
1, 1, 21,
1, 1, 0,
1, 0, 0
)
]
)

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

process.out = cms.OutputModule("PoolOutputModule",
fileName = cms.untracked.string('file:testLooperEventNavigation.root'),
fastCloning = cms.untracked.bool(False)
from IOPool.Output.modules import PoolOutputModule
process.out = PoolOutputModule(
fileName = 'testLooperEventNavigation.root',
fastCloning = False
)

process.path1 = cms.Path(process.test)
Expand Down
30 changes: 14 additions & 16 deletions FWCore/Integration/test/testRunMergeCOPY1_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import FWCore.ParameterSet.Config as cms

process = cms.Process("COPY")

process.load("FWCore.MessageService.MessageLogger_cfi")
process.MessageLogger.cerr.FwkReport.reportEvery = 1000
process.MessageLogger.cerr.threshold = 'ERROR'

Expand All @@ -19,20 +17,21 @@
Rethrow = FWCore.Framework.test.cmsExceptionsFatalOption_cff.Rethrow
)


process.source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring(
from IOPool.Input.modules import PoolSource
process.source = PoolSource(
fileNames = [
'file:testRunMergeRecombined.root',
'file:testRunMergeRecombined.root'
)
, duplicateCheckMode = cms.untracked.string('checkEachFile')
, skipEvents = cms.untracked.uint32(3)
, noEventSort = cms.untracked.bool(False)
]
, duplicateCheckMode = 'checkEachFile'
, skipEvents = 3
, noEventSort = False
)

process.test = cms.EDAnalyzer('RunLumiEventAnalyzer',
verbose = cms.untracked.bool(True),
expectedRunLumiEvents = cms.untracked.vuint32(
from FWCore.Framework.modules import RunLumiEventAnalyzer
process.test = RunLumiEventAnalyzer(
verbose = True,
expectedRunLumiEvents = [
1, 0, 0,
1, 1, 0,
1, 1, 4,
Expand Down Expand Up @@ -113,7 +112,7 @@
1, 1, 10,
1, 1, 0,
1, 0, 0
)
]
)
# At this point the first input file is done and
# we start with the second input file here.
Expand Down Expand Up @@ -205,8 +204,7 @@

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

process.out = cms.OutputModule("PoolOutputModule",
fileName = cms.untracked.string('file:testRunMergeRecombinedCopied1.root')
)
from IOPool.Output.modules import PoolOutputModule
process.out = PoolOutputModule(fileName = 'testRunMergeRecombinedCopied1.root')

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

0 comments on commit 1cea75c

Please sign in to comment.