]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
added parent functionality
authormhorner <mhorner@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 12 Jul 2004 19:34:17 +0000 (19:34 +0000)
committermhorner <mhorner@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 12 Jul 2004 19:34:17 +0000 (19:34 +0000)
EMCAL/AliEMCALRecPoint.cxx
EMCAL/AliEMCALRecPoint.h

index 842000725ac57522371d11111ae2dbb630af0540..824a728d7ed8bb17d20d132f381f655557c0f289 100644 (file)
@@ -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<AliEMCALDigit *>(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
 {
index e65c5fc627288ddb4d8daf76b6764934645dd504..bc8d52ed9238a36f04b6470d5640a8a0ff0a5036 100644 (file)
@@ -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)
  
 };