]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Bugfix: memory leak in the histogram class
authorkaamodt <kaamodt@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 5 Jul 2010 05:04:44 +0000 (05:04 +0000)
committerkaamodt <kaamodt@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 5 Jul 2010 05:04:44 +0000 (05:04 +0000)
Added extra cut on the qt in armateros plots
Added extra functionality to say how many events are used in bg calculations for mesons
Put back in again the code produced by Christian to account for warnings

PWG4/GammaConv/AliAnalysisTaskGammaConversion.cxx
PWG4/GammaConv/AliGammaConversionHistograms.cxx
PWG4/GammaConv/AliV0Reader.cxx
PWG4/GammaConv/AliV0Reader.h
PWG4/macros/ConfigGammaConversion.C

index b008b47fa028adfca6d08ce09c93781b608bfbc6..41d0c505f8629611ee0c5cd8dddd757a5b237627 100644 (file)
@@ -36,7 +36,6 @@
 #include "AliGammaConversionBGHandler.h"
 #include "AliESDCaloCluster.h" // for combining PHOS and GammaConv
 #include "AliKFVertex.h"
-#include "AliV0.h"
 class AliCFContainer;
 class AliCFManager;
 class AliKFVertex;
@@ -1407,7 +1406,8 @@ void AliAnalysisTaskGammaConversion::ProcessV0s(){
        fHistograms->FillHistogram("ESD_TrueConvGamma_P_AsymmetryP",fV0Reader->GetMotherCandidateP(),fV0Reader->GetPositiveTrackP()/fV0Reader->GetMotherCandidateP());
        fHistograms->FillHistogram("ESD_TrueConvGamma_E_dEdxP",fV0Reader->GetNegativeTrackP(),fV0Reader->GetNegativeTrackTPCdEdx());
        fHistograms->FillHistogram("ESD_TrueConvGamma_P_dEdxP",fV0Reader->GetPositiveTrackP(),fV0Reader->GetPositiveTrackTPCdEdx());
-
+       fHistograms->FillHistogram("ESD_TrueConvGamma_alfa_qt",armenterosQtAlfa[1],armenterosQtAlfa[0]);
 
                                
        //store MCTruth properties
@@ -1716,6 +1716,7 @@ void AliAnalysisTaskGammaConversion::ProcessGammasForNeutralMesonAnalysis(){
       if(twoGammaCandidate->GetNDF()>0){
        chi2TwoGammaCandidate = twoGammaCandidate->GetChi2()/twoGammaCandidate->GetNDF();
                                
+       fHistograms->FillHistogram("ESD_Mother_Chi2",chi2TwoGammaCandidate);
        if(chi2TwoGammaCandidate>0 && chi2TwoGammaCandidate<fV0Reader->GetChi2CutMeson()){
                                        
          TVector3 momentumVectorTwoGammaCandidate(twoGammaCandidate->GetPx(),twoGammaCandidate->GetPy(),twoGammaCandidate->GetPz());
@@ -2170,7 +2171,7 @@ void AliAnalysisTaskGammaConversion::RecalculateV0ForGamma(){
  Double_t xPrimaryVertex=vtxT3D->GetXv();
  Double_t yPrimaryVertex=vtxT3D->GetYv();
  Double_t zPrimaryVertex=vtxT3D->GetZv();
- Float_t primvertex[3]={xPrimaryVertex,yPrimaryVertex,zPrimaryVertex};
// Float_t primvertex[3]={xPrimaryVertex,yPrimaryVertex,zPrimaryVertex};
 
  Float_t nsigmaTPCtrackPos;
  Float_t nsigmaTPCtrackNeg;
@@ -2303,12 +2304,8 @@ void AliAnalysisTaskGammaConversion::RecalculateV0ForGamma(){
 
      Float_t cpa=vertex.GetV0CosineOfPointingAngle(xPrimaryVertex,yPrimaryVertex,zPrimaryVertex);
 
-     AliV0 pvertex;
-     pvertex.SetParamN(nt);
-     pvertex.SetParamP(pt);
-     pvertex.Update(primvertex);
  
-     Float_t v0Rr=pvertex.GetRr();
+
      //  cout<< "v0Rr::"<< v0Rr<<endl;
      // if (pvertex.GetRr()<0.5){
      // continue;
@@ -2351,7 +2348,6 @@ void AliAnalysisTaskGammaConversion::RecalculateV0ForGamma(){
         fHistograms->FillHistogram("ESD_RecalculateV0_P_dEdxP",curElecPosAt.P(),posTrack->GetTPCsignal());
         fHistograms->FillHistogram("ESD_RecalculateV0_cpa",cpa);
         fHistograms->FillHistogram("ESD_RecalculateV0_dca",dca);
-        fHistograms->FillHistogram("ESD_RecalculateV0_Rr",v0Rr);
         fHistograms->FillHistogram("ESD_RecalculateV0_normdistP",normdistP);
         fHistograms->FillHistogram("ESD_RecalculateV0_normdistN",normdistN);
 
index 866b7f3f99597afdaf3d841ac7889889db2bd659..2c87e821b6977aa146a16d0d04b6295fff4d8835 100644 (file)
@@ -191,7 +191,7 @@ Bool_t AliGammaConversionHistograms::BinLogAxis(const char* name, Int_t dim){
     newBins[i] = factor * newBins[i-1];
   }
   axis->Set(bins, newBins);
-  delete newBins;
+  delete [] newBins;
 
   return kTRUE;
 
index 2f65ec1499f5879236e7daf12b9a11824f16d02a..44345f0098acc2eb022368e8bb73e859b61a7d73 100644 (file)
@@ -109,6 +109,8 @@ AliV0Reader::AliV0Reader() :
   fPIDMinPKaonRejectionLowP(0),
   fPIDMinPProtonRejectionLowP(0),
   fPIDMinPPionRejectionLowP(0),
+  fDoQtGammaSelection(kFALSE),
+  fQtMax(100.),
   fXVertexCut(0.),
   fYVertexCut(0.),
   fZVertexCut(0.),
@@ -124,7 +126,8 @@ AliV0Reader::AliV0Reader() :
   fBGEventHandler(NULL),
   fBGEventInitialized(kFALSE),
   fEsdTrackCuts(NULL),
-  fNumberOfESDTracks(0)
+  fNumberOfESDTracks(0),
+  nEventsForBGCalculation(10)
 {
   //fESDpid = new AliESDpid;   
 }
@@ -191,6 +194,8 @@ AliV0Reader::AliV0Reader(const AliV0Reader & original) :
   fPIDMinPKaonRejectionLowP(original.fPIDMinPKaonRejectionLowP),
   fPIDMinPProtonRejectionLowP(original.fPIDMinPProtonRejectionLowP),
   fPIDMinPPionRejectionLowP(original.fPIDMinPPionRejectionLowP),
+  fDoQtGammaSelection(original.fDoQtGammaSelection),
+  fQtMax(original.fQtMax),
   fXVertexCut(original.fXVertexCut),
   fYVertexCut(original.fYVertexCut),
   fZVertexCut(original.fZVertexCut),
@@ -206,7 +211,8 @@ AliV0Reader::AliV0Reader(const AliV0Reader & original) :
   fBGEventHandler(original.fBGEventHandler),
   fBGEventInitialized(original.fBGEventInitialized),
   fEsdTrackCuts(original.fEsdTrackCuts),
-  fNumberOfESDTracks(original.fNumberOfESDTracks)
+  fNumberOfESDTracks(original.fNumberOfESDTracks),
+  nEventsForBGCalculation(original.nEventsForBGCalculation)
 {
        
 }
@@ -333,7 +339,7 @@ void AliV0Reader::Initialize(){
       multiplicityBinLimitsArray[3] = 27.5;
       multiplicityBinLimitsArray[4] = 41.5;
           
-      fBGEventHandler = new AliGammaConversionBGHandler(8,5,10);
+      fBGEventHandler = new AliGammaConversionBGHandler(8,5,nEventsForBGCalculation);
       
       /*
       // ---------------------------------
@@ -635,7 +641,17 @@ Bool_t AliV0Reader::NextV0(){
       }
     }
 
-    
+    // Gamma selection based on QT from Armenteros
+    if(fDoQtGammaSelection == kTRUE){
+      if(armenterosQtAlfa[0]>fQtMax){
+       if(fHistograms != NULL){
+         fHistograms->FillHistogram("ESD_CutQt_InvMass",GetMotherCandidateMass());
+       }
+       fCurrentV0IndexNumber++;
+       continue;
+      }
+    }
+
     //checks if we have a prim vertex
     if(fESDEvent->GetPrimaryVertex()->GetNContributors()<=0) { 
       if(fHistograms != NULL){
index b6df568637a5cd9e17bb1ce79182d1663973bc6d..e8b3bc92122609b287444d2d6c7dd0460b3ba2ad 100644 (file)
@@ -659,6 +659,15 @@ class AliV0Reader : public TObject {
    */
   void SetPIDMinPPionRejectionLowP(Double_t PIDMinPPionRejectionLowP ){fPIDMinPPionRejectionLowP=PIDMinPPionRejectionLowP;}
 
+  /*
+   *Set if we want to use Gamma Selection based on Qt from Armenteros
+   */
+  void SetDoQtGammaSelection(Bool_t doQtGammaSelection){fDoQtGammaSelection=doQtGammaSelection;}
+  /*
+   * Sets the MaxQtCut value.
+   */
+  void SetQtMax(Double_t qtMax){fQtMax=qtMax;}
+
   /*
    * Updates the V0 information of the current V0.
    */
@@ -718,6 +727,8 @@ class AliV0Reader : public TObject {
 
   void SetESDtrackCuts(AliESDtrackCuts * const trackCuts){fEsdTrackCuts = trackCuts;}
 
+  void SetNEventsForBG(Int_t nev){nEventsForBGCalculation = nev;}
+
   Int_t CountESDTracks();
 
   Int_t GetCurrentV0IndexNumber() const {return fCurrentV0IndexNumber;}
@@ -808,7 +819,8 @@ class AliV0Reader : public TObject {
   Double_t fPIDMinPKaonRejectionLowP; // Momentum limit to apply kaon rejection
   Double_t fPIDMinPProtonRejectionLowP; // Momentum limit to apply proton rejection
   Double_t fPIDMinPPionRejectionLowP; // Momentum limit to apply proton rejection
-
+  Bool_t   fDoQtGammaSelection; // Select gammas using qtMax
+  Double_t fQtMax; // Maximum Qt from Armenteros to select Gammas
   Double_t fXVertexCut; //vertex cut
   Double_t fYVertexCut; //vertex cut
   Double_t fZVertexCut; // vertexcut
@@ -837,7 +849,9 @@ class AliV0Reader : public TObject {
 
   static AliESDpid* fgESDpid;                 // ESD pid object
 
-  ClassDef(AliV0Reader,10)
+  Int_t nEventsForBGCalculation;
+
+  ClassDef(AliV0Reader,11)
 };
 
 inline void AliV0Reader::InitESDpid(Int_t type)
index 4abf10b0b0bd102f60bc6e22430ce6ec0a3f3863..2a2b1521748d4de7df14cd537290a1cbd5ad7504 100644 (file)
@@ -15,7 +15,7 @@
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
-const int c_array_size = 12;
+const int c_array_size = 13;
 
 class AliAnalysisDataContainer;
 class AliGammaConversionHistograms;
@@ -36,7 +36,9 @@ Bool_t kGCrunRES = kFALSE;
 Bool_t kGCRecalculateV0ForGamma = kFALSE;
 /** ---------------------------------- define cuts here ------------------------------------*/
 
-TString kGCAnalysisCutSelectionId="900011100010"; // do not cheange here, use -set-cut-selection in argument instead
+TString kGCAnalysisCutSelectionId="9000111000100"; // do not change here, use -set-cut-selection in argument instead
+
+Int_t kGCNEventsForBGCalculation=10;
 
 Int_t kGCpidOfNegativeTrack=11;
 Int_t kGCpidOfPositiveTrack=-11;
@@ -289,7 +291,7 @@ Bool_t kGCplotESDTrueConvGammaEAsymmetryP         = kTRUE;
 Bool_t kGCplotESDTrueConvGammaPAsymmetryP         = kTRUE;
 Bool_t kGCplotESDTrueConvGammaEdEdxP         = kTRUE;
 Bool_t kGCplotESDTrueConvGammaPdEdxP         = kTRUE;
-
+Bool_t kGCplotESDTrueConvGammaQtAlfa         = kTRUE;
 
 Bool_t kGCplotESDTrueConvGammaPtvsChi2       = kTRUE;
 Bool_t kGCplotESDTrueConvGammaEtavsChi2      = kTRUE;
@@ -326,6 +328,7 @@ Bool_t kGCplotESDNoCutConvGammaMCPtEta        = kTRUE;
 Bool_t kGCplotESDNoCutConversionMCZR          = kFALSE;
 Bool_t kGCplotESDNoCutConversionMCXY          = kFALSE;
 
+Bool_t kGCplotESDMotherChi2 = kTRUE;
 Bool_t kGCplotESDMotherOpeningAngleGamma = kTRUE;
 Bool_t kGCplotESDMotherEnergy            = kFALSE;
 Bool_t kGCplotESDMotherPt                = kFALSE;
@@ -387,6 +390,7 @@ Bool_t kGCplotESDCutdedxSigmaPionLine=kTRUE;
 Bool_t kGCplotESDCutPionRejectionLowP  =kTRUE;
 Bool_t kGCplotESDCutProtonRejectionLowP=kTRUE;
 Bool_t kGCplotESDCutKaonRejectionLowP  =kTRUE;
+Bool_t kGCplotESDCutQtGammaSelection=kTRUE;
 Bool_t kGCplotESDCutR             = kTRUE;
 Bool_t kGCplotESDCutLine          = kTRUE;
 Bool_t kGCplotESDCutZ             = kTRUE;
@@ -793,6 +797,11 @@ Double_t kGCPIDMinPProtonRejectionLowP=2.;
 Double_t kGCPIDMinPPionRejectionLowP=0.5;
 
 
+Bool_t kGCdoQtGammaSelection=kTRUE;
+Double_t kGCQtMax=100.;
+
+
+
 Bool_t scanArguments(TString arguments){
   
   Bool_t iResult = kTRUE;
@@ -1074,7 +1083,11 @@ AliAnalysisTaskGammaConversion* ConfigGammaConversion(TString arguments, AliAnal
                
     AliCFManager *man = new AliCFManager();
     man->SetParticleContainer(container);
-               
+    for(int i = 0;i<nstep;i++){
+      TObjArray *tmp = new TObjArray(0);
+      man->SetParticleCutsList(i,tmp) ;
+    }
+
     // end ---------------------------------------------------------------------------
                
                
@@ -1275,7 +1288,9 @@ AliAnalysisTaskGammaConversion* ConfigGammaConversion(TString arguments, AliAnal
   v0Reader->SetPIDMinPKaonRejectionLowP(kGCPIDMinPKaonRejectionLowP);
   v0Reader->SetPIDMinPProtonRejectionLowP(kGCPIDMinPProtonRejectionLowP);
   v0Reader->SetPIDMinPPionRejectionLowP(kGCPIDMinPPionRejectionLowP);
-
+  v0Reader->SetDoQtGammaSelection(kGCdoQtGammaSelection);
+  v0Reader->SetQtMax(kGCQtMax);
+  v0Reader->SetNEventsForBG(kGCNEventsForBGCalculation);
 
   // Create the GammaConversionTask
 
@@ -1379,11 +1394,7 @@ void build() {
   TStopwatch timer;
   timer.Start();
   gSystem->Load("libTree.so");
-  gSystem->Load("libGui.so");
-  gSystem->Load("libMinuit.so");
   gSystem->Load("libGeom");
-  gSystem->Load("libProof");
-  gSystem->Load("libRAWDatabase");
        
   ////
   //Setting up ESD.par//
@@ -1392,10 +1403,6 @@ void build() {
   setupPar("ESD");
   gSystem->Load("libVMC.so");
   gSystem->Load("libESD.so");
-
-
-  gSystem->Load("libCDB.so");
-  gSystem->Load("libSTEER.so");
        
   ////
   ////
@@ -1634,7 +1641,7 @@ void AddHistograms(AliGammaConversionHistograms *histograms){
     if(kGCplotESDTrueConvGammaPAsymmetryP== kTRUE){ histograms->AddHistogram("ESD_TrueConvGamma_P_AsymmetryP" ,"" ,kGCnXBinsP, kGCfirstXBinP, kGClastXBinP,kGCnYBinsAsymmetry, kGCfirstYBinAsymmetry, kGClastYBinAsymmetry,"", "");}
     if(kGCplotESDTrueConvGammaEdEdxP== kTRUE){ histograms->AddHistogram("ESD_TrueConvGamma_E_dEdxP" ,"" ,kGCnXBinsP, kGCfirstXBinP, kGClastXBinP,kGCnYBinsdEdx, kGCfirstYBindEdx, kGClastYBindEdx,"", "",0);}
     if(kGCplotESDTrueConvGammaPdEdxP== kTRUE){ histograms->AddHistogram("ESD_TrueConvGamma_P_dEdxP" ,"" ,kGCnXBinsP, kGCfirstXBinP, kGClastXBinP,kGCnYBinsdEdx, kGCfirstYBindEdx, kGClastYBindEdx,"", "",0);}
-
+    if(kGCplotESDTrueConvGammaQtAlfa== kTRUE){ histograms->AddHistogram("ESD_TrueConvGamma_alfa_qt" ,"" ,kGCnXBinsP, kGCfirstXBinAlphaG, kGClastXBinAlpha,kGCnYBinsQt, kGCfirstYBinQt, kGClastYBinQt,"", "");}
                
     if(kGCplotESDTrueConvGammaMCPtEta == kTRUE){ histograms->AddHistogram("ESD_TrueConvGamma_MC_Pt_Eta" ,"" , kGCnXBinsPt, kGCfirstXBinPt, kGClastXBinPt, kGCnXBinsEta, kGCfirstXBinEta, kGClastXBinEta, "", "");}
     if(kGCplotESDTrueConversionMCZR == kTRUE){ histograms->AddHistogram("ESD_TrueConversion_MC_ZR" ,"" , kGCnXBinsZR, kGCfirstXBinZR, kGClastXBinZR, kGCnYBinsZR, kGCfirstYBinZR, kGClastYBinZR, "", "");}
@@ -1676,7 +1683,7 @@ void AddHistograms(AliGammaConversionHistograms *histograms){
     if(kGCplotESDNoCutConversionMCXY == kTRUE){ histograms->AddHistogram("ESD_NoCutConversion_MC_XY" ,"" , kGCnXBinsXY, kGCfirstXBinXY, kGClastXBinXY, kGCnYBinsXY, kGCfirstYBinXY, kGClastYBinXY, "", "");}
                
                
-               
+    if(kGCplotESDMotherChi2 == kTRUE){ histograms->AddHistogram("ESD_Mother_Chi2","" , kGCnXBinsGammaChi2, kGCfirstXBinGammaChi2, kGClastXBinGammaChi2, "", "");}
     if(kGCplotESDMotherOpeningAngleGamma == kTRUE){ histograms->AddHistogram("ESD_Mother_GammaDaughter_OpeningAngle" ,"" , kGCnXBinsOpeningAngle, kGCfirstXBinOpeningAngle, kGClastXBinOpeningAngle, "", "");}
     if(kGCplotESDMotherEnergy == kTRUE){ histograms->AddHistogram("ESD_Mother_Energy" ,"" , kGCnXBinsEnergy, kGCfirstXBinEnergy, kGClastXBinEnergy, "", "");}
     if(kGCplotESDMotherPt == kTRUE){ histograms->AddHistogram("ESD_Mother_Pt" ,"" , kGCnXBinsPt, kGCfirstXBinPt, kGClastXBinPt, "", "");}
@@ -1823,6 +1830,8 @@ void AddHistograms(AliGammaConversionHistograms *histograms){
     if(kGCplotESDCutdedxSigmaPionLine == kTRUE){histograms->AddHistogram("ESD_CutdEdxSigmaPionLine_InvMass" ,"dedx PionLine" , kGCnXBinsGammaMass, kGCfirstXBinGammaMass, kGClastXBinGammaMass,"","");}
     if(kGCplotESDCutPionRejectionLowP==kTRUE){histograms->AddHistogram("ESD_CutPionRejectionLowP_InvMass" ,"dedx PionRejection LowP" , kGCnXBinsGammaMass, kGCfirstXBinGammaMass, kGClastXBinGammaMass,"","");}
     if(kGCplotESDCutKaonRejectionLowP==kTRUE){histograms->AddHistogram("ESD_CutKaonRejectionLowP_InvMass" ,"dedx KaonRejection LowP" , kGCnXBinsGammaMass, kGCfirstXBinGammaMass, kGClastXBinGammaMass,"","");}
+    if(kGCplotESDCutQtGammaSelection==kTRUE){histograms->AddHistogram("ESD_CutQt_InvMass","ESD_CutQt_InvMass",kGCnXBinsGammaMass, kGCfirstXBinGammaMass, kGClastXBinGammaMass,"","");}
+
     if(kGCplotESDCutProtonRejectionLowP==kTRUE){histograms->AddHistogram("ESD_CutProtonRejectionLowP_InvMass" ,"dedx ProtonRejection LowP" , kGCnXBinsGammaMass, kGCfirstXBinGammaMass, kGClastXBinGammaMass,"","");}
     if(kGCplotESDCutR == kTRUE){histograms->AddHistogram("ESD_CutR_InvMass" ,"Above RMax" , kGCnXBinsGammaMass, kGCfirstXBinGammaMass, kGClastXBinGammaMass,"","");}
     if(kGCplotESDCutNDF == kTRUE){histograms->AddHistogram("ESD_CutNDF_InvMass" ,"NDF <= 0" , kGCnXBinsGammaMass, kGCfirstXBinGammaMass, kGClastXBinGammaMass,"","");}
@@ -2099,7 +2108,7 @@ Int_t SetAnalysisCutSelection(TString analysisCutSelection){
   // set the cuts depending on the Cut Selection Id
   // first number is dummy always set to 9 
   //  const char* cutSelection = analysisCutSelection.Data(); 
-  if(analysisCutSelection.Length()!=12){
+  if(analysisCutSelection.Length()!=13){
     cout<<"Cut selection has the wrong length!"<<endl;
     return 0;
   }
@@ -2123,8 +2132,10 @@ Int_t SetAnalysisCutSelection(TString analysisCutSelection){
   Int_t etaCut=array[9];
   Int_t chi2MesonCut=array[10];
   Int_t LowPRejectionSigmaCut=array[11];
+  Int_t QtMaxCut=array[12];
 
-  cout<<"LowPRejectionSigmaCut"<<LowPRejectionSigmaCut<<endl;
+  cout<<"QtMaxCut:"<<QtMaxCut<<endl;
+  cout<<"LowPRejectionSigmaCut:"<<LowPRejectionSigmaCut<<endl;
   cout<<"chi2MesonCut: "<< chi2MesonCut<<endl;
   cout<<"etaCut: "<<etaCut<<endl;
   cout<<"clsTPCCut: "<<clsTPCCut<<endl;
@@ -2221,6 +2232,12 @@ Int_t SetAnalysisCutSelection(TString analysisCutSelection){
   case 2:  // 1.5 GeV
     kGCPIDMinPnSigmaAbovePionLine=1.5;
     break;
+  case 3:  // 20.0 GeV
+    kGCPIDMinPnSigmaAbovePionLine=20.;
+    break;
+  case 4:  // 50.0 GeV
+    kGCPIDMinPnSigmaAbovePionLine=50.;
+    break;
   default:
     return iResult;
   }
@@ -2347,6 +2364,25 @@ Int_t SetAnalysisCutSelection(TString analysisCutSelection){
   default:
     return iResult;
   }
+  switch(QtMaxCut){
+  case 0: //
+    kGCQtMax=1.;
+    break;
+  case 1:
+    kGCQtMax=0.1;
+    break;
+  case 2:
+    kGCQtMax=0.07;
+    break;
+  case 3:
+    kGCQtMax=0.05;
+    break;
+  case 4:
+    kGCQtMax=0.03;
+    break;
+  default:
+    return iResult;
+  }
 
   iResult=1;
   return iResult;
@@ -2369,6 +2405,7 @@ void string2array(const std::string& number, int a[c_array_size])
         ASSIGNARRAY(9);
         ASSIGNARRAY(10);
         ASSIGNARRAY(11);
+        ASSIGNARRAY(12);
   }
 }