CMS 3D CMS Logo

PFTauElecRejectionBenchMarkAnalyzer.cc
Go to the documentation of this file.
1 // system include files
2 #include <memory>
3 
4 // user include files
7 
10 
14 
16 
17 using namespace edm;
18 using namespace reco;
19 using namespace std;
20 
21 //
22 // class declaration
23 
25 public:
28 
29 private:
30  void beginJob() override;
31  void analyze(const edm::Event &, const edm::EventSetup &) override;
32  void endJob() override;
33  // ----------member data ---------------------------
34 
35  string outputfile;
38  double maxDeltaR;
39  double minMCPt;
40  double maxMCAbsEta;
41  double minRecoPt;
42  double maxRecoAbsEta;
45 
50 
52 };
54 
55 //
56 // constants, enums and typedefs
57 //
58 
59 //
60 // static data member definitions
61 //
62 
63 //
64 // constructors and destructor
65 //
67 
68 {
69  // now do what ever initialization is needed
70  outputfile = iConfig.getUntrackedParameter<string>("OutputFile");
71  benchmarkLabel = iConfig.getParameter<string>("BenchmarkLabel");
72  sGenParticleSource_tok_ = consumes<edm::HepMCProduct>(iConfig.getParameter<InputTag>("InputTruthLabel"));
73  maxDeltaR = iConfig.getParameter<double>("maxDeltaR");
74  minMCPt = iConfig.getParameter<double>("minMCPt");
75  maxMCAbsEta = iConfig.getParameter<double>("maxMCAbsEta");
76  minRecoPt = iConfig.getParameter<double>("minRecoPt");
77  maxRecoAbsEta = iConfig.getParameter<double>("maxRecoAbsEta");
78  pfTauProducer_tok_ = consumes<reco::PFTauCollection>(iConfig.getParameter<InputTag>("PFTauProducer"));
79  pfTauDiscriminatorByIsolationProducer_tok_ =
80  consumes<reco::PFTauDiscriminator>(iConfig.getParameter<InputTag>("PFTauDiscriminatorByIsolationProducer"));
81  pfTauDiscriminatorAgainstElectronProducer_tok_ =
82  consumes<reco::PFTauDiscriminator>(iConfig.getParameter<InputTag>("PFTauDiscriminatorAgainstElectronProducer"));
83  sGenMatchObjectLabel = iConfig.getParameter<string>("GenMatchObjectLabel");
84  applyEcalCrackCut = iConfig.getParameter<bool>("ApplyEcalCrackCut");
85 
87 
88  PFTauElecRejectionBenchmark_.setup(outputfile,
89  benchmarkLabel,
90  maxDeltaR,
91  minRecoPt,
92  maxRecoAbsEta,
93  minMCPt,
94  maxMCAbsEta,
95  sGenMatchObjectLabel,
96  applyEcalCrackCut,
97  db);
98 }
99 
101  // do anything here that needs to be done at desctruction time
102  // (e.g. close files, deallocate resources etc.)
103 }
104 
105 //
106 // member functions
107 //
108 
109 // ------------ method called to for each event ------------
111  // get gen products
112  Handle<HepMCProduct> mcevt;
113  iEvent.getByToken(sGenParticleSource_tok_, mcevt);
114 
115  // get pftau collection
116  Handle<PFTauCollection> thePFTau;
117  iEvent.getByToken(pfTauProducer_tok_, thePFTau);
118 
119  // get iso discriminator association vector
120  Handle<PFTauDiscriminator> thePFTauDiscriminatorByIsolation;
121  iEvent.getByToken(pfTauDiscriminatorByIsolationProducer_tok_, thePFTauDiscriminatorByIsolation);
122 
123  // get anti-elec discriminator association vector
124  Handle<PFTauDiscriminator> thePFTauDiscriminatorAgainstElectron;
125  iEvent.getByToken(pfTauDiscriminatorAgainstElectronProducer_tok_, thePFTauDiscriminatorAgainstElectron);
126 
127  PFTauElecRejectionBenchmark_.process(
128  mcevt, thePFTau, thePFTauDiscriminatorByIsolation, thePFTauDiscriminatorAgainstElectron);
129 }
130 
131 // ------------ method called once each job just before starting event loop
132 // ------------
134 
135 // ------------ method called once each job just after ending the event loop
136 // ------------
137 void PFTauElecRejectionBenchmarkAnalyzer::endJob() { PFTauElecRejectionBenchmark_.write(); }
138 
139 // define this as a plug-in
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::PFTauCollection > pfTauProducer_tok_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
PFTauElecRejectionBenchmarkAnalyzer(const edm::ParameterSet &)
PFTauElecRejection Benchmark.
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
void beginJob()
Definition: Breakpoints.cc:14
void analyze(const edm::Event &, const edm::EventSetup &) override
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::EDGetTokenT< reco::PFTauDiscriminator > pfTauDiscriminatorByIsolationProducer_tok_
edm::EDGetTokenT< reco::PFTauDiscriminator > pfTauDiscriminatorAgainstElectronProducer_tok_
fixed size matrix
HLT enums.
edm::EDGetTokenT< edm::HepMCProduct > sGenParticleSource_tok_