83 std::map< std::string, std::vector<std::string> >
PathModules;
114 std::cout <<
"Inside Constructor" << std::endl;
127 std::cout <<
"Inside analyze - run, block, event " 129 <<
" , " << iEvent.
id() <<
" , " << std::endl;
135 if (!triggerResults.
isValid()) {
137 std::cout <<
"Trigger results not valid" << std::endl;
142 std::cout <<
"Found triggerResults" << std::endl;
150 bool hasRawTriggerEvent =
true;
151 if( !rawTriggerEvent.
isValid() ){
152 hasRawTriggerEvent =
false;
154 std::cout <<
"No RAW trigger summary found! Returning...";
156 if( !aodTriggerEvent.
isValid() ){
158 std::cout <<
"No AOD trigger summary found! Returning...";
166 for (
unsigned int iPD = 0; iPD < datasetNames.size(); iPD++) {
168 for (
unsigned int iPath = 0;
173 std::cout <<
"Looking at path " << pathName << std::endl;
175 <<
" triggerResults->size() = " << triggerResults->
size()
181 std::string fullPathToCPP =
"HLT/GeneralHLTOffline/" 182 + label +
"/cppath_" + label +
hlt_menu_;
184 TH1F * hist_mini_cppath =
nullptr;
187 hist_mini_cppath = ME_mini_cppath->
getTH1F();
190 if (hist_mini_cppath) {
191 TAxis * axis = hist_mini_cppath->GetXaxis();
194 int bin_num = axis->FindBin(pathNameNoVer.c_str());
195 int bn = bin_num - 1;
196 hist_mini_cppath->Fill(bn, 0);
197 hist_mini_cppath->SetEntries(hist_mini_cppath->Integral());
201 if( index < triggerResults->
size() ) {
223 std::cout <<
"Inside beginRun" << std::endl;
237 std::cout <<
"Warning, didn't find process HLT" << std::endl;
253 auto si = nameStreams.begin();
254 auto se = nameStreams.end();
257 for ( ; si != se; ++si) {
260 if ( ((*si).find(
"Physics") != std::string::npos) ||((*si).find(
"Scouting") != std::string::npos) ||((*si).find(
"Parking") != std::string::npos) || (*si) ==
"A") {
265 for (
auto const & di: datasetperStream) {
266 datasetNames.push_back(di);
271 if (
debugPrint)
std::cout <<
"Number of total datasets " << datasetNames.size() << std::endl;
279 std::cout <<
"Number of datasets to be monitored " 280 << datasetNames.size() << std::endl;
286 <<
"datasetPaths.size() = " << datasetPaths.size() << std::endl;
287 for (
auto const & datasetPath : datasetPaths) {
289 << datasetPath << std::endl;
295 bool foundDataset =
false;
303 <<
" found in AddedDatasets at position " <<
d << std::endl;
310 std::cout <<
" Fill trigger paths for dataset " 323 std::cout <<
" Additional runs : Check for additional" 324 <<
"trigger paths per dataset " << std::endl;
329 for (
unsigned int iTrig = 0; iTrig < datasetPaths.size(); iTrig++) {
331 std::cout <<
"Looping over trigger list in dataset " 333 << datasetPaths[iTrig] << std::endl;
338 std::cout <<
"Looping over existing trigger list " << od
344 std::cout <<
" FOUND " << datasetPaths[iTrig] << std::endl;
353 <<
" NOT FOUND - so we added it to the correct dataset " 360 std::cout <<
" PDsVectorPathsVector[" << is <<
"] is " 363 std::cout <<
" trigger " << ip <<
" path " 377 for(
auto pathName : triggerNames){
379 auto NumModules =
int( moduleLabels.size() );
381 if( !(pathName.find(
"HLT_") != std::string::npos) )
continue;
382 if( (pathName.find(
"HLT_Physics")!=std::string::npos) ||
383 (pathName.find(
"HLT_Random")!=std::string::npos) )
continue;
387 std::vector<std::string> good_module_names;
388 good_module_names.clear();
389 for(
int iMod=0; iMod<NumModules; iMod++ ){
392 if( !(moduleEDMType ==
"EDFilter") )
continue;
393 if( moduleType.find(
"Selector")!= std::string::npos )
continue;
394 if( moduleType ==
"HLTTriggerTypeFilter" ||
395 moduleType ==
"HLTBool" ||
396 moduleType ==
"PrimaryVertexObjectFilter" ||
397 moduleType ==
"JetVertexChecker" ||
398 moduleType ==
"HLTRHemisphere" ||
399 moduleType ==
"DetectorStateFilter" )
continue;
401 if( moduleLabels[iMod].
compare(0, prefix.length(),
prefix) == 0 )
continue;
402 good_module_names.push_back(moduleLabels[iMod]);
430 for (
unsigned int iPD = 0; iPD <
DataSetNames.size(); iPD++)
444 PD_Folder =
"HLT/GeneralHLTOffline/" +
label;
451 folderz =
"HLT/GeneralHLTOffline/" +
label;
456 TH1F * hist_mini_cppath =
nullptr;
470 if (hist_mini_cppath) {
471 TAxis * axis = hist_mini_cppath->GetXaxis();
473 axis->SetBinLabel(jPath, pathName.c_str());
478 std::vector<std::string> moduleLabels =
PathModules[pathNameVer];
479 auto NumModules =
int( moduleLabels.size() );
481 if( NumModules==0 )
continue;
483 std::string pathName_dataset =
"cpfilt_" + label +
"_" + pathName;
494 for(
int iMod=0; iMod<NumModules; iMod++ ){
498 axis->SetBinLabel(iMod+1,moduleLabels[iMod].c_str());
503 std::cout <<
"book1D for " << pathName << std::endl;
507 std::cout <<
"Success setupHltMatrix( " << label <<
" , " 508 << iPD <<
" )" << std::endl;
515 bool hasRawTriggerEvent,
519 std::cout <<
"Inside fillHltMatrix( " << label <<
" , " 520 << path <<
" ) " << std::endl;
524 fullPathToCPP =
"HLT/GeneralHLTOffline/" + label +
"/cppath_" + label +
"_" +
hlt_menu_;
528 TH1F * hist_mini_cppath =
nullptr;
532 hist_mini_cppath = ME_mini_cppath->
getTH1F();
537 if( (path.find(
"HLT_") != std::string::npos) &&
538 !(path.find(
"HLT_Physics")!=std::string::npos) &&
539 !(path.find(
"HLT_Random")!=std::string::npos) ){
541 unsigned int triggerEventSize = 0;
542 if( hasRawTriggerEvent && triggerEventRAW.
isValid() ) triggerEventSize = triggerEventRAW->
size();
543 else if( triggerEventAOD.
isValid() ) triggerEventSize = triggerEventAOD->
sizeFilters();
545 std::string pathName_dataset =
"cpfilt_" + label +
"_" + pathNameNoVer;
547 TH1F * hist_cpfilt_mini =
nullptr;
551 hist_cpfilt_mini = ME_cpfilt_mini->
getTH1F();
556 auto NumModules =
int( moduleLabels.size() );
558 for(
int iMod=0; iMod<NumModules; iMod++ ){
563 unsigned int idx_module_trg = 0;
564 if( hasRawTriggerEvent && triggerEventRAW.
isValid() ) idx_module_trg = triggerEventRAW->
filterIndex(moduleWhoseResultsWeWant);
565 else if( triggerEventAOD.
isValid() ) idx_module_trg = triggerEventAOD->
filterIndex(moduleWhoseResultsWeWant);
567 if( !(idx_module_trg < triggerEventSize) )
continue;
568 if( hist_cpfilt_mini ){
569 TAxis * axis = hist_cpfilt_mini->GetXaxis();
570 int bin_num = axis->FindBin(moduleLabels[iMod].c_str());
571 int bn = bin_num - 1;
573 if( bin_num!=1 && hasRawTriggerEvent ){
574 bool passPreviousFilters =
true;
575 for(
int ibin = bin_num-1; ibin>0; ibin-- ){
576 std::string previousFilter(axis->GetBinLabel(ibin));
577 edm::InputTag previousModuleWhoseResultsWeWant(previousFilter,
580 unsigned int idx_previous_module_trg = 0;
581 if( hasRawTriggerEvent && triggerEventRAW.
isValid() ) idx_previous_module_trg = triggerEventRAW->
filterIndex(previousModuleWhoseResultsWeWant);
582 else if( triggerEventAOD.
isValid() ) idx_previous_module_trg = triggerEventAOD->
filterIndex(previousModuleWhoseResultsWeWant);
584 if( !(idx_previous_module_trg < triggerEventSize) ){
585 passPreviousFilters =
false;
590 if( passPreviousFilters ) hist_cpfilt_mini->Fill(bn, 1);
592 else hist_cpfilt_mini->Fill(bn, 1);
601 if( accept && hist_mini_cppath ){
602 TAxis * axis = hist_mini_cppath->GetXaxis();
603 int bin_num = axis->FindBin(pathNameNoVer.c_str());
604 int bn = bin_num - 1;
605 hist_mini_cppath->Fill(bn, 1);
unsigned int size() const
number of trigger paths in trigger table
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool compare(const P &i, const P &j)
edm::EDGetTokenT< trigger::TriggerEventWithRefs > triggerSummaryTokenRAW
void analyze(const edm::Event &, const edm::EventSetup &) override
const std::string moduleType(const std::string &module) const
C++ class name of module.
std::map< std::string, TH1F * > hist_cpfilt_mini_
trigger::size_type sizeFilters() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
bool accept() const
Has at least one path accepted the event?
const std::vector< std::string > & triggerNames() const
names of trigger paths
trigger::size_type filterIndex(const edm::InputTag &filterTag) const
find index of filter in data-member vector from filter tag
MonitorElement * bookString(Args &&...args)
edm::EDGetTokenT< trigger::TriggerEvent > triggerSummaryTokenAOD
const std::string moduleEDMType(const std::string &module) const
C++ base class name of module.
const std::string & tableName() const
HLT ConfDB table name.
std::string plotDirectoryName
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
LuminosityBlockNumber_t luminosityBlock() const
static const std::string removeVersion(const std::string &trigger)
virtual void setupHltMatrix(DQMStore::IBooker &iBooker, const std::string &, int)
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
const std::vector< std::string > & streamNames() const
void setCurrentFolder(std::string const &fullpath)
unsigned int size() const
Get number of paths stored.
const std::vector< std::string > & streamContent(unsigned int stream) const
names of datasets in stream with index i
MonitorElement * book1D(Args &&...args)
~GeneralHLTOffline() override
static std::string const triggerResults
std::map< std::string, MonitorElement * > cppath_mini_
virtual void fillHltMatrix(const std::string &, const std::string &, bool, bool, edm::Handle< trigger::TriggerEventWithRefs >, edm::Handle< trigger::TriggerEvent >)
const std::string & processName() const
process name
size_type filterIndex(const edm::InputTag &filterTag) const
index from tag
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
const std::vector< std::string > & datasetContent(unsigned int dataset) const
names of trigger paths in dataset with index i
std::map< std::string, MonitorElement * > cpfilt_mini_
void dqmBeginRun(edm::Run const &iRun, edm::EventSetup const &iSetup) override
std::vector< std::vector< std::string > > PDsVectorPathsVector
std::vector< std::string > AddedDatasets
void bookHistograms(DQMStore::IBooker &, edm::Run const &iRun, edm::EventSetup const &iSetup) override
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
HLTConfigProvider hlt_config_
size_type size() const
number of filters
std::map< std::string, std::vector< std::string > > PathModules
GeneralHLTOffline(const edm::ParameterSet &)
std::vector< std::string > DataSetNames
edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken