* 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 ---
+// --- AliRoot header files ---
+#include "AliHeader.h"
#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
+{
+ AliHeader *h = gAlice->GetHeader();
+ return h->GetNprimary();
+ // return gAlice->GetNtrack();
+}
- }
- return name ;
+//____________________________________________________________________________
+const Int_t AliPHOSRecParticle::GetNPrimariesToRecParticles() const
+{
+
+ Int_t rv = 0 ;
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+ Int_t emcRPindex = ((AliPHOSTrackSegment*)gime->TrackSegments()->At(GetPHOSTSIndex()))->GetEmcIndex();
+ ((AliPHOSEmcRecPoint*)gime->EmcRecPoints()->At(emcRPindex))->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 > GetNPrimariesToRecParticles() ) {
+ if (fDebug)
+ Warning("GetPrimary", "%d is larger that the number of primaries %d", index, GetNPrimaries()) ;
+ } else {
+ Int_t dummy ;
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+ Int_t emcRPindex = ((AliPHOSTrackSegment*)gime->TrackSegments()->At(GetPHOSTSIndex()))->GetEmcIndex();
+ Int_t *list = static_cast<AliPHOSEmcRecPoint*>(gime->EmcRecPoints()->At(emcRPindex))->GetPrimaries(dummy) ;
+ Int_t primaryindex ;
+ if(index<dummy)
+ primaryindex = list[index] ;
+ else{
+ if (fDebug)
+ printf("No primary number %d in list \n",index) ;
+ return 0 ;
+ }
+ if(primaryindex>4999999){
+ if (fDebug)
+ printf("No method to extract primaries from background!\n") ;
+ return 0 ;
+ }
+ return gime->Primary(primaryindex) ;
+ }
+ return 0 ;
}
+