Fixes
authorcoppedis <coppedis@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 5 Nov 2010 08:36:10 +0000 (08:36 +0000)
committercoppedis <coppedis@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 5 Nov 2010 08:36:10 +0000 (08:36 +0000)
ZDC/AliZDCRecoParamPbPb.cxx
ZDC/AliZDCReconstructor.cxx

index f41a157..6c7b085 100644 (file)
@@ -138,22 +138,24 @@ AliZDCRecoParamPbPb *AliZDCRecoParamPbPb::GetHighFluxParam(Float_t beamEnergy)
   TFile *fileGlauberMC =  TFile::Open("$ALICE_ROOT/ZDC/GlauberMCDist.root");
   if(!fileGlauberMC) printf(" AliZDCRecoParamPbPb::GetHighFluxParam() ERROR opening file $ALICE_ROOT/ZDC/SpectatorSignal.root\n");
   
+  Float_t sqrtS = 2*beamEnergy;
+  
   TH1D *hNpartDist=0x0, *hbDist=0x0;
-  if(TMath::Abs(beamEnergy-5500)<100.){
+  if(TMath::Abs(sqrtS-5500)<100.){
     fileGlauberMC->cd("energy5500");
     fileGlauberMC->GetObject("energy5500/hNpartGlauber;1", hNpartDist);
     if(!hNpartDist) printf("  AliZDCRecoParamPbPb::GetHighFluxParam() PROBLEM!!! Can't get Glauber MC Npart distribution from file GlauberMCDist.root\n");
     fileGlauberMC->GetObject("energy5500/hbGlauber;1", hbDist);
     if(!hbDist) printf("  AliZDCRecoParamPbPb::GetHighFluxParam() PROBLEM!!! Can't get Glauber MC b distribution from file GlauberMCDist.root\n");
   }
-  else if(TMath::Abs(beamEnergy-2760)<100.){
+  else if(TMath::Abs(sqrtS-2760)<100.){
     fileGlauberMC->cd("energy2760");
     fileGlauberMC->GetObject("energy2760/hNpartGlauber;1", hNpartDist);
     if(!hNpartDist) printf("  PROBLEM!!! Can't get Glauber MC Npart distribution from file GlauberMCDist.root\n");
     fileGlauberMC->GetObject("energy2760/hbGlauber;1", hbDist);
     if(!hbDist) printf("  AliZDCRecoParamPbPb::GetHighFluxParam() PROBLEM!!! Can't get Glauber MC b distribution from file GlauberMCDist.root\n");
   }
-  else printf(" No AliZDCRecoParam provided for Pb-Pb @ sqrt(s) = %1.0f GeV\n", beamEnergy);
+  else printf(" No AliZDCRecoParam provided for Pb-Pb @ sqrt(s) = %1.0f GeV\n", sqrtS);
   //
   hNpartDist->SetDirectory(0);
   hbDist->SetDirectory(0);
index 9010c5e..83b032c 100644 (file)
@@ -146,8 +146,9 @@ void AliZDCReconstructor::Init(TString beamType, Float_t beamEnergy)
   }
   else if((beamType.CompareTo("A-A")) == 0 || (beamType.CompareTo("AA")) == 0){
     fRecoMode=2;
-  }
-    
+    if(!fgRecoParam) fgRecoParam = const_cast<AliZDCRecoParam*>(GetRecoParam());
+    if( fgRecoParam ) fgRecoParam->SetGlauberMCDist(fBeamEnergy);      
+  }    
   
   fESDZDC = new AliESDZDC();
   
@@ -821,6 +822,7 @@ void AliZDCReconstructor::ReconstructEventpp(TTree *clustersTree,
   clustersTree->Branch("ZDC", "AliZDCReco", &reco, kBufferSize);
   // write the output tree
   clustersTree->Fill();
+  delete reco;
 }
 
 //_____________________________________________________________________________
@@ -1019,8 +1021,11 @@ void AliZDCReconstructor::ReconstructEventPbPb(TTree *clustersTree,
   if(fIsCalibrationMB == kFALSE){
     // ******  Reconstruction parameters ------------------ 
     if(!fgMBCalibData) fgMBCalibData = const_cast<AliZDCMBCalib*>(GetMBCalibData()); 
-    if(!fgRecoParam) fgRecoParam = const_cast<AliZDCRecoParam*>(GetRecoParam()); 
-    fgRecoParam->SetGlauberMCDist(fBeamEnergy);
+    if(!fgRecoParam){
+      fgRecoParam = const_cast<AliZDCRecoParam*>(GetRecoParam());
+      if(!fgRecoParam) return;
+      fgRecoParam->SetGlauberMCDist(fBeamEnergy);     
+    }
      
     TH2F *hZDCvsZEM  = fgMBCalibData->GethZDCvsZEM();
     TH2F *hZDCCvsZEM = fgMBCalibData->GethZDCCvsZEM();
@@ -1229,7 +1234,8 @@ void AliZDCReconstructor::ReconstructEventPbPb(TTree *clustersTree,
     if(nGenSpec>416) nGenSpec=416; if(nGenSpec<0) nGenSpec=0;
     if(nGenSpecC>416) nGenSpecC=416; if(nGenSpecC<0) nGenSpecC=0;
     if(nGenSpecA>416) nGenSpecA=416; if(nGenSpecA<0) nGenSpecA=0;    
-  
+    
+    delete line; 
     delete lineC;  delete lineA;
 
   } // ONLY IF fIsCalibrationMB==kFALSE
@@ -1247,6 +1253,7 @@ void AliZDCReconstructor::ReconstructEventPbPb(TTree *clustersTree,
   //reco->Print("");
   // write the output tree
   clustersTree->Fill();
+  delete reco;
 }