CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
GeneralHLTOffline Class Reference
Inheritance diagram for GeneralHLTOffline:
DQMEDAnalyzer edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 GeneralHLTOffline (const edm::ParameterSet &)
 
 ~GeneralHLTOffline () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &ev, edm::EventSetup const &es) final
 
virtual void analyze (edm::Event const &, edm::EventSetup const &)
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) override
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
 DQMEDAnalyzer ()
 
 DQMEDAnalyzer (DQMEDAnalyzer const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer &&)=delete
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) override
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) override
 
 ~DQMEDAnalyzer () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &iRun, edm::EventSetup const &iSetup) override
 
void dqmBeginRun (edm::Run const &iRun, edm::EventSetup const &iSetup) override
 
virtual void fillHltMatrix (const std::string &, const std::string &, bool, bool, edm::Handle< trigger::TriggerEventWithRefs >, edm::Handle< trigger::TriggerEvent >)
 
virtual void setupHltMatrix (DQMStore::IBooker &iBooker, const std::string &, int)
 

Private Attributes

std::vector< std::string > AddedDatasets
 
std::map< std::string, MonitorElement * > cpfilt_mini_
 
MonitorElementcppath_
 
std::map< std::string, MonitorElement * > cppath_mini_
 
std::vector< std::string > DataSetNames
 
bool debugPrint
 
std::map< std::string, TH1F * > hist_cpfilt_mini_
 
HLTConfigProvider hlt_config_
 
std::string hlt_menu_
 
std::string hltTag
 
bool outputPrint
 
std::map< std::string, std::vector< std::string > > PathModules
 
std::vector< std::vector< std::string > > PDsVectorPathsVector
 
std::string plotDirectoryName
 
bool streamA_found_
 
edm::EDGetTokenT< edm::TriggerResultstriggerResultsToken
 
edm::EDGetTokenT< trigger::TriggerEventtriggerSummaryTokenAOD
 
edm::EDGetTokenT< trigger::TriggerEventWithRefstriggerSummaryTokenRAW
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Description: [one line class summary] Implementation: [Notes on implementation]

Definition at line 49 of file GeneralHLTOffline.cc.

Constructor & Destructor Documentation

GeneralHLTOffline::GeneralHLTOffline ( const edm::ParameterSet ps)
explicit

Definition at line 98 of file GeneralHLTOffline.cc.

References gather_cfg::cout, debugPrint, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), hltTag, outputPrint, plotDirectoryName, AlCaHLTBitMon_QueryRunRegistry::string, triggerResultsToken, triggerSummaryTokenAOD, triggerSummaryTokenRAW, and ~GeneralHLTOffline().

98  :streamA_found_(false),
99  hlt_menu_(""),
100  cppath_(nullptr) {
101  debugPrint = false;
102  outputPrint = false;
103 
105  "HLT/General");
106 
107  hltTag = ps.getParameter<std::string> ("HltProcessName");
108 
109  triggerSummaryTokenRAW = consumes <trigger::TriggerEventWithRefs> (edm::InputTag(std::string("hltTriggerSummaryRAW"), std::string(""), hltTag));
110  triggerSummaryTokenAOD = consumes <trigger::TriggerEvent> (edm::InputTag(std::string("hltTriggerSummaryAOD"), std::string(""), hltTag));
111  triggerResultsToken = consumes <edm::TriggerResults> (edm::InputTag(std::string("TriggerResults"), std::string(""), hltTag));
112 
113  if (debugPrint) {
114  std::cout << "Inside Constructor" << std::endl;
115  std::cout << "Got plot dirname = " << plotDirectoryName << std::endl;
116  }
117 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< trigger::TriggerEventWithRefs > triggerSummaryTokenRAW
MonitorElement * cppath_
edm::EDGetTokenT< trigger::TriggerEvent > triggerSummaryTokenAOD
std::string plotDirectoryName
edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken
GeneralHLTOffline::~GeneralHLTOffline ( )
overridedefault

Referenced by GeneralHLTOffline().

Member Function Documentation

void GeneralHLTOffline::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 124 of file GeneralHLTOffline.cc.

References accept(), edm::HLTGlobalStatus::accept(), gather_cfg::cout, cppath_, cppath_mini_, makeLayoutFileForGui::datasetNames, DataSetNames, debugPrint, MonitorElement::Fill(), fillHltMatrix(), edm::Event::getByToken(), MonitorElement::getTH1F(), hlt_config_, hlt_menu_, edm::EventBase::id(), edm::HandleBase::isValid(), diffTwoXMLs::label, edm::EventID::luminosityBlock(), PDsVectorPathsVector, HLTConfigProvider::removeVersion(), edm::EventID::run(), edm::HLTGlobalStatus::size(), findQualityFiles::size, streamA_found_, AlCaHLTBitMon_QueryRunRegistry::string, HLTConfigProvider::triggerIndex(), triggerResults, triggerResultsToken, triggerSummaryTokenAOD, and triggerSummaryTokenRAW.

125  {
126  if (debugPrint)
127  std::cout << "Inside analyze - run, block, event "
128  << iEvent.id().run() << " , " << iEvent.id().luminosityBlock()
129  << " , " << iEvent.id() << " , " << std::endl;
130 
131  // Access Trigger Results
133  iEvent.getByToken(triggerResultsToken, triggerResults);
134 
135  if (!triggerResults.isValid()) {
136  if (debugPrint)
137  std::cout << "Trigger results not valid" << std::endl;
138  return;
139  }
140 
141  if (debugPrint)
142  std::cout << "Found triggerResults" << std::endl;
143 
145  iEvent.getByToken(triggerSummaryTokenRAW, rawTriggerEvent);
146 
147  edm::Handle<trigger::TriggerEvent> aodTriggerEvent;
148  iEvent.getByToken(triggerSummaryTokenAOD, aodTriggerEvent);
149 
150  bool hasRawTriggerEvent = true;
151  if( !rawTriggerEvent.isValid() ){
152  hasRawTriggerEvent = false;
153  if (debugPrint)
154  std::cout << "No RAW trigger summary found! Returning...";
155 
156  if( !aodTriggerEvent.isValid() ){
157  if (debugPrint)
158  std::cout << "No AOD trigger summary found! Returning...";
159  return;
160  }
161  }
162 
163  if (streamA_found_) {
164  const std::vector<std::string> &datasetNames = DataSetNames;
165  // Loop over PDs
166  for (unsigned int iPD = 0; iPD < datasetNames.size(); iPD++) {
167  // Loop over Paths in each PD
168  for (unsigned int iPath = 0;
169  iPath < PDsVectorPathsVector[iPD].size(); iPath++) {
170  std::string &pathName = PDsVectorPathsVector[iPD][iPath];
171  unsigned int index = hlt_config_.triggerIndex(pathName);
172  if (debugPrint) {
173  std::cout << "Looking at path " << pathName << std::endl;
174  std::cout << "Index = " << index
175  << " triggerResults->size() = " << triggerResults->size()
176  << std::endl;
177  }
178 
179  // fill the histos with empty weights......
180  const std::string &label = datasetNames[iPD];
181  std::string fullPathToCPP = "HLT/GeneralHLTOffline/"
182  + label + "/cppath_" + label + hlt_menu_;
183  MonitorElement * ME_mini_cppath = nullptr;
184  TH1F * hist_mini_cppath = nullptr;
185  if( cppath_mini_.find(fullPathToCPP)!=cppath_mini_.end() ){
186  ME_mini_cppath = cppath_mini_[fullPathToCPP];
187  hist_mini_cppath = ME_mini_cppath->getTH1F();
188  }
189 
190  if (hist_mini_cppath) {
191  TAxis * axis = hist_mini_cppath->GetXaxis();
192  if (axis) {
193  std::string pathNameNoVer = hlt_config_.removeVersion(PDsVectorPathsVector[iPD][iPath]);
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());
198  }
199  }
200 
201  if( index < triggerResults->size() ) {
202  bool accept = triggerResults->accept(index);
203  if( accept ) cppath_->Fill(index, 1);
204 
205  fillHltMatrix(datasetNames[iPD], pathName,
206  accept,
207  hasRawTriggerEvent,
208  rawTriggerEvent,
209  aodTriggerEvent);
210  } // end if (index < triggerResults->size())
211  } // end Loop over Paths in each PD
212  } // end Loop over PDs
213  }
214 }
RunNumber_t run() const
Definition: EventID.h:39
size
Write out results.
edm::EDGetTokenT< trigger::TriggerEventWithRefs > triggerSummaryTokenRAW
MonitorElement * cppath_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
TH1F * getTH1F() const
bool accept() const
Has at least one path accepted the event?
edm::EDGetTokenT< trigger::TriggerEvent > triggerSummaryTokenAOD
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:40
static const std::string removeVersion(const std::string &trigger)
void Fill(long long x)
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
unsigned int size() const
Get number of paths stored.
static std::string const triggerResults
Definition: EdmProvDump.cc:41
std::map< std::string, MonitorElement * > cppath_mini_
bool isValid() const
Definition: HandleBase.h:74
virtual void fillHltMatrix(const std::string &, const std::string &, bool, bool, edm::Handle< trigger::TriggerEventWithRefs >, edm::Handle< trigger::TriggerEvent >)
std::vector< std::vector< std::string > > PDsVectorPathsVector
HLTConfigProvider hlt_config_
edm::EventID id() const
Definition: EventBase.h:60
std::vector< std::string > DataSetNames
edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken
void GeneralHLTOffline::bookHistograms ( DQMStore::IBooker iBooker,
edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overrideprivatevirtual

Implements DQMEDAnalyzer.

Definition at line 414 of file GeneralHLTOffline.cc.

References DQMStore::IBooker::book1D(), DQMStore::IBooker::bookString(), cppath_, DataSetNames, hlt_config_, hlt_menu_, plotDirectoryName, DQMStore::IBooker::setCurrentFolder(), setupHltMatrix(), HLTConfigProvider::size(), and streamA_found_.

417 {
419 
421 
422  iBooker.setCurrentFolder("HLT/GeneralHLTOffline/");
423  iBooker.bookString("hltMenuName", hlt_menu_.c_str());
424  cppath_ = iBooker.book1D("cppath" + hlt_menu_,
425  "Counts/Path",
426  hlt_config_.size(), 0, hlt_config_.size());
427 
428  if (streamA_found_) {
429 
430  for (unsigned int iPD = 0; iPD < DataSetNames.size(); iPD++)
431  setupHltMatrix(iBooker, DataSetNames[iPD], iPD);
432 
433  } // if stream A or Physics streams are found
434 } // end of bookHistograms
unsigned int size() const
number of trigger paths in trigger table
MonitorElement * cppath_
MonitorElement * bookString(Args &&...args)
Definition: DQMStore.h:100
std::string plotDirectoryName
virtual void setupHltMatrix(DQMStore::IBooker &iBooker, const std::string &, int)
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:118
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
HLTConfigProvider hlt_config_
std::vector< std::string > DataSetNames
void GeneralHLTOffline::dqmBeginRun ( edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overrideprivatevirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 220 of file GeneralHLTOffline.cc.

References AddedDatasets, compare(), gather_cfg::cout, edmIntegrityCheck::d, HLTConfigProvider::datasetContent(), dataset::datasetName, makeLayoutFileForGui::datasetNames, DataSetNames, debugPrint, MillePedeFileConverter_cfg::e, runEdmFileComparison::found, hlt_config_, hlt_menu_, hltTag, HLTConfigProvider::init(), createfilelist::int, HLTConfigProvider::moduleEDMType(), HLTConfigProvider::moduleLabels(), HLTConfigProvider::moduleType(), gen::n, PathModules, PDsVectorPathsVector, tablePrinter::prefix, HLTConfigProvider::processName(), HLTConfigProvider::removeVersion(), HLTConfigProvider::size(), streamA_found_, HLTConfigProvider::streamContent(), HLTConfigProvider::streamNames(), AlCaHLTBitMon_QueryRunRegistry::string, HLTConfigProvider::tableName(), and HLTConfigProvider::triggerNames().

221  {
222  if (debugPrint)
223  std::cout << "Inside beginRun" << std::endl;
224 
225  // Reset "condition" variables that could have memory of previous
226  // runs.
227 
228  PDsVectorPathsVector.clear();
229  AddedDatasets.clear();
230  DataSetNames.clear();
231  PathModules.clear();
232 
233 
234  bool changed = true;
235  if (!hlt_config_.init(iRun, iSetup, hltTag, changed)) {
236  if (debugPrint) {
237  std::cout << "Warning, didn't find process HLT" << std::endl;
238  return;
239  }
240  } else {
241  if (debugPrint)
242  std::cout << " HLTConfig processName " << hlt_config_.processName()
243  << " tableName " << hlt_config_.tableName()
244  << " size " << hlt_config_.size() << std::endl;
245  }
247  for (unsigned int n = 0, e = hlt_menu_.length(); n != e; ++n)
248  if (hlt_menu_[n] == '/' || hlt_menu_[n] == '.')
249  hlt_menu_[n] = '_';
250 
251 
252  const std::vector<std::string> &nameStreams = hlt_config_.streamNames();
253  auto si = nameStreams.begin();
254  auto se = nameStreams.end();
255  std::vector<std::string> datasetNames;
256 
257  for ( ; si != se; ++si) {
258  if (debugPrint) std::cout << "This is stream " << *si << std::endl;
259 
260  if ( ((*si).find("Physics") != std::string::npos) ||((*si).find("Scouting") != std::string::npos) ||((*si).find("Parking") != std::string::npos) || (*si) == "A") {
261  streamA_found_ = true;
262 
263  std::vector<std::string> datasetperStream = hlt_config_.streamContent(*si);
264 
265  for (auto const & di: datasetperStream) {
266  datasetNames.push_back(di);
267  }
268  }
269  }
270 
271  if (debugPrint) std::cout << "Number of total datasets " << datasetNames.size() << std::endl;
272 
273 
274  if (streamA_found_) {
275 
277 
278  if (debugPrint)
279  std::cout << "Number of datasets to be monitored "
280  << datasetNames.size() << std::endl;
281 
282  for (auto const & datasetName : datasetNames) {
283  const std::vector<std::string> &datasetPaths = hlt_config_.datasetContent(datasetName);
284  if (debugPrint) {
285  std::cout << "This is dataset " << datasetName
286  << "datasetPaths.size() = " << datasetPaths.size() << std::endl;
287  for (auto const & datasetPath : datasetPaths) {
288  std::cout << "Paths in begin job "
289  << datasetPath << std::endl;
290  }
291  }
292 
293  // Check if dataset has been added - if not add it
294  // need to loop through AddedDatasets and compare
295  bool foundDataset = false;
296  int datasetNum = -1;
297  for (unsigned int d = 0; d < AddedDatasets.size(); d++) {
298  if (AddedDatasets[d] == datasetName) {
299  foundDataset = true;
300  datasetNum = d;
301  if (debugPrint)
302  std::cout << "Dataset " << datasetName
303  << " found in AddedDatasets at position " << d << std::endl;
304  break;
305  }
306  }
307 
308  if (!foundDataset) {
309  if (debugPrint)
310  std::cout << " Fill trigger paths for dataset "
311  << datasetName << std::endl;
312  PDsVectorPathsVector.push_back(datasetPaths);
313  // store dataset pathname
314  AddedDatasets.push_back(datasetName);
315  } else {
316  // This trigger path has already been added - this implies that
317  // this is a new run What we want to do is check if there is a
318  // new trigger that was not in the original dataset For a given
319  // dataset, loop over the stored list of triggers, and compare
320  // to the current list of triggers If any of the triggers are
321  // missing, add them to the end of the appropriate dataset
322  if (debugPrint)
323  std::cout << " Additional runs : Check for additional"
324  << "trigger paths per dataset " << std::endl;
325  // Loop over correct path of PDsVectorPathsVector
326  bool found = false;
327 
328  // Loop over triggers in the path
329  for (unsigned int iTrig = 0; iTrig < datasetPaths.size(); iTrig++) {
330  if (debugPrint)
331  std::cout << "Looping over trigger list in dataset "
332  << iTrig << " "
333  << datasetPaths[iTrig] << std::endl;
334  found = false;
335  // Loop over triggers already on the list
336  for (unsigned int od = 0; od < PDsVectorPathsVector[datasetNum].size(); od++) {
337  if (debugPrint)
338  std::cout << "Looping over existing trigger list " << od
339  << " " << PDsVectorPathsVector[datasetNum][od] << std::endl;
340  // Compare, see if match is found
341  if (hlt_config_.removeVersion(datasetPaths[iTrig]) == hlt_config_.removeVersion(PDsVectorPathsVector[datasetNum][od])) {
342  found = true;
343  if (debugPrint)
344  std::cout << " FOUND " << datasetPaths[iTrig] << std::endl;
345  break;
346  }
347  }
348  // If match is not found, add trigger to correct path of PDsVectorPathsVector
349  if (!found)
350  PDsVectorPathsVector[datasetNum].push_back(datasetPaths[iTrig]);
351  if (debugPrint)
352  std::cout << datasetPaths[iTrig]
353  << " NOT FOUND - so we added it to the correct dataset "
354  << datasetName << std::endl;
355  }
356  }
357  // Let's check this whole big structure
358  if (debugPrint) {
359  for (unsigned int is = 0; is < PDsVectorPathsVector.size(); is++) {
360  std::cout << " PDsVectorPathsVector[" << is << "] is "
361  << PDsVectorPathsVector[is].size() << std::endl;
362  for (unsigned int ip = 0; ip < PDsVectorPathsVector[is].size(); ip++) {
363  std::cout << " trigger " << ip << " path "
364  << PDsVectorPathsVector[is][ip] << std::endl;
365  }
366  }
367  }
368 
369  if (debugPrint)
370  std::cout <<"Found PD: " << datasetName << std::endl;
371  } // end of loop over dataset names
372 
373 
374 
375  std::vector<std::string> triggerNames = hlt_config_.triggerNames();
376 
377  for(auto pathName : triggerNames){
378  const std::vector<std::string>& moduleLabels = hlt_config_.moduleLabels(pathName);
379  auto NumModules = int( moduleLabels.size() );
380 
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;
384 
385  std::string prefix("hltPre");
386 
387  std::vector<std::string> good_module_names;
388  good_module_names.clear();
389  for( int iMod=0; iMod<NumModules; iMod++ ){
390  std::string moduleType = hlt_config_.moduleType(moduleLabels[iMod]);
391  std::string moduleEDMType = hlt_config_.moduleEDMType(moduleLabels[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;
400 
401  if( moduleLabels[iMod].compare(0, prefix.length(), prefix) == 0 ) continue;
402  good_module_names.push_back(moduleLabels[iMod]);
403  }
404  PathModules[pathName] = good_module_names;
405  } // loop over paths
406 
407  } // if stream A or Physics streams found
408 
409 
410 }
unsigned int size() const
number of trigger paths in trigger table
bool compare(const P &i, const P &j)
const std::string moduleType(const std::string &module) const
C++ class name of module.
const std::vector< std::string > & triggerNames() const
names of trigger paths
const std::string moduleEDMType(const std::string &module) const
C++ base class name of module.
const std::string & tableName() const
HLT ConfDB table name.
static const std::string removeVersion(const std::string &trigger)
const std::vector< std::string > & streamNames() const
const std::vector< std::string > & streamContent(unsigned int stream) const
names of datasets in stream with index i
const std::string & processName() const
process name
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::vector< std::vector< std::string > > PDsVectorPathsVector
std::vector< std::string > AddedDatasets
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
HLTConfigProvider hlt_config_
std::map< std::string, std::vector< std::string > > PathModules
std::vector< std::string > DataSetNames
string datasetName
Definition: dataset.py:927
void GeneralHLTOffline::fillHltMatrix ( const std::string &  label,
const std::string &  path,
bool  accept,
bool  hasRawTriggerEvent,
edm::Handle< trigger::TriggerEventWithRefs triggerEventRAW,
edm::Handle< trigger::TriggerEvent triggerEventAOD 
)
privatevirtual

Definition at line 512 of file GeneralHLTOffline.cc.

References gather_cfg::cout, cpfilt_mini_, cppath_mini_, debugPrint, DEFINE_FWK_MODULE, trigger::TriggerEvent::filterIndex(), trigger::TriggerEventWithRefs::filterIndex(), MonitorElement::getTH1F(), hlt_config_, hlt_menu_, hltTag, createfilelist::int, edm::HandleBase::isValid(), callgraph::path, PathModules, HLTConfigProvider::removeVersion(), trigger::TriggerEventWithRefs::size(), trigger::TriggerEvent::sizeFilters(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by analyze().

517  {
518  if (debugPrint)
519  std::cout << "Inside fillHltMatrix( " << label << " , "
520  << path << " ) " << std::endl;
521 
522  std::string fullPathToCPP;
523 
524  fullPathToCPP = "HLT/GeneralHLTOffline/" + label + "/cppath_" + label + "_" + hlt_menu_;
525 
526  std::string dnamez = "cppath_" + label + "_" + hlt_menu_;
527 
528  TH1F * hist_mini_cppath = nullptr;
529  MonitorElement * ME_mini_cppath = nullptr;
530  if( cppath_mini_.find(dnamez)!=cppath_mini_.end() ){
531  ME_mini_cppath = cppath_mini_[dnamez];
532  hist_mini_cppath = ME_mini_cppath->getTH1F();
533  }
534 
535  std::string pathNameNoVer = hlt_config_.removeVersion(path);
536 
537  if( (path.find("HLT_") != std::string::npos) &&
538  !(path.find("HLT_Physics")!=std::string::npos) &&
539  !(path.find("HLT_Random")!=std::string::npos) ){
540 
541  unsigned int triggerEventSize = 0;
542  if( hasRawTriggerEvent && triggerEventRAW.isValid() ) triggerEventSize = triggerEventRAW->size();
543  else if( triggerEventAOD.isValid() ) triggerEventSize = triggerEventAOD->sizeFilters();
544 
545  std::string pathName_dataset = "cpfilt_" + label + "_" + pathNameNoVer;
546 
547  TH1F * hist_cpfilt_mini = nullptr;
548  MonitorElement * ME_cpfilt_mini = nullptr;
549  if( cpfilt_mini_.find(pathName_dataset)!=cpfilt_mini_.end() ){
550  ME_cpfilt_mini = cpfilt_mini_[pathName_dataset];
551  hist_cpfilt_mini = ME_cpfilt_mini->getTH1F();
552  }
553 
554 
555  std::vector<std::string> moduleLabels = PathModules[path];
556  auto NumModules = int( moduleLabels.size() );
557 
558  for( int iMod=0; iMod<NumModules; iMod++ ){
559  edm::InputTag moduleWhoseResultsWeWant(moduleLabels[iMod],
560  "",
561  hltTag);
562 
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);
566 
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;
572 
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,
578  "",
579  hltTag);
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);
583 
584  if( !(idx_previous_module_trg < triggerEventSize) ){
585  passPreviousFilters = false;
586  break;
587  }
588  }
589  // Only fill if previous filters have been passed
590  if( passPreviousFilters ) hist_cpfilt_mini->Fill(bn, 1);
591  }
592  else hist_cpfilt_mini->Fill(bn, 1);
593 
594  }
595  }
596  }
597  else{
598  if (debugPrint) std::cout << "No AOD trigger summary found! Returning..." << std::endl;
599  }
600 
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);
606  }
607 
608  if (debugPrint)
609  std::cout << "hist->Fill" << std::endl;
610 } // End fillHltMatrix
trigger::size_type sizeFilters() const
Definition: TriggerEvent.h:135
TH1F * getTH1F() const
trigger::size_type filterIndex(const edm::InputTag &filterTag) const
find index of filter in data-member vector from filter tag
Definition: TriggerEvent.h:123
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
static const std::string removeVersion(const std::string &trigger)
std::map< std::string, MonitorElement * > cppath_mini_
bool isValid() const
Definition: HandleBase.h:74
size_type filterIndex(const edm::InputTag &filterTag) const
index from tag
std::map< std::string, MonitorElement * > cpfilt_mini_
HLTConfigProvider hlt_config_
size_type size() const
number of filters
std::map< std::string, std::vector< std::string > > PathModules
void GeneralHLTOffline::setupHltMatrix ( DQMStore::IBooker iBooker,
const std::string &  label,
int  iPD 
)
privatevirtual

Definition at line 437 of file GeneralHLTOffline.cc.

References DQMStore::IBooker::book1D(), gather_cfg::cout, cpfilt_mini_, cppath_mini_, debugPrint, hist_cpfilt_mini_, hlt_config_, hlt_menu_, createfilelist::int, diffTwoXMLs::label, PathModules, PDsVectorPathsVector, HLTConfigProvider::removeVersion(), DQMStore::IBooker::setCurrentFolder(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by bookHistograms().

437  {
438  std::string h_name;
439  std::string h_title;
440  std::string pathName;
441  std::string PD_Folder;
442  std::string Path_Folder;
443 
444  PD_Folder = "HLT/GeneralHLTOffline/" + label;
445 
446  iBooker.setCurrentFolder(PD_Folder);
447 
448  // make it the top level directory, that is on the same dir level as
449  // paths
450  std::string folderz;
451  folderz = "HLT/GeneralHLTOffline/" + label;
452  iBooker.setCurrentFolder(folderz);
453 
454  std::string dnamez = "cppath_" + label + "_" + hlt_menu_;
455  int sizez = PDsVectorPathsVector[iPD].size();
456  TH1F * hist_mini_cppath = nullptr;
457  cppath_mini_[dnamez] = iBooker.book1D(dnamez.c_str(),
458  dnamez.c_str(),
459  sizez,
460  0,
461  sizez);
462  if( cppath_mini_[dnamez] )
463  hist_mini_cppath = cppath_mini_[dnamez]->getTH1F();
464 
465  unsigned int jPath;
466  for (unsigned int iPath = 0; iPath < PDsVectorPathsVector[iPD].size(); iPath++) {
467  pathName = hlt_config_.removeVersion(PDsVectorPathsVector[iPD][iPath]);
468  jPath = iPath + 1;
469 
470  if (hist_mini_cppath) {
471  TAxis * axis = hist_mini_cppath->GetXaxis();
472  if (axis)
473  axis->SetBinLabel(jPath, pathName.c_str());
474  }
475 
476  std::string pathNameVer = PDsVectorPathsVector[iPD][iPath];
477 
478  std::vector<std::string> moduleLabels = PathModules[pathNameVer];
479  auto NumModules = int( moduleLabels.size() );
480 
481  if( NumModules==0 ) continue;
482 
483  std::string pathName_dataset = "cpfilt_" + label + "_" + pathName;
484 
485  cpfilt_mini_[pathName_dataset] = iBooker.book1D(pathName_dataset.c_str(),
486  pathName.c_str(),
487  NumModules,
488  0,
489  NumModules);
490 
491  if( cpfilt_mini_[pathName_dataset] )
492  hist_cpfilt_mini_[pathName_dataset] = cpfilt_mini_[pathName_dataset]->getTH1F();
493 
494  for( int iMod=0; iMod<NumModules; iMod++ ){
495  if( cpfilt_mini_[pathName_dataset] && hist_cpfilt_mini_[pathName_dataset] ){
496  TAxis * axis = hist_cpfilt_mini_[pathName_dataset]->GetXaxis();
497  if (axis)
498  axis->SetBinLabel(iMod+1,moduleLabels[iMod].c_str());
499  }
500  }
501 
502  if (debugPrint)
503  std::cout << "book1D for " << pathName << std::endl;
504  }
505 
506  if (debugPrint)
507  std::cout << "Success setupHltMatrix( " << label << " , "
508  << iPD << " )" << std::endl;
509 } // End setupHltMatrix
std::map< std::string, TH1F * > hist_cpfilt_mini_
static const std::string removeVersion(const std::string &trigger)
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:118
std::map< std::string, MonitorElement * > cppath_mini_
std::map< std::string, MonitorElement * > cpfilt_mini_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
std::vector< std::vector< std::string > > PDsVectorPathsVector
HLTConfigProvider hlt_config_
std::map< std::string, std::vector< std::string > > PathModules

Member Data Documentation

std::vector<std::string> GeneralHLTOffline::AddedDatasets
private

Definition at line 81 of file GeneralHLTOffline.cc.

Referenced by dqmBeginRun().

std::map<std::string, MonitorElement*> GeneralHLTOffline::cpfilt_mini_
private

Definition at line 90 of file GeneralHLTOffline.cc.

Referenced by fillHltMatrix(), and setupHltMatrix().

MonitorElement* GeneralHLTOffline::cppath_
private

Definition at line 88 of file GeneralHLTOffline.cc.

Referenced by analyze(), and bookHistograms().

std::map<std::string, MonitorElement*> GeneralHLTOffline::cppath_mini_
private

Definition at line 89 of file GeneralHLTOffline.cc.

Referenced by analyze(), fillHltMatrix(), and setupHltMatrix().

std::vector<std::string> GeneralHLTOffline::DataSetNames
private

Definition at line 82 of file GeneralHLTOffline.cc.

Referenced by analyze(), bookHistograms(), and dqmBeginRun().

bool GeneralHLTOffline::debugPrint
private
std::map<std::string, TH1F*> GeneralHLTOffline::hist_cpfilt_mini_
private

Definition at line 91 of file GeneralHLTOffline.cc.

Referenced by setupHltMatrix().

HLTConfigProvider GeneralHLTOffline::hlt_config_
private
std::string GeneralHLTOffline::hlt_menu_
private
std::string GeneralHLTOffline::hltTag
private

Definition at line 78 of file GeneralHLTOffline.cc.

Referenced by dqmBeginRun(), fillHltMatrix(), and GeneralHLTOffline().

bool GeneralHLTOffline::outputPrint
private

Definition at line 72 of file GeneralHLTOffline.cc.

Referenced by GeneralHLTOffline().

std::map< std::string, std::vector<std::string> > GeneralHLTOffline::PathModules
private

Definition at line 83 of file GeneralHLTOffline.cc.

Referenced by dqmBeginRun(), fillHltMatrix(), and setupHltMatrix().

std::vector< std::vector<std::string> > GeneralHLTOffline::PDsVectorPathsVector
private

Definition at line 80 of file GeneralHLTOffline.cc.

Referenced by analyze(), dqmBeginRun(), and setupHltMatrix().

std::string GeneralHLTOffline::plotDirectoryName
private

Definition at line 77 of file GeneralHLTOffline.cc.

Referenced by bookHistograms(), and GeneralHLTOffline().

bool GeneralHLTOffline::streamA_found_
private

Definition at line 73 of file GeneralHLTOffline.cc.

Referenced by analyze(), bookHistograms(), and dqmBeginRun().

edm::EDGetTokenT<edm::TriggerResults> GeneralHLTOffline::triggerResultsToken
private

Definition at line 84 of file GeneralHLTOffline.cc.

Referenced by analyze(), and GeneralHLTOffline().

edm::EDGetTokenT<trigger::TriggerEvent> GeneralHLTOffline::triggerSummaryTokenAOD
private

Definition at line 86 of file GeneralHLTOffline.cc.

Referenced by analyze(), and GeneralHLTOffline().

edm::EDGetTokenT<trigger::TriggerEventWithRefs> GeneralHLTOffline::triggerSummaryTokenRAW
private

Definition at line 85 of file GeneralHLTOffline.cc.

Referenced by analyze(), and GeneralHLTOffline().