CMS 3D CMS Logo

IsolatedGenParticles.h
Go to the documentation of this file.
1 #ifndef CalibrationIsolatedParticlesIsolatedGenParticles_h
2 #define CalibrationIsolatedParticlesIsolatedGenParticles_h
3 
4 // system include files
5 #include <memory>
6 
7 // user include files
10 
13 
15 //TFile Service
18 
19 // track associator
23 
24 // ecal / hcal
27 
32 
35 
37 
38 //L1 objects
45 
54 
57 
58 // root objects
59 #include "TROOT.h"
60 #include "TSystem.h"
61 #include "TFile.h"
62 #include "TH1I.h"
63 #include "TH2D.h"
64 #include "TProfile.h"
65 #include "TDirectory.h"
66 #include "TTree.h"
67 
68 
69 namespace{
70  class ParticlePtGreater{
71  public:
72  int operator()(const HepMC::GenParticle * p1,
73  const HepMC::GenParticle * p2) const{
74  return p1->momentum().perp() > p2->momentum().perp();
75  }
76  };
77 
78  class ParticlePGreater{
79  public:
80  int operator()(const HepMC::GenParticle * p1,
81  const HepMC::GenParticle * p2) const{
82  return p1->momentum().rho() > p2->momentum().rho();
83  }
84  };
85 }
86 
87 
89 
90 public:
91  explicit IsolatedGenParticles(const edm::ParameterSet&);
92  ~IsolatedGenParticles() override;
93 
94 private:
95  void beginJob() override ;
96  void analyze(const edm::Event&, const edm::EventSetup&) override;
97  void endJob() override ;
98 
99  double DeltaPhi(double v1, double v2);
100  double DeltaR(double eta1, double phi1, double eta2, double phi2);
101  double DeltaR2(double eta1, double phi1, double eta2, double phi2);
102 
103  void fillTrack (GlobalPoint& posVec, math::XYZTLorentzVector& momVec, GlobalPoint& posECAL, int pdgId, bool okECAL, bool accpet);
104  void fillIsolatedTrack(math::XYZTLorentzVector& momVec, GlobalPoint& posECAL, int pdgId);
105  void BookHistograms();
106  void clearTreeVectors();
107  int particleCode(int);
108 
109  static const int NPBins = 3;
110  static const int NEtaBins = 4;
111  static const int PBins=32, EtaBins=60, Particles=12;
113  double genPartPBins[NPBins+1], genPartEtaBins[NEtaBins+1];
114  double pSeed, ptMin, etaMax, pCutIsolate;
116 
119 
122 
123  bool initL1, useHepMC;
124  static const size_t nL1BitsMax=128;
125  std::string algoBitToName[nL1BitsMax];
126  double a_coneR, a_charIsoR, a_neutIsoR, a_mipR;
129 
138 
139 
141 
144  TH2D *h_pEta[Particles];
145 
146  TTree *tree;
147 
148  std::vector<double> *t_isoTrkPAll;
149  std::vector<double> *t_isoTrkPtAll;
150  std::vector<double> *t_isoTrkPhiAll;
151  std::vector<double> *t_isoTrkEtaAll;
152  std::vector<double> *t_isoTrkPdgIdAll;
153  std::vector<double> *t_isoTrkDEtaAll;
154  std::vector<double> *t_isoTrkDPhiAll;
155 
156  std::vector<double> *t_isoTrkP;
157  std::vector<double> *t_isoTrkPt;
158  std::vector<double> *t_isoTrkEne;
159  std::vector<double> *t_isoTrkEta;
160  std::vector<double> *t_isoTrkPhi;
161  std::vector<double> *t_isoTrkEtaEC;
162  std::vector<double> *t_isoTrkPhiEC;
163  std::vector<double> *t_isoTrkPdgId;
164 
165  std::vector<double> *t_maxNearP31x31;
166  std::vector<double> *t_cHadronEne31x31, *t_cHadronEne31x31_1, *t_cHadronEne31x31_2, *t_cHadronEne31x31_3;
167  std::vector<double> *t_nHadronEne31x31;
168  std::vector<double> *t_photonEne31x31;
169  std::vector<double> *t_eleEne31x31;
170  std::vector<double> *t_muEne31x31;
171 
172  std::vector<double> *t_maxNearP25x25;
173  std::vector<double> *t_cHadronEne25x25, *t_cHadronEne25x25_1, *t_cHadronEne25x25_2, *t_cHadronEne25x25_3;
174  std::vector<double> *t_nHadronEne25x25;
175  std::vector<double> *t_photonEne25x25;
176  std::vector<double> *t_eleEne25x25;
177  std::vector<double> *t_muEne25x25;
178 
179  std::vector<double> *t_maxNearP21x21;
180  std::vector<double> *t_cHadronEne21x21, *t_cHadronEne21x21_1, *t_cHadronEne21x21_2, *t_cHadronEne21x21_3;
181  std::vector<double> *t_nHadronEne21x21;
182  std::vector<double> *t_photonEne21x21;
183  std::vector<double> *t_eleEne21x21;
184  std::vector<double> *t_muEne21x21;
185 
186  std::vector<double> *t_maxNearP15x15;
187  std::vector<double> *t_cHadronEne15x15, *t_cHadronEne15x15_1, *t_cHadronEne15x15_2, *t_cHadronEne15x15_3;
188  std::vector<double> *t_nHadronEne15x15;
189  std::vector<double> *t_photonEne15x15;
190  std::vector<double> *t_eleEne15x15;
191  std::vector<double> *t_muEne15x15;
192 
193  std::vector<double> *t_maxNearP11x11;
194  std::vector<double> *t_cHadronEne11x11, *t_cHadronEne11x11_1, *t_cHadronEne11x11_2, *t_cHadronEne11x11_3;
195  std::vector<double> *t_nHadronEne11x11;
196  std::vector<double> *t_photonEne11x11;
197  std::vector<double> *t_eleEne11x11;
198  std::vector<double> *t_muEne11x11;
199 
200  std::vector<double> *t_maxNearP9x9;
201  std::vector<double> *t_cHadronEne9x9, *t_cHadronEne9x9_1, *t_cHadronEne9x9_2, *t_cHadronEne9x9_3;
202  std::vector<double> *t_nHadronEne9x9;
203  std::vector<double> *t_photonEne9x9;
204  std::vector<double> *t_eleEne9x9;
205  std::vector<double> *t_muEne9x9;
206 
207  std::vector<double> *t_maxNearP7x7;
208  std::vector<double> *t_cHadronEne7x7, *t_cHadronEne7x7_1, *t_cHadronEne7x7_2, *t_cHadronEne7x7_3;
209  std::vector<double> *t_nHadronEne7x7;
210  std::vector<double> *t_photonEne7x7;
211  std::vector<double> *t_eleEne7x7;
212  std::vector<double> *t_muEne7x7;
213 
214  std::vector<double> *t_maxNearP3x3;
215  std::vector<double> *t_cHadronEne3x3, *t_cHadronEne3x3_1, *t_cHadronEne3x3_2, *t_cHadronEne3x3_3;
216  std::vector<double> *t_nHadronEne3x3;
217  std::vector<double> *t_photonEne3x3;
218  std::vector<double> *t_eleEne3x3;
219  std::vector<double> *t_muEne3x3;
220 
221  std::vector<double> *t_maxNearP1x1;
222  std::vector<double> *t_cHadronEne1x1, *t_cHadronEne1x1_1, *t_cHadronEne1x1_2, *t_cHadronEne1x1_3;
223  std::vector<double> *t_nHadronEne1x1;
224  std::vector<double> *t_photonEne1x1;
225  std::vector<double> *t_eleEne1x1;
226  std::vector<double> *t_muEne1x1;
227 
228  std::vector<double> *t_maxNearPHC1x1;
229  std::vector<double> *t_cHadronEneHC1x1, *t_cHadronEneHC1x1_1, *t_cHadronEneHC1x1_2, *t_cHadronEneHC1x1_3;
230  std::vector<double> *t_nHadronEneHC1x1;
231  std::vector<double> *t_photonEneHC1x1;
232  std::vector<double> *t_eleEneHC1x1;
233  std::vector<double> *t_muEneHC1x1;
234 
235  std::vector<double> *t_maxNearPHC3x3;
236  std::vector<double> *t_cHadronEneHC3x3, *t_cHadronEneHC3x3_1, *t_cHadronEneHC3x3_2, *t_cHadronEneHC3x3_3;
237  std::vector<double> *t_nHadronEneHC3x3;
238  std::vector<double> *t_photonEneHC3x3;
239  std::vector<double> *t_eleEneHC3x3;
240  std::vector<double> *t_muEneHC3x3;
241 
242  std::vector<double> *t_maxNearPHC5x5;
243  std::vector<double> *t_cHadronEneHC5x5, *t_cHadronEneHC5x5_1, *t_cHadronEneHC5x5_2, *t_cHadronEneHC5x5_3;
244  std::vector<double> *t_nHadronEneHC5x5;
245  std::vector<double> *t_photonEneHC5x5;
246  std::vector<double> *t_eleEneHC5x5;
247  std::vector<double> *t_muEneHC5x5;
248 
249  std::vector<double> *t_maxNearPHC7x7;
250  std::vector<double> *t_cHadronEneHC7x7, *t_cHadronEneHC7x7_1, *t_cHadronEneHC7x7_2, *t_cHadronEneHC7x7_3;
251  std::vector<double> *t_nHadronEneHC7x7;
252  std::vector<double> *t_photonEneHC7x7;
253  std::vector<double> *t_eleEneHC7x7;
254  std::vector<double> *t_muEneHC7x7;
255 
256  std::vector<double> *t_maxNearPR;
257  std::vector<double> *t_cHadronEneR, *t_cHadronEneR_1, *t_cHadronEneR_2, *t_cHadronEneR_3;
258  std::vector<double> *t_nHadronEneR;
259  std::vector<double> *t_photonEneR;
260  std::vector<double> *t_eleEneR;
261  std::vector<double> *t_muEneR;
262 
263  std::vector<double> *t_maxNearPIsoR;
264  std::vector<double> *t_cHadronEneIsoR, *t_cHadronEneIsoR_1, *t_cHadronEneIsoR_2, *t_cHadronEneIsoR_3;
265  std::vector<double> *t_nHadronEneIsoR;
266  std::vector<double> *t_photonEneIsoR;
267  std::vector<double> *t_eleEneIsoR;
268  std::vector<double> *t_muEneIsoR;
269 
270  std::vector<double> *t_maxNearPHCR;
271  std::vector<double> *t_cHadronEneHCR, *t_cHadronEneHCR_1, *t_cHadronEneHCR_2, *t_cHadronEneHCR_3;
272  std::vector<double> *t_nHadronEneHCR;
273  std::vector<double> *t_photonEneHCR;
274  std::vector<double> *t_eleEneHCR;
275  std::vector<double> *t_muEneHCR;
276 
277  std::vector<double> *t_maxNearPIsoHCR;
278  std::vector<double> *t_cHadronEneIsoHCR, *t_cHadronEneIsoHCR_1, *t_cHadronEneIsoHCR_2, *t_cHadronEneIsoHCR_3;
279  std::vector<double> *t_nHadronEneIsoHCR;
280  std::vector<double> *t_photonEneIsoHCR;
281  std::vector<double> *t_eleEneIsoHCR;
282  std::vector<double> *t_muEneIsoHCR;
283 
284  std::vector<int> *t_L1Decision;
285  std::vector<double> *t_L1CenJetPt, *t_L1CenJetEta, *t_L1CenJetPhi;
286  std::vector<double> *t_L1FwdJetPt, *t_L1FwdJetEta, *t_L1FwdJetPhi;
287  std::vector<double> *t_L1TauJetPt, *t_L1TauJetEta, *t_L1TauJetPhi;
288  std::vector<double> *t_L1MuonPt, *t_L1MuonEta, *t_L1MuonPhi;
289  std::vector<double> *t_L1IsoEMPt, *t_L1IsoEMEta, *t_L1IsoEMPhi;
290  std::vector<double> *t_L1NonIsoEMPt, *t_L1NonIsoEMEta, *t_L1NonIsoEMPhi;
291  std::vector<double> *t_L1METPt, *t_L1METEta, *t_L1METPhi;
292 
293  spr::genSimInfo isoinfo1x1, isoinfo3x3, isoinfo7x7, isoinfo9x9, isoinfo11x11;
294  spr::genSimInfo isoinfo15x15, isoinfo21x21, isoinfo25x25, isoinfo31x31;
295  spr::genSimInfo isoinfoHC1x1, isoinfoHC3x3, isoinfoHC5x5, isoinfoHC7x7;
296  spr::genSimInfo isoinfoR, isoinfoIsoR, isoinfoHCR, isoinfoIsoHCR;
297 
298 };
299 
300 #endif
std::vector< double > * t_cHadronEneHC1x1_3
std::vector< double > * t_eleEne7x7
std::vector< double > * t_nHadronEne21x21
std::vector< double > * t_isoTrkEtaAll
std::vector< double > * t_maxNearPHCR
std::vector< double > * t_isoTrkPdgId
std::vector< double > * t_eleEne31x31
std::vector< double > * t_eleEneHC7x7
std::vector< int > * t_L1Decision
spr::genSimInfo isoinfo31x31
std::vector< double > * t_nHadronEne7x7
std::vector< double > * t_isoTrkPt
std::vector< double > * t_L1TauJetPt
std::vector< double > * t_photonEne7x7
std::vector< double > * t_L1MuonPt
std::vector< double > * t_isoTrkEta
std::vector< double > * t_cHadronEneHC7x7_3
std::vector< double > * t_cHadronEne15x15_3
std::vector< double > * t_maxNearP15x15
std::vector< double > * t_nHadronEneHC7x7
std::vector< double > * t_photonEne21x21
std::vector< double > * t_photonEneHC5x5
def analyze(function, filename, filter=None)
Definition: Profiling.py:11
edm::EDGetTokenT< l1extra::L1JetParticleCollection > tok_L1extCenJet_
std::vector< double > * t_muEneIsoHCR
std::vector< double > * t_eleEne11x11
std::vector< double > * t_eleEne3x3
std::vector< double > * t_L1IsoEMPt
std::vector< double > * t_photonEne1x1
std::vector< double > * t_nHadronEneR
std::vector< double > * t_cHadronEneIsoR_3
std::vector< double > * t_maxNearP11x11
std::vector< double > * t_maxNearPHC7x7
edm::EDGetTokenT< l1extra::L1JetParticleCollection > tok_L1extTauJet_
std::vector< double > * t_photonEneHCR
std::vector< double > * t_muEneIsoR
std::vector< double > * t_nHadronEne9x9
std::vector< double > * t_isoTrkPdgIdAll
edm::Service< TFileService > fs
std::vector< double > * t_muEneHC7x7
std::vector< double > * t_nHadronEneIsoHCR
std::vector< double > * t_L1FwdJetPt
std::vector< double > * t_photonEneHC3x3
std::vector< double > * t_muEneR
std::vector< double > * t_muEne9x9
std::vector< double > * t_muEne21x21
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > tok_L1GTrorsrc_
std::vector< double > * t_maxNearP7x7
edm::EDGetTokenT< l1extra::L1MuonParticleCollection > tok_L1extMusrc_
spr::genSimInfo isoinfoHC7x7
std::vector< double > * t_muEneHC1x1
void beginJob()
Definition: Breakpoints.cc:15
std::vector< double > * t_photonEneHC7x7
std::vector< double > * t_maxNearPIsoHCR
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
std::vector< double > * t_isoTrkPAll
std::vector< double > * t_nHadronEneHC1x1
std::vector< double > * t_eleEneIsoHCR
std::vector< double > * t_eleEneHC5x5
std::vector< double > * t_muEneHCR
std::vector< double > * t_maxNearP25x25
std::vector< double > * t_cHadronEne3x3_3
edm::EDGetTokenT< l1extra::L1EmParticleCollection > tok_L1Em_
std::vector< double > * t_eleEne25x25
std::vector< double > * t_eleEne9x9
std::vector< double > * t_eleEne1x1
std::vector< double > * t_muEne11x11
std::vector< double > * t_eleEneHCR
std::vector< double > * t_muEne7x7
std::vector< double > * t_cHadronEneR_3
std::vector< double > * t_muEne1x1
std::vector< double > * t_cHadronEneIsoHCR_3
std::vector< double > * t_eleEneHC3x3
std::vector< double > * t_isoTrkDEtaAll
std::vector< double > * t_muEne25x25
std::vector< double > * t_cHadronEne9x9_3
std::vector< double > * t_L1NonIsoEMPt
std::vector< double > * t_photonEne25x25
std::vector< double > * t_maxNearP21x21
std::vector< double > * t_maxNearP31x31
std::vector< double > * t_muEneHC3x3
std::vector< double > * t_cHadronEne25x25_3
std::vector< double > * t_cHadronEneHCR_3
std::vector< double > * t_L1CenJetPt
std::vector< double > * t_maxNearPHC5x5
std::vector< double > * t_cHadronEne11x11_3
std::vector< double > * t_isoTrkDPhiAll
std::vector< double > * t_photonEneIsoHCR
std::vector< double > * t_nHadronEne31x31
std::vector< double > * t_maxNearP3x3
double p2[4]
Definition: TauolaWrapper.h:90
std::vector< double > * t_isoTrkPhiEC
std::vector< double > * t_maxNearP1x1
edm::EDGetTokenT< L1GlobalTriggerObjectMapRecord > tok_L1GTobjmap_
std::vector< double > * t_maxNearPHC3x3
std::vector< double > * t_nHadronEneHCR
std::vector< double > * t_eleEneR
std::vector< double > * t_eleEneIsoR
std::vector< double > * t_isoTrkPhiAll
bool operator()(const HepMC::GenParticle *a, const HepMC::GenParticle *b) const
std::vector< double > * t_photonEneHC1x1
std::vector< double > * t_maxNearPR
edm::EDGetTokenT< l1extra::L1EmParticleCollection > tok_L1extNonIsoEm_
std::vector< double > * t_muEne31x31
std::vector< double > * t_isoTrkPtAll
std::vector< double > * t_isoTrkP
std::vector< double > * t_nHadronEne11x11
std::vector< double > * t_nHadronEneIsoR
std::vector< double > * t_eleEne21x21
std::vector< double > * t_maxNearPHC1x1
std::vector< double > * t_cHadronEne31x31_3
std::vector< double > * t_maxNearP9x9
std::vector< double > * t_photonEne31x31
std::vector< double > * t_nHadronEneHC3x3
std::vector< double > * t_photonEne15x15
std::vector< double > * t_isoTrkPhi
std::vector< double > * t_nHadronEne15x15
std::vector< double > * t_photonEneR
std::vector< double > * t_isoTrkEtaEC
std::vector< double > * t_nHadronEne1x1
edm::EDGetTokenT< edm::HepMCProduct > tok_hepmc_
const MagneticField * bField
std::vector< double > * t_cHadronEneHC5x5_3
edm::EDGetTokenT< reco::GenParticleCollection > tok_genParticles_
std::vector< double > * t_photonEne9x9
double p1[4]
Definition: TauolaWrapper.h:89
std::vector< double > * t_nHadronEne25x25
std::vector< double > * t_photonEne3x3
std::vector< double > * t_cHadronEneHC3x3_3
std::vector< double > * t_eleEneHC1x1
std::vector< double > * t_photonEne11x11
std::vector< double > * t_muEne3x3
std::vector< double > * t_muEne15x15
edm::EDGetTokenT< l1extra::L1JetParticleCollection > tok_L1extFwdJet_
std::vector< double > * t_L1METPt
std::vector< double > * t_muEneHC5x5
std::vector< double > * t_cHadronEne21x21_3
std::vector< double > * t_cHadronEne7x7_3
std::vector< double > * t_photonEneIsoR
std::vector< double > * t_eleEne15x15
std::vector< double > * t_maxNearPIsoR
std::vector< double > * t_nHadronEne3x3
std::vector< double > * t_nHadronEneHC5x5
std::vector< double > * t_isoTrkEne
std::vector< double > * t_cHadronEne1x1_3