CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HiPhotonType.cc
Go to the documentation of this file.
6 
10 
11 #include <vector>
12 
13 using namespace edm;
14 using namespace reco;
15 
17 {
18  using namespace std;
19 
20  const GenParticleCollection *collection1 = inputHandle.product();
21  mcisocut = HiGammaJetSignalDef(collection1);
22  PI = 3.141592653589793238462643383279502884197169399375105820974945;
23 
24 }
25 
26 
28 {
29  using namespace std;
30  using namespace edm;
31  using namespace reco;
32  // Check if a given particle is isolated.
33 
34  return mcisocut.IsIsolatedPP(pp);
35 }
36 
37 
38 
40 {
41  using namespace std;
42  if ( pp.pdgId() != 22)
43  return false;
44 
45  if ( pp.mother() ==0 )
46  {
47  // cout << "No mom for this particle.." << endl;
48  return false;
49  }
50  else
51  {
52  if (pp.mother()->pdgId() == 22)
53  {
54  cout << " found a prompt photon" << endl;
55  return true;
56  }
57  else
58  return false;
59  }
60 }
61 
62 
64  fSigParticles(0)
65 { PI = 3.141592653589793238462643383279502884197169399375105820974945;
66 }
68  fSigParticles(0)
69 {
70  using namespace std;
71 
72  fSigParticles = sigParticles;
73  PI = 3.141592653589793238462643383279502884197169399375105820974945;
74 
75 }
76 
78 {
79  using namespace std;
80  using namespace edm;
81  using namespace reco;
82  // Check if a given particle is isolated.
83 
84  double EtCone = 0;
85  double EtPhoton = 0;
86  double PtMaxHadron = 0;
87  double cone = 0.5;
88  const int maxindex = (int)fSigParticles->size();
89  for(int i=0; i < maxindex ; ++i) {
90 
91  const GenParticle &p=(*fSigParticles)[i];
92 
93  if(p.status()!=1)
94  continue;
95  if (p.collisionId() != pp.collisionId())
96  continue;
97 
98  int apid= abs(p.pdgId());
99  if(apid>11 && apid<20)
100  continue; //get rid of muons and neutrinos
101 
102  if(getDeltaR(p,pp)>cone)
103  continue;
104 
105  double et=p.et();
106  double pt = p.pt();
107  EtCone+=et;
108  bool isHadron = false;
109  if ( fabs(pp.pdgId())>100 && fabs(pp.pdgId()) != 310)
110  isHadron = true;
111 
112  if(apid>100 && apid!=310 && pt>PtMaxHadron)
113  {
114  if ( (isHadron == true) && (fabs(pp.pt()-pt)<0.001) && (pp.pdgId()==p.pdgId()) )
115  continue;
116  else
117  PtMaxHadron=pt;
118  }
119 
120  }
121  EtPhoton = pp.et();
122 
123  // isolation cuts
124  if(EtCone-EtPhoton > 5+EtPhoton/20)
125  return kFALSE;
126  if(PtMaxHadron > 4.5+EtPhoton/40)
127  return kFALSE;
128 
129  return kTRUE;
130 
131 }
132 
134 {
135  using namespace std;
136  using namespace edm;
137  using namespace reco;
138 
139  // Check if a given particle is isolated.
140 
141  double EtCone = 0;
142  double EtPhoton = 0;
143  double cone = 0.4;
144 
145  const int maxindex = (int)fSigParticles->size();
146  for(int i=0; i < maxindex ; ++i) {
147 
148  const GenParticle &p=(*fSigParticles)[i];
149 
150  if(p.status()!=1)
151  continue;
152  if (p.collisionId() != pp.collisionId())
153  continue;
154 
155  //int apid= abs(p.pdgId());
156  // if(apid>11 && apid<20)
157  // continue; //get rid of muons and neutrinos
158 
159  if(getDeltaR(p,pp)>cone)
160  continue;
161  double et=p.et();
162  // double pt = p.pt();
163  EtCone+=et;
164 
165  }
166 
167  EtPhoton = pp.et();
168 
169  // isolation cuts
170 
171  if(EtCone-EtPhoton > 5)
172  return kFALSE;
173  //if(PtMaxHadron > 4.5+EtPhoton/40)
174  // return kFALSE;
175 
176  return kTRUE;
177 
178 }
180 {
181  using namespace std;
182  using namespace edm;
183  using namespace reco;
184 
185  // Check if a given particle is isolated.
186 
187  double EtCone = 0;
188  double EtPhoton = 0;
189  double cone = 0.4;
190 
191  const int maxindex = (int)fSigParticles->size();
192  for(int i=0; i < maxindex ; ++i) {
193 
194  const GenParticle &p=(*fSigParticles)[i];
195 
196  if(p.status()!=1)
197  continue;
198  if (p.collisionId() != pp.collisionId())
199  continue;
200 
201  if(getDeltaR(p,pp)>cone)
202  continue;
203 
204  double et=p.et();
205  // double pt = p.pt();
206  EtCone+=et;
207 
208  }
209  EtPhoton = pp.et();
210 
211  // isolation cuts
212 
213  if(EtCone-EtPhoton > 5)
214  return kFALSE;
215  return kTRUE;
216 
217 }
218 
220 {
221  double dEta = track1.eta() - track2.eta();
222  double dPhi = track1.phi() - track2.phi();
223 
224  while(dPhi >= PI) dPhi -= (2.0*PI);
225  while(dPhi < (-1.0*PI)) dPhi += (2.0*PI);
226 
227  return sqrt(dEta*dEta+dPhi*dPhi);
228 }
229 
231 {
232  double dPhi = track1.phi() - track2.phi();
233 
234  while(dPhi >= PI) dPhi -= (2.0*PI);
235  while(dPhi < (-1.0*PI)) dPhi += (2.0*PI);
236 
237  return dPhi;
238 }
239 
240 
241 
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
double getDeltaR(const reco::Candidate &track1, const reco::Candidate &track2)
int i
Definition: DBlmapReader.cc:9
virtual int pdgId() const
PDG identifier.
tuple pp
Definition: createTree.py:15
#define PI
virtual double et() const
transverse energy
virtual int status() const
status word
int collisionId() const
Definition: GenParticle.h:39
virtual double pt() const
transverse momentum
bool IsIsolated(const reco::GenParticle &pp)
Definition: HiPhotonType.cc:77
double dPhi(double phi1, double phi2)
Definition: JetUtil.h:30
bool IsIsolatedJP(const reco::GenParticle &pp)
T sqrt(T t)
Definition: SSEVec.h:48
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual int pdgId() const =0
PDG identifier.
T const * product() const
Definition: Handle.h:81
bool IsIsolatedPP(const reco::GenParticle &pp)
HiPhotonType(edm::Handle< reco::GenParticleCollection > inputHandle)
Definition: HiPhotonType.cc:16
bool IsPrompt(const reco::GenParticle &pp)
Definition: HiPhotonType.cc:39
double getDeltaPhi(const reco::Candidate &track1, const reco::Candidate &track2)
tuple cout
Definition: gather_cfg.py:121
virtual const Candidate * mother(size_type=0) const
return mother at a given position, i = 0, ... numberOfMothers() - 1 (read only mode) ...
bool IsIsolated(const reco::GenParticle &pp)
Definition: HiPhotonType.cc:27
const reco::GenParticleCollection * fSigParticles
Definition: HiPhotonType.h:40
virtual double phi() const =0
momentum azimuthal angle
virtual double eta() const =0
momentum pseudorapidity