CMS 3D CMS Logo

PFSimParticle.cc
Go to the documentation of this file.
2 // #include "FWCore/MessageLogger/interface/MessageLogger.h"
3 
4 using namespace reco;
5 using namespace std;
6 
7 PFSimParticle::PFSimParticle() : PFTrack(), pdgCode_(0), id_(0), motherId_(0) {}
8 
10  int pdgCode,
11  unsigned id,
12  int motherId,
13  const vector<int>& daughterIds,
14  unsigned rectrackId,
15  const std::vector<unsigned>& recHitContrib,
16  const std::vector<double>& recHitContribFrac)
17  : PFTrack(charge),
18  pdgCode_(pdgCode),
19  id_(id),
20  motherId_(motherId),
21  daughterIds_(daughterIds),
22  rectrackId_(rectrackId),
23  recHitContrib_(recHitContrib),
24  recHitContribFrac_(recHitContribFrac) {}
25 
27  : PFTrack(other),
28  pdgCode_(other.pdgCode_),
29  id_(other.id_),
30  motherId_(other.motherId_),
31  daughterIds_(other.daughterIds_),
32  rectrackId_(other.rectrackId_),
33  recHitContrib_(other.recHitContrib_),
34  recHitContribFrac_(other.recHitContribFrac_) {}
35 
36 ostream& reco::operator<<(ostream& out, const PFSimParticle& particle) {
37  if (!out)
38  return out;
39 
41 
42  out << setiosflags(ios::right);
43  out << setiosflags(ios::fixed);
44 
45  out << "Particle #" << particle.id() << ", mother = " << setw(2) << particle.motherId();
46 
47  out << setprecision(1);
48  out << ", charge = " << setw(5) << particle.charge();
49  out << setprecision(3);
50 
51  // modif to get "name" of particle from pdg code
52  int partId = particle.pdgCode();
54 
55  // We have here a subset of particles only.
56  // To be filled according to the needs.
57  switch (partId) {
58  case 1: {
59  name = "d";
60  break;
61  }
62  case 2: {
63  name = "u";
64  break;
65  }
66  case 3: {
67  name = "s";
68  break;
69  }
70  case 4: {
71  name = "c";
72  break;
73  }
74  case 5: {
75  name = "b";
76  break;
77  }
78  case 6: {
79  name = "t";
80  break;
81  }
82  case -1: {
83  name = "~d";
84  break;
85  }
86  case -2: {
87  name = "~u";
88  break;
89  }
90  case -3: {
91  name = "~s";
92  break;
93  }
94  case -4: {
95  name = "~c";
96  break;
97  }
98  case -5: {
99  name = "~b";
100  break;
101  }
102  case -6: {
103  name = "~t";
104  break;
105  }
106  case 11: {
107  name = "e-";
108  break;
109  }
110  case -11: {
111  name = "e+";
112  break;
113  }
114  case 12: {
115  name = "nu_e";
116  break;
117  }
118  case -12: {
119  name = "~nu_e";
120  break;
121  }
122  case 13: {
123  name = "mu-";
124  break;
125  }
126  case -13: {
127  name = "mu+";
128  break;
129  }
130  case 14: {
131  name = "nu_mu";
132  break;
133  }
134  case -14: {
135  name = "~nu_mu";
136  break;
137  }
138  case 15: {
139  name = "tau-";
140  break;
141  }
142  case -15: {
143  name = "tau+";
144  break;
145  }
146  case 16: {
147  name = "nu_tau";
148  break;
149  }
150  case -16: {
151  name = "~nu_tau";
152  break;
153  }
154  case 21: {
155  name = "gluon";
156  break;
157  }
158  case 22: {
159  name = "gamma";
160  break;
161  }
162  case 23: {
163  name = "Z0";
164  break;
165  }
166  case 24: {
167  name = "W+";
168  break;
169  }
170  case 25: {
171  name = "H0";
172  break;
173  }
174  case -24: {
175  name = "W-";
176  break;
177  }
178  case 111: {
179  name = "pi0";
180  break;
181  }
182  case 113: {
183  name = "rho0";
184  break;
185  }
186  case 223: {
187  name = "omega";
188  break;
189  }
190  case 333: {
191  name = "phi";
192  break;
193  }
194  case 443: {
195  name = "J/psi";
196  break;
197  }
198  case 553: {
199  name = "Upsilon";
200  break;
201  }
202  case 130: {
203  name = "K0L";
204  break;
205  }
206  case 211: {
207  name = "pi+";
208  break;
209  }
210  case -211: {
211  name = "pi-";
212  break;
213  }
214  case 213: {
215  name = "rho+";
216  break;
217  }
218  case -213: {
219  name = "rho-";
220  break;
221  }
222  case 221: {
223  name = "eta";
224  break;
225  }
226  case 331: {
227  name = "eta'";
228  break;
229  }
230  case 441: {
231  name = "etac";
232  break;
233  }
234  case 551: {
235  name = "etab";
236  break;
237  }
238  case 310: {
239  name = "K0S";
240  break;
241  }
242  case 311: {
243  name = "K0";
244  break;
245  }
246  case -311: {
247  name = "Kbar0";
248  break;
249  }
250  case 321: {
251  name = "K+";
252  break;
253  }
254  case -321: {
255  name = "K-";
256  break;
257  }
258  case 411: {
259  name = "D+";
260  break;
261  }
262  case -411: {
263  name = "D-";
264  break;
265  }
266  case 421: {
267  name = "D0";
268  break;
269  }
270  case 431: {
271  name = "Ds_+";
272  break;
273  }
274  case -431: {
275  name = "Ds_-";
276  break;
277  }
278  case 511: {
279  name = "B0";
280  break;
281  }
282  case 521: {
283  name = "B+";
284  break;
285  }
286  case -521: {
287  name = "B-";
288  break;
289  }
290  case 531: {
291  name = "Bs_0";
292  break;
293  }
294  case 541: {
295  name = "Bc_+";
296  break;
297  }
298  case -541: {
299  name = "Bc_+";
300  break;
301  }
302  case 313: {
303  name = "K*0";
304  break;
305  }
306  case -313: {
307  name = "K*bar0";
308  break;
309  }
310  case 323: {
311  name = "K*+";
312  break;
313  }
314  case -323: {
315  name = "K*-";
316  break;
317  }
318  case 413: {
319  name = "D*+";
320  break;
321  }
322  case -413: {
323  name = "D*-";
324  break;
325  }
326  case 423: {
327  name = "D*0";
328  break;
329  }
330  case 513: {
331  name = "B*0";
332  break;
333  }
334  case 523: {
335  name = "B*+";
336  break;
337  }
338  case -523: {
339  name = "B*-";
340  break;
341  }
342  case 533: {
343  name = "B*_s0";
344  break;
345  }
346  case 543: {
347  name = "B*_c+";
348  break;
349  }
350  case -543: {
351  name = "B*_c-";
352  break;
353  }
354  case 1114: {
355  name = "Delta-";
356  break;
357  }
358  case -1114: {
359  name = "Deltabar+";
360  break;
361  }
362  case -2112: {
363  name = "nbar0";
364  break;
365  }
366  case 2112: {
367  name = "n";
368  break;
369  }
370  case 2114: {
371  name = "Delta0";
372  break;
373  }
374  case -2114: {
375  name = "Deltabar0";
376  break;
377  }
378  case 3122: {
379  name = "Lambda0";
380  break;
381  }
382  case -3122: {
383  name = "Lambdabar0";
384  break;
385  }
386  case 3112: {
387  name = "Sigma-";
388  break;
389  }
390  case -3112: {
391  name = "Sigmabar+";
392  break;
393  }
394  case 3212: {
395  name = "Sigma0";
396  break;
397  }
398  case -3212: {
399  name = "Sigmabar0";
400  break;
401  }
402  case 3214: {
403  name = "Sigma*0";
404  break;
405  }
406  case -3214: {
407  name = "Sigma*bar0";
408  break;
409  }
410  case 3222: {
411  name = "Sigma+";
412  break;
413  }
414  case -3222: {
415  name = "Sigmabar-";
416  break;
417  }
418  case 2212: {
419  name = "p";
420  break;
421  }
422  case -2212: {
423  name = "~p";
424  break;
425  }
426  case -2214: {
427  name = "Delta-";
428  break;
429  }
430  case 2214: {
431  name = "Delta+";
432  break;
433  }
434  case -2224: {
435  name = "Deltabar--";
436  break;
437  }
438  case 2224: {
439  name = "Delta++";
440  break;
441  }
442  default: {
443  name = "unknown";
444  cout << "Unknown code : " << partId << endl;
445  }
446  }
447 
448  out << ", pdg=" << setw(6) << particle.pdgCode() << setw(6)
449  << name
450 
451  // end of modif to get name from pdg code
452 
453  << ", pT =" << setw(7) << closestApproach.momentum().Pt() << ", E =" << setw(7)
454  << closestApproach.momentum().E();
455 
456  out << resetiosflags(ios::right | ios::fixed);
457 
458  out << "\tdaughters : ";
459  for (unsigned i = 0; i < particle.daughterIds().size(); i++)
460  out << particle.daughterIds()[i] << " ";
461 
462  // out<<endl;
463  // for(unsigned i=0; i<particle.trajectoryPoints_.size(); i++)
464  // out<<particle.trajectoryPoints_[i]<<endl;
465 
466  return out;
467 }
alignBH_cfg.fixed
fixed
Definition: alignBH_cfg.py:54
mps_fire.i
i
Definition: mps_fire.py:428
reco::PFTrajectoryPoint::momentum
const math::XYZTLorentzVector & momentum() const
4-momenta quadrivector
Definition: PFTrajectoryPoint.h:109
reco::PFTrack
Base class for particle flow input reconstructed tracks and simulated particles.
Definition: PFTrack.h:63
reco::PFSimParticle::PFSimParticle
PFSimParticle()
Definition: PFSimParticle.cc:7
gather_cfg.cout
cout
Definition: gather_cfg.py:144
reco::PFSimParticle::id
unsigned id() const
Definition: PFSimParticle.h:38
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
reco::PFSimParticle::motherId
int motherId() const
Definition: PFSimParticle.h:41
reco::PFTrack::trajectoryPoint
const reco::PFTrajectoryPoint & trajectoryPoint(unsigned index) const
Definition: PFTrack.h:95
reco::PFSimParticle
true particle for particle flow
Definition: PFSimParticle.h:19
trackingPlots.other
other
Definition: trackingPlots.py:1460
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
reco::operator<<
std::ostream & operator<<(std::ostream &, BeamSpot beam)
Definition: BeamSpot.cc:66
reco::PFSimParticle::daughterIds
const std::vector< int > & daughterIds() const
Definition: PFSimParticle.h:44
reco::PFSimParticle::pdgCode
int pdgCode() const
Definition: PFSimParticle.h:35
reco::PFTrack::charge
double charge() const
Definition: PFTrack.h:81
objects.autophobj.motherId
motherId
Definition: autophobj.py:237
std
Definition: JetResolutionObject.h:76
PFSimParticle.h
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
reco::PFTrajectoryPoint
A PFTrack holds several trajectory points, which basically contain the position and momentum of a tra...
Definition: PFTrajectoryPoint.h:26
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
reco::PFTrajectoryPoint::ClosestApproach
Point of closest approach from beam axis (initial point in the case of PFSimParticle)
Definition: PFTrajectoryPoint.h:36