Added the conversion electron in the particle type list
[u/mrichter/AliRoot.git] / PHOS / AliPHOSRecParticle.cxx
index 6dfb60e..027a972 100644 (file)
 
 // --- Standard library ---
 
-#include <assert.h>
 
 // --- AliRoot header files ---
-
 #include "AliPHOSRecParticle.h"
-#include "TPad.h"
+#include "AliPHOSGetter.h" 
 
-ClassImp(AliPHOSRecParticle)
+//____________________________________________________________________________
+  AliPHOSRecParticle::AliPHOSRecParticle(): fPHOSTrackSegment(0)  ,  fDebug( kFALSE )
+{
+  // ctor
+  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 ;
 
@@ -65,9 +72,92 @@ ClassImp(AliPHOSRecParticle)
   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];
+}
+
+//____________________________________________________________________________
+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::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  
+{
+  // 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;
+}