]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Added some features: 1) 4D (DPhi, DEta, TOF TPC) correlation histograms can now be...
authormiweber <miweber@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 30 May 2013 12:00:29 +0000 (12:00 +0000)
committermiweber <miweber@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 30 May 2013 12:00:29 +0000 (12:00 +0000)
PWGCF/Correlations/DPhi/DiHadronPID/AliAnalysisTaskDiHadronPID.cxx
PWGCF/Correlations/DPhi/DiHadronPID/AliAnalysisTaskDiHadronPID.h
PWGCF/Correlations/macros/DiHadronPID/AddTaskDiHadronPID.C

index a3ea37689b1fe2ddaec6cb32c65cb97d008ebd48..fb0e85046d25821ab62ae47d7fc58c467e6b5a8a 100644 (file)
@@ -101,8 +101,10 @@ AliAnalysisTaskDiHadronPID::AliAnalysisTaskDiHadronPID():
        fLvsEta(0x0),
        fLvsEtaProjections(0x0),        
        fMakeTOFcorrelations(kTRUE),
-       fMakeTOFTPCcorrelations(kFALSE)
-       //fDebug(0)
+       fMakeTOFTPCcorrelationsPi(kFALSE),
+       fMakeTOFTPCcorrelationsKa(kFALSE),
+       fMakeTOFTPCcorrelationsPr(kFALSE),      
+       fTOFIntervalFactorTOFTPC(1.)
 
 {
 
@@ -150,8 +152,10 @@ AliAnalysisTaskDiHadronPID::AliAnalysisTaskDiHadronPID(const char* name):
        fLvsEta(0x0),
        fLvsEtaProjections(0x0),
        fMakeTOFcorrelations(kTRUE),
-       fMakeTOFTPCcorrelations(kFALSE)                                                 
-       //fDebug(0) 
+       fMakeTOFTPCcorrelationsPi(kFALSE),
+       fMakeTOFTPCcorrelationsKa(kFALSE),
+       fMakeTOFTPCcorrelationsPr(kFALSE),      
+       fTOFIntervalFactorTOFTPC(1.)
 
 {
 
@@ -326,7 +330,7 @@ void AliAnalysisTaskDiHadronPID::UserCreateOutputObjects() {
        }
 
        // Create TOF/TPC correlation histograms. (DPhi,DEta,TOF,TPC).
-       if (fMakeTOFTPCcorrelations) {
+       if (fMakeTOFTPCcorrelationsPi || fMakeTOFTPCcorrelationsKa || fMakeTOFTPCcorrelationsPr) {
 
                Double_t ptarrayTOFTPC[16] = {2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 
                                                                          2.8, 3.0, 3.2, 3.4, 3.6, 3.8, 
@@ -354,13 +358,6 @@ void AliAnalysisTaskDiHadronPID::UserCreateOutputObjects() {
                        nptbins, ptarrayTOFTPC);
                fOutputList->Add(fMixedEventsTOFTPCbins);
 
-               Int_t NBinsTOFTPC[4] = {32, 32, 60, 40};
-               Double_t minTOFTPC[4] = {-TMath::Pi()/2., -1.6, -1., -1.};
-               Double_t maxTOFTPC[4] = {3.*TMath::Pi()/2., 1.6, -1., -1.};
-
-               Double_t sTOFest = 110.;
-               Double_t sTPCest = 4.5;
-
                fTOFTPChistos = new TObjArray(3);
                fTOFTPChistos->SetOwner(kTRUE);
                fTOFTPChistos->SetName("CorrelationsTOFTPC");
@@ -373,6 +370,8 @@ void AliAnalysisTaskDiHadronPID::UserCreateOutputObjects() {
 
                for (Int_t iSpecies = 0; iSpecies < 3; iSpecies++) {
 
+                       // Create the directory structure Pion, Kaon, Proton, regardless
+                       // of wether the histograms are created (to keep the order.)
                        TObjArray* TOFTPChistosTmp = new TObjArray(fTOFTPCPtAxis->GetNbins());
                        TOFTPChistosTmp->SetOwner(kTRUE);
                        TOFTPChistosTmp->SetName(speciesname[iSpecies].Data());
@@ -384,67 +383,80 @@ void AliAnalysisTaskDiHadronPID::UserCreateOutputObjects() {
                                TOFTPCmismatchTmp->SetName(speciesname[iSpecies].Data());       
                        }
 
-                       for (Int_t iBinPt = 1; iBinPt < (fTOFTPCPtAxis->GetNbins() + 1); iBinPt++) {
-               
-                               // Determine PID ranges.
-
-                               // Set range +/- 5 sigma of main peak. (+ 10 sigma for TOF max, for mismatches.)
-                               Double_t TOFmin = -5. * sTOFest;
-                               Double_t TOFmax = 10. * sTOFest;
-                               Double_t TPCmin = -4. * sTPCest;
-                               Double_t TPCmax = 4. * sTPCest;
-
-                               Double_t TOFexp = AliFunctionsDiHadronPID::TOFExpTime(fTOFTPCPtAxis->GetBinLowEdge(iBinPt), 0.4,  AliFunctionsDiHadronPID::M(iSpecies));
-                               Double_t TPCexp = AliFunctionsDiHadronPID::TPCExpdEdX(fTOFTPCPtAxis->GetBinLowEdge(iBinPt), 0.4,  AliFunctionsDiHadronPID::M(iSpecies));
-
-                               for (Int_t jSpecies = 0; jSpecies < 3; jSpecies++) {
-
-                                       if (iSpecies == jSpecies) {continue;}
-
-                                       Double_t TOFexpOther = AliFunctionsDiHadronPID::TOFExpTime(fTOFTPCPtAxis->GetBinLowEdge(iBinPt), 0.4,  AliFunctionsDiHadronPID::M(jSpecies));
-                                       Double_t TPCexpOther = AliFunctionsDiHadronPID::TPCExpdEdX(fTOFTPCPtAxis->GetBinLowEdge(iBinPt), 0.4,  AliFunctionsDiHadronPID::M(jSpecies));
-                               
-                                       // If any peak is within +/- 7 sigma, then also add this peak.
-                                       if ( (TMath::Abs(TOFexp - TOFexpOther) < 7. * sTOFest) ||
-                                                (TMath::Abs(TPCexp - TPCexpOther) < 7. * sTPCest) ) {
+                       // Only Create the TOF/TPC histograms when requested.
+                       Bool_t MakeTOFTPCcorrelations[3] = {fMakeTOFTPCcorrelationsPi, fMakeTOFTPCcorrelationsKa, fMakeTOFTPCcorrelationsPr};
+                       if (MakeTOFTPCcorrelations[iSpecies]) {
+                               for (Int_t iBinPt = 1; iBinPt < (fTOFTPCPtAxis->GetNbins() + 1); iBinPt++) {
+                       
+                                       // Approximate resolutions of TOF and TPC detector.
+                                       const Double_t sTOFest = 110.;
+                                       const Double_t sTPCest = 4.5;
+                                       
+                                       // Set range +/- 5 sigma of main peak. (+ 10 sigma for TOF max, for mismatches.)
+                                       Double_t TOFmin = -5. * sTOFest;
+                                       Double_t TOFmax = 10. * sTOFest;
+                                       Double_t TPCmin = -4. * sTPCest;
+                                       Double_t TPCmax = 4. * sTPCest;
+
+                                       Double_t TOFexp = AliFunctionsDiHadronPID::TOFExpTime(fTOFTPCPtAxis->GetBinLowEdge(iBinPt), 0.4,  AliFunctionsDiHadronPID::M(iSpecies));
+                                       Double_t TPCexp = AliFunctionsDiHadronPID::TPCExpdEdX(fTOFTPCPtAxis->GetBinLowEdge(iBinPt), 0.4,  AliFunctionsDiHadronPID::M(iSpecies));
+
+                                       for (Int_t jSpecies = 0; jSpecies < 3; jSpecies++) {
+
+                                               if (iSpecies == jSpecies) {continue;}
+
+                                               Double_t TOFexpOther = AliFunctionsDiHadronPID::TOFExpTime(fTOFTPCPtAxis->GetBinLowEdge(iBinPt), 0.4,  AliFunctionsDiHadronPID::M(jSpecies));
+                                               Double_t TPCexpOther = AliFunctionsDiHadronPID::TPCExpdEdX(fTOFTPCPtAxis->GetBinLowEdge(iBinPt), 0.4,  AliFunctionsDiHadronPID::M(jSpecies));
+                                       
+                                               // If any peak is within +/- 7 sigma, then also add this peak.
+                                               if ( (TMath::Abs(TOFexp - TOFexpOther) < 7. * sTOFest) ||
+                                                        (TMath::Abs(TPCexp - TPCexpOther) < 7. * sTPCest) ) {
+
+                                                       TOFmin = TMath::Min(TOFmin, (TOFexpOther - TOFexp - 2. * sTOFest) );
+                                                       TOFmax = TMath::Max(TOFmax, (TOFexpOther - TOFexp + 10. * sTOFest) );
+                                                       TPCmin = TMath::Min(TPCmin, (TPCexpOther - TPCexp - 2. * sTPCest) );
+                                                       TPCmax = TMath::Max(TPCmax, (TPCexpOther - TPCexp + 2. * sTPCest) );                                            
 
-                                               TOFmin = TMath::Min(TOFmin, (TOFexpOther - TOFexp - 2. * sTOFest) );
-                                               TOFmax = TMath::Max(TOFmax, (TOFexpOther - TOFexp + 10. * sTOFest) );
-                                               TPCmin = TMath::Min(TPCmin, (TPCexpOther - TPCexp - 2. * sTPCest) );
-                                               TPCmax = TMath::Max(TPCmax, (TPCexpOther - TPCexp + 2. * sTPCest) );                                            
+                                               }
 
                                        }
 
-                               }
-
-                               minTOFTPC[2] = TOFmin;
-                               maxTOFTPC[2] = TOFmax;
-                               minTOFTPC[3] = TPCmin;
-                               maxTOFTPC[3] = TPCmax;
-
-                               THnF* htmp = new THnF(Form("fCorrelationsTOFTPC_%i",iBinPt),
-                                       Form("%5.3f < p_{T} < %5.3f", fTOFTPCPtAxis->GetBinLowEdge(iBinPt), fTOFTPCPtAxis->GetBinUpEdge(iBinPt)), 
-                                       4, NBinsTOFTPC, minTOFTPC, maxTOFTPC);
-
-                               (htmp->GetAxis(0))->SetTitle("#Delta#phi");
-                               (htmp->GetAxis(1))->SetTitle("#Delta#eta");
-                               (htmp->GetAxis(2))->SetTitle("t_{TOF} (ps)");
-                               (htmp->GetAxis(3))->SetTitle("dE/dx (a.u.)");
-
-                               TOFTPChistosTmp->Add(htmp);
-
-                               if (fCalculateMismatch) { 
-                                       // Mismatch histogram.
-                                       TH2F* htmp2 = new TH2F(Form("fMismatchTOFTPC_%i",iBinPt),
-                                               Form("%5.3f < p_{T} < %5.3f; t_{TOF} (ps); dE/dx (a.u.)", fTOFTPCPtAxis->GetBinLowEdge(iBinPt), fTOFTPCPtAxis->GetBinUpEdge(iBinPt)), 
-                                               NBinsTOFTPC[2], TOFmin, TOFmax, NBinsTOFTPC[3], TPCmin, TPCmax);
-                                       htmp2->SetDirectory(0);
-
-                                       TOFTPCmismatchTmp->Add(htmp2);
-       
-                               }
-
-                       }
+                                       // With the standard TOF range, fitting the deuterons and the TOF mismatches is
+                                       // hard. This flag doubles the range of the TOF axis in the TOF/TPC histograms,
+                                       // while leaving the resolution the same. Turning on this flag will greatly increase
+                                       // the memory consumption of the task, to the point that it's probably too much 
+                                       // to save a Buffer with all three species included.
+                                       Double_t TOFreach = TOFmax - TOFmin;
+                                       TOFmax += (TOFreach * (fTOFIntervalFactorTOFTPC - 1.));
+                                       Int_t TOFbins = (60. * fTOFIntervalFactorTOFTPC);
+
+                                       Int_t NBinsTOFTPC[4] = {32, 32, TOFbins, 40};
+                                       Double_t minTOFTPC[4] = {-TMath::Pi()/2., -1.6, TOFmin, TPCmin};
+                                       Double_t maxTOFTPC[4] = {3.*TMath::Pi()/2., 1.6, TOFmax, TPCmax};
+
+                                       THnF* htmp = new THnF(Form("fCorrelationsTOFTPC_%i",iBinPt),
+                                               Form("%5.3f < p_{T} < %5.3f", fTOFTPCPtAxis->GetBinLowEdge(iBinPt), fTOFTPCPtAxis->GetBinUpEdge(iBinPt)), 
+                                               4, NBinsTOFTPC, minTOFTPC, maxTOFTPC);
+
+                                       (htmp->GetAxis(0))->SetTitle("#Delta#phi");
+                                       (htmp->GetAxis(1))->SetTitle("#Delta#eta");
+                                       (htmp->GetAxis(2))->SetTitle("t_{TOF} (ps)");
+                                       (htmp->GetAxis(3))->SetTitle("dE/dx (a.u.)");
+
+                                       TOFTPChistosTmp->Add(htmp);
+
+                                       if (fCalculateMismatch) { 
+                                               // Mismatch histogram.
+                                               TH2F* htmp2 = new TH2F(Form("fMismatchTOFTPC_%i",iBinPt),
+                                                       Form("%5.3f < p_{T} < %5.3f; t_{TOF} (ps); dE/dx (a.u.)", fTOFTPCPtAxis->GetBinLowEdge(iBinPt), fTOFTPCPtAxis->GetBinUpEdge(iBinPt)), 
+                                                       NBinsTOFTPC[2], TOFmin, TOFmax, NBinsTOFTPC[3], TPCmin, TPCmax);
+                                               htmp2->SetDirectory(0);
+
+                                               TOFTPCmismatchTmp->Add(htmp2);
+               
+                                       }
+                               } // End loop over pT bins.
+                       } // End species if.
 
                        fTOFTPChistos->Add(TOFTPChistosTmp);
                        if (fCalculateMismatch) {fTOFTPCmismatch->Add(TOFTPCmismatchTmp);}
@@ -545,10 +557,13 @@ void AliAnalysisTaskDiHadronPID::UserExec(Option_t*) {
                                        }
                                }
 
-                               if (fMakeTOFTPCcorrelations) { 
+                               Bool_t MakeTOFTPCcorrelations[3] = {fMakeTOFTPCcorrelationsPi, fMakeTOFTPCcorrelationsKa, fMakeTOFTPCcorrelationsPr};
+                               if (fMakeTOFTPCcorrelationsPi || fMakeTOFTPCcorrelationsKa || fMakeTOFTPCcorrelationsPr) { 
 
                                        for (Int_t iSpecies = 0; iSpecies < 3; iSpecies++) {
 
+                                               if (!MakeTOFTPCcorrelations[iSpecies]) {continue;}
+
                                                TObjArray* atmp = (TObjArray*)fTOFTPCmismatch->At(iSpecies);
                                                Int_t ptbin = fTOFTPCPtAxis->FindBin(apt);
 
@@ -584,13 +599,13 @@ void AliAnalysisTaskDiHadronPID::UserExec(Option_t*) {
                        if (fCorrelationsTOFbins) fCorrelationsTOFbins->Fill(DPhi,DEta,associatedtrack->Pt());
                        if (fCorrelationsTOFTPCbins) fCorrelationsTOFTPCbins->Fill(DPhi,DEta,associatedtrack->Pt());
 
-                       for (Int_t iSpecies = 0; iSpecies < 3; iSpecies++) {
-
-                               Double_t apt = associatedtrack->Pt();
+                       Double_t apt = associatedtrack->Pt();
 
-                               // Fill TOF correlations.
-                               if (fMakeTOFcorrelations) {
+                       // Fill TOF correlations.
+                       if (fMakeTOFcorrelations) {
                                
+                               for (Int_t iSpecies = 0; iSpecies < 3; iSpecies++) {
+
                                        TObjArray* atmp = (TObjArray*)fTOFhistos->At(iSpecies);
                                        Int_t ptbin = fTOFPtAxis->FindBin(apt);
 
@@ -602,9 +617,15 @@ void AliAnalysisTaskDiHadronPID::UserExec(Option_t*) {
 
                                        }
                                }
+                       }
+
+                       // Fill TOF/ TPC Correlations.
+                       Bool_t MakeTOFTPCcorrelations[3] = {fMakeTOFTPCcorrelationsPi, fMakeTOFTPCcorrelationsKa, fMakeTOFTPCcorrelationsPr};
+                       if (fMakeTOFTPCcorrelationsPi || fMakeTOFTPCcorrelationsKa || fMakeTOFTPCcorrelationsPr) { 
 
-                               // Fill TOF/ TPC Correlations.
-                               if (fMakeTOFTPCcorrelations) {
+                               for (Int_t iSpecies = 0; iSpecies < 3; iSpecies++) {
+
+                                       if (!MakeTOFTPCcorrelations[iSpecies]) {continue;}
 
                                        TObjArray* atmp = (TObjArray*)fTOFTPChistos->At(iSpecies);
                                        Int_t ptbin = fTOFTPCPtAxis->FindBin(apt);
@@ -619,8 +640,8 @@ void AliAnalysisTaskDiHadronPID::UserExec(Option_t*) {
                                                htmp->Fill(TOFTPCfill);
 
                                        }                               
-                               }
-                       }
+                               }       
+                       }               
                }
        }
 
index e41cdfdb20aae7df20c5735d708c3fc5995b8269..0d0bd7dcbedc4d781f49c4296e410c72aa9cc548 100644 (file)
@@ -45,11 +45,13 @@ public:
     void SetPoolSize(Int_t poolsize) {fPoolSize = poolsize;}
     void SetMixEvents(Bool_t mixevents = kTRUE) {fMixEvents = mixevents;}
     void SetMixTriggers(Bool_t mixtriggers = kTRUE) {fMixTriggers = mixtriggers;}
-       //void SetDebugLevel(Int_t debuglevel) {fDebug = debuglevel;}
 
        void SetCalculateMismatch(Bool_t calcmismatch) {fCalculateMismatch = calcmismatch;}
        void SetMakeTOFCorrelations(Bool_t makeTOF) {fMakeTOFcorrelations = makeTOF;}
-       void SetMakeTOFTPCCorrelations(Bool_t makeTOFTPC) {fMakeTOFTPCcorrelations = makeTOFTPC;}
+       void SetMakeTOFTPCCorrelationsPi(Bool_t makeTOFTPC) {fMakeTOFTPCcorrelationsPi = makeTOFTPC;}
+       void SetMakeTOFTPCCorrelationsKa(Bool_t makeTOFTPC) {fMakeTOFTPCcorrelationsKa = makeTOFTPC;}
+       void SetMakeTOFTPCCorrelationsPr(Bool_t makeTOFTPC) {fMakeTOFTPCcorrelationsPr = makeTOFTPC;}           
+       void SetTOFIntervalFactorTOFTPC(Double_t factor = 1.) {fTOFIntervalFactorTOFTPC = factor;}
 
        // Getters.
        Int_t GetNDEtaBins() const {return fNDEtaBins;}
@@ -59,11 +61,13 @@ public:
        Int_t GetPoolSize() const {return fPoolSize;}
        Bool_t GetMixEvents() const {return fMixEvents;}
        Bool_t GetMixTriggers() const {return fMixTriggers;}
-       //Int_t GetDebugLevel() const {return fDebug;}  
 
        Bool_t GetCalculateMismatch() const {return fCalculateMismatch;}
        Bool_t GetMakeTOFCorrelations() const {return fMakeTOFcorrelations;}
-       Bool_t GetMakeTOFTPCCorrelations() const {return fMakeTOFTPCcorrelations;}
+       Bool_t GetMakeTOFTPCCorrelationsPi() const {return fMakeTOFTPCcorrelationsPi;}
+       Bool_t GetMakeTOFTPCCorrelationsKa() const {return fMakeTOFTPCcorrelationsKa;}
+       Bool_t GetMakeTOFTPCCorrelationsPr() const {return fMakeTOFTPCcorrelationsPr;}          
+       Double_t GetTOFIntervalFactorTOFTPC() const {return fTOFIntervalFactorTOFTPC;}
 
 private:
        //void FillGlobalTracksArray();
@@ -130,8 +134,10 @@ private:
 
        // Flags.
        Bool_t                                                  fMakeTOFcorrelations;           //
-       Bool_t                                                  fMakeTOFTPCcorrelations;        //
-       //Int_t                                                 fDebug;                                         // Debug flag.
+       Bool_t                                                  fMakeTOFTPCcorrelationsPi;      //
+       Bool_t                                                  fMakeTOFTPCcorrelationsKa;      //
+       Bool_t                                                  fMakeTOFTPCcorrelationsPr;      //
+       Double_t                                                fTOFIntervalFactorTOFTPC;       // Makes the TOF interval longer while keeping the resolution constant.
 
        ClassDef(AliAnalysisTaskDiHadronPID, 3);
 
index 0f2a76dfbc0ee00a1731a3474c01c357cf11d67c..df5fe78e8523398b3234d07dd44cde37e576fc7a 100644 (file)
@@ -22,7 +22,10 @@ AliAnalysisTaskDiHadronPID* AddTaskDiHadronPID(
        Bool_t isMC = kFALSE,
        Int_t DebugLevel = 0,
        Bool_t MakeTOFCorrelations = kTRUE,
-       Bool_t MakeTOFTPCCorrelations = kFALSE,
+       Bool_t MakeTOFTPCCorrelationsPi = kFALSE,
+       Bool_t MakeTOFTPCCorrelationsKa = kFALSE,
+       Bool_t MakeTOFTPCCorrelationsPr = kFALSE,               
+       Double_t TOFIntervalFactorTOFTPC = 1.,
        const char* outputFileName = 0,
        const char* containerName = "DiHadronPID",
        const char* folderName = "PWGCF_DiHadronPID")
@@ -48,7 +51,10 @@ AliAnalysisTaskDiHadronPID* AddTaskDiHadronPID(
     DiHadronPIDTask->SetMixTriggers(MixTriggers);
     DiHadronPIDTask->SetDebugLevel(DebugLevel);
     DiHadronPIDTask->SetMakeTOFCorrelations(MakeTOFCorrelations);
-    DiHadronPIDTask->SetMakeTOFTPCCorrelations(MakeTOFTPCCorrelations);
+    DiHadronPIDTask->SetMakeTOFTPCCorrelationsPi(MakeTOFTPCCorrelationsPi);
+    DiHadronPIDTask->SetMakeTOFTPCCorrelationsKa(MakeTOFTPCCorrelationsKa);
+    DiHadronPIDTask->SetMakeTOFTPCCorrelationsPr(MakeTOFTPCCorrelationsPr);        
+    DiHadronPIDTask->SetTOFIntervalFactorTOFTPC(TOFIntervalFactorTOFTPC);
 
     // Configure and add Event Cuts.
        AliAODEventCutsDiHadronPID* eventcuts = new AliAODEventCutsDiHadronPID("EventCuts");