1 |
ashriniv |
1.1 |
#include "FWCore/Framework/interface/Event.h"
|
2 |
|
|
#include "FWCore/Utilities/interface/InputTag.h"
|
3 |
|
|
#include "FWCore/Framework/interface/EDAnalyzer.h"
|
4 |
|
|
#include "FWCore/Framework/interface/Frameworkfwd.h"
|
5 |
|
|
#include "FWCore/ParameterSet/interface/ParameterSet.h"
|
6 |
|
|
|
7 |
|
|
#include "TH1D.h"
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
class PatTriggerAnalyzerPrescale : public edm::EDAnalyzer {
|
11 |
|
|
|
12 |
|
|
public:
|
13 |
|
|
/// default constructor
|
14 |
|
|
explicit PatTriggerAnalyzerPrescale( const edm::ParameterSet & iConfig );
|
15 |
|
|
/// default destructor
|
16 |
|
|
~PatTriggerAnalyzerPrescale(){};
|
17 |
|
|
|
18 |
|
|
private:
|
19 |
|
|
/// everything that needs to be done before the event loop
|
20 |
|
|
virtual void beginJob();
|
21 |
|
|
/// everything that needs to be done during the event loop
|
22 |
|
|
virtual void analyze( const edm::Event & iEvent, const edm::EventSetup & iSetup );
|
23 |
|
|
/// everything that needs to be done after the event loop
|
24 |
|
|
virtual void endJob(){};
|
25 |
|
|
|
26 |
|
|
/// histogram
|
27 |
|
|
TH1D * histo_;
|
28 |
|
|
|
29 |
|
|
/// event counter
|
30 |
|
|
Int_t bin_;
|
31 |
|
|
|
32 |
|
|
/// HLT path name configuration parameter
|
33 |
|
|
std::string pathName_;
|
34 |
|
|
|
35 |
|
|
};
|
36 |
|
|
|
37 |
|
|
#include "FWCore/ServiceRegistry/interface/Service.h"
|
38 |
|
|
#include "CommonTools/UtilAlgos/interface/TFileService.h"
|
39 |
|
|
|
40 |
|
|
#include "DataFormats/PatCandidates/interface/TriggerEvent.h"
|
41 |
|
|
|
42 |
|
|
|
43 |
|
|
using namespace pat;
|
44 |
|
|
|
45 |
|
|
|
46 |
|
|
PatTriggerAnalyzerPrescale::PatTriggerAnalyzerPrescale( const edm::ParameterSet & iConfig )
|
47 |
|
|
: bin_( 0 )
|
48 |
|
|
, pathName_( iConfig.getParameter< std::string >( "pathName" ) )
|
49 |
|
|
{
|
50 |
|
|
}
|
51 |
|
|
|
52 |
|
|
void PatTriggerAnalyzerPrescale::beginJob()
|
53 |
|
|
{
|
54 |
|
|
edm::Service< TFileService > fileService;
|
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 |
|
|
|
63 |
|
|
void PatTriggerAnalyzerPrescale::analyze( const edm::Event & iEvent, const edm::EventSetup & iSetup )
|
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 |
|
|
|
78 |
|
|
#include "FWCore/Framework/interface/MakerMacros.h"
|
79 |
|
|
DEFINE_FWK_MODULE( PatTriggerAnalyzerPrescale );
|