]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALRecParticle.cxx
Introducing the raw data format
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALRecParticle.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15 /* $Id$ */
16 //_________________________________________________________________________
17 //  A Reconstructed Particle in EMCAL    
18 //  To become a general class of AliRoot ?       
19 //  Why should I put meaningless comments
20 //  just to satisfy
21 //  the code checker                 
22 //       
23 //*-- Author: Yves Schutz (SUBATECH)
24
25
26 // --- ROOT system ---
27
28 // --- Standard library ---
29
30
31 // --- AliRoot header files ---
32 #include "AliEMCALRecParticle.h"
33 #include "AliEMCALGetter.h" 
34 #include "TParticle.h"
35
36 ClassImp(AliEMCALRecParticle)
37
38
39 //____________________________________________________________________________
40   AliEMCALRecParticle::AliEMCALRecParticle(): fEMCALRecPoint(0), fDebug(kFALSE)
41 {
42   // ctor
43   const Int_t nSPECIES = AliESDtrack::kSPECIESN;
44   for(Int_t i = 0; i<nSPECIES ; i++)
45     fPID[i]=0.;
46 }
47 //____________________________________________________________________________
48 AliEMCALRecParticle::AliEMCALRecParticle(const AliEMCALRecParticle & rp)
49   : AliEMCALFastRecParticle(rp)
50 {
51   // copy ctor
52
53   fEMCALRecPoint    = rp.fEMCALRecPoint ; 
54   fDebug            = kFALSE ; 
55   fType             = rp.fType ; 
56   fIndexInList      = rp.fIndexInList ;
57
58   fPdgCode     = rp.fPdgCode;
59   fStatusCode  = rp.fStatusCode;
60   fMother[0]   = rp.fMother[0];
61   fMother[1]   = rp.fMother[1];
62   fDaughter[0] = rp.fDaughter[0];
63   fDaughter[1] = rp.fDaughter[1];
64   fWeight      = rp.fWeight;
65   fCalcMass    = rp.fCalcMass;
66   fPx          = rp.fPx;
67   fPy          = rp.fPy;
68   fPz          = rp.fPz;
69   fE           = rp.fE;
70   fVx          = rp.fVx;
71   fVy          = rp.fVy;
72   fVz          = rp.fVz;
73   fVt          = rp.fVt;
74   fPolarTheta  = rp.fPolarTheta;
75   fPolarPhi    = rp.fPolarPhi;
76   fParticlePDG = rp.fParticlePDG; 
77   const Int_t nSPECIES = AliESDtrack::kSPECIESN;
78   for(Int_t i = 0; i<nSPECIES ; i++)
79     fPID[i]=rp.fPID[i];  
80 }
81
82 //____________________________________________________________________________
83 const Int_t AliEMCALRecParticle::GetNPrimaries() const  
84 {   
85   return -1;
86 }
87
88 //____________________________________________________________________________
89 const Int_t AliEMCALRecParticle::GetNPrimariesToRecParticles() const  
90
91   // Returns the number of primaries at the origine of a RecParticle
92   Int_t rv = 0 ;
93   AliEMCALGetter * gime = AliEMCALGetter::Instance() ; 
94   dynamic_cast<AliEMCALRecPoint*>(gime->ECARecPoints()->At(GetEMCALRPIndex()))->GetPrimaries(rv) ; 
95
96   return rv ; 
97 }
98
99 //____________________________________________________________________________
100 const TParticle * AliEMCALRecParticle::GetPrimary(Int_t index) const  
101 {
102   // Getts the list of primary particles at the origine of the RecParticle
103   if ( index > GetNPrimariesToRecParticles() ) { 
104     if (fDebug) 
105       Warning("GetPrimary", "AliEMCALRecParticle::GetPrimary -> %d is larger that the number of primaries %d", 
106               index, GetNPrimaries()) ;
107     return 0 ; 
108   } 
109   Int_t dummy ; 
110   AliEMCALGetter * gime = AliEMCALGetter::Instance() ; 
111
112   Int_t primaryindex = dynamic_cast<AliEMCALRecPoint*>(gime->ECARecPoints()->At(GetEMCALRPIndex()))->GetPrimaries(dummy)[index] ; 
113
114   return gime->Primary(primaryindex) ;
115 }
116
117 //____________________________________________________________________________
118 const Double_t * AliEMCALRecParticle::GetPID()
119 {
120   // Get the probability densities that this reconstructed particle
121   // has a type of i:
122   // i       particle types
123   // ----------------------
124   // 0       electron
125   // 1       muon
126   // 2       pi+-
127   // 3       K+-
128   // 4       p/pbar
129   // 5       photon
130   // 6       pi0 at high pt
131   // 7       neutron
132   // 8       K0L
133
134  
135   if (IsElectron()     ) fPID[0] = 1.0;
136   if (IsChargedHadron()) {
137     fPID[1] = 0.25;
138     fPID[2] = 0.25;
139     fPID[3] = 0.25;
140     fPID[4] = 0.25;
141   }
142   if (IsFastChargedHadron()) {
143     fPID[1] = 0.33;
144     fPID[2] = 0.33;
145     fPID[3] = 0.33;
146     fPID[4] = 0.00;
147   }
148   if (IsSlowChargedHadron()) {
149     fPID[1] = 0.00;
150     fPID[2] = 0.00;
151     fPID[3] = 0.00;
152     fPID[4] = 1.00;
153   }
154
155   if (IsPhoton() || IsHardPhoton()) fPID[5] = 1.0;
156   if (IsHardPi0())                  fPID[6] = 1.0;
157   if (IsFastNeutralHadron())        fPID[7] = 1.0;
158   if (IsSlowNeutralHadron())        fPID[8] = 1.0;
159
160   if (IsEleCon()) fPID[9] = 1.0;
161   return fPID;
162 }