ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/src/MCParticle.cc
Revision: 1.2
Committed: Fri Nov 21 20:15:02 2008 UTC (16 years, 5 months ago) by loizides
Content type: text/plain
Branch: MAIN
Changes since 1.1: +16 -6 lines
Log Message:
Include daughter in prinout if "l" is given. Add a couple of useful functions.

File Contents

# User Rev Content
1 loizides 1.2 // $Id: MCParticle.cc,v 1.1 2008/07/25 11:32:45 bendavid Exp $
2 bendavid 1.1
3     #include "MitAna/DataTree/interface/MCParticle.h"
4    
5     ClassImp(mithep::MCParticle)
6    
7     using namespace mithep;
8    
9     //--------------------------------------------------------------------------------------------------
10     Double_t MCParticle::Charge() const
11     {
12 loizides 1.2 // Get charge from pdg lookup/
13 bendavid 1.1
14     TParticlePDG* pdgEntry = PdgEntry();
15     if (pdgEntry)
16     return pdgEntry->Charge()/3.0;
17     else {
18 loizides 1.2 Error("Charge", "Pdg code %i not found in table, returning charge=-99.0", fPdgId);
19 bendavid 1.1 return -99.0;
20     }
21     }
22    
23     //--------------------------------------------------------------------------------------------------
24 loizides 1.2 void MCParticle::Print(Option_t *opt) const
25 bendavid 1.1 {
26 loizides 1.2 // Print particle kinematics. In case option "l" is given then also print info about daughters.
27    
28     printf("id=%5d st=%2d nd=%3d gen=%d px=%.3f py=%.3f pz=%.3f e=%.3f\n",
29     PdgId(), Status(), NDaughters(), IsGenerated(), Px(), Py(), Pz(), E());
30    
31     if (opt && opt[0]=='l') {
32     for (UInt_t i=0; i<NDaughters(); ++i) {
33     printf(" %2d -> id=%5d st=%2d gen=%d px=%.3f py=%.3f pz=%.3f e=%.3f\n",
34     i, Daughter(i)->PdgId(), Daughter(i)->Status(), Daughter(i)->IsGenerated(),
35     Daughter(i)->Px(), Daughter(i)->Py(), Daughter(i)->Pz(), Daughter(i)->E());
36     }
37     }
38 bendavid 1.1 }