]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSRecParticle.cxx
Change method SetRunReconstruction to SetRunLocalReconstruction
[u/mrichter/AliRoot.git] / PHOS / AliPHOSRecParticle.cxx
index 463902b858268dc124bd743c178a5bb221f347e9..de1dd40be02bf3af7146ce99997cdb43b401cad1 100644 (file)
 
 
 // --- AliRoot header files ---
-
 #include "AliPHOSRecParticle.h"
 #include "AliPHOSGetter.h" 
-#include "TParticle.h"
 
-ClassImp(AliPHOSRecParticle)
+//____________________________________________________________________________
+  AliPHOSRecParticle::AliPHOSRecParticle(): fPHOSTrackSegment(0)  ,  fDebug( kFALSE )
+{
+  // ctor
+  const Int_t nSPECIES = AliESDtrack::kSPECIES;
+  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 ;
 
@@ -65,33 +72,91 @@ ClassImp(AliPHOSRecParticle)
   fPolarTheta  = rp.fPolarTheta;
   fPolarPhi    = rp.fPolarPhi;
   fParticlePDG = rp.fParticlePDG; 
-  
+  const Int_t nSPECIES = AliESDtrack::kSPECIES;
+  for(Int_t i = 0; i<nSPECIES ; i++)
+    fPID[i]=rp.fPID[i];
 }
 
 //____________________________________________________________________________
 const Int_t AliPHOSRecParticle::GetNPrimaries() const  
 { 
+  return -1;
+}
 
+//____________________________________________________________________________
+const Int_t AliPHOSRecParticle::GetNPrimariesToRecParticles() const  
+{ 
+  // Get the number of primaries at the origine of the RecParticle
   Int_t rv = 0 ;
-  AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; 
-  gime->EmcRecPoint(gime->TrackSegment(GetPHOSTSIndex())->GetEmcIndex())->GetPrimaries(rv) ; 
+  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 ; 
 }
 
 //____________________________________________________________________________
 const TParticle * AliPHOSRecParticle::GetPrimary(Int_t index) const  
 {
-  if ( index > GetNPrimaries() ) 
-    cout << "WARNING : AliPHOSRecParticle::GetPrimary -> " << index << " is larger that the number of primaries " 
-        <<  GetNPrimaries() << endl ; 
+  // 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::GetInstance() ; 
-    Int_t primaryindex = gime->EmcRecPoint(gime->TrackSegment(GetPHOSTSIndex())->GetEmcIndex())->GetPrimaries(dummy)[index] ; 
-    if (primaryindex >= 10000000) 
-      cout << "WARNING : AliPHOSRecParticle::GetPrimary -> not a signal primary" << endl ; 
-    else 
-      return gime->Primary(primaryindex) ; 
+    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
+
+  const Int_t nSPECIES = AliESDtrack::kSPECIES;
+  if (IsElectron()     ) fPID[0] = 1.0;
+  if (IsChargedHadron()) {
+    fPID[1] = 0.25;
+    fPID[2] = 0.25;
+    fPID[3] = 0.25;
+    fPID[4] = 0.25;
   }
-  return 0 ; 
+  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[nSPECIES]  =1.0;
+  if (IsHardPi0())                  fPID[nSPECIES+1]=1.0;
+  if (IsFastNeutralHadron())        fPID[nSPECIES+2]=1.0;
+  if (IsSlowNeutralHadron())        fPID[nSPECIES+3]=1.0;
+
+  return fPID;
 }