87 std::map< std::string, std::vector<std::string> >
PathModules;
118 std::cout <<
"Inside Constructor" << std::endl;
131 std::cout <<
"Inside analyze - run, block, event " 133 <<
" , " << iEvent.
id() <<
" , " << std::endl;
139 if (!triggerResults.
isValid()) {
141 std::cout <<
"Trigger results not valid" << std::endl;
146 std::cout <<
"Found triggerResults" << std::endl;
154 bool hasRawTriggerEvent =
true;
155 if( !rawTriggerEvent.
isValid() ){
156 hasRawTriggerEvent =
false;
158 std::cout <<
"No RAW trigger summary found! Returning...";
160 if( !aodTriggerEvent.
isValid() ){
162 std::cout <<
"No AOD trigger summary found! Returning...";
170 for (
unsigned int iPD = 0; iPD < datasetNames.size(); iPD++) {
172 for (
unsigned int iPath = 0;
177 std::cout <<
"Looking at path " << pathName << std::endl;
179 <<
" triggerResults->size() = " << triggerResults->
size()
185 std::string fullPathToCPP =
"HLT/GeneralHLTOffline/" 186 + label +
"/cppath_" + label +
hlt_menu_;
188 TH1F * hist_mini_cppath =
nullptr;
191 hist_mini_cppath = ME_mini_cppath->
getTH1F();
194 if (hist_mini_cppath) {
195 TAxis * axis = hist_mini_cppath->GetXaxis();
198 int bin_num = axis->FindBin(pathNameNoVer.c_str());
199 int bn = bin_num - 1;
200 hist_mini_cppath->Fill(bn, 0);
201 hist_mini_cppath->SetEntries(hist_mini_cppath->Integral());
205 if( index < triggerResults->
size() ) {
227 std::cout <<
"Inside beginRun" << std::endl;
241 std::cout <<
"Warning, didn't find process HLT" << std::endl;
257 auto si = nameStreams.begin();
258 auto se = nameStreams.end();
261 for ( ; si != se; ++si) {
264 if ( ((*si).find(
"Physics") != std::string::npos) ||((*si).find(
"Scouting") != std::string::npos) ||((*si).find(
"Parking") != std::string::npos) || (*si) ==
"A") {
269 for (
auto const & di: datasetperStream) {
270 datasetNames.push_back(di);
275 if (
debugPrint)
std::cout <<
"Number of total datasets " << datasetNames.size() << std::endl;
283 std::cout <<
"Number of datasets to be monitored " 284 << datasetNames.size() << std::endl;
290 <<
"datasetPaths.size() = " << datasetPaths.size() << std::endl;
291 for (
auto const & datasetPath : datasetPaths) {
293 << datasetPath << std::endl;
299 bool foundDataset =
false;
307 <<
" found in AddedDatasets at position " <<
d << std::endl;
314 std::cout <<
" Fill trigger paths for dataset " 327 std::cout <<
" Additional runs : Check for additional" 328 <<
"trigger paths per dataset " << std::endl;
333 for (
unsigned int iTrig = 0; iTrig < datasetPaths.size(); iTrig++) {
335 std::cout <<
"Looping over trigger list in dataset " 337 << datasetPaths[iTrig] << std::endl;
342 std::cout <<
"Looping over existing trigger list " << od
348 std::cout <<
" FOUND " << datasetPaths[iTrig] << std::endl;
357 <<
" NOT FOUND - so we added it to the correct dataset " 364 std::cout <<
" PDsVectorPathsVector[" << is <<
"] is " 367 std::cout <<
" trigger " << ip <<
" path " 381 for(
auto pathName : triggerNames){
383 auto NumModules =
int( moduleLabels.size() );
385 if( !(pathName.find(
"HLT_") != std::string::npos) )
continue;
386 if( (pathName.find(
"HLT_Physics")!=std::string::npos) ||
387 (pathName.find(
"HLT_Random")!=std::string::npos) )
continue;
391 std::vector<std::string> good_module_names;
392 good_module_names.clear();
393 for(
int iMod=0; iMod<NumModules; iMod++ ){
396 if( !(moduleEDMType ==
"EDFilter") )
continue;
397 if( moduleType.find(
"Selector")!= std::string::npos )
continue;
398 if( moduleType ==
"HLTTriggerTypeFilter" ||
399 moduleType ==
"HLTBool" ||
400 moduleType ==
"PrimaryVertexObjectFilter" ||
401 moduleType ==
"JetVertexChecker" ||
402 moduleType ==
"HLTRHemisphere" ||
403 moduleType ==
"DetectorStateFilter" )
continue;
405 if( moduleLabels[iMod].
compare(0, prefix.length(),
prefix) == 0 )
continue;
406 good_module_names.push_back(moduleLabels[iMod]);
434 for (
unsigned int iPD = 0; iPD <
DataSetNames.size(); iPD++)
448 PD_Folder =
"HLT/GeneralHLTOffline/" +
label;
455 folderz =
"HLT/GeneralHLTOffline/" +
label;
460 TH1F * hist_mini_cppath =
nullptr;
474 if (hist_mini_cppath) {
475 TAxis * axis = hist_mini_cppath->GetXaxis();
477 axis->SetBinLabel(jPath, pathName.c_str());
482 std::vector<std::string> moduleLabels =
PathModules[pathNameVer];
483 auto NumModules =
int( moduleLabels.size() );
485 if( NumModules==0 )
continue;
487 std::string pathName_dataset =
"cpfilt_" + label +
"_" + pathName;
498 for(
int iMod=0; iMod<NumModules; iMod++ ){
502 axis->SetBinLabel(iMod+1,moduleLabels[iMod].c_str());
507 std::cout <<
"book1D for " << pathName << std::endl;
511 std::cout <<
"Success setupHltMatrix( " << label <<
" , " 512 << iPD <<
" )" << std::endl;
519 bool hasRawTriggerEvent,
523 std::cout <<
"Inside fillHltMatrix( " << label <<
" , " 524 << path <<
" ) " << std::endl;
528 fullPathToCPP =
"HLT/GeneralHLTOffline/" + label +
"/cppath_" + label +
"_" +
hlt_menu_;
532 TH1F * hist_mini_cppath =
nullptr;
536 hist_mini_cppath = ME_mini_cppath->
getTH1F();
541 if( (path.find(
"HLT_") != std::string::npos) &&
542 !(path.find(
"HLT_Physics")!=std::string::npos) &&
543 !(path.find(
"HLT_Random")!=std::string::npos) ){
545 unsigned int triggerEventSize = 0;
546 if( hasRawTriggerEvent && triggerEventRAW.
isValid() ) triggerEventSize = triggerEventRAW->
size();
547 else if( triggerEventAOD.
isValid() ) triggerEventSize = triggerEventAOD->
sizeFilters();
549 std::string pathName_dataset =
"cpfilt_" + label +
"_" + pathNameNoVer;
551 TH1F * hist_cpfilt_mini =
nullptr;
555 hist_cpfilt_mini = ME_cpfilt_mini->
getTH1F();
560 auto NumModules =
int( moduleLabels.size() );
562 for(
int iMod=0; iMod<NumModules; iMod++ ){
567 unsigned int idx_module_trg = 0;
568 if( hasRawTriggerEvent && triggerEventRAW.
isValid() ) idx_module_trg = triggerEventRAW->
filterIndex(moduleWhoseResultsWeWant);
569 else if( triggerEventAOD.
isValid() ) idx_module_trg = triggerEventAOD->
filterIndex(moduleWhoseResultsWeWant);
571 if( !(idx_module_trg < triggerEventSize) )
continue;
572 if( hist_cpfilt_mini ){
573 TAxis * axis = hist_cpfilt_mini->GetXaxis();
574 int bin_num = axis->FindBin(moduleLabels[iMod].c_str());
575 int bn = bin_num - 1;
577 if( bin_num!=1 && hasRawTriggerEvent ){
578 bool passPreviousFilters =
true;
579 for(
int ibin = bin_num-1; ibin>0; ibin-- ){
580 std::string previousFilter(axis->GetBinLabel(ibin));
581 edm::InputTag previousModuleWhoseResultsWeWant(previousFilter,
584 unsigned int idx_previous_module_trg = 0;
585 if( hasRawTriggerEvent && triggerEventRAW.
isValid() ) idx_previous_module_trg = triggerEventRAW->
filterIndex(previousModuleWhoseResultsWeWant);
586 else if( triggerEventAOD.
isValid() ) idx_previous_module_trg = triggerEventAOD->
filterIndex(previousModuleWhoseResultsWeWant);
588 if( !(idx_previous_module_trg < triggerEventSize) ){
589 passPreviousFilters =
false;
594 if( passPreviousFilters ) hist_cpfilt_mini->Fill(bn, 1);
596 else hist_cpfilt_mini->Fill(bn, 1);
605 if( accept && hist_mini_cppath ){
606 TAxis * axis = hist_mini_cppath->GetXaxis();
607 int bin_num = axis->FindBin(pathNameNoVer.c_str());
608 int bn = bin_num - 1;
609 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
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
void setCurrentFolder(const std::string &fullpath)
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
TH1F * getTH1F(void) const
HLTConfigProvider hlt_config_
size_type size() const
number of filters
void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
std::map< std::string, std::vector< std::string > > PathModules
GeneralHLTOffline(const edm::ParameterSet &)
std::vector< std::string > DataSetNames
edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken
void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override