* about the suitability of this software for any purpose. It is *
* provided "as is" without express or implied warranty. *
**************************************************************************/
-
/* $Id$ */
-
//_________________________________________________________________________
// A Reconstructed Particle in PHOS
-// To become a general class of AliRoot ?
+// To become a general class of AliRoot ?
+// Why should I put meaningless comments
+// just to satisfy
+// the code checker
//
//*-- Author: Yves Schutz (SUBATECH)
// --- Standard library ---
-// --- AliRoot header files ---
+// --- AliRoot header files ---
#include "AliPHOSRecParticle.h"
-#include "TPad.h"
-#include "AliPHOSIndexToObject.h"
-
-ClassImp(AliPHOSRecParticle)
-
+#include "AliPHOSGetter.h"
//____________________________________________________________________________
- AliPHOSRecParticle::AliPHOSRecParticle(AliPHOSTrackSegment * ts)
+ AliPHOSRecParticle::AliPHOSRecParticle(): fPHOSTrackSegment(0) , fDebug( kFALSE )
{
// ctor
-
- fPHOSTrackSegment = ts->GetIndexInList() ;
- fIndexInList = -1 ;
- Float_t kenergy = ts->GetEnergy() ;
- TVector3 momdir = ts->GetMomentumDirection() ;
- fPx = kenergy * momdir.X() ;
- fPy = kenergy * momdir.Y() ;
- fPz = kenergy * momdir.Z() ;
- fType = kUNDEFINED;
- fE = kenergy ; // !!! all particles have mass = 0
+ const Int_t nSPECIES = AliESDtrack::kSPECIESN;
+ for(Int_t i = 0; i<nSPECIES ; i++)
+ fPID[i]=0.;
}
+
//____________________________________________________________________________
AliPHOSRecParticle::AliPHOSRecParticle(const AliPHOSRecParticle & rp)
+ : AliPHOSFastRecParticle(rp)
{
// copy ctor
fPHOSTrackSegment = rp.fPHOSTrackSegment ;
+ fDebug = kFALSE ;
fType = rp.fType ;
fIndexInList = rp.fIndexInList ;
fPolarTheta = rp.fPolarTheta;
fPolarPhi = rp.fPolarPhi;
fParticlePDG = rp.fParticlePDG;
+ const Int_t nSPECIES = AliESDtrack::kSPECIESN;
+ for(Int_t i = 0; i<nSPECIES ; i++)
+ fPID[i]=rp.fPID[i];
}
//____________________________________________________________________________
-Int_t * AliPHOSRecParticle::GetPrimaries(Int_t & number)
-{
- // Retrieves all the primary particles at the origine of this reconstructed particle
-
- AliPHOSTrackSegment * ts = GetPHOSTrackSegment() ;
-
- Int_t emcnumber = 0 ;
- Int_t * emclist = ts->GetPrimariesEmc(emcnumber) ;
-
- Int_t ppsdlnumber = 0 ;
- Int_t * ppsdllist = ts->GetPrimariesPpsdLow(ppsdlnumber) ;
-
- Int_t ppsdunumber = 0 ;
- Int_t * ppsdulist = ts->GetPrimariesPpsdUp(ppsdunumber) ;
-
- number = emcnumber + ppsdlnumber + ppsdunumber ;
- Int_t * list = new Int_t[number] ;
-
- Int_t index ;
- for ( index = 0 ; index < emcnumber ; index++)
- list[index] = emclist[index] ;
-
- Int_t jndex ;
- for ( jndex = 0 ; jndex < ppsdlnumber ; jndex++) {
- assert(index < number) ;
- list[index] = ppsdllist[jndex] ;
- index++ ;
- }
-
- for ( jndex = 0 ; jndex < ppsdunumber ; jndex++) {
- assert(index < number) ;
- list[index] = ppsdulist[jndex] ;
- index++ ;
- }
-
- delete emclist ;
- delete ppsdllist ;
- delete ppsdulist ;
+const Int_t AliPHOSRecParticle::GetNPrimaries() const
+{
+ return -1;
+}
- return list ;
+//____________________________________________________________________________
+const Int_t AliPHOSRecParticle::GetNPrimariesToRecParticles() const
+{
+ // Get the number of primaries at the origine of the RecParticle
+ Int_t rv = 0 ;
+ AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
+ Int_t emcRPindex = dynamic_cast<AliPHOSTrackSegment*>(gime->TrackSegments()->At(GetPHOSTSIndex()))->GetEmcIndex();
+ dynamic_cast<AliPHOSEmcRecPoint*>(gime->EmcRecPoints()->At(emcRPindex))->GetPrimaries(rv) ;
+ return rv ;
}
//____________________________________________________________________________
-AliPHOSTrackSegment * AliPHOSRecParticle::GetPHOSTrackSegment() const
+const TParticle * AliPHOSRecParticle::GetPrimary(Int_t index) const
{
- // Retrieves the PHOS track segment at the origine of this reconstructed particle
-
- AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ;
- return please->GimeTrackSegment( fPHOSTrackSegment ) ;
-
+ // Get the list of primary particles at the origine of the RecParticle
+ if ( index > GetNPrimariesToRecParticles() ) {
+ if (fDebug)
+ Warning("GetPrimary", "AliPHOSRecParticle::GetPrimary -> %d is larger that the number of primaries %d",
+ index, GetNPrimaries()) ;
+ return 0 ;
+ }
+ else {
+ Int_t dummy ;
+ AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
+
+ Int_t emcRPindex = dynamic_cast<AliPHOSTrackSegment*>(gime->TrackSegments()->At(GetPHOSTSIndex()))->GetEmcIndex();
+ Int_t primaryindex = dynamic_cast<AliPHOSEmcRecPoint*>(gime->EmcRecPoints()->At(emcRPindex))->GetPrimaries(dummy)[index] ;
+ return gime->Primary(primaryindex) ;
+ }
+ // return 0 ;
}
+//____________________________________________________________________________
+const Double_t * AliPHOSRecParticle::GetPID()
+{
+ // Get the probability densities that this reconstructed particle
+ // has a type of i:
+ // i particle types
+ // ----------------------
+ // 0 electron
+ // 1 muon
+ // 2 pi+-
+ // 3 K+-
+ // 4 p/pbar
+ // 5 photon
+ // 6 pi0 at high pt
+ // 7 neutron
+ // 8 K0L
+
+
+ if (IsElectron() ) fPID[0] = 1.0;
+ if (IsChargedHadron()) {
+ fPID[1] = 0.25;
+ fPID[2] = 0.25;
+ fPID[3] = 0.25;
+ fPID[4] = 0.25;
+ }
+ if (IsFastChargedHadron()) {
+ fPID[1] = 0.33;
+ fPID[2] = 0.33;
+ fPID[3] = 0.33;
+ fPID[4] = 0.00;
+ }
+ if (IsSlowChargedHadron()) {
+ fPID[1] = 0.00;
+ fPID[2] = 0.00;
+ fPID[3] = 0.00;
+ fPID[4] = 1.00;
+ }
+ if (IsPhoton() || IsHardPhoton()) fPID[5] = 1.0;
+ if (IsHardPi0()) fPID[6] = 1.0;
+ if (IsFastNeutralHadron()) fPID[7] = 1.0;
+ if (IsSlowNeutralHadron()) fPID[8] = 1.0;
+ if (IsEleCon()) fPID[9] = 1.0;
+ return fPID;
+}