CMS 3D CMS Logo

PFSimParticle.cc

Go to the documentation of this file.
00001 #include "DataFormats/ParticleFlowReco/interface/PFSimParticle.h"
00002 // #include "FWCore/MessageLogger/interface/MessageLogger.h"
00003 
00004 using namespace reco;
00005 using namespace std;
00006 
00007 
00008 PFSimParticle::PFSimParticle() :
00009   PFTrack(),
00010   pdgCode_(0), 
00011   id_(0),
00012   motherId_(0)
00013 {}
00014 
00015 
00016 PFSimParticle::PFSimParticle(double charge, int pdgCode,
00017                              unsigned id, int motherId,
00018                              const vector<int>& daughterIds,
00019                              unsigned rectrackId, 
00020                              std::vector<unsigned> recHitContrib, 
00021                              std::vector<double> recHitContribFrac ):
00022   PFTrack(charge),
00023   pdgCode_(pdgCode), 
00024   id_(id), 
00025   motherId_(motherId), 
00026   daughterIds_(daughterIds),
00027   rectrackId_(rectrackId), 
00028   recHitContrib_(recHitContrib), 
00029   recHitContribFrac_(recHitContribFrac)
00030 {}
00031 
00032 
00033 PFSimParticle::PFSimParticle(const PFSimParticle& other) :
00034   PFTrack(other), 
00035   pdgCode_(other.pdgCode_), 
00036   id_(other.id_), 
00037   motherId_(other.motherId_), 
00038   daughterIds_(other.daughterIds_),
00039   rectrackId_(other.rectrackId_),
00040   recHitContrib_(other.recHitContrib_),
00041   recHitContribFrac_(other.recHitContribFrac_)
00042 {}
00043 
00044 ostream& reco::operator<<(ostream& out, 
00045                           const PFSimParticle& particle) {  
00046   if (!out) return out;  
00047 
00048   const reco::PFTrajectoryPoint& closestApproach = 
00049     particle.trajectoryPoint(reco::PFTrajectoryPoint::ClosestApproach);
00050   
00051   out<<setiosflags(ios::right);
00052   out<<setiosflags(ios::fixed);
00053   
00054   out<<"Particle #"<<particle.id()
00055      <<", mother = "<<setw(2)<<particle.motherId();
00056   
00057   out<<setprecision(1);
00058   out<<", charge = "<<setw(5)<<particle.charge();
00059   out<<setprecision(3);
00060   
00061   //   modif to get "name" of particle from pdg code
00062   int partId = particle.pdgCode();
00063   std::string name;
00064   
00065   // We have here a subset of particles only. 
00066   // To be filled according to the needs.
00067   switch(partId) {
00068           case    1: { name = "d"; break; } 
00069           case    2: { name = "u"; break; } 
00070           case    3: { name = "s"; break; } 
00071           case    4: { name = "c"; break; } 
00072           case    5: { name = "b"; break; } 
00073           case    6: { name = "t"; break; } 
00074           case   -1: { name = "~d"; break; } 
00075           case   -2: { name = "~u"; break; } 
00076           case   -3: { name = "~s"; break; } 
00077           case   -4: { name = "~c"; break; } 
00078           case   -5: { name = "~b"; break; } 
00079           case   -6: { name = "~t"; break; } 
00080           case   11: { name = "e-"; break; }
00081           case  -11: { name = "e+"; break; }
00082           case   12: { name = "nu_e"; break; }
00083           case  -12: { name = "~nu_e"; break; }
00084           case   13: { name = "mu-"; break; }
00085           case  -13: { name = "mu+"; break; }
00086           case   14: { name = "nu_mu"; break; }
00087           case  -14: { name = "~nu_mu"; break; }
00088           case   15: { name = "tau-"; break; }
00089           case  -15: { name = "tau+"; break; }
00090           case   16: { name = "nu_tau"; break; }
00091           case  -16: { name = "~nu_tau"; break; }
00092           case   21: { name = "gluon"; break; }
00093           case   22: { name = "gamma"; break; }
00094           case   23: { name = "Z0"; break; }
00095           case   24: { name = "W+"; break; }
00096           case   25: { name = "H0"; break; }
00097           case  -24: { name = "W-"; break; }
00098           case  111: { name = "pi0"; break; }
00099           case  113: { name = "rho0"; break; }
00100           case  223: { name = "omega"; break; }
00101           case  333: { name = "phi"; break; }
00102           case  443: { name = "J/psi"; break; }
00103           case  553: { name = "Upsilon"; break; }
00104           case  130: { name = "K0L"; break; }
00105           case  211: { name = "pi+"; break; }
00106           case -211: { name = "pi-"; break; }
00107           case  213: { name = "rho+"; break; }
00108           case -213: { name = "rho-"; break; }
00109           case  221: { name = "eta"; break; }
00110           case  331: { name = "eta'"; break; }
00111           case  441: { name = "etac"; break; }
00112           case  551: { name = "etab"; break; }
00113           case  310: { name = "K0S"; break; }
00114           case  311: { name = "K0"; break; }
00115           case -311: { name = "Kbar0"; break; }
00116           case  321: { name = "K+"; break; }
00117           case -321: { name = "K-"; break; }
00118           case  411: { name = "D+"; break; }
00119           case -411: { name = "D-"; break; }
00120           case  421: { name = "D0"; break; }
00121           case  431: { name = "Ds_+"; break; }
00122           case -431: { name = "Ds_-"; break; }
00123           case  511: { name = "B0"; break; }
00124           case  521: { name = "B+"; break; }
00125           case -521: { name = "B-"; break; }
00126           case  531: { name = "Bs_0"; break; }
00127           case  541: { name = "Bc_+"; break; }
00128           case -541: { name = "Bc_+"; break; }
00129           case  313: { name = "K*0"; break; }
00130           case -313: { name = "K*bar0"; break; }
00131           case  323: { name = "K*+"; break; }
00132           case -323: { name = "K*-"; break; }
00133           case  413: { name = "D*+"; break; }
00134           case -413: { name = "D*-"; break; }
00135           case  423: { name = "D*0"; break; }
00136           case  513: { name = "B*0"; break; }
00137           case  523: { name = "B*+"; break; }
00138           case -523: { name = "B*-"; break; }
00139           case  533: { name = "B*_s0"; break; }
00140           case  543: { name = "B*_c+"; break; }
00141           case -543: { name = "B*_c-"; break; }
00142           case  1114: { name = "Delta-"; break; }
00143           case -1114: { name = "Deltabar+"; break; }
00144           case -2112: { name = "nbar0"; break; }
00145           case  2112: { name = "n"; break; }
00146           case  2114: { name = "Delta0"; break; }
00147           case -2114: { name = "Deltabar0"; break; }
00148           case  3122: { name = "Lambda0"; break; }
00149           case -3122: { name = "Lambdabar0"; break; }
00150           case  3112: { name = "Sigma-"; break; }
00151           case -3112: { name = "Sigmabar+"; break; }
00152           case  3212: { name = "Sigma0"; break; }
00153           case -3212: { name = "Sigmabar0"; break; }
00154           case  3214: { name = "Sigma*0"; break; }
00155           case -3214: { name = "Sigma*bar0"; break; }
00156           case  3222: { name = "Sigma+"; break; }
00157           case -3222: { name = "Sigmabar-"; break; }
00158           case  2212: { name = "p"; break; }
00159           case -2212: { name = "~p"; break; }
00160           case -2214: { name = "Delta-"; break; }
00161           case  2214: { name = "Delta+"; break; }
00162           case -2224: { name = "Deltabar--"; break; }
00163           case  2224: { name = "Delta++"; break; }
00164           default: { 
00165     name = "unknown"; 
00166     cout << "Unknown code : " << partId << endl;
00167   }   
00168   }
00169   
00170   out<<", pdg="<<setw(6)<<particle.pdgCode() << setw(6)<< name
00171     
00172     // end of modif to get name from pdg code
00173     
00174      <<", pT ="<<setw(7)<<closestApproach.momentum().Pt() 
00175      <<", E  ="<<setw(7)<<closestApproach.momentum().E();
00176   
00177   out<<resetiosflags(ios::right|ios::fixed);
00178   
00179   out<<"\tdaughters : ";
00180   for(unsigned i=0; i<particle.daughterIds_.size(); i++) 
00181     out<<particle.daughterIds_[i]<<" ";
00182   
00183   //   out<<endl;
00184   //   for(unsigned i=0; i<particle.trajectoryPoints_.size(); i++) 
00185   //     out<<particle.trajectoryPoints_[i]<<endl;
00186   
00187   return out;
00188 }

Generated on Tue Jun 9 17:31:23 2009 for CMSSW by  doxygen 1.5.4