CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
9  PFTrack(),
10  pdgCode_(0),
11  id_(0),
12  motherId_(0)
13 {}
14 
15 
17  unsigned id, int motherId,
18  const vector<int>& daughterIds,
19  unsigned rectrackId,
20  const std::vector<unsigned>& recHitContrib,
21  const std::vector<double>& recHitContribFrac ):
22  PFTrack(charge),
23  pdgCode_(pdgCode),
24  id_(id),
25  motherId_(motherId),
26  daughterIds_(daughterIds),
27  rectrackId_(rectrackId),
28  recHitContrib_(recHitContrib),
29  recHitContribFrac_(recHitContribFrac)
30 {}
31 
32 
34  PFTrack(other),
35  pdgCode_(other.pdgCode_),
36  id_(other.id_),
37  motherId_(other.motherId_),
38  daughterIds_(other.daughterIds_),
39  rectrackId_(other.rectrackId_),
40  recHitContrib_(other.recHitContrib_),
41  recHitContribFrac_(other.recHitContribFrac_)
42 {}
43 
44 ostream& reco::operator<<(ostream& out,
45  const PFSimParticle& particle) {
46  if (!out) return out;
47 
48  const reco::PFTrajectoryPoint& closestApproach =
50 
51  out<<setiosflags(ios::right);
52  out<<setiosflags(ios::fixed);
53 
54  out<<"Particle #"<<particle.id()
55  <<", mother = "<<setw(2)<<particle.motherId();
56 
57  out<<setprecision(1);
58  out<<", charge = "<<setw(5)<<particle.charge();
59  out<<setprecision(3);
60 
61  // modif to get "name" of particle from pdg code
62  int partId = particle.pdgCode();
64 
65  // We have here a subset of particles only.
66  // To be filled according to the needs.
67  switch(partId) {
68  case 1: { name = "d"; break; }
69  case 2: { name = "u"; break; }
70  case 3: { name = "s"; break; }
71  case 4: { name = "c"; break; }
72  case 5: { name = "b"; break; }
73  case 6: { name = "t"; break; }
74  case -1: { name = "~d"; break; }
75  case -2: { name = "~u"; break; }
76  case -3: { name = "~s"; break; }
77  case -4: { name = "~c"; break; }
78  case -5: { name = "~b"; break; }
79  case -6: { name = "~t"; break; }
80  case 11: { name = "e-"; break; }
81  case -11: { name = "e+"; break; }
82  case 12: { name = "nu_e"; break; }
83  case -12: { name = "~nu_e"; break; }
84  case 13: { name = "mu-"; break; }
85  case -13: { name = "mu+"; break; }
86  case 14: { name = "nu_mu"; break; }
87  case -14: { name = "~nu_mu"; break; }
88  case 15: { name = "tau-"; break; }
89  case -15: { name = "tau+"; break; }
90  case 16: { name = "nu_tau"; break; }
91  case -16: { name = "~nu_tau"; break; }
92  case 21: { name = "gluon"; break; }
93  case 22: { name = "gamma"; break; }
94  case 23: { name = "Z0"; break; }
95  case 24: { name = "W+"; break; }
96  case 25: { name = "H0"; break; }
97  case -24: { name = "W-"; break; }
98  case 111: { name = "pi0"; break; }
99  case 113: { name = "rho0"; break; }
100  case 223: { name = "omega"; break; }
101  case 333: { name = "phi"; break; }
102  case 443: { name = "J/psi"; break; }
103  case 553: { name = "Upsilon"; break; }
104  case 130: { name = "K0L"; break; }
105  case 211: { name = "pi+"; break; }
106  case -211: { name = "pi-"; break; }
107  case 213: { name = "rho+"; break; }
108  case -213: { name = "rho-"; break; }
109  case 221: { name = "eta"; break; }
110  case 331: { name = "eta'"; break; }
111  case 441: { name = "etac"; break; }
112  case 551: { name = "etab"; break; }
113  case 310: { name = "K0S"; break; }
114  case 311: { name = "K0"; break; }
115  case -311: { name = "Kbar0"; break; }
116  case 321: { name = "K+"; break; }
117  case -321: { name = "K-"; break; }
118  case 411: { name = "D+"; break; }
119  case -411: { name = "D-"; break; }
120  case 421: { name = "D0"; break; }
121  case 431: { name = "Ds_+"; break; }
122  case -431: { name = "Ds_-"; break; }
123  case 511: { name = "B0"; break; }
124  case 521: { name = "B+"; break; }
125  case -521: { name = "B-"; break; }
126  case 531: { name = "Bs_0"; break; }
127  case 541: { name = "Bc_+"; break; }
128  case -541: { name = "Bc_+"; break; }
129  case 313: { name = "K*0"; break; }
130  case -313: { name = "K*bar0"; break; }
131  case 323: { name = "K*+"; break; }
132  case -323: { name = "K*-"; break; }
133  case 413: { name = "D*+"; break; }
134  case -413: { name = "D*-"; break; }
135  case 423: { name = "D*0"; break; }
136  case 513: { name = "B*0"; break; }
137  case 523: { name = "B*+"; break; }
138  case -523: { name = "B*-"; break; }
139  case 533: { name = "B*_s0"; break; }
140  case 543: { name = "B*_c+"; break; }
141  case -543: { name = "B*_c-"; break; }
142  case 1114: { name = "Delta-"; break; }
143  case -1114: { name = "Deltabar+"; break; }
144  case -2112: { name = "nbar0"; break; }
145  case 2112: { name = "n"; break; }
146  case 2114: { name = "Delta0"; break; }
147  case -2114: { name = "Deltabar0"; break; }
148  case 3122: { name = "Lambda0"; break; }
149  case -3122: { name = "Lambdabar0"; break; }
150  case 3112: { name = "Sigma-"; break; }
151  case -3112: { name = "Sigmabar+"; break; }
152  case 3212: { name = "Sigma0"; break; }
153  case -3212: { name = "Sigmabar0"; break; }
154  case 3214: { name = "Sigma*0"; break; }
155  case -3214: { name = "Sigma*bar0"; break; }
156  case 3222: { name = "Sigma+"; break; }
157  case -3222: { name = "Sigmabar-"; break; }
158  case 2212: { name = "p"; break; }
159  case -2212: { name = "~p"; break; }
160  case -2214: { name = "Delta-"; break; }
161  case 2214: { name = "Delta+"; break; }
162  case -2224: { name = "Deltabar--"; break; }
163  case 2224: { name = "Delta++"; break; }
164  default: {
165  name = "unknown";
166  cout << "Unknown code : " << partId << endl;
167  }
168  }
169 
170  out<<", pdg="<<setw(6)<<particle.pdgCode() << setw(6)<< name
171 
172  // end of modif to get name from pdg code
173 
174  <<", pT ="<<setw(7)<<closestApproach.momentum().Pt()
175  <<", E ="<<setw(7)<<closestApproach.momentum().E();
176 
177  out<<resetiosflags(ios::right|ios::fixed);
178 
179  out<<"\tdaughters : ";
180  for(unsigned i=0; i<particle.daughterIds_.size(); i++)
181  out<<particle.daughterIds_[i]<<" ";
182 
183  // out<<endl;
184  // for(unsigned i=0; i<particle.trajectoryPoints_.size(); i++)
185  // out<<particle.trajectoryPoints_[i]<<endl;
186 
187  return out;
188 }
int i
Definition: DBlmapReader.cc:9
std::vector< int > daughterIds_
id of daughter particles (can be &gt; 2 in hadron showers)
Definition: PFSimParticle.h:69
int pdgCode() const
Definition: PFSimParticle.h:35
Base class for particle flow input reconstructed tracks and simulated particles.
Definition: PFTrack.h:63
std::ostream & operator<<(std::ostream &, BeamSpot beam)
Definition: BeamSpot.cc:71
Point of closest approach from beam axis (initial point in the case of PFSimParticle) ...
true particle for particle flow
Definition: PFSimParticle.h:19
tuple out
Definition: dbtoconf.py:99
const math::XYZTLorentzVector & momentum() const
4-momenta quadrivector
const reco::PFTrajectoryPoint & trajectoryPoint(unsigned index) const
Definition: PFTrack.h:102
unsigned id() const
Definition: PFSimParticle.h:38
int motherId() const
Definition: PFSimParticle.h:41
tuple cout
Definition: gather_cfg.py:121
A PFTrack holds several trajectory points, which basically contain the position and momentum of a tra...
double charge() const
Definition: PFTrack.h:87