fix for streamer and reading of external file
authorrbertens <rbertens@cern.ch>
Fri, 21 Nov 2014 14:36:52 +0000 (15:36 +0100)
committerrbertens <rbertens@cern.ch>
Fri, 21 Nov 2014 14:37:08 +0000 (15:37 +0100)
PWG/FLOW/Tasks/AliAnalysisTaskPIDconfig.cxx
PWG/FLOW/Tasks/AliAnalysisTaskPIDconfig.h
PWGCF/FLOW/macros/AddTaskPIDconfig.C

index ae7edd0..d2efc72 100644 (file)
@@ -97,7 +97,8 @@ fUseCentrality(kTRUE),
 fCutTPCmultiplicityOutliersAOD(kFALSE),
 fPIDcuts(kFALSE),
 fCentralityEstimator("V0M"),
-fContourCutList(0),
+fContoursFile(0),
+fCutContourList(0),
 fListQA(0x0),
 fListQAtpctof(0x0),
 fListQAInfo(0x0),
@@ -122,7 +123,10 @@ fHistdEdxvsPTPCafterPID(0)
 //fSparseSpecies(0),
 //fvalueSpecies(0)
 {
-    for(int i=0;i<150;i++){fContourCut[i]= NULL;}
+    for(int i=0;i<150;i++){
+        fCutContour[i]= NULL;
+        fCutGraph[i]=NULL;
+    }
 }
 
 
@@ -147,7 +151,8 @@ fUseCentrality(kTRUE),
 fCutTPCmultiplicityOutliersAOD(kFALSE),
 fPIDcuts(kFALSE),
 fCentralityEstimator("V0M"),
-fContourCutList(0),
+fContoursFile(0),
+fCutContourList(0),
 fListQA(0x0),
 fListQAtpctof(0x0),
 fListQAInfo(0x0),
@@ -172,9 +177,9 @@ fHistdEdxvsPTPCafterPID(0)
 //fSparseSpecies(0),
 //fvalueSpecies(0)
 {
-    //fvalueSpecies = new Double_t[9];
     //Default Constructor
-    //fContourCut[3][50]=NULL;
+    //fCutContour[150]=NULL;
+    //fCutGraph[150]=NULL;
     DefineInput(0,TChain::Class());
     DefineOutput(1,TList::Class());
 }
@@ -184,7 +189,12 @@ AliAnalysisTaskPIDconfig::~AliAnalysisTaskPIDconfig()
 {
     //Destructor
     
-    for(int i=0;i<150;i++){delete fContourCut[i];}
+    fContoursFile->Close();
+    for(int i=0;i<150;i++){
+        delete fCutContour[i];
+        delete fCutGraph[i];
+    }
+    
     
     //   delete fPID;
     //  delete fPIDqa;
@@ -449,7 +459,7 @@ void AliAnalysisTaskPIDconfig::UserExec(Option_t*){
                 if(fPIDcuts && pWithinRange){// for pions, kaons and protons only
                     if(ispecie==AliPID::kPion || ispecie==AliPID::kKaon || ispecie==AliPID::kProton){
                         int index = 50*i+p_bin;
-                        if(fContourCut[index]->IsInside(nSigmaTOF,nSigmaTPC)){
+                        if(fCutContour[index]->IsInside(nSigmaTOF,nSigmaTPC)){
                             TH3 *hist1 = (TH3*)fListQAtpctof->At(ispecie);
                             if (hist1){
                                 hist1->Fill(nSigmaTPC,nSigmaTOF,p);}
@@ -468,7 +478,16 @@ void AliAnalysisTaskPIDconfig::UserExec(Option_t*){
                         }
                     }
                 }
-               
+                if(!fPIDcuts){
+                    TH3 *hist1 = (TH3*)fListQAtpctof->At(ispecie);
+                    if (hist1){
+                        hist1->Fill(nSigmaTPC,nSigmaTOF,p);}
+                    
+                    TH3 *hist2 = (TH3*)fListQAtpctof->At(ispecie+AliPID::kSPECIESC);
+                    if (hist2){
+                        hist2->Fill(nSigmaTPC,nSigmaTOF,pT);}
+                    
+                }
             }
         }//probMis
         
@@ -497,10 +516,11 @@ void AliAnalysisTaskPIDconfig::CheckCentrality(AliVEvent* event, Bool_t &central
 //______________________________________________________________________________
 void AliAnalysisTaskPIDconfig::GetPIDContours()
 {
-    if(fContourCutList){cout<<"+++++++++++++++++The contour file has been retrieved+++++++++++++++++++"<<endl;}
+    fContoursFile = new TFile(Form("$ALICE_ROOT/PWGCF/FLOW/database/PIDCutContours_%i-%i.root",fCentralityPercentileMin,fCentralityPercentileMax));
     
-    TGraph *CutGraph[150];
-    //TCutG *cut[3][10];
+    fCutContourList=(TDirectory*)fContoursFile->Get("Filterbit1");
+    if(!fCutContourList){printf("The contour file is empty"); return;}
+
     Double_t pBinning[50];
     for(int b=0;b<50;b++){pBinning[b]=b;}
     TString species[3] = {"pion","kaon","proton"};
@@ -508,19 +528,18 @@ void AliAnalysisTaskPIDconfig::GetPIDContours()
     for(int i=0;i<150;i++){
         int ispecie = i/50;
         int iPbin = i%50;
-        TList *Species_contours = (TList*)fContourCutList->Get(species[ispecie]);
-        if(Species_contours){cout<<"Species_contours exists"<<endl;}
+        TList *Species_contours = (TList*)fCutContourList->Get(species[ispecie]);
+        //if(Species_contours){cout<<"Species_contours exists"<<endl;}
         
         TString Graph_Name = "contourlines_";
         Graph_Name += species[ispecie];
         Graph_Name += Form("%.f%.f-%i%icent",pBinning[iPbin],pBinning[iPbin]+1,fCentralityPercentileMin,fCentralityPercentileMax);
-        cout<<Graph_Name<<endl;
-        CutGraph[i] = (TGraph*)Species_contours->FindObject(Graph_Name);
+        //cout<<Graph_Name<<endl;
+        fCutGraph[i] = (TGraph*)Species_contours->FindObject(Graph_Name);
         
-        if(!CutGraph[i]){cout<<"Contour Graph does not exist"<<endl; continue;}
+        if(!fCutGraph[i]){cout<<"Contour Graph does not exist"<<endl; continue;}
         
-        fContourCut[i] = new TCutG(Graph_Name.Data(),CutGraph[i]->GetN(),CutGraph[i]->GetX(),CutGraph[i]->GetY());
-        if(!fContourCut[i]){cout<<"i = "<<i<<endl;}
+        fCutContour[i] = new TCutG(Graph_Name.Data(),fCutGraph[i]->GetN(),fCutGraph[i]->GetX(),fCutGraph[i]->GetY());
         
     }
     
index 0e614d0..0ddc8e4 100644 (file)
@@ -62,7 +62,7 @@ public:
     void CheckCentrality(AliVEvent *event,Bool_t &centralitypass); //to use only events with the correct centrality....
     void SetCuts(Bool_t b){fPIDcuts = b;}
     //void MultiplicityOutlierCut(AliVEvent *event,Bool_t &centralitypass,Int_t ntracks);
-    void SetPIDcontoursList(TDirectory* b){fContourCutList = b;}
+    void SetPIDcontoursList(TDirectory* b){fCutContourList = b;}
     //TGraph* GetPIDcontours(TString specie, Double_t Plow, Double_t Phigh,Int_t centMin, Int_t centMax){}
     void GetPIDContours();
     
@@ -71,46 +71,48 @@ protected:
     
     
 private:
-    AliVEvent             *fVevent;
-    AliESDEvent           *fESD;
-    AliAODEvent           *fAOD;
-    AliPIDResponse        *fPIDResponse;             //! PID response Handler
-    Int_t                  fTriggerSelection;
-    Int_t                  fCentralityPercentileMin;
-    Int_t                  fCentralityPercentileMax;
-    Double_t               fFilterBit;
-    Double_t               fDCAxyCut;
-    Double_t               fDCAzCut;
-    Bool_t                 fData2011;
-    Bool_t                 fTriggerMB;
-    Bool_t                 fTriggerCentral;
-    Bool_t                 fUseCentrality;
-    Bool_t                 fCutTPCmultiplicityOutliersAOD;
-    Bool_t                 fPIDcuts;
-    TString                fCentralityEstimator;   //"V0M","TRK","TKL","ZDC","FMD"
-    TDirectory            *fContourCutList;
-    TList                 *fListQA;           // List of all lists
-    TList                 *fListQAtpctof;     //! List with combined PID from TPC + TOF
-    TList                 *fListQAInfo;
-    TH1F                  *fhistCentralityPass;
-    TH1F                  *fNoEvents;
-    TH1F                  *fpVtxZ;
-    TH2F                  *fhistDCABefore;
-    TH2F                  *fhistDCAAfter;
-    TH1F                  *fhistPhiDistBefore;
-    TH1F                  *fhistPhiDistAfter;
-    TH1F                  *fhistEtaDistBefore;
-    TH1F                  *fhistEtaDistAfter;
-    TH2F                  *fTPCvsGlobalMultBeforeOutliers;
-    TH2F                  *fTPCvsGlobalMultAfterOutliers;
-    TH2F                  *fTPCvsGlobalMultAfter;
-    TH2F                  *fHistBetavsPTOFbeforePID;
-    TH2F                  *fHistdEdxvsPTPCbeforePID;
-    TH3F                  *fhistNsigmaP;
-    TH3F                  *fhistNsigmaPt;
-    TH2F                  *fHistBetavsPTOFafterPID;
-    TH2F                  *fHistdEdxvsPTPCafterPID;
-    TCutG                 *fContourCut[150];
+    AliVEvent             *fVevent;             //! event
+    AliESDEvent           *fESD;                //! esd
+    AliAODEvent           *fAOD;                //! aod
+    AliPIDResponse        *fPIDResponse;        //! PID response Handler
+    Int_t                  fTriggerSelection;   // trigger selection
+    Int_t                  fCentralityPercentileMin;    // min centrality
+    Int_t                  fCentralityPercentileMax;    // max cen
+    Double_t               fFilterBit;                  // filterbit
+    Double_t               fDCAxyCut;           // dca cut
+    Double_t               fDCAzCut;            // dcz z
+    Bool_t                 fData2011;           // 2011 data
+    Bool_t                 fTriggerMB;          // minB trigger
+    Bool_t                 fTriggerCentral;     // cen trigger
+    Bool_t                 fUseCentrality;      // use centrality
+    Bool_t                 fCutTPCmultiplicityOutliersAOD;      // do outlier cut
+    Bool_t                 fPIDcuts;            // pid cuts
+    TString                fCentralityEstimator;// cen estimator "V0M","TRK","TKL","ZDC","FMD"
+    TFile                 *fContoursFile;       //! contours file
+    TDirectory            *fCutContourList;     //! contour list
+    TList                 *fListQA;             //! List of all lists
+    TList                 *fListQAtpctof;       //! List with combined PID from TPC + TOF
+    TList                 *fListQAInfo;         //! list q ainfo
+    TH1F                  *fhistCentralityPass; //! cen histo   
+    TH1F                  *fNoEvents;           //! event no    
+    TH1F                  *fpVtxZ;              //! v vertex no
+    TH2F                  *fhistDCABefore;      //! dca after hist
+    TH2F                  *fhistDCAAfter;       //! another hist
+    TH1F                  *fhistPhiDistBefore;  //! another hist
+    TH1F                  *fhistPhiDistAfter;   //! another hist
+    TH1F                  *fhistEtaDistBefore;  //! another hist
+    TH1F                  *fhistEtaDistAfter;   //! another hist
+    TH2F                  *fTPCvsGlobalMultBeforeOutliers;      //! another hist
+    TH2F                  *fTPCvsGlobalMultAfterOutliers;       //! another hist
+    TH2F                  *fTPCvsGlobalMultAfter;       //! another hist
+    TH2F                  *fHistBetavsPTOFbeforePID;    //! another hist
+    TH2F                  *fHistdEdxvsPTPCbeforePID;    //! another hist
+    TH3F                  *fhistNsigmaP;        //! another hist
+    TH3F                  *fhistNsigmaPt;       //! another hist
+    TH2F                  *fHistBetavsPTOFafterPID;     //! another hist
+    TH2F                  *fHistdEdxvsPTPCafterPID;     //! another hist
+    TCutG                 *fCutContour[150];    //! another hist
+    TGraph                *fCutGraph[150];      //! grpahs
     
     
     //qa object initialisation
@@ -121,7 +123,7 @@ private:
     AliAnalysisTaskPIDconfig(const AliAnalysisTaskPIDconfig &other);
     AliAnalysisTaskPIDconfig& operator=(const AliAnalysisTaskPIDconfig &other);
     
-    ClassDef(AliAnalysisTaskPIDconfig,2)  // Task to properly set the PID response functions of all detectors
+    ClassDef(AliAnalysisTaskPIDconfig,3)  // Task to properly set the PID response functions of all detectors
 };
 
 #endif
index 2a70c11..70a5a11 100644 (file)
@@ -57,17 +57,6 @@ void AddTaskPIDconfig(Int_t CentralityTriggerSelection = AliVEvent::kMB, Double_
         pidTask[i]->SetDCAxyCut(10);
         pidTask[i]->SetDCAzCut(10);
         pidTask[i]->SetCuts(PIDcuts);
-        if(PIDcuts){
-            
-            TFile *ContoursFile = new TFile(Form("$ALICE_ROOT/PWGCF/FLOW/database/PIDCutContours_%.f-%.f.root",centrMin[icentr],centrMax[icentr]));
-
-            Contourlist = new TDirectory;
-            Contourlist=(TDirectory*)ContoursFile->Get("Filterbit1");
-            if(!Contourlist){printf("The contour file is empty"); continue;}
-    
-            pidTask[i]->SetPIDcontoursList(Contourlist);
-            
-        }
         
         mgr->AddTask(pidTask[i]);
         
@@ -80,4 +69,4 @@ void AddTaskPIDconfig(Int_t CentralityTriggerSelection = AliVEvent::kMB, Double_
         //return pidTask[icentr];
 
     }
-}
+}
\ No newline at end of file