]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Memory leaks fixed
authorkharlov <kharlov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 1 Oct 2007 20:24:08 +0000 (20:24 +0000)
committerkharlov <kharlov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 1 Oct 2007 20:24:08 +0000 (20:24 +0000)
PHOS/AliPHOSClusterizer.cxx
PHOS/AliPHOSClusterizer.h
PHOS/AliPHOSClusterizerv1.cxx
PHOS/AliPHOSClusterizerv1.h
PHOS/AliPHOSReconstructor.cxx
PHOS/AliPHOSReconstructor.h

index 381624be23ee5428dbd8dfd74627d7192cfe055a..3b5af58d27cc1f5760f09191f143acfe4d36291f 100644 (file)
@@ -28,6 +28,8 @@
 
 ClassImp(AliPHOSClusterizer)
 
+AliPHOSCalibData * AliPHOSClusterizer::fgCalibData  = 0 ; 
+
 //____________________________________________________________________________
 AliPHOSClusterizer::AliPHOSClusterizer():
   fGeom(NULL),
index 0260a3e038deba707a0314da9e97cad3ff85f2a5..23690c33d23fcd2f7d505fa56963d371ebda6c4d 100644 (file)
@@ -6,6 +6,9 @@
 /* History of cvs commits:
  *
  * $Log$
+ * Revision 1.43  2007/09/26 14:22:17  cvetan
+ * Important changes to the reconstructor classes. Complete elimination of the run-loaders, which are now steered only from AliReconstruction. Removal of the corresponding Reconstruct() and FillESD() methods.
+ *
  * Revision 1.42  2007/08/28 12:55:07  policheh
  * Loaders removed from the reconstruction code (C.Cheshkov)
  *
@@ -36,6 +39,7 @@
 class TTree;
 
 class AliPHOSGeometry;
+class AliPHOSCalibData ;
 
 class AliPHOSClusterizer : public TObject {
 
@@ -73,6 +77,7 @@ public:
 
 protected:
 
+  static AliPHOSCalibData * fgCalibData ;   //! Calibration database if aval.
   AliPHOSGeometry *fGeom; // Pointer to PHOS geometry
   TClonesArray *fDigitsArr; // Array with input digits
   TTree *fTreeR; // Tree with output clusters
index f9179a85dd8968a3a50bc6e19b17ea8d3300f20f..89568f2ed7b002543c451ce60cb2ef56e180c7ce 100644 (file)
@@ -18,6 +18,9 @@
 /* History of cvs commits:
  *
  * $Log$
+ * Revision 1.115  2007/09/26 14:22:17  cvetan
+ * Important changes to the reconstructor classes. Complete elimination of the run-loaders, which are now steered only from AliReconstruction. Removal of the corresponding Reconstruct() and FillESD() methods.
+ *
  * Revision 1.114  2007/09/06 16:06:44  kharlov
  * Absence of sorting results in loose of all unfolded clusters
  *
@@ -183,7 +186,7 @@ AliPHOSClusterizerv1::AliPHOSClusterizerv1() :
   AliPHOSClusterizer(),
   fDefaultInit(0),            fEmcCrystals(0),          fToUnfold(0),
   fWrite(0),                  fNumberOfEmcClusters(0),  fNumberOfCpvClusters(0),
-  fCalibData(0),              fADCchanelEmc(0),         fADCpedestalEmc(0),
+  fADCchanelEmc(0),         fADCpedestalEmc(0),
   fADCchanelCpv(0),           fADCpedestalCpv(0),       fEmcClusteringThreshold(0),
   fCpvClusteringThreshold(0), fEmcMinE(0),              fCpvMinE(0),
   fEmcLocMaxCut(0),           fW0(0),                   fCpvLocMaxCut(0),
@@ -201,7 +204,7 @@ AliPHOSClusterizerv1::AliPHOSClusterizerv1(AliPHOSGeometry *geom) :
   AliPHOSClusterizer(geom),
   fDefaultInit(0),            fEmcCrystals(0),          fToUnfold(0),
   fWrite(0),                  fNumberOfEmcClusters(0),  fNumberOfCpvClusters(0),
-  fCalibData(0),              fADCchanelEmc(0),         fADCpedestalEmc(0),
+  fADCchanelEmc(0),         fADCpedestalEmc(0),
   fADCchanelCpv(0),           fADCpedestalCpv(0),       fEmcClusteringThreshold(0),
   fCpvClusteringThreshold(0), fEmcMinE(0),              fCpvMinE(0),
   fEmcLocMaxCut(0),           fW0(0),                   fCpvLocMaxCut(0),
@@ -229,14 +232,14 @@ Float_t  AliPHOSClusterizerv1::CalibrateEMC(Float_t amp, Int_t absId)
   // Calibration parameters are taken from calibration data base for raw data,
   // or from digitizer parameters for simulated data.
 
-  if(fCalibData){
+  if(fgCalibData){
     Int_t relId[4];
     fGeom->AbsToRelNumbering(absId,relId) ;
     Int_t   module = relId[0];
     Int_t   column = relId[3];
     Int_t   row    = relId[2];
     if(absId <= fEmcCrystals) { // this is EMC 
-      fADCchanelEmc   = fCalibData->GetADCchannelEmc (module,column,row);
+      fADCchanelEmc   = fgCalibData->GetADCchannelEmc (module,column,row);
       return amp*fADCchanelEmc ;        
     }
   }
@@ -254,15 +257,15 @@ Float_t  AliPHOSClusterizerv1::CalibrateCPV(Int_t amp, Int_t absId)
   // Calibration parameters are taken from calibration data base for raw data,
   // or from digitizer parameters for simulated data.
 
-  if(fCalibData){
+  if(fgCalibData){
     Int_t relId[4];
     fGeom->AbsToRelNumbering(absId,relId) ;
     Int_t   module = relId[0];
     Int_t   column = relId[3];
     Int_t   row    = relId[2];
     if(absId > fEmcCrystals) { // this is CPV
-      fADCchanelCpv   = fCalibData->GetADCchannelCpv (module,column,row);
-      fADCpedestalCpv = fCalibData->GetADCpedestalCpv(module,column,row);
+      fADCchanelCpv   = fgCalibData->GetADCchannelCpv (module,column,row);
+      fADCpedestalCpv = fgCalibData->GetADCpedestalCpv(module,column,row);
       return fADCpedestalCpv + amp*fADCchanelCpv ;              
     }     
   }
@@ -288,8 +291,6 @@ void AliPHOSClusterizerv1::Digits2Clusters(Option_t *option)
     return ;
   }
 
-  GetCalibrationParameters() ;
-
   MakeClusters() ;
     
   AliDebug(2,Form(" ---- Printing clusters (%d)\n",
@@ -411,10 +412,11 @@ void AliPHOSClusterizerv1::GetCalibrationParameters()
   // It is a user responsilibity to open CDB before reconstruction, for example: 
   // AliCDBStorage* storage = AliCDBManager::Instance()->GetStorage("local://CalibDB");
 
-  fCalibData = new AliPHOSCalibData(-1); //use AliCDBManager's run number
-  if (fCalibData->GetCalibDataEmc() == 0)
+  if (!fgCalibData) 
+    fgCalibData = new AliPHOSCalibData(-1); //use AliCDBManager's run number
+  if (fgCalibData->GetCalibDataEmc() == 0)
     AliFatal("Calibration parameters for PHOS EMC not found. Stop reconstruction.\n");
-  if (fCalibData->GetCalibDataCpv() == 0)
+  if (fgCalibData->GetCalibDataCpv() == 0)
     AliFatal("Calibration parameters for PHOS CPV not found. Stop reconstruction.\n");
 
 }
@@ -430,6 +432,8 @@ void AliPHOSClusterizerv1::Init()
   if(!gMinuit) 
     gMinuit = new TMinuit(100);
 
+  GetCalibrationParameters() ;
+
 }
 
 //____________________________________________________________________________
@@ -463,8 +467,6 @@ void AliPHOSClusterizerv1::InitParameters()
     
   fWrite                   = kTRUE ;
 
-  fCalibData               = 0 ;
-
   fIsOldRCUFormat          = kFALSE;
 }
 
@@ -1076,27 +1078,6 @@ void AliPHOSClusterizerv1::Print(const Option_t *)const
        fW0CPV )) ; 
 }
 //____________________________________________________________________________
-//void AliPHOSClusterizerv1::GetVertex(void)
-//{ //Extracts vertex posisition
-//  
-  //ESD
-//DP - todo  if(){
-//
-//  }
-
-//  //MC Generator
-//  if(gAlice && gAlice->GetMCApp() && gAlice->Generator()){
-//    Float_t x,y,z ;
-//    gAlice->Generator()->GetOrigin(x,y,z) ;
-//    fVtx.SetXYZ(x,y,z) ;
-//    return ; 
-//  }
-//
-//  //No any source
-//  fVtx[0]=fVtx[1]=fVtx[2]=0. ;
-//
-//}
-//____________________________________________________________________________
 void AliPHOSClusterizerv1::PrintRecPoints(Option_t * option)
 {
   // Prints list of RecPoints produced at the current pass of AliPHOSClusterizer
@@ -1151,11 +1132,11 @@ void AliPHOSClusterizerv1::SetDistancesToBadChannels()
   //For each EMC rec. point set the distance to the nearest bad crystal.
   //Author: Boris Polichtchouk 
 
-  if(!fCalibData->GetNumOfEmcBadChannels()) return;
-  AliInfo(Form("%d bad channel(s) found.\n",fCalibData->GetNumOfEmcBadChannels()));
+  if(!fgCalibData->GetNumOfEmcBadChannels()) return;
+  AliInfo(Form("%d bad channel(s) found.\n",fgCalibData->GetNumOfEmcBadChannels()));
 
   Int_t badIds[8000];
-  fCalibData->EmcBadChannelIds(badIds);
+  fgCalibData->EmcBadChannelIds(badIds);
 
   AliPHOSEmcRecPoint* rp;
 
@@ -1170,7 +1151,7 @@ void AliPHOSClusterizerv1::SetDistancesToBadChannels()
     rp = (AliPHOSEmcRecPoint*)fEMCRecPoints->At(iRP);
     minDist = 1.e+07;
 
-    for(Int_t iBad=0; iBad<fCalibData->GetNumOfEmcBadChannels(); iBad++) {
+    for(Int_t iBad=0; iBad<fgCalibData->GetNumOfEmcBadChannels(); iBad++) {
       rp->GetGlobalPosition(gposRecPoint,gmat);
       fGeom->RelPosInAlice(badIds[iBad],gposBadChannel);
       AliDebug(2,Form("BC position:[%.3f,%.3f,%.3f], RP position:[%.3f,%.3f,%.3f]. E=%.3f\n",
index f6b765367f76a0d96388fc2bbccd6e394ca46db7..9f9406fe0437ea11fa0f4fa303c50c304d2c2db4 100644 (file)
@@ -8,6 +8,9 @@
 /* History of cvs commits:
  *
  * $Log$
+ * Revision 1.53  2007/08/28 12:55:07  policheh
+ * Loaders removed from the reconstruction code (C.Cheshkov)
+ *
  * Revision 1.52  2007/08/07 14:16:00  kharlov
  * Quality assurance added (Yves Schutz)
  *
@@ -61,7 +64,6 @@ class AliPHOSEmcRecPoint ;
 class AliPHOSDigit ;
 class AliPHOSDigitizer ;
 class AliPHOSGeometry ;
-class AliPHOSCalibData ;
 
 class AliPHOSClusterizerv1 : public AliPHOSClusterizer {
   
@@ -151,7 +153,6 @@ private:
   Int_t   fNumberOfCpvClusters ;     // number of CPV clusters found
  
   //Calibration parameters
-  AliPHOSCalibData * fCalibData ;   //! Calibration database if aval.
   Float_t fADCchanelEmc ;           // width of one ADC channel in GeV
   Float_t fADCpedestalEmc ;         //
   Float_t fADCchanelCpv ;           // width of one ADC channel in CPV 'popugais'
index 461e350a09d967a2dcacff1fc82500e3311bfbb7..f31ee83f053e428e58e652b46cdb855a1bbe9228 100644 (file)
@@ -71,7 +71,7 @@ AliPHOSReconstructor::AliPHOSReconstructor() :
   }
 
   fGeom = AliPHOSGeometry::GetInstance("IHEP","");
-} 
+}
 
 //____________________________________________________________________________
   AliPHOSReconstructor::~AliPHOSReconstructor()
@@ -106,8 +106,8 @@ void AliPHOSReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree,
   // write tracks to the ESD
 
   AliPHOSTrackSegmentMaker *tsm = new AliPHOSTrackSegmentMakerv1(fGeom);
-  AliPHOSPID *pid = new AliPHOSPIDv1(fGeom);
+  AliPHOSPID               *pid = new AliPHOSPIDv1              (fGeom);
+
   // do current event; the loop over events is done by AliReconstruction::Run()
   tsm->SetESD(esd) ; 
   tsm->SetInput(clustersTree);
@@ -131,7 +131,6 @@ void AliPHOSReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree,
   TClonesArray *recParticles  = pid->GetRecParticles();
   Int_t nOfRecParticles = recParticles->GetEntries();
   
-  
   esd->SetNumberOfPHOSClusters(nOfRecParticles) ; 
   esd->SetFirstPHOSCluster(esd->GetNumberOfCaloClusters()) ;
 
@@ -190,6 +189,27 @@ void AliPHOSReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree,
   
   //######################################
   
+  // Read digits array
+  TBranch *branch = digitsTree->GetBranch("PHOS");
+  if (!branch) { 
+    AliError("can't get the branch with the PHOS digits !");
+    return;
+  }
+  TClonesArray *fDigitsArr    = new TClonesArray("AliPHOSDigit",100);
+  branch->SetAddress(&fDigitsArr);
+  branch->GetEntry(0);
+
+  // Get the clusters array
+  TBranch *emcbranch = clustersTree->GetBranch("PHOSEmcRP");
+  if (!emcbranch) { 
+    AliError("can't get the branch with the PHOS EMC clusters !");
+    return;
+  }
+
+  TObjArray *fEmcRecPoints = new TObjArray(100) ;
+  emcbranch->SetAddress(&fEmcRecPoints);
+  emcbranch->GetEntry(0);
+
   //Fill CaloClusters 
   const Float_t kBigShort = std::numeric_limits<short int>::max() - 1;
   const Float_t nsec100   = 1e9*100.; // units of 0.01 ns
@@ -202,19 +222,9 @@ void AliPHOSReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree,
     // Get track segment and EMC rec.point associated with this rec.particle
     AliPHOSTrackSegment *ts    = static_cast<AliPHOSTrackSegment *>(tsm->GetTrackSegments()->At(rp->GetPHOSTSIndex()));
 
-    // Get the clusters array
-    TBranch *emcbranch = clustersTree->GetBranch("PHOSEmcRP");
-    if (!emcbranch) { 
-      AliError("can't get the branch with the PHOS EMC clusters !");
-      return;
-    }
-    TObjArray *emcRecPoints = new TObjArray(100) ;
-    emcbranch->SetAddress(&emcRecPoints);
-    emcbranch->GetEntry(0);
-
-    AliPHOSEmcRecPoint  *emcRP = static_cast<AliPHOSEmcRecPoint *>(emcRecPoints->At(ts->GetEmcIndex()));
+    AliPHOSEmcRecPoint  *emcRP = static_cast<AliPHOSEmcRecPoint *>(fEmcRecPoints->At(ts->GetEmcIndex()));
     AliESDCaloCluster   *ec    = new AliESDCaloCluster() ; 
-        
+    
     Float_t xyz[3];
     for (Int_t ixyz=0; ixyz<3; ixyz++) 
       xyz[ixyz] = rp->GetPos()[ixyz];
@@ -228,19 +238,9 @@ void AliPHOSReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree,
     Short_t *timeList  = new Short_t[digitMult];
     Short_t *digiList  = new Short_t[digitMult];
 
-    // Read digits array
-    TBranch *branch = digitsTree->GetBranch("PHOS");
-    if (!branch) { 
-      AliError("can't get the branch with the PHOS digits !");
-      return;
-    }
-    TClonesArray *digitsArr = new TClonesArray("AliPHOSDigit",100);
-    branch->SetAddress(&digitsArr);
-    branch->GetEntry(0);
-
     // Convert Float_t* and Int_t* to Short_t* to save memory
     for (Int_t iDigit=0; iDigit<digitMult; iDigit++) {
-      AliPHOSDigit *digit = static_cast<AliPHOSDigit *>(digitsArr->At(digitsList[iDigit]));
+      AliPHOSDigit *digit = static_cast<AliPHOSDigit *>(fDigitsArr->At(digitsList[iDigit]));
       amplList[iDigit] =
        (Short_t)(TMath::Min(digit->GetEnergy()*gev500,kBigShort)); // Energy in units of GeV/500
       timeList[iDigit] =
@@ -258,10 +258,10 @@ void AliPHOSReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree,
     // fills the ESDCaloCluster
  
     ec->SetPHOS(kTRUE);
-    ec->SetPosition(xyz);                 //rec.point position in MARS
-    ec->SetE(rp->Energy());         //total particle energy
+    ec->SetPosition(xyz);                       //rec.point position in MARS
+    ec->SetE(rp->Energy());                     //total particle energy
     ec->SetClusterDisp(emcRP->GetDispersion()); //cluster dispersion
-    ec->SetPid          (rp->GetPID()) ;        //array of particle identification
+    ec->SetPid(rp->GetPID()) ;                  //array of particle identification
     ec->SetM02(emcRP->GetM2x()) ;               //second moment M2x
     ec->SetM20(emcRP->GetM2z()) ;               //second moment M2z
     ec->SetNExMax(emcRP->GetNExMax());          //number of local maxima
@@ -296,9 +296,13 @@ void AliPHOSReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree,
     delete [] amplList;
     delete [] timeList;
     delete [] digiList;    
-  }  
+  }
+
+  delete tsm;
+  delete pid;
 }
 
+//____________________________________________________________________________
 AliTracker* AliPHOSReconstructor::CreateTracker() const
 {
   // creates the PHOS tracker
@@ -359,4 +363,6 @@ void  AliPHOSReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digits
                  modMax,colMax,rowMax,eMax));
 
   digitsTree->Fill();
+  digits->Delete();
+  delete digits;
 }
index 51775fc7a567b5330d7a66c5719bb77579547822..5ba0d148536d1b045c1da70a8958c679555f7e86 100644 (file)
@@ -8,6 +8,9 @@
 /* History of cvs commits:
  *
  * $Log$
+ * Revision 1.14  2007/09/26 14:22:18  cvetan
+ * Important changes to the reconstructor classes. Complete elimination of the run-loaders, which are now steered only from AliReconstruction. Removal of the corresponding Reconstruct() and FillESD() methods.
+ *
  * Revision 1.13  2007/08/30 10:40:27  cvetan
  * Minor
  *
@@ -31,8 +34,8 @@
 
 //_________________________________________________________________________
 //  Wrapping class for reconstruction
-//*--
-//*-- Author: Yves Schutz (SUBATECH) 
+//--
+//-- Author: Yves Schutz (SUBATECH) 
 // Reconstruction class. Redesigned from the old AliReconstructionner class and 
 // derived from STEER/AliReconstructor. 
 //_________________________________________________________________________
@@ -67,7 +70,8 @@ public:
     // requested by the Coding Convention
     Fatal("cpy ctor", "not implemented") ;
   }
-  ~AliPHOSReconstructor() ; //dtor            
+  virtual ~AliPHOSReconstructor() ; //dtor            
+
   static void                SetDebug()   { fgDebug = kTRUE ; }
   static void                ResetDebug() { fgDebug = kFALSE ; }
   static Bool_t              Debug() { return fgDebug ; }
@@ -96,9 +100,9 @@ public:
 private:
   
   static Bool_t fgDebug ; //! verbosity controller
-  static AliPHOSRecoParam*   fgkRecoParamEmc; // reconstruction parameters for EMC
-  static AliPHOSRecoParam*   fgkRecoParamCpv; // reconstruction parameters for EMC
-  AliPHOSGeometry*           fGeom;           // pointer to the PHOS geometry
+  static AliPHOSRecoParam *fgkRecoParamEmc; // reconstruction parameters for EMC
+  static AliPHOSRecoParam *fgkRecoParamCpv; // reconstruction parameters for EMC
+  AliPHOSGeometry         *fGeom;           // pointer to the PHOS geometry
 
   ClassDef(AliPHOSReconstructor,4)  // PHOS Reconstruction class