]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSRecParticle.cxx
The new class AliTrackReference used (M.Ivanov)
[u/mrichter/AliRoot.git] / PHOS / AliPHOSRecParticle.cxx
index 6dfb60e1293923c52440e333b39f9d48bfca4a18..e92de231c9555adb9101bec7fbbb3338a5ab3522 100644 (file)
 
 // --- Standard library ---
 
-#include <assert.h>
 
 // --- AliRoot header files ---
 
 #include "AliPHOSRecParticle.h"
-#include "TPad.h"
+#include "AliPHOSGetter.h" 
+#include "TParticle.h"
 
 ClassImp(AliPHOSRecParticle)
 
@@ -43,6 +43,7 @@ ClassImp(AliPHOSRecParticle)
   // copy ctor
 
   fPHOSTrackSegment = rp.fPHOSTrackSegment ; 
+  fDebug            = kFALSE ; 
   fType             = rp.fType ; 
   fIndexInList      = rp.fIndexInList ;
 
@@ -68,6 +69,35 @@ ClassImp(AliPHOSRecParticle)
   
 }
 
+//____________________________________________________________________________
+const Int_t AliPHOSRecParticle::GetNPrimaries() const  
+{ 
 
+  Int_t rv = 0 ;
+  AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; 
+  gime->EmcRecPoint(gime->TrackSegment(GetPHOSTSIndex())->GetEmcIndex())->GetPrimaries(rv) ; 
+  return rv ; 
+}
 
+//____________________________________________________________________________
+const TParticle * AliPHOSRecParticle::GetPrimary(Int_t index) const  
+{
+  if ( index > GetNPrimaries() ) { 
+    if (fDebug) 
+      cout << "WARNING : AliPHOSRecParticle::GetPrimary -> " << index << " is larger that the number of primaries " 
+          <<  GetNPrimaries() << endl ;
+    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) { // it comes from backgroundfile 
+      if (fDebug) 
+       cout << "WARNING : AliPHOSRecParticle::GetPrimary -> not a signal primary" << endl ;
+      return 0 ; 
+    } else 
+      return gime->Primary(primaryindex) ; 
+  } 
+  return 0 ; 
+}