1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 //_________________________________________________________________________
17 // A Reconstructed Particle in PHOS
18 // To become a general class of AliRoot ?
19 // Why should I put meaningless comments
23 //*-- Author: Yves Schutz (SUBATECH)
26 // --- ROOT system ---
28 // --- Standard library ---
31 // --- AliRoot header files ---
32 #include "AliPHOSRecParticle.h"
33 #include "AliPHOSGetter.h"
34 #include "AliPHOSGeometry.h"
36 //____________________________________________________________________________
37 AliPHOSRecParticle::AliPHOSRecParticle(): fPHOSTrackSegment(0) , fDebug( kFALSE )
40 const Int_t nSPECIES = AliESDtrack::kSPECIESN;
41 for(Int_t i = 0; i<nSPECIES ; i++)
46 //____________________________________________________________________________
47 AliPHOSRecParticle::AliPHOSRecParticle(const AliPHOSRecParticle & rp)
48 : AliPHOSFastRecParticle(rp)
52 fPHOSTrackSegment = rp.fPHOSTrackSegment ;
55 fIndexInList = rp.fIndexInList ;
57 fPdgCode = rp.fPdgCode;
58 fStatusCode = rp.fStatusCode;
59 fMother[0] = rp.fMother[0];
60 fMother[1] = rp.fMother[1];
61 fDaughter[0] = rp.fDaughter[0];
62 fDaughter[1] = rp.fDaughter[1];
64 fCalcMass = rp.fCalcMass;
73 fPolarTheta = rp.fPolarTheta;
74 fPolarPhi = rp.fPolarPhi;
75 fParticlePDG = rp.fParticlePDG;
76 const Int_t nSPECIES = AliESDtrack::kSPECIESN;
77 for(Int_t i = 0; i<nSPECIES ; i++)
81 //____________________________________________________________________________
82 const Int_t AliPHOSRecParticle::GetNPrimaries() const
87 //____________________________________________________________________________
88 const Int_t AliPHOSRecParticle::GetNPrimariesToRecParticles() const
90 // Get the number of primaries at the origine of the RecParticle
92 AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
93 Int_t emcRPindex = dynamic_cast<AliPHOSTrackSegment*>(gime->TrackSegments()->At(GetPHOSTSIndex()))->GetEmcIndex();
94 dynamic_cast<AliPHOSEmcRecPoint*>(gime->EmcRecPoints()->At(emcRPindex))->GetPrimaries(rv) ;
98 //____________________________________________________________________________
99 const TParticle * AliPHOSRecParticle::GetPrimary() const
101 // Get the primary particle at the origine of the RecParticle and
102 // which has deposited the largest energy in SDigits
103 AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
105 Error("GetPrimary", "Getter not yet instantiated") ;
106 gime->Event(gime->EventNumber(), "SRTPX") ;
107 if(GetNPrimaries() == 0)
109 if(GetNPrimaries() == 1)
110 return GetPrimary(0) ;
113 const AliPHOSGeometry * geom = gime->PHOSGeometry() ;
115 geom->ImpactOnEmc(static_cast<double>(Theta()),static_cast<double>(Phi()), module,z,x);
119 geom->RelPosToAbsId(module,x,z,AbsId) ;
120 TClonesArray * sdigits = gime->SDigits() ;
121 AliPHOSDigit * sdig ;
123 for(Int_t i = 0 ; i < sdigits->GetEntriesFast() ; i++){
124 sdig = static_cast<AliPHOSDigit *>(sdigits->At(i)) ;
125 if((sdig->GetId() == AbsId)){
126 if((sdig->GetAmp() > amp) && (sdig->GetNprimary())){
127 amp = sdig->GetAmp() ;
128 iPrim = sdig->GetPrimary(1) ;
130 // do not scan rest of list
131 if(sdig->GetId() > AbsId)
137 return gime->Primary(iPrim) ;
142 //____________________________________________________________________________
143 const TParticle * AliPHOSRecParticle::GetPrimary(Int_t index) const
145 // Get one of the primary particles at the origine of the RecParticle
146 if ( index > GetNPrimariesToRecParticles() ) {
148 Warning("GetPrimary", "AliPHOSRecParticle::GetPrimary -> %d is larger that the number of primaries %d",
149 index, GetNPrimaries()) ;
154 AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
156 Int_t emcRPindex = dynamic_cast<AliPHOSTrackSegment*>(gime->TrackSegments()->At(GetPHOSTSIndex()))->GetEmcIndex();
157 Int_t primaryindex = dynamic_cast<AliPHOSEmcRecPoint*>(gime->EmcRecPoints()->At(emcRPindex))->GetPrimaries(dummy)[index] ;
158 return gime->Primary(primaryindex) ;
163 //____________________________________________________________________________
164 void AliPHOSRecParticle::SetPID(Int_t type, Double_t weight)
166 // Set the probability densities that this reconstructed particle
169 // ----------------------
179 // 9 Conversion electron
181 fPID[type] = weight ;