]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/SPECTRA/Nuclei/B2/macros/AddTaskB2.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / Nuclei / B2 / macros / AddTaskB2.C
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 // Add task B2
17 // author: Eulogio Serradilla <eulogio.serradilla@cern.ch>
18
19 AliAnalysisTaskB2* AddTaskB2(  const TString& species
20                              , const TString& containername
21                              , const TString& trksel
22                              , Int_t pidProc
23                              , const TString& periodname
24                              , Bool_t   simulation       = kFALSE
25                              , Bool_t   heavyIons        = kFALSE
26                              , Double_t maxDCAxy         = 1
27                              , Double_t maxDCAz          = 2
28                              , Double_t maxEta           = 0.8
29                              , Double_t maxY             = 0.5
30                              , Bool_t ntrkMultTrigger    = 0
31                              , Double_t minKNOmult       = -10
32                              , Double_t maxKNOmult       = 10000
33                              , Bool_t   V0AND            = kFALSE
34                              , const TString& ztag       = ""
35                              , Double_t maxVz            = 10
36                              , Bool_t momentumCorr       = kFALSE
37                              , const TString& binSize    = ""
38                              , Bool_t xRowsTPC           = 0
39                              , Int_t minTPCnClsOrXRows   = 70
40                              , Double_t minCentrality    = 0
41                              , Double_t maxCentrality    = 20
42                              , Double_t minM2            = 2.
43                              , Double_t maxM2            = 6.)
44 {
45 //
46 // Create, configure and add the analysis task to the analysis manager
47 //
48         using namespace std;
49         
50         // sample config
51         
52         const Double_t kMaxVx     = 1.;
53         const Double_t kMaxVy     = 1.;
54         
55         const Double_t kMaxNSigma = 3.;
56         
57         const Int_t kMaxNSigmaITS = 3;
58         const Int_t kMaxNSigmaTPC = 3;
59         const Int_t kMaxNSigmaTOF = 3;
60         
61         TString period = periodname;
62         period.ToLower();
63         
64         // Get pointer to the existing analysis manager
65         
66         AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
67         if (!mgr)
68         {
69                 cerr << "AddTaskB2: no analysis manager to connect to" << endl;
70                 return 0;
71         }
72         
73         if (!mgr->GetInputEventHandler())
74         {
75                 cerr << "AddTaskB2: this task requires an input event handler" << endl;
76                 return 0;
77         }
78         
79         // Create and configure the task
80         
81         AliAnalysisTaskB2* task = new AliAnalysisTaskB2(Form("B2.%s",containername.Data()));
82         
83         task->SetParticleSpecies(species);
84         task->SetSimulation(simulation);
85         task->SetHeavyIons(heavyIons);
86         task->SetV0ANDtrigger(V0AND);
87         
88         task->SetMaxNSigmaITS(kMaxNSigmaITS);
89         task->SetMaxNSigmaTPC(kMaxNSigmaTPC);
90         task->SetMaxNSigmaTOF(kMaxNSigmaTOF);
91         
92         task->SetNtrkMultTrigger(ntrkMultTrigger);
93         
94         gROOT->LoadMacro("$ALICE_ROOT/PWGLF/SPECTRA/Nuclei/B2/macros/MeanNtrk.C");
95         Double_t meanNtrk = MeanNtrk(period, maxEta, V0AND);
96         
97         task->SetMeanNtrk(meanNtrk);
98         task->SetKNOmultInterval(minKNOmult, maxKNOmult);
99         task->SetVertexXInterval(-kMaxVx, kMaxVx);
100         task->SetVertexYInterval(-kMaxVy, kMaxVy);
101         task->SetVertexZInterval(-maxVz, maxVz);
102         
103         task->SetEtaInterval(-maxEta, maxEta);
104         task->SetRapidityInterval(-maxY, maxY);
105         task->SetM2Interval(minM2, maxM2);
106         
107         task->SetCentralityInterval(minCentrality, maxCentrality);
108         
109         if(period=="lhc11a_wsdd" || period=="lhc11a_wosdd")
110         {
111                 task->SetNoFastOnlyTrigger();
112         }
113         
114         // momentum correction
115         
116         if(momentumCorr && species=="Deuteron")
117         {
118                 gROOT->LoadMacro("$ALICE_ROOT/PWGLF/SPECTRA/Nuclei/B2/macros/MomentumCorrection.C");
119                 
120                 TProfile* pfx = MomentumCorrection(species);
121                 task->SetMomentumCorrectionProfile(pfx);
122                 if(pfx != 0) task->SetMomentumCorrection();
123         }
124         
125         // histograms
126         
127         gROOT->LoadMacro("$ALICE_ROOT/PWGLF/SPECTRA/Nuclei/B2/macros/CreateHistograms.C");
128         
129         AliLnHistoMap* hMap = CreateHistograms(species, binSize, simulation, maxDCAxy, maxEta, maxY, heavyIons);
130         
131         task->SetHistogramMap(hMap);
132         
133         // track selection criteria
134         
135         gROOT->LoadMacro("$ALICE_ROOT/PWGLF/SPECTRA/Nuclei/B2/macros/TrackCuts.C");
136         
137         AliESDtrackCuts* trkCuts = TrackCuts(task, trksel, maxDCAxy, maxDCAz, kMaxNSigma, xRowsTPC, minTPCnClsOrXRows, maxEta);
138         task->SetESDtrackCuts(trkCuts);
139         
140         // PID
141         
142         gROOT->LoadMacro("$ALICE_ROOT/PWGLF/SPECTRA/Nuclei/B2/macros/BetheBlochParams.C");
143         
144         Double_t bethe[5];
145         BetheBlochParams(bethe, period);
146         
147         gROOT->LoadMacro("$ALICE_ROOT/PWGLF/SPECTRA/Nuclei/B2/macros/PriorProbabilities.C");
148         
149         Double_t prob[9];
150         PriorProbabilities(prob, period, trksel, ztag);
151         
152         AliLnID* lnID = new AliLnID();
153         
154         lnID->SetTPCBetheBlochParams(bethe);
155         lnID->SetPriorProbabilities(prob);
156         lnID->SetPidProcedure(pidProc);
157         
158         if(!simulation) lnID->SetTPCChargeCorrection(2.3);
159         
160         task->SetPID(lnID);
161         
162         // Add task to the manager
163         
164         mgr->AddTask(task);
165         
166         // input and output containers
167         
168         AliAnalysisDataContainer* output = mgr->CreateContainer(containername.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:AliAnalysisTaskB2", AliAnalysisManager::GetCommonFileName()));
169         
170         mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
171         mgr->ConnectOutput(task, 1, output);
172         
173         return task;
174 }