CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PatTriggerAnalyzerPrescale.cc
Go to the documentation of this file.
6 
7 #include "TH1D.h"
8 
9 
11 
12  public:
14  explicit PatTriggerAnalyzerPrescale( const edm::ParameterSet & iConfig );
17 
18  private:
20  virtual void beginJob();
22  virtual void analyze( const edm::Event & iEvent, const edm::EventSetup & iSetup );
24  virtual void endJob(){};
25 
27  TH1D * histo_;
28 
30  Int_t bin_;
31 
33  std::string pathName_;
34 
35 };
36 
39 
41 
42 
43 using namespace pat;
44 
45 
47 : bin_( 0 )
48 , pathName_( iConfig.getParameter< std::string >( "pathName" ) )
49 {
50 }
51 
53 {
55 
56  // Histogram definition for 100 events on the x-axis
57  histo_ = fileService->make< TH1D >( "histo_", std::string( "Prescale values of " + pathName_ ).c_str(), 100, 0., 100.);
58  histo_->SetXTitle( "event" );
59  histo_->SetYTitle( "prescale" );
60  histo_->SetMinimum( 0. );
61 }
62 
64 {
65  // PAT trigger event
66  edm::Handle< TriggerEvent > triggerEvent;
67  iEvent.getByLabel( "patTriggerEvent", triggerEvent );
68 
69  // Get the HLT path
70  const TriggerPath * path( triggerEvent->path( pathName_ ) );
71 
72  // Fill prescale factor into histogram
73  ++bin_;
74  if ( path ) histo_->SetBinContent( bin_, path->prescale() );
75 }
76 
77 
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
list path
Definition: scaleCards.py:51
int iEvent
Definition: GenABIO.cc:243
Analysis-level HLTrigger path class.
Definition: TriggerPath.h:41
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
std::string pathName_
HLT path name configuration parameter.
PatTriggerAnalyzerPrescale(const edm::ParameterSet &iConfig)
default constructor
edm::Service< TFileService > fileService
virtual void endJob()
everything that needs to be done after the event loop
virtual void beginJob()
everything that needs to be done before the event loop
T * make() const
make new ROOT object
virtual void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup)
everything that needs to be done during the event loop
~PatTriggerAnalyzerPrescale()
default destructor