From 87cdc3befc1320aec528afbae5ad8cb77d2a8812 Mon Sep 17 00:00:00 2001 From: mhorner Date: Mon, 12 Jul 2004 19:34:17 +0000 Subject: [PATCH] added parent functionality --- EMCAL/AliEMCALRecPoint.cxx | 63 ++++++++++++++++++++++++++++++++++++-- EMCAL/AliEMCALRecPoint.h | 8 ++++- 2 files changed, 68 insertions(+), 3 deletions(-) diff --git a/EMCAL/AliEMCALRecPoint.cxx b/EMCAL/AliEMCALRecPoint.cxx index 842000725ac..824a728d7ed 100644 --- a/EMCAL/AliEMCALRecPoint.cxx +++ b/EMCAL/AliEMCALRecPoint.cxx @@ -46,9 +46,12 @@ AliEMCALRecPoint::AliEMCALRecPoint() // ctor fMaxTrack = 0 ; fMulDigit = 0 ; + fMaxParent = 0; + fMulParent = 0; fAmp = 0. ; fCoreEnergy = 0 ; fEnergyList = 0 ; + fParentsList = 0; fTime = 0. ; fLocPos.SetX(0.) ; //Local position should be evaluated fCoreRadius = 10; //HG Check this @@ -59,10 +62,13 @@ AliEMCALRecPoint::AliEMCALRecPoint(const char * opt) : AliRecPoint(opt) { // ctor fMaxTrack = 200 ; - fMulDigit = 0 ; + fMaxParent = 200; + fMulDigit = 0 ; + fMulParent = 0; fAmp = 0. ; fCoreEnergy = 0 ; fEnergyList = 0 ; + fParentsList = new Int_t[fMaxParent]; fTime = -1. ; fLocPos.SetX(1000000.) ; //Local position should be evaluated fCoreRadius = 10; //HG Check this @@ -73,6 +79,8 @@ AliEMCALRecPoint::~AliEMCALRecPoint() // dtor if ( fEnergyList ) delete[] fEnergyList ; + if ( fParentsList) + delete[] fParentsList; } //____________________________________________________________________________ @@ -290,7 +298,8 @@ void AliEMCALRecPoint::EvalAll(Float_t logWeight,TClonesArray * digits) EvalCoreEnergy(logWeight, digits); EvalTime(digits) ; - //EvalPrimaries(digits) ; + EvalPrimaries(digits) ; + EvalParents(digits); } //____________________________________________________________________________ @@ -528,6 +537,56 @@ void AliEMCALRecPoint::EvalPrimaries(TClonesArray * digits) } +//______________________________________________________________________________ +void AliEMCALRecPoint::EvalParents(TClonesArray * digits) +{ + // Constructs the list of parent particles (tracks) which have contributed to this RecPoint + + AliEMCALDigit * digit ; + Int_t * tempo = new Int_t[fMaxParent] ; + + Int_t index ; + for ( index = 0 ; index < GetDigitsMultiplicity() ; index++ ) { // all digits + digit = dynamic_cast(digits->At( fDigitsList[index] )) ; + Int_t nparents = digit->GetNiparent() ; + Int_t * newparentarray = new Int_t[nparents] ; + Int_t ii ; + for ( ii = 0 ; ii < nparents ; ii++) + newparentarray[ii] = digit->GetIparent(ii+1) ; + + Int_t jndex ; + for ( jndex = 0 ; jndex < nparents ; jndex++ ) { // all primaries in digit + if ( fMulParent > fMaxParent ) { + fMulTrack = - 1 ; + Error("GetNiparent", "increase fMaxParent") ; + break ; + } + Int_t newparent = newparentarray[jndex] ; + Int_t kndex ; + Bool_t already = kFALSE ; + for ( kndex = 0 ; kndex < fMulTrack ; kndex++ ) { //check if not already stored + if ( newparent == tempo[kndex] ){ + already = kTRUE ; + break ; + } + } // end of check + if ( !already) { // store it + tempo[fMulParent] = newparent ; + fMulParent++ ; + } // store it + } // all parents in digit + delete newparentarray ; + } // all digits + + + fParentsList = new Int_t[fMulParent] ; + for(index = 0; index < fMulParent; index++) + fParentsList[index] = tempo[index] ; + + delete tempo ; + +} + //____________________________________________________________________________ void AliEMCALRecPoint::GetLocalPosition(TVector3 & lpos) const { diff --git a/EMCAL/AliEMCALRecPoint.h b/EMCAL/AliEMCALRecPoint.h index e65c5fc6272..bc8d52ed923 100644 --- a/EMCAL/AliEMCALRecPoint.h +++ b/EMCAL/AliEMCALRecPoint.h @@ -40,12 +40,15 @@ class AliEMCALRecPoint : public AliRecPoint { virtual void EvalAll(Float_t logWeight, TClonesArray * digits); virtual void EvalLocalPosition(Float_t logWeight, TClonesArray * digits) ; virtual void EvalPrimaries(TClonesArray * digits) ; + virtual void EvalParents(TClonesArray * digits) ; // virtual void GetGlobalPosition(TVector3 & gpos, TMatrix & /*gmat*/) const; // return global position in ALICE virtual void GetGlobalPosition(TVector3 & gpos) const; // return global position (x, y, z) in ALICE virtual void GetLocalPosition(TVector3 & lpos) const; // return local position (eta, phi, r) in EMCAL virtual Int_t * GetPrimaries(Int_t & number) const {number = fMulTrack ; return fTracksList ; } + virtual Int_t * GetParents(Int_t & number) const {number = fMulParent ; + return fParentsList ; } Float_t GetCoreEnergy()const {return fCoreEnergy ;} virtual Float_t GetDispersion()const {return fDispersion ;} virtual void GetElipsAxis(Float_t * lambda)const {lambda[0] = fLambda[0]; lambda[1] = fLambda[1];}; @@ -89,8 +92,11 @@ protected: Float_t *fEnergyList ; //[fMulDigit] energy of digits Float_t fTime ; // Time of the digit with maximal energy deposition Float_t fCoreRadius; // The radius in which the core energy is evaluated + Int_t fMulParent; // Multiplicity of the parents + Int_t fMaxParent; // Maximum number of parents allowed + Int_t * fParentsList; // [fMaxParent] list of the parents of the digits - ClassDef(AliEMCALRecPoint,5) // RecPoint for EMCAL (Base Class) + ClassDef(AliEMCALRecPoint,6) // RecPoint for EMCAL (Base Class) }; -- 2.39.3