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 
31 
32 private:
33  void beginJob() override;
34  void analyze(const edm::Event &, const edm::EventSetup &) override;
35  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_ =
83  consumes<reco::PFTauDiscriminator>(iConfig.getParameter<InputTag>("PFTauDiscriminatorByIsolationProducer"));
84  pfTauDiscriminatorAgainstElectronProducer_tok_ =
85  consumes<reco::PFTauDiscriminator>(iConfig.getParameter<InputTag>("PFTauDiscriminatorAgainstElectronProducer"));
86  sGenMatchObjectLabel = iConfig.getParameter<string>("GenMatchObjectLabel");
87  applyEcalCrackCut = iConfig.getParameter<bool>("ApplyEcalCrackCut");
88 
89  db = edm::Service<DQMStore>().operator->();
90 
91  PFTauElecRejectionBenchmark_.setup(outputfile,
92  benchmarkLabel,
93  maxDeltaR,
94  minRecoPt,
96  minMCPt,
98  sGenMatchObjectLabel,
99  applyEcalCrackCut,
100  db);
101 }
102 
104  // do anything here that needs to be done at desctruction time
105  // (e.g. close files, deallocate resources etc.)
106 }
107 
108 //
109 // member functions
110 //
111 
112 // ------------ method called to for each event ------------
114  // get gen products
115  Handle<HepMCProduct> mcevt;
116  iEvent.getByToken(sGenParticleSource_tok_, mcevt);
117 
118  // get pftau collection
119  Handle<PFTauCollection> thePFTau;
120  iEvent.getByToken(pfTauProducer_tok_, thePFTau);
121 
122  // get iso discriminator association vector
123  Handle<PFTauDiscriminator> thePFTauDiscriminatorByIsolation;
124  iEvent.getByToken(pfTauDiscriminatorByIsolationProducer_tok_, thePFTauDiscriminatorByIsolation);
125 
126  // get anti-elec discriminator association vector
127  Handle<PFTauDiscriminator> thePFTauDiscriminatorAgainstElectron;
128  iEvent.getByToken(pfTauDiscriminatorAgainstElectronProducer_tok_, thePFTauDiscriminatorAgainstElectron);
129 
130  PFTauElecRejectionBenchmark_.process(
131  mcevt, thePFTau, thePFTauDiscriminatorByIsolation, thePFTauDiscriminatorAgainstElectron);
132 }
133 
134 // ------------ method called once each job just before starting event loop
135 // ------------
137 
138 // ------------ method called once each job just after ending the event loop
139 // ------------
140 void PFTauElecRejectionBenchmarkAnalyzer::endJob() { PFTauElecRejectionBenchmark_.write(); }
141 
142 // define this as a plug-in
PFTauElecRejectionBenchmarkAnalyzer::sGenParticleSource_tok_
edm::EDGetTokenT< edm::HepMCProduct > sGenParticleSource_tok_
Definition: PFTauElecRejectionBenchMarkAnalyzer.cc:49
bk::beginJob
void beginJob()
Definition: Breakpoints.cc:14
writedatasetfile.outputfile
outputfile
Definition: writedatasetfile.py:27
PFTauElecRejectionBenchmarkAnalyzer::sGenMatchObjectLabel
string sGenMatchObjectLabel
Definition: PFTauElecRejectionBenchMarkAnalyzer.cc:47
PFTauElecRejectionBenchmarkAnalyzer::pfTauProducer_tok_
edm::EDGetTokenT< reco::PFTauCollection > pfTauProducer_tok_
Definition: PFTauElecRejectionBenchMarkAnalyzer.cc:50
edm::EDGetTokenT< edm::HepMCProduct >
edm
HLT enums.
Definition: AlignableModifier.h:19
PFTauElecRejectionBenchmarkAnalyzer::maxRecoAbsEta
double maxRecoAbsEta
Definition: PFTauElecRejectionBenchMarkAnalyzer.cc:45
PFTauElecRejectionBenchmark.h
dqm::legacy::MonitorElement
Definition: MonitorElement.h:461
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
EDAnalyzer.h
PFTauElecRejectionBenchmarkAnalyzer::MonitorElement
dqm::legacy::MonitorElement MonitorElement
Definition: PFTauElecRejectionBenchMarkAnalyzer.cc:27
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
edm::Handle
Definition: AssociativeIterator.h:50
PFTauElecRejectionBenchmarkAnalyzer::applyEcalCrackCut
bool applyEcalCrackCut
Definition: PFTauElecRejectionBenchMarkAnalyzer.cc:46
edm::EDAnalyzer
Definition: EDAnalyzer.h:28
dqmiodatasetharvest.db
db
Definition: dqmiodatasetharvest.py:119
MakerMacros.h
PFTauElecRejectionBenchmarkAnalyzer::PFTauElecRejectionBenchmarkAnalyzer
PFTauElecRejectionBenchmarkAnalyzer(const edm::ParameterSet &)
PFTauElecRejection Benchmark.
Definition: PFTauElecRejectionBenchMarkAnalyzer.cc:69
PFTauElecRejectionBenchmarkAnalyzer::outputfile
string outputfile
Definition: PFTauElecRejectionBenchMarkAnalyzer.cc:38
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
dqm::legacy::DQMStore
Definition: DQMStore.h:727
PFTauElecRejectionBenchmarkAnalyzer::DQMStore
dqm::legacy::DQMStore DQMStore
Definition: PFTauElecRejectionBenchMarkAnalyzer.cc:26
Service.h
PFTauElecRejectionBenchmarkAnalyzer::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: PFTauElecRejectionBenchMarkAnalyzer.cc:113
PFTauElecRejectionBenchmarkAnalyzer::~PFTauElecRejectionBenchmarkAnalyzer
~PFTauElecRejectionBenchmarkAnalyzer() override
Definition: PFTauElecRejectionBenchMarkAnalyzer.cc:103
PFTauElecRejectionBenchmarkAnalyzer::maxMCAbsEta
double maxMCAbsEta
Definition: PFTauElecRejectionBenchMarkAnalyzer.cc:43
pfTauBenchmarkElecRejection_cfi.minMCPt
minMCPt
Definition: pfTauBenchmarkElecRejection_cfi.py:9
PFTauElecRejectionBenchmarkAnalyzer::pfTauDiscriminatorByIsolationProducer_tok_
edm::EDGetTokenT< reco::PFTauDiscriminator > pfTauDiscriminatorByIsolationProducer_tok_
Definition: PFTauElecRejectionBenchMarkAnalyzer.cc:51
PFTauElecRejectionBenchmarkAnalyzer::PFTauElecRejectionBenchmark_
PFTauElecRejectionBenchmark PFTauElecRejectionBenchmark_
Definition: PFTauElecRejectionBenchMarkAnalyzer.cc:54
PFTauElecRejectionBenchmarkAnalyzer::pfTauDiscriminatorAgainstElectronProducer_tok_
edm::EDGetTokenT< reco::PFTauDiscriminator > pfTauDiscriminatorAgainstElectronProducer_tok_
Definition: PFTauElecRejectionBenchMarkAnalyzer.cc:52
PFTauElecRejectionBenchmarkAnalyzer::beginJob
void beginJob() override
Definition: PFTauElecRejectionBenchMarkAnalyzer.cc:136
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
PFTauElecRejectionBenchmark
Definition: PFTauElecRejectionBenchmark.h:27
edm::Service
Definition: Service.h:30
iEvent
int iEvent
Definition: GenABIO.cc:224
pfTauBenchmarkElecRejection_cfi.maxRecoAbsEta
maxRecoAbsEta
Definition: pfTauBenchmarkElecRejection_cfi.py:8
PFTauElecRejectionBenchmarkAnalyzer::maxDeltaR
double maxDeltaR
Definition: PFTauElecRejectionBenchMarkAnalyzer.cc:41
analyze
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
edm::EventSetup
Definition: EventSetup.h:57
pfTauBenchmarkElecRejection_cfi.minRecoPt
minRecoPt
Definition: pfTauBenchmarkElecRejection_cfi.py:7
PFTauElecRejectionBenchmarkAnalyzer::minMCPt
double minMCPt
Definition: PFTauElecRejectionBenchMarkAnalyzer.cc:42
InputTag.h
std
Definition: JetResolutionObject.h:76
PFTauElecRejectionBenchmarkAnalyzer::benchmarkLabel
string benchmarkLabel
Definition: PFTauElecRejectionBenchMarkAnalyzer.cc:40
Frameworkfwd.h
ewkMuLumiMonitorDQM_cfi.maxDeltaR
maxDeltaR
Definition: ewkMuLumiMonitorDQM_cfi.py:44
pfTauBenchmarkElecRejection_cfi.maxMCAbsEta
maxMCAbsEta
Definition: pfTauBenchmarkElecRejection_cfi.py:10
PFTauElecRejectionBenchmarkAnalyzer::db
DQMStore * db
Definition: PFTauElecRejectionBenchMarkAnalyzer.cc:39
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ParameterSet.h
edm::Event
Definition: Event.h:73
PFTauElecRejectionBenchmarkAnalyzer::endJob
void endJob() override
Definition: PFTauElecRejectionBenchMarkAnalyzer.cc:140
edm::InputTag
Definition: InputTag.h:15
PFTauElecRejectionBenchmarkAnalyzer
Definition: PFTauElecRejectionBenchMarkAnalyzer.cc:24
PFTauElecRejectionBenchmarkAnalyzer::minRecoPt
double minRecoPt
Definition: PFTauElecRejectionBenchMarkAnalyzer.cc:44