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 () 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 beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) 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
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) 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 102 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().

102  :streamA_found_(false),
103  hlt_menu_(""),
104  cppath_(nullptr) {
105  debugPrint = false;
106  outputPrint = false;
107 
109  "HLT/General");
110 
111  hltTag = ps.getParameter<std::string> ("HltProcessName");
112 
113  triggerSummaryTokenRAW = consumes <trigger::TriggerEventWithRefs> (edm::InputTag(std::string("hltTriggerSummaryRAW"), std::string(""), hltTag));
114  triggerSummaryTokenAOD = consumes <trigger::TriggerEvent> (edm::InputTag(std::string("hltTriggerSummaryAOD"), std::string(""), hltTag));
115  triggerResultsToken = consumes <edm::TriggerResults> (edm::InputTag(std::string("TriggerResults"), std::string(""), hltTag));
116 
117  if (debugPrint) {
118  std::cout << "Inside Constructor" << std::endl;
119  std::cout << "Got plot dirname = " << plotDirectoryName << std::endl;
120  }
121 }
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 128 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.

129  {
130  if (debugPrint)
131  std::cout << "Inside analyze - run, block, event "
132  << iEvent.id().run() << " , " << iEvent.id().luminosityBlock()
133  << " , " << iEvent.id() << " , " << std::endl;
134 
135  // Access Trigger Results
137  iEvent.getByToken(triggerResultsToken, triggerResults);
138 
139  if (!triggerResults.isValid()) {
140  if (debugPrint)
141  std::cout << "Trigger results not valid" << std::endl;
142  return;
143  }
144 
145  if (debugPrint)
146  std::cout << "Found triggerResults" << std::endl;
147 
149  iEvent.getByToken(triggerSummaryTokenRAW, rawTriggerEvent);
150 
151  edm::Handle<trigger::TriggerEvent> aodTriggerEvent;
152  iEvent.getByToken(triggerSummaryTokenAOD, aodTriggerEvent);
153 
154  bool hasRawTriggerEvent = true;
155  if( !rawTriggerEvent.isValid() ){
156  hasRawTriggerEvent = false;
157  if (debugPrint)
158  std::cout << "No RAW trigger summary found! Returning...";
159 
160  if( !aodTriggerEvent.isValid() ){
161  if (debugPrint)
162  std::cout << "No AOD trigger summary found! Returning...";
163  return;
164  }
165  }
166 
167  if (streamA_found_) {
168  const std::vector<std::string> &datasetNames = DataSetNames;
169  // Loop over PDs
170  for (unsigned int iPD = 0; iPD < datasetNames.size(); iPD++) {
171  // Loop over Paths in each PD
172  for (unsigned int iPath = 0;
173  iPath < PDsVectorPathsVector[iPD].size(); iPath++) {
174  std::string &pathName = PDsVectorPathsVector[iPD][iPath];
175  unsigned int index = hlt_config_.triggerIndex(pathName);
176  if (debugPrint) {
177  std::cout << "Looking at path " << pathName << std::endl;
178  std::cout << "Index = " << index
179  << " triggerResults->size() = " << triggerResults->size()
180  << std::endl;
181  }
182 
183  // fill the histos with empty weights......
184  const std::string &label = datasetNames[iPD];
185  std::string fullPathToCPP = "HLT/GeneralHLTOffline/"
186  + label + "/cppath_" + label + hlt_menu_;
187  MonitorElement * ME_mini_cppath = nullptr;
188  TH1F * hist_mini_cppath = nullptr;
189  if( cppath_mini_.find(fullPathToCPP)!=cppath_mini_.end() ){
190  ME_mini_cppath = cppath_mini_[fullPathToCPP];
191  hist_mini_cppath = ME_mini_cppath->getTH1F();
192  }
193 
194  if (hist_mini_cppath) {
195  TAxis * axis = hist_mini_cppath->GetXaxis();
196  if (axis) {
197  std::string pathNameNoVer = hlt_config_.removeVersion(PDsVectorPathsVector[iPD][iPath]);
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());
202  }
203  }
204 
205  if( index < triggerResults->size() ) {
206  bool accept = triggerResults->accept(index);
207  if( accept ) cppath_->Fill(index, 1);
208 
209  fillHltMatrix(datasetNames[iPD], pathName,
210  accept,
211  hasRawTriggerEvent,
212  rawTriggerEvent,
213  aodTriggerEvent);
214  } // end if (index < triggerResults->size())
215  } // end Loop over Paths in each PD
216  } // end Loop over PDs
217  }
218 }
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:519
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::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
overrideprivate

Definition at line 616 of file GeneralHLTOffline.cc.

617  {
618 }
void GeneralHLTOffline::bookHistograms ( DQMStore::IBooker iBooker,
edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overrideprivatevirtual

Implements DQMEDAnalyzer.

Definition at line 418 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_.

421 {
423 
425 
426  iBooker.setCurrentFolder("HLT/GeneralHLTOffline/");
427  iBooker.bookString("hltMenuName", hlt_menu_.c_str());
428  cppath_ = iBooker.book1D("cppath" + hlt_menu_,
429  "Counts/Path",
430  hlt_config_.size(), 0, hlt_config_.size());
431 
432  if (streamA_found_) {
433 
434  for (unsigned int iPD = 0; iPD < DataSetNames.size(); iPD++)
435  setupHltMatrix(iBooker, DataSetNames[iPD], iPD);
436 
437  } // if stream A or Physics streams are found
438 } // 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:279
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 224 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().

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

Definition at line 621 of file GeneralHLTOffline.cc.

References DEFINE_FWK_MODULE.

622  {
623 }
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 516 of file GeneralHLTOffline.cc.

References gather_cfg::cout, cpfilt_mini_, cppath_mini_, debugPrint, 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().

521  {
522  if (debugPrint)
523  std::cout << "Inside fillHltMatrix( " << label << " , "
524  << path << " ) " << std::endl;
525 
526  std::string fullPathToCPP;
527 
528  fullPathToCPP = "HLT/GeneralHLTOffline/" + label + "/cppath_" + label + "_" + hlt_menu_;
529 
530  std::string dnamez = "cppath_" + label + "_" + hlt_menu_;
531 
532  TH1F * hist_mini_cppath = nullptr;
533  MonitorElement * ME_mini_cppath = nullptr;
534  if( cppath_mini_.find(dnamez)!=cppath_mini_.end() ){
535  ME_mini_cppath = cppath_mini_[dnamez];
536  hist_mini_cppath = ME_mini_cppath->getTH1F();
537  }
538 
539  std::string pathNameNoVer = hlt_config_.removeVersion(path);
540 
541  if( (path.find("HLT_") != std::string::npos) &&
542  !(path.find("HLT_Physics")!=std::string::npos) &&
543  !(path.find("HLT_Random")!=std::string::npos) ){
544 
545  unsigned int triggerEventSize = 0;
546  if( hasRawTriggerEvent && triggerEventRAW.isValid() ) triggerEventSize = triggerEventRAW->size();
547  else if( triggerEventAOD.isValid() ) triggerEventSize = triggerEventAOD->sizeFilters();
548 
549  std::string pathName_dataset = "cpfilt_" + label + "_" + pathNameNoVer;
550 
551  TH1F * hist_cpfilt_mini = nullptr;
552  MonitorElement * ME_cpfilt_mini = nullptr;
553  if( cpfilt_mini_.find(pathName_dataset)!=cpfilt_mini_.end() ){
554  ME_cpfilt_mini = cpfilt_mini_[pathName_dataset];
555  hist_cpfilt_mini = ME_cpfilt_mini->getTH1F();
556  }
557 
558 
559  std::vector<std::string> moduleLabels = PathModules[path];
560  auto NumModules = int( moduleLabels.size() );
561 
562  for( int iMod=0; iMod<NumModules; iMod++ ){
563  edm::InputTag moduleWhoseResultsWeWant(moduleLabels[iMod],
564  "",
565  hltTag);
566 
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);
570 
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;
576 
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,
582  "",
583  hltTag);
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);
587 
588  if( !(idx_previous_module_trg < triggerEventSize) ){
589  passPreviousFilters = false;
590  break;
591  }
592  }
593  // Only fill if previous filters have been passed
594  if( passPreviousFilters ) hist_cpfilt_mini->Fill(bn, 1);
595  }
596  else hist_cpfilt_mini->Fill(bn, 1);
597 
598  }
599  }
600  }
601  else{
602  if (debugPrint) std::cout << "No AOD trigger summary found! Returning..." << std::endl;
603  }
604 
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);
610  }
611 
612  if (debugPrint)
613  std::cout << "hist->Fill" << std::endl;
614 } // 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 441 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().

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

Referenced by dqmBeginRun().

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

Definition at line 94 of file GeneralHLTOffline.cc.

Referenced by fillHltMatrix(), and setupHltMatrix().

MonitorElement* GeneralHLTOffline::cppath_
private

Definition at line 92 of file GeneralHLTOffline.cc.

Referenced by analyze(), and bookHistograms().

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

Definition at line 93 of file GeneralHLTOffline.cc.

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

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

Definition at line 86 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 95 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 82 of file GeneralHLTOffline.cc.

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

bool GeneralHLTOffline::outputPrint
private

Definition at line 76 of file GeneralHLTOffline.cc.

Referenced by GeneralHLTOffline().

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

Definition at line 87 of file GeneralHLTOffline.cc.

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

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

Definition at line 84 of file GeneralHLTOffline.cc.

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

std::string GeneralHLTOffline::plotDirectoryName
private

Definition at line 81 of file GeneralHLTOffline.cc.

Referenced by bookHistograms(), and GeneralHLTOffline().

bool GeneralHLTOffline::streamA_found_
private

Definition at line 77 of file GeneralHLTOffline.cc.

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

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

Definition at line 88 of file GeneralHLTOffline.cc.

Referenced by analyze(), and GeneralHLTOffline().

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

Definition at line 90 of file GeneralHLTOffline.cc.

Referenced by analyze(), and GeneralHLTOffline().

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

Definition at line 89 of file GeneralHLTOffline.cc.

Referenced by analyze(), and GeneralHLTOffline().