CMS 3D CMS Logo

SiPixelPhase1Base.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Class: SiPixelPhase1Base
4 //
5 // Implementations of the class
6 //
7 // Original Author: Yi-Mu "Enoch" Chen
8 
10 
11 // Constructor requires manually looping the trigger flag settings
12 // Since constructor of GenericTriggerEventFlag requires
13 // EDConsumerBase class protected member calls
15  DQMEDAnalyzer(),
16  HistogramManagerHolder( iConfig )
17 {
18  // Flags will default to empty vector if not specified in configuration file
19  auto flags = iConfig.getUntrackedParameter<edm::VParameterSet>( "triggerflags" , {} );
20 
21  for( auto& flag : flags ){
22  triggerlist.emplace_back( new GenericTriggerEventFlag(flag, consumesCollector(), *this) );
23  }
24 }
25 
26 // Booking histograms as required by the DQM
27 void
29  DQMStore::IBooker& iBooker,
30  edm::Run const& run,
31  edm::EventSetup const& iSetup )
32 {
33  for( HistogramManager& histoman : histo ){
34  histoman.book( iBooker, iSetup );
35  }
36 
37  // Running trigger flag initialization (per run)
38  for( auto& trigger : triggerlist ){
39  if( trigger->on() ){
40  trigger->initRun( run, iSetup );
41  }
42  }
43 }
44 
45 // trigger checking function
46 bool
48  const edm::Event& iEvent,
49  const edm::EventSetup& iSetup,
50  const unsigned trgidx ) const
51 {
52  // Always return true for MC
53  if( !iEvent.isRealData() ) { return true; }
54 
55  // Always return true is flag is not on;
56  if( !triggerlist.at(trgidx)->on() ) { return true; }
57 
58  return triggerlist.at(trgidx)->accept( iEvent, iSetup );
59 }
T getUntrackedParameter(std::string const &, T const &) const
void bookHistograms(DQMStore::IBooker &iBooker, edm::Run const &run, edm::EventSetup const &iSetup)
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
std::vector< std::unique_ptr< GenericTriggerEventFlag > > triggerlist
std::vector< Variable::Flags > flags
Definition: MVATrainer.cc:135
Provides a code based selection for trigger and DCS information in order to have no failing filters i...
bool isRealData() const
Definition: EventBase.h:64
SiPixelPhase1Base(const edm::ParameterSet &iConfig)
bool checktrigger(const edm::Event &iEvent, const edm::EventSetup &iSetup, const unsigned trgidx) const
int iEvent
Definition: GenABIO.cc:230
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
std::vector< HistogramManager > histo
Definition: Run.h:42