test
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() override ;
34  virtual void analyze(const edm::Event&, const edm::EventSetup&) override;
35  virtual void endJob() override ;
36  // ----------member data ---------------------------
37 
38  string outputfile;
41  double maxDeltaR;
42  double minMCPt;
43  double maxMCAbsEta;
44  double minRecoPt;
45  double maxRecoAbsEta;
48 
53 
55 };
57 
58 //
59 // constants, enums and typedefs
60 //
61 
62 //
63 // static data member definitions
64 //
65 
66 //
67 // constructors and destructor
68 //
70 
71 {
72  //now do what ever initialization is needed
73  outputfile = iConfig.getUntrackedParameter<string>("OutputFile");
74  benchmarkLabel = iConfig.getParameter<string>("BenchmarkLabel");
75  sGenParticleSource_tok_ = consumes<edm::HepMCProduct>(iConfig.getParameter<InputTag>("InputTruthLabel"));
76  maxDeltaR = iConfig.getParameter<double>("maxDeltaR");
77  minMCPt = iConfig.getParameter<double>("minMCPt");
78  maxMCAbsEta = iConfig.getParameter<double>("maxMCAbsEta");
79  minRecoPt = iConfig.getParameter<double>("minRecoPt");
80  maxRecoAbsEta = iConfig.getParameter<double>("maxRecoAbsEta");
81  pfTauProducer_tok_ = consumes<reco::PFTauCollection>(iConfig.getParameter<InputTag>("PFTauProducer"));
82  pfTauDiscriminatorByIsolationProducer_tok_ = consumes<reco::PFTauDiscriminator>
83  (iConfig.getParameter<InputTag>("PFTauDiscriminatorByIsolationProducer"));
84  pfTauDiscriminatorAgainstElectronProducer_tok_ = consumes<reco::PFTauDiscriminator>
85  (iConfig.getParameter<InputTag>("PFTauDiscriminatorAgainstElectronProducer") );
86  sGenMatchObjectLabel = iConfig.getParameter<string>("GenMatchObjectLabel");
87  applyEcalCrackCut = iConfig.getParameter<bool>("ApplyEcalCrackCut");
88 
89 
91 
92 
93  PFTauElecRejectionBenchmark_.setup(
94  outputfile,
95  benchmarkLabel,
96  maxDeltaR,
97  minRecoPt,
98  maxRecoAbsEta,
99  minMCPt,
100  maxMCAbsEta,
101  sGenMatchObjectLabel,
102  applyEcalCrackCut,
103  db);
104 }
105 
106 
108 {
109  // do anything here that needs to be done at desctruction time
110  // (e.g. close files, deallocate resources etc.)
111 }
112 
113 
114 //
115 // member functions
116 //
117 
118 // ------------ method called to for each event ------------
119 void
121 {
122 
123  // get gen products
124  Handle<HepMCProduct> mcevt;
125  iEvent.getByToken(sGenParticleSource_tok_, mcevt);
126 
127  // get pftau collection
128  Handle<PFTauCollection> thePFTau;
129  iEvent.getByToken(pfTauProducer_tok_,thePFTau);
130 
131  // get iso discriminator association vector
132  Handle<PFTauDiscriminator> thePFTauDiscriminatorByIsolation;
133  iEvent.getByToken(pfTauDiscriminatorByIsolationProducer_tok_,thePFTauDiscriminatorByIsolation);
134 
135  // get anti-elec discriminator association vector
136  Handle<PFTauDiscriminator> thePFTauDiscriminatorAgainstElectron;
137  iEvent.getByToken(pfTauDiscriminatorAgainstElectronProducer_tok_,thePFTauDiscriminatorAgainstElectron);
138 
139  PFTauElecRejectionBenchmark_.process(mcevt, thePFTau, thePFTauDiscriminatorByIsolation,
140  thePFTauDiscriminatorAgainstElectron);
141 }
142 
143 
144 // ------------ method called once each job just before starting event loop ------------
145 void
147 {
148 }
149 
150 // ------------ method called once each job just after ending the event loop ------------
151 void
153  PFTauElecRejectionBenchmark_.write();
154 }
155 
156 //define this as a plug-in
158 
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:462
#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 &) override
int iEvent
Definition: GenABIO.cc:230
edm::EDGetTokenT< reco::PFTauDiscriminator > pfTauDiscriminatorByIsolationProducer_tok_
edm::EDGetTokenT< reco::PFTauDiscriminator > pfTauDiscriminatorAgainstElectronProducer_tok_
edm::EDGetTokenT< edm::HepMCProduct > sGenParticleSource_tok_