adding proper destructors and some small changes in analysis macro
authormchojnac <mchojnac@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 29 Jul 2013 14:17:58 +0000 (14:17 +0000)
committermchojnac <mchojnac@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 29 Jul 2013 14:17:58 +0000 (14:17 +0000)
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraBothEventCuts.cxx
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraBothEventCuts.h
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraBothHistoManager.cxx
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraBothHistoManager.h
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraBothTrackCuts.cxx
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraBothTrackCuts.h
PWGLF/SPECTRA/PiKaPr/TestAOD/AnalysisBoth.C

index f3f316c..3b42aec 100644 (file)
@@ -48,7 +48,9 @@ fIsSelected(0), fCentralityCutMin(0), fCentralityCutMax(0), fQVectorCutMin(0), f
 fHistoCuts(0),fHistoVtxBefSel(0),fHistoVtxAftSel(0),fHistoEtaBefSel(0),fHistoEtaAftSel(0),fHistoNChAftSel(0),fHistoQVector(0)
 ,fHistoEP(0),fHistoVtxAftSelwithoutZvertexCut(0),fHistoVtxalltriggerEventswithMCz(0),fHistoVtxAftSelwithoutZvertexCutusingMCz(0)
 {
-  // Constructor
+  // Constructori
+  Bool_t oldStatus = TH1::AddDirectoryStatus();
+  TH1::AddDirectory(kFALSE);   
   fHistoCuts = new TH1I("fEventCuts", "Event Cuts", kNVtxCuts, -0.5, kNVtxCuts - 0.5);
   fHistoVtxBefSel = new TH1F("fHistoVtxBefSel", "Vtx distr before event selection",300,-15,15);
   fHistoVtxAftSel = new TH1F("fHistoVtxAftSel", "Vtx distr after event selection",300,-15,15);
@@ -77,6 +79,34 @@ fHistoCuts(0),fHistoVtxBefSel(0),fHistoVtxAftSel(0),fHistoEtaBefSel(0),fHistoEta
   fTrackBits=1;
   fCentEstimator="V0M";
   fMaxChi2perNDFforVertex=-1;
+  TH1::AddDirectory(oldStatus);        
+}
+//______________________________________________________
+
+AliSpectraBothEventCuts::~AliSpectraBothEventCuts()
+{
+       if(fHistoCuts)
+               delete fHistoCuts;
+       if(fHistoVtxBefSel)
+               delete fHistoVtxBefSel;
+       if(fHistoVtxAftSel)
+               delete fHistoVtxAftSel;
+       if(fHistoVtxAftSelwithoutZvertexCut)
+               delete fHistoVtxAftSelwithoutZvertexCut;
+       if(fHistoVtxalltriggerEventswithMCz)
+               delete fHistoVtxalltriggerEventswithMCz;
+       if(fHistoVtxAftSelwithoutZvertexCutusingMCz)
+               delete fHistoVtxAftSelwithoutZvertexCutusingMCz;
+       if(fHistoEtaBefSel)
+               delete fHistoEtaBefSel;
+       if(fHistoEtaAftSel)
+               delete fHistoEtaAftSel ;
+       if(fHistoNChAftSel)
+               delete fHistoNChAftSel;
+       if(fHistoQVector)
+               delete fHistoQVector;
+       if(fHistoEP)
+               delete fHistoEP;
 }
 
 //______________________________________________________
index ad932ef..2553a52 100644 (file)
@@ -33,7 +33,7 @@ fHistoVtxBefSel(0),fHistoVtxAftSel(0),fHistoEtaBefSel(0),fHistoEtaAftSel(0),
 fHistoNChAftSel(0),fHistoQVector(0),fHistoEP(0), fHistoVtxAftSelwithoutZvertexCut(0),fHistoVtxalltriggerEventswithMCz(0),fHistoVtxAftSelwithoutZvertexCutusingMCz(0)
 {}
   AliSpectraBothEventCuts(const char *name);
-  virtual  ~AliSpectraBothEventCuts() {}
+  virtual ~AliSpectraBothEventCuts();// {}
   
   void SetIsMC(Bool_t isMC = kFALSE)    {fIsMC = isMC; };
   Bool_t GetIsMC()           const           { return fIsMC;};
index 9f23e3c..b38113a 100644 (file)
@@ -77,7 +77,15 @@ AliSpectraBothHistoManager::AliSpectraBothHistoManager(const char *name,Int_t nr
    
   TH1::AddDirectory(oldStatus);
 }
-
+//_______________________________________________________________________________________
+AliSpectraBothHistoManager::~AliSpectraBothHistoManager()
+{
+       if (fOutputList) 
+       { 
+               fOutputList->Delete();
+               delete fOutputList;
+       }
+}
 //_______________________________________________________
 
 TH2F* AliSpectraBothHistoManager::BookPtGenHistogram(const char * name)
index eab64d9..e0012ef 100644 (file)
@@ -71,7 +71,7 @@ class AliSpectraBothHistoManager : public TNamed
 public:
    AliSpectraBothHistoManager() :  TNamed(), fOutputList(0), fNRebin(0) {}
   AliSpectraBothHistoManager(const char *name,Int_t nrebin);
-   virtual  ~AliSpectraBothHistoManager() {}
+   virtual  ~AliSpectraBothHistoManager() ;
 
 
    TH2F*   BookPtGenHistogram(const char * name);
index 2a332e3..3a2490f 100644 (file)
@@ -63,6 +63,8 @@ AliSpectraBothTrackCuts::AliSpectraBothTrackCuts(const char *name) : TNamed(name
 fHistoCuts(0), fHistoNSelectedPos(0), fHistoNSelectedNeg(0), fHistoNMatchedPos(0), fHistoNMatchedNeg(0), fHistoEtaPhiHighPt(0), fHistoNclustersITS(0),fTrack(0),fCuts(0)
   
 {
+  Bool_t oldStatus = TH1::AddDirectoryStatus();
+  TH1::AddDirectory(kFALSE);   
   // Constructor
   fHistoCuts = new TH1I("fTrkCuts", "Track Cuts", kNTrkCuts, -0.5, kNTrkCuts - 0.5);
   for(Int_t ibin=1;ibin<=kNTrkCuts;ibin++)fHistoCuts->GetXaxis()->SetBinLabel(ibin,kBinLabel[ibin-1]);
@@ -92,8 +94,30 @@ fHistoCuts(0), fHistoNSelectedPos(0), fHistoNSelectedNeg(0), fHistoNMatchedPos(0
   fYCutMax       = 100000.0; // default value of y cut ~ no cut 
   fYCutMin       = -100000.0; // default value of y cut ~ no cut 
   fMinTPCcls=70; // ncls in TPC
+   TH1::AddDirectory(oldStatus);
+       
 }
+//_______________________________________________________
+AliSpectraBothTrackCuts::~AliSpectraBothTrackCuts()
+{
+       if(fHistoCuts)
+               delete fHistoCuts;
+       if(fHistoNSelectedPos)
+               delete fHistoNSelectedPos;
+       if(fHistoNSelectedNeg)
+               delete fHistoNSelectedNeg;
+       if(fHistoNMatchedPos)
+               delete fHistoNMatchedPos;
+       if(fHistoNMatchedNeg)
+               delete fHistoNMatchedNeg;
+       if(fHistoEtaPhiHighPt)
+               delete fHistoEtaPhiHighPt;
+       if(fHistoNclustersITS)
+               delete fHistoNclustersITS;
+
 
+
+}
 //_______________________________________________________
 Bool_t AliSpectraBothTrackCuts::IsSelected(AliVTrack * track,Bool_t FillHistStat)
 {
index 1d435c1..4ca7ab3 100644 (file)
@@ -35,7 +35,7 @@ class AliSpectraBothTrackCuts : public TNamed
 fHistoCuts(0), fHistoNSelectedPos(0), fHistoNSelectedNeg(0), fHistoNMatchedPos(0), fHistoNMatchedNeg(0), fHistoEtaPhiHighPt(0), fHistoNclustersITS(0),fTrack(0),fCuts(0) {}
   
   AliSpectraBothTrackCuts(const char *name);
-  virtual  ~AliSpectraBothTrackCuts() {} // To be implemented
+  virtual  ~AliSpectraBothTrackCuts(); 
   
   Bool_t IsSelected(AliVTrack * track,Bool_t FillHistStat);
   
index 0c352e1..f2961ef 100644 (file)
@@ -531,7 +531,7 @@ TH1F* GetOneHistFromPtDCAhisto(TString name,TString hnameout,AliSpectraBothHisto
        
 void GetPtHistFromPtDCAhisto(TString hnamein, TString hnameout, AliSpectraBothHistoManager* hman,TH1F** histo,TFormula* dcacutxy)
 {
-       Float_t min[3]={0.3,0.3,0.4};
+       Float_t min[3]={0.3,0.3,0.45};
        Float_t max[3]={1.5,1.2,2.2};
        for(Int_t icharge=0;icharge<2;icharge++)
        {