]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSRecParticle.cxx
Updated for new classes and cleand (a bit).
[u/mrichter/AliRoot.git] / PHOS / AliPHOSRecParticle.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 PHOS    
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 "AliPHOSRecParticle.h"
33 #include "AliPHOSGetter.h" 
34
35 ClassImp(AliPHOSRecParticle)
36
37
38 //____________________________________________________________________________
39  AliPHOSRecParticle::AliPHOSRecParticle(const AliPHOSRecParticle & rp)
40    : AliPHOSFastRecParticle(rp)
41 {
42   // copy ctor
43
44   fPHOSTrackSegment = rp.fPHOSTrackSegment ; 
45   fDebug            = kFALSE ; 
46   fType             = rp.fType ; 
47   fIndexInList      = rp.fIndexInList ;
48
49   fPdgCode     = rp.fPdgCode;
50   fStatusCode  = rp.fStatusCode;
51   fMother[0]   = rp.fMother[0];
52   fMother[1]   = rp.fMother[1];
53   fDaughter[0] = rp.fDaughter[0];
54   fDaughter[1] = rp.fDaughter[1];
55   fWeight      = rp.fWeight;
56   fCalcMass    = rp.fCalcMass;
57   fPx          = rp.fPx;
58   fPy          = rp.fPy;
59   fPz          = rp.fPz;
60   fE           = rp.fE;
61   fVx          = rp.fVx;
62   fVy          = rp.fVy;
63   fVz          = rp.fVz;
64   fVt          = rp.fVt;
65   fPolarTheta  = rp.fPolarTheta;
66   fPolarPhi    = rp.fPolarPhi;
67   fParticlePDG = rp.fParticlePDG; 
68   
69 }
70
71 //____________________________________________________________________________
72 const Int_t AliPHOSRecParticle::GetNPrimaries() const  
73
74   return -1;
75 }
76
77 //____________________________________________________________________________
78 const Int_t AliPHOSRecParticle::GetNPrimariesToRecParticles() const  
79
80   // Get the number of primaries at the origine of the RecParticle
81   Int_t rv = 0 ;
82   AliPHOSGetter * gime = AliPHOSGetter::Instance() ; 
83   Int_t emcRPindex = dynamic_cast<AliPHOSTrackSegment*>(gime->TrackSegments()->At(GetPHOSTSIndex()))->GetEmcIndex();
84   dynamic_cast<AliPHOSEmcRecPoint*>(gime->EmcRecPoints()->At(emcRPindex))->GetPrimaries(rv) ; 
85   return rv ; 
86 }
87
88 //____________________________________________________________________________
89 const TParticle * AliPHOSRecParticle::GetPrimary(Int_t index) const  
90 {
91   // Get the list of primary particles at the origine of the RecParticle
92   if ( index > GetNPrimariesToRecParticles() ) { 
93     if (fDebug) 
94       Warning("GetPrimary", "AliPHOSRecParticle::GetPrimary -> %d is larger that the number of primaries %d", 
95               index, GetNPrimaries()) ;
96     return 0 ; 
97   } 
98   else { 
99     Int_t dummy ; 
100     AliPHOSGetter * gime = AliPHOSGetter::Instance() ; 
101
102     Int_t emcRPindex = dynamic_cast<AliPHOSTrackSegment*>(gime->TrackSegments()->At(GetPHOSTSIndex()))->GetEmcIndex();
103     Int_t primaryindex = dynamic_cast<AliPHOSEmcRecPoint*>(gime->EmcRecPoints()->At(emcRPindex))->GetPrimaries(dummy)[index] ; 
104     return gime->Primary(primaryindex) ;
105    } 
106   //  return 0 ; 
107 }
108 //____________________________________________________________________________
109 const Double_t * AliPHOSRecParticle::GetPID()
110 {
111   // Get the probability densities that this reconstructed particle
112   // has a type of i:
113   // i       particle types
114   // ----------------------
115   // 0       electron
116   // 1       muon
117   // 2       pi+-
118   // 3       K+-
119   // 4       p/pbar
120   // 5       photon
121   // 6       pi0 at high pt
122   // 7       neutron
123   // 8       K0L
124   const Int_t nSPECIES = AliESDtrack::kSPECIES;
125   if (IsElectron()     ) fPID[0] = 1.0;
126   if (IsChargedHadron()) {
127     fPID[1] = 0.25;
128     fPID[2] = 0.25;
129     fPID[3] = 0.25;
130     fPID[4] = 0.25;
131   }
132   if (IsFastChargedHadron()) {
133     fPID[1] = 0.33;
134     fPID[2] = 0.33;
135     fPID[3] = 0.33;
136     fPID[4] = 0.00;
137   }
138   if (IsSlowChargedHadron()) {
139     fPID[1] = 0.00;
140     fPID[2] = 0.00;
141     fPID[3] = 0.00;
142     fPID[4] = 1.00;
143   }
144
145   if (IsPhoton() || IsHardPhoton()) fPID[nSPECIES]  =1.0;
146   if (IsHardPi0())                  fPID[nSPECIES+1]=1.0;
147   if (IsFastNeutralHadron())        fPID[nSPECIES+2]=1.0;
148   if (IsSlowNeutralHadron())        fPID[nSPECIES+3]=1.0;
149
150   return fPID;
151 }