]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
code updates suggested by Federico to improve memory management
authorjklay <jklay@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 30 Apr 2008 21:51:00 +0000 (21:51 +0000)
committerjklay <jklay@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 30 Apr 2008 21:51:00 +0000 (21:51 +0000)
EMCAL/AliEMCALDigitizer.cxx
EMCAL/AliEMCALLoader.cxx
EMCAL/AliEMCALReconstructor.cxx
EMCAL/AliEMCALReconstructor.h

index ff290568d5697085b83b1868a240debebe9ee687..767fdd5cad360a0f59578f3303cbf1fda2dd696f 100644 (file)
@@ -254,7 +254,7 @@ void AliEMCALDigitizer::Digitize(Int_t event)
   rl->GetEvent(readEvent);
 
   TClonesArray * digits = emcalLoader->Digits() ; 
-  digits->Delete() ;  
+  digits->Delete() ;  //JLK why is this created then deleted?
 
   // Load Geometry
   AliEMCALGeometry *geom = 0;
@@ -324,7 +324,7 @@ void AliEMCALDigitizer::Digitize(Int_t event)
   AliEMCALDigit * digit ;
   AliEMCALDigit * curSDigit ;
 
-  TClonesArray * ticks = new TClonesArray("AliEMCALTick",1000) ;
+  //  TClonesArray * ticks = new TClonesArray("AliEMCALTick",1000) ;
 
   //Put Noise contribution
   for(absID = 0; absID < nEMC; absID++){ // Nov 30, 2006 by PAI; was from 1 to nEMC
@@ -336,14 +336,22 @@ void AliEMCALDigitizer::Digitize(Int_t event)
     
     if(absID==nextSig){
       //Add SDigits from all inputs    
-      ticks->Clear() ;
-      Int_t contrib = 0 ;
-      Float_t a = digit->GetAmp() ;
-      Float_t b = TMath::Abs( a /fTimeSignalLength) ;
+      //      ticks->Clear() ;
+      //Int_t contrib = 0 ;
+
+      //Follow PHOS and comment out this timing model til a better one
+      //can be developed - JLK 28-Apr-2008
+
+      //Float_t a = digit->GetAmp() ;
+      //Float_t b = TMath::Abs( a /fTimeSignalLength) ;
       //Mark the beginning of the signal
-      new((*ticks)[contrib++]) AliEMCALTick(digit->GetTime(),0, b);  
+      //new((*ticks)[contrib++]) AliEMCALTick(digit->GetTime(),0, b);  
       //Mark the end of the signal     
-      new((*ticks)[contrib++]) AliEMCALTick(digit->GetTime()+fTimeSignalLength, -a, -b);
+      //new((*ticks)[contrib++]) AliEMCALTick(digit->GetTime()+fTimeSignalLength, -a, -b);
+
+      // Calculate time as time of the largest digit
+      Float_t time = digit->GetTime() ;
+      Float_t eTime= digit->GetAmp() ;
       
       // loop over input
       for(i = 0; i< fInput ; i++){  //loop over (possible) merge sources
@@ -360,11 +368,16 @@ void AliEMCALDigitizer::Digitize(Int_t event)
          else
            primaryoffset = i ;
          curSDigit->ShiftPrimary(primaryoffset) ;
-         
-         a = curSDigit->GetAmp() ;
-         b = a /fTimeSignalLength ;
-         new((*ticks)[contrib++]) AliEMCALTick(curSDigit->GetTime(),0, b);  
-         new((*ticks)[contrib++]) AliEMCALTick(curSDigit->GetTime()+fTimeSignalLength, -a, -b); 
+
+         //Remove old timing model - JLK 28-April-2008
+         //a = curSDigit->GetAmp() ;
+         //b = a /fTimeSignalLength ;
+         //new((*ticks)[contrib++]) AliEMCALTick(curSDigit->GetTime(),0, b);  
+         //new((*ticks)[contrib++]) AliEMCALTick(curSDigit->GetTime()+fTimeSignalLength, -a, -b); 
+         if(curSDigit->GetAmp()>eTime) {
+           eTime = curSDigit->GetAmp();
+           time = curSDigit->GetTime();
+         }
 
          *digit = *digit + *curSDigit ;  //add energies
 
@@ -380,7 +393,8 @@ void AliEMCALDigitizer::Digitize(Int_t event)
       amp *= static_cast<Float_t>(gRandom->Poisson(fMeanPhotonElectron)) / static_cast<Float_t>(fMeanPhotonElectron) ;
   
       //calculate and set time
-      Float_t time = FrontEdgeTime(ticks) ;
+      //New timing model needed - JLK 28-April-2008
+      //Float_t time = FrontEdgeTime(ticks) ;
       digit->SetTime(time) ;
 
       //Find next signal module
@@ -401,8 +415,8 @@ void AliEMCALDigitizer::Digitize(Int_t event)
                     absID, amp, nextSig));
   } // for(absID = 1; absID <= nEMC; absID++)
   
-  ticks->Delete() ;
-  delete ticks ;
+  //ticks->Delete() ;
+  //delete ticks ;
 
   delete sdigArray ; //We should not delete its contents
 
index 5219e943e58a1a961dfe67fa160482a1c70b9356..663f6b95dadf9922cbbf3aa3c8b51fd926973671 100644 (file)
@@ -256,9 +256,7 @@ Int_t AliEMCALLoader::GetEvent()
      TBranch * branchS = treeS->GetBranch(fDetectorName);
      branchS->ResetAddress();
      if (fSDigits) {
-       fSDigits->Delete();
-       delete fSDigits;
-       fSDigits = 0x0;
+       fSDigits->Clear();
      }
      branchS->SetAddress(&fSDigits);
      treeS->GetEvent(0);
@@ -270,9 +268,7 @@ Int_t AliEMCALLoader::GetEvent()
      TBranch * branchD = treeD->GetBranch(fDetectorName);
      branchD->ResetAddress();
      if (fDigits) {
-       fDigits->Delete();
-       delete fDigits;
-       fDigits = 0x0;
+       fDigits->Clear();
      }
      branchD->SetAddress(&fDigits);
      treeD->GetEvent(0);
@@ -284,9 +280,7 @@ Int_t AliEMCALLoader::GetEvent()
      TBranch * branchR = treeR->GetBranch(fgkECARecPointsBranchName);
      branchR->ResetAddress();
      if (fRecPoints) {
-       fRecPoints->Delete();
-       delete fRecPoints;
-       fRecPoints = 0x0;
+       fRecPoints->Clear();
      }
      branchR->SetAddress(&fRecPoints);
      treeR->GetEvent(0);
index a5a2d6d6fefa8bfee899e4215bc22bc703094d5b..7708f9a432bd1d5524d7e750ac76d8201413a120 100644 (file)
@@ -61,8 +61,8 @@ ClassImp(AliEMCALReconstructor)
 
 AliEMCALRecParam* AliEMCALReconstructor::fgkRecParam = 0;  // EMCAL rec. parameters
 AliEMCALRawUtils* AliEMCALReconstructor::fgRawUtils = 0;   // EMCAL raw utilities class
+AliEMCALClusterizer* AliEMCALReconstructor::fgClusterizer = 0;   // EMCAL clusterizer class
 TClonesArray*     AliEMCALReconstructor::fgDigitsArr = 0;  // shoud read just once at event
-
 //____________________________________________________________________________
 AliEMCALReconstructor::AliEMCALReconstructor() 
   : fDebug(kFALSE), fList(0), fGeom(0) 
@@ -71,6 +71,7 @@ AliEMCALReconstructor::AliEMCALReconstructor()
   InitRecParam();
 
   fgRawUtils = new AliEMCALRawUtils;
+  fgClusterizer = new AliEMCALClusterizerv1;
 
   //To make sure we match with the geometry in a simulation file,
   //let's try to get it first.  If not, take the default geometry
@@ -144,15 +145,18 @@ void AliEMCALReconstructor::Reconstruct(TTree* digitsTree, TTree* clustersTree)
 
   if(fgDigitsArr && fgDigitsArr->GetEntries()) {
 
-    AliEMCALClusterizerv1 clu;
-    clu.SetInput(digitsTree);
-    clu.SetOutput(clustersTree);
+    fgClusterizer->SetInput(digitsTree);
+    fgClusterizer->SetOutput(clustersTree);
+    
     if(Debug())
-      clu.Digits2Clusters("deb all") ;
+      fgClusterizer->Digits2Clusters("deb all") ;
     else
-      clu.Digits2Clusters("") ;
+      fgClusterizer->Digits2Clusters("");
+    
+    fgClusterizer->Clear();
 
   }
+
 }
 
 //____________________________________________________________________________
@@ -196,7 +200,6 @@ void AliEMCALReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree,
   // Works on the current event
   //  printf(" ## AliEMCALReconstructor::FillESD() is started ### \n ");
   //return;
-  const double timeScale = 1.e+11; // transition constant from sec to 0.01 ns 
 
   //######################################################
   //#########Calculate trigger and set trigger info###########
@@ -426,6 +429,7 @@ void AliEMCALReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree,
   // printf(" ## AliEMCALReconstructor::FillESD() is ended : ncl %i -> %i ### \n ",nClusters, nClustersNew); 
 }
 
+//__________________________________________________________________________
 void AliEMCALReconstructor::ReadDigitsArrayFromTree(TTree *digitsTree) const
 {
   // See AliEMCALClusterizer::SetInput(TTree *digitsTree);
index a0bcb470b210e4bd348653239852dcce8be20b2b..da9d138929b3155a8afc47061bdcab339d294749 100644 (file)
@@ -77,15 +77,17 @@ public:
 private:
   
   Bool_t fDebug; //! verbosity controller
+
   TList *fList;  //! List of hists (only for trigger now)
   AliEMCALGeometry         *fGeom;           // pointer to the EMCAL geometry
 
+  static AliEMCALClusterizer* fgClusterizer; // clusterizer
   static AliEMCALRecParam*   fgkRecParam; // reconstruction parameters for EMCAL
   static AliEMCALRawUtils*   fgRawUtils;  // raw utilities class -
                                          // only need one per reco
   static TClonesArray*       fgDigitsArr; // Array with EMCAL digits
 
-  ClassDef(AliEMCALReconstructor,3)  // Reconstruction algorithm class (Base Class)
+  ClassDef(AliEMCALReconstructor,5)  // Reconstruction algorithm class (Base Class)
 
 };