]> 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 67da3bf4310982e194540d25ede078eeeb7379c4..e92de231c9555adb9101bec7fbbb3338a5ab3522 100644 (file)
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
-
+/* $Id$ */
 //_________________________________________________________________________
-// Reconstructed Particle
-//*-- Y. Schutz:   SUBATECH 
-//////////////////////////////////////////////////////////////////////////////
+//  A Reconstructed Particle in PHOS    
+//  To become a general class of AliRoot ?       
+//  Why should I put meaningless comments
+//  just to satisfy
+//  the code checker                 
+//       
+//*-- Author: Yves Schutz (SUBATECH)
+
 
 // --- ROOT system ---
 
 // --- Standard library ---
 
+
 // --- AliRoot header files ---
 
 #include "AliPHOSRecParticle.h"
+#include "AliPHOSGetter.h" 
+#include "TParticle.h"
 
 ClassImp(AliPHOSRecParticle)
 
 
 //____________________________________________________________________________
- AliPHOSRecParticle::AliPHOSRecParticle(AliPHOSTrackSegment * ts)
+ AliPHOSRecParticle::AliPHOSRecParticle(const AliPHOSRecParticle & rp)
 {
-  // ctor
-  fPHOSTrackSegment = new AliPHOSTrackSegment(*ts) ; 
-  fE                = ts->GetEnergy() ; 
-  TVector3 momdir   = ts->GetMomentumDirection() ;
-  fPx               = fE * momdir.X() ; 
-  fPy               = fE * momdir.Y() ; 
-  fPz               = fE * momdir.Z() ; 
-  fType             = kUNDEFINED ;  
-                           
+  // copy ctor
+
+  fPHOSTrackSegment = rp.fPHOSTrackSegment ; 
+  fDebug            = kFALSE ; 
+  fType             = rp.fType ; 
+  fIndexInList      = rp.fIndexInList ;
+
+  fPdgCode     = rp.fPdgCode;
+  fStatusCode  = rp.fStatusCode;
+  fMother[0]   = rp.fMother[0];
+  fMother[1]   = rp.fMother[1];
+  fDaughter[0] = rp.fDaughter[0];
+  fDaughter[1] = rp.fDaughter[1];
+  fWeight      = rp.fWeight;
+  fCalcMass    = rp.fCalcMass;
+  fPx          = rp.fPx;
+  fPy          = rp.fPy;
+  fPz          = rp.fPz;
+  fE           = rp.fE;
+  fVx          = rp.fVx;
+  fVy          = rp.fVy;
+  fVz          = rp.fVz;
+  fVt          = rp.fVt;
+  fPolarTheta  = rp.fPolarTheta;
+  fPolarPhi    = rp.fPolarPhi;
+  fParticlePDG = rp.fParticlePDG; 
+  
 }
 
 //____________________________________________________________________________
-TString AliPHOSRecParticle::Name()
-{
-  TString  name ; 
-  switch (fType) {
-  case kGAMMA:
-    name = "PHOTON" ;
-    break ; 
-   case kELECTRON:
-     name = "ELECTRON" ;
-    break ; 
-  case kNEUTRAL:
-    name = "NEUTRAL" ;
-    break ; 
-   case kCHARGEDHADRON:
-    name = "CHARGED HADRON" ;
-    break ; 
-  case kNEUTRALHADRON:
-    name = "NEUTRAL HADRON" ; 
-    break ; 
-  case kNEUTRALEM:
-    name = "NEUTRAL EM" ; 
-    break ; 
-  case kGAMMAHADRON:
-    name = "PHOTON HADRON" ; 
-    break ; 
+const Int_t AliPHOSRecParticle::GetNPrimaries() const  
+{ 
 
-  }
-  return name ; 
+  Int_t rv = 0 ;
+  AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; 
+  gime->EmcRecPoint(gime->TrackSegment(GetPHOSTSIndex())->GetEmcIndex())->GetPrimaries(rv) ; 
+  return rv ; 
 }
 
 //____________________________________________________________________________
-void AliPHOSRecParticle::Print()
+const TParticle * AliPHOSRecParticle::GetPrimary(Int_t index) const  
 {
-  cout << "AliPHOSRecParticle > " << "type is  " << Name() << endl 
-       << "                     " << "Energy = " << fE << endl 
-       << "                     " << "Px     = " << fPx << endl 
-       << "                     " << "Py     = " << fPy << endl 
-       << "                     " << "Pz     = " << fPz << endl ; 
+  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 ; 
 }
+