From 51d189f496edc80d4a25952606433811ad3d76a8 Mon Sep 17 00:00:00 2001 From: schutz Date: Thu, 23 May 2002 16:32:36 +0000 Subject: [PATCH] Introduced members GetPrimary and GetNPrimaries, to recover primaries in TreeK dependingo on the RecParticle. --- PHOS/AliPHOSRecParticle.cxx | 22 ++++++++++++++-------- PHOS/AliPHOSRecParticle.h | 13 ++++++++----- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/PHOS/AliPHOSRecParticle.cxx b/PHOS/AliPHOSRecParticle.cxx index 463902b8582..e92de231c95 100644 --- a/PHOS/AliPHOSRecParticle.cxx +++ b/PHOS/AliPHOSRecParticle.cxx @@ -43,6 +43,7 @@ ClassImp(AliPHOSRecParticle) // copy ctor fPHOSTrackSegment = rp.fPHOSTrackSegment ; + fDebug = kFALSE ; fType = rp.fType ; fIndexInList = rp.fIndexInList ; @@ -81,17 +82,22 @@ const Int_t AliPHOSRecParticle::GetNPrimaries() const //____________________________________________________________________________ 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 ; - else { + 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) - cout << "WARNING : AliPHOSRecParticle::GetPrimary -> not a signal primary" << endl ; - else + 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 ; } + diff --git a/PHOS/AliPHOSRecParticle.h b/PHOS/AliPHOSRecParticle.h index 71e7aa41070..5fa1ea2b9c7 100644 --- a/PHOS/AliPHOSRecParticle.h +++ b/PHOS/AliPHOSRecParticle.h @@ -24,13 +24,15 @@ class AliPHOSRecParticle : public AliPHOSFastRecParticle { public: - AliPHOSRecParticle() { } + AliPHOSRecParticle() { fPHOSTrackSegment = 0 ; fDebug = kFALSE ; } AliPHOSRecParticle(const AliPHOSRecParticle & rp) ; // ctor virtual ~AliPHOSRecParticle(){ } Int_t GetPHOSTSIndex()const { return fPHOSTrackSegment ; } - const Int_t AliPHOSRecParticle::GetNPrimaries() const ; - const TParticle * AliPHOSRecParticle::GetPrimary(Int_t index) const ; + virtual const Int_t GetNPrimaries() const ; + virtual const TParticle * GetPrimary(Int_t index) const ; + void SetDebug() { fDebug = kTRUE ; } + void UnsetDebug() { fDebug = kFALSE ; } void SetTraskSegment(Int_t index){fPHOSTrackSegment = index; } typedef TClonesArray RecParticlesList ; @@ -38,8 +40,9 @@ class AliPHOSRecParticle : public AliPHOSFastRecParticle { private: Int_t fPHOSTrackSegment ; // pointer to the associated track segment in PHOS - - ClassDef(AliPHOSRecParticle,1) // Reconstructed Particle + Bool_t fDebug ; + + ClassDef(AliPHOSRecParticle,2) // Reconstructed Particle }; #endif // AliPHOSRECPARTICLE_H -- 2.43.0