bug fix
authorhdalsgaa <hdalsgaa@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 7 Sep 2010 11:54:07 +0000 (11:54 +0000)
committerhdalsgaa <hdalsgaa@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 7 Sep 2010 11:54:07 +0000 (11:54 +0000)
PWG2/FORWARD/analysis/AliFMDAnaParameters.cxx
PWG2/FORWARD/analysis/AliFMDAnaParameters.h
PWG2/FORWARD/analysis/SubmitSharingEffCorrection.C

index 55cd254..6c01f90 100644 (file)
@@ -114,52 +114,51 @@ AliFMDAnaParameters::AliFMDAnaParameters() :
   
 }
 //____________________________________________________________________
-const char* AliFMDAnaParameters::GetPath(const char* species) const  {
+const char* AliFMDAnaParameters::GetPath(const char* species)  {
   //Get path of object
-  TString path = "";
-  
+  static TString*  path = new TString();
   if(species == fgkBackgroundID)
-    path = Form("%s/%s_%d_%d_%d_%d_%d_%d.root",
-               fBackgroundPath.Data(),
-               fgkBackgroundID,
-               fEnergy,
-               fTrigger,
-               fMagField,
-               fSpecies,
-               fInelGtZero,
-               0);
+    path->Form("%s/%s_%d_%d_%d_%d_%d_%d.root",
+             fBackgroundPath.Data(),
+             fgkBackgroundID,
+             fEnergy,
+             fTrigger,
+             fMagField,
+             fSpecies,
+             fInelGtZero,
+             0);
   if(species == fgkEnergyDistributionID)
-    path = Form("%s/%s_%d_%d_%d_%d_%d_%d.root",
-               fEnergyPath.Data(),
-               fgkEnergyDistributionID,
-               fEnergy,
-               fTrigger,
-               fMagField,
-               fSpecies,
-               fRealData,
-               0);
+    path->Form("%s/%s_%d_%d_%d_%d_%d_%d.root",
+             fEnergyPath.Data(),
+             fgkEnergyDistributionID,
+             fEnergy,
+             fTrigger,
+             fMagField,
+             fSpecies,
+             fRealData,
+             0);
   if(species == fgkEventSelectionEffID)
-    path = Form("%s/%s_%d_%d_%d_%d_%d_%d.root",
-               fEventSelectionEffPath.Data(),
-               fgkEventSelectionEffID,
-               fEnergy,
-               fTrigger,
-               fMagField,
-               fSpecies,
-               fInelGtZero,
-               0);
+    path->Form("%s/%s_%d_%d_%d_%d_%d_%d.root",
+             fEventSelectionEffPath.Data(),
+             fgkEventSelectionEffID,
+             fEnergy,
+             fTrigger,
+             fMagField,
+             fSpecies,
+             fInelGtZero,
+             0);
   if(species == fgkSharingEffID)
-    path = Form("%s/%s_%d_%d_%d_%d_%d_%d.root",
-               fSharingEffPath.Data(),
-               fgkSharingEffID,
-               fEnergy,
-               fTrigger,
-               fMagField,
-               fSpecies,
-               0,
-               0);
-
-  return path.Data();
+    path->Form("%s/%s_%d_%d_%d_%d_%d_%d.root",
+             fSharingEffPath.Data(),
+             fgkSharingEffID,
+             fEnergy,
+             fTrigger,
+             fMagField,
+             fSpecies,
+             0,
+             0);
+  return path->Data();
 }
 //____________________________________________________________________
 void AliFMDAnaParameters::Init(Bool_t forceReInit, UInt_t what)
@@ -210,6 +209,7 @@ void AliFMDAnaParameters::InitBackground() {
 
 void AliFMDAnaParameters::InitEnergyDists() {
   //Init energy distributions
+    
   TFile* fin = TFile::Open(GetPath(fgkEnergyDistributionID));
   
   if (!fin) return;
index b794c2c..79ddda1 100644 (file)
@@ -130,7 +130,7 @@ public:
   void     SetEnergy(Energy energy) {fEnergy = energy;}
   Energy   GetEnergy() {return fEnergy;}
   void     SetMagField(MagField magfield) {fMagField = magfield;}
-  const char*    GetPath(const char* species) const;
+  const char*    GetPath(const char* species);
   void     SetCollisionSystem(Species collsystem) {fSpecies = collsystem;}
   Species  GetCollisionSystem() const {return fSpecies;}
   void     PrintStatus() const;
index c3f9b16..7081601 100644 (file)
@@ -13,7 +13,7 @@ void SubmitSharingEffCorrection(const Char_t* filename="fmdana.root", Bool_t sto
   gStyle->SetTitleFont(132,"Z");
   
   AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
-  
+  pars->Init(kTRUE,AliFMDAnaParameters::kBackgroundCorrection);
   if(energy == 900)
     pars->SetEnergy(AliFMDAnaParameters::k900);
   else if(energy == 7000)