CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
18 using namespace edm;
19 using namespace reco;
20 using namespace std;
21 
22 //
23 // class declaration
24 
25 
27 public:
30 
31 
32 private:
33  virtual void beginJob() ;
34  virtual void analyze(const edm::Event&, const edm::EventSetup&);
35  virtual void endJob() ;
36  // ----------member data ---------------------------
37 
38  string outputfile;
42  double maxDeltaR;
43  double minMCPt;
44  double maxMCAbsEta;
45  double minRecoPt;
46  double maxRecoAbsEta;
52 
54 };
56 
57 //
58 // constants, enums and typedefs
59 //
60 
61 //
62 // static data member definitions
63 //
64 
65 //
66 // constructors and destructor
67 //
69 
70 {
71  //now do what ever initialization is needed
72  outputfile =
73  iConfig.getUntrackedParameter<string>("OutputFile");
74  benchmarkLabel =
75  iConfig.getParameter<string>("BenchmarkLabel");
76  sGenParticleSource =
77  iConfig.getParameter<InputTag>("InputTruthLabel");
78  maxDeltaR =
79  iConfig.getParameter<double>("maxDeltaR");
80  minMCPt =
81  iConfig.getParameter<double>("minMCPt");
82  maxMCAbsEta =
83  iConfig.getParameter<double>("maxMCAbsEta");
84  minRecoPt =
85  iConfig.getParameter<double>("minRecoPt");
86  maxRecoAbsEta =
87  iConfig.getParameter<double>("maxRecoAbsEta");
88  pfTauProducer =
89  iConfig.getParameter<InputTag>("PFTauProducer");
90  pfTauDiscriminatorByIsolationProducer =
91  iConfig.getParameter<InputTag>("PFTauDiscriminatorByIsolationProducer");
92  pfTauDiscriminatorAgainstElectronProducer =
93  iConfig.getParameter<InputTag>("PFTauDiscriminatorAgainstElectronProducer");
94  sGenMatchObjectLabel =
95  iConfig.getParameter<string>("GenMatchObjectLabel");
96  applyEcalCrackCut =
97  iConfig.getParameter<bool>("ApplyEcalCrackCut");
98 
99 
101 
102 
103  PFTauElecRejectionBenchmark_.setup(
104  outputfile,
105  benchmarkLabel,
106  maxDeltaR,
107  minRecoPt,
108  maxRecoAbsEta,
109  minMCPt,
110  maxMCAbsEta,
111  sGenMatchObjectLabel,
112  applyEcalCrackCut,
113  db);
114 }
115 
116 
118 {
119  // do anything here that needs to be done at desctruction time
120  // (e.g. close files, deallocate resources etc.)
121 }
122 
123 
124 //
125 // member functions
126 //
127 
128 // ------------ method called to for each event ------------
129 void
131 {
132 
133  // get gen products
134  Handle<HepMCProduct> mcevt;
135  iEvent.getByLabel(sGenParticleSource, mcevt);
136 
137  // get pftau collection
138  Handle<PFTauCollection> thePFTau;
139  iEvent.getByLabel(pfTauProducer,thePFTau);
140 
141  // get iso discriminator association vector
142  Handle<PFTauDiscriminator> thePFTauDiscriminatorByIsolation;
143  iEvent.getByLabel(pfTauDiscriminatorByIsolationProducer,thePFTauDiscriminatorByIsolation);
144 
145  // get anti-elec discriminator association vector
146  Handle<PFTauDiscriminator> thePFTauDiscriminatorAgainstElectron;
147  iEvent.getByLabel(pfTauDiscriminatorAgainstElectronProducer,thePFTauDiscriminatorAgainstElectron);
148 
149  PFTauElecRejectionBenchmark_.process(mcevt, thePFTau, thePFTauDiscriminatorByIsolation,
150  thePFTauDiscriminatorAgainstElectron);
151 }
152 
153 
154 // ------------ method called once each job just before starting event loop ------------
155 void
157 {
158 }
159 
160 // ------------ method called once each job just after ending the event loop ------------
161 void
163  PFTauElecRejectionBenchmark_.write();
164 }
165 
166 //define this as a plug-in
168 
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
tuple db
Definition: EcalCondDB.py:151
PFTauElecRejectionBenchmarkAnalyzer(const edm::ParameterSet &)
PFTauElecRejection Benchmark.
void beginJob()
Definition: Breakpoints.cc:15
virtual void analyze(const edm::Event &, const edm::EventSetup &)
int iEvent
Definition: GenABIO.cc:243
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356