]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/SPECTRA/Nuclei/B2/macros/AddTaskB2AOD.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / Nuclei / B2 / macros / AddTaskB2AOD.C
CommitLineData
9e44412b 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 (AOD)
17// author: Eulogio Serradilla <eulogio.serradilla@cern.ch>
18
19AliAnalysisTaskB2AOD* AddTaskB2AOD( 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 << "AddTaskB2AOD: no analysis manager to connect to" << endl;
70 return 0;
71 }
72
73 if (!mgr->GetInputEventHandler())
74 {
75 cerr << "AddTaskB2AOD: this task requires an input event handler" << endl;
76 return 0;
77 }
78
79 // Create and configure the task
80
81 AliAnalysisTaskB2AOD* task = new AliAnalysisTaskB2AOD(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 AliLnAODtrackCuts* trkCuts = new AliLnAODtrackCuts();
136
137 trkCuts->SetSelectionCriteria(trksel);
138 trkCuts->SetMaxDCAxy(maxDCAxy);
139 trkCuts->SetMaxDCAz(maxDCAz);
140 trkCuts->SetMaxNSigmaToVtx(kMaxNSigma);
141 trkCuts->SetMaxEta(maxEta);
142 trkCuts->SetTPCXRowsCut(xRowsTPC);
143 trkCuts->SetMinTPCnClsOrXRows(minTPCnClsOrXRows);
144
145 task->SetTrackCuts(trkCuts);
146
147 // PID
148
149 gROOT->LoadMacro("$ALICE_ROOT/PWGLF/SPECTRA/Nuclei/B2/macros/BetheBlochParams.C");
150
151 Double_t bethe[5];
152 BetheBlochParams(bethe, period);
153
154 gROOT->LoadMacro("$ALICE_ROOT/PWGLF/SPECTRA/Nuclei/B2/macros/PriorProbabilities.C");
155
156 Double_t prob[9];
157 PriorProbabilities(prob, period, trksel, ztag);
158
159 AliLnID* lnID = new AliLnID();
160
161 lnID->SetTPCBetheBlochParams(bethe);
162 lnID->SetPriorProbabilities(prob);
163 lnID->SetPidProcedure(pidProc);
164
165 if(!simulation) lnID->SetTPCChargeCorrection(2.3);
166
167 task->SetPID(lnID);
168
169 // Add task to the manager
170
171 mgr->AddTask(task);
172
173 // input and output containers
174
175 AliAnalysisDataContainer* output = mgr->CreateContainer(containername.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:AliAnalysisTaskB2AOD", AliAnalysisManager::GetCommonFileName()));
176
177 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
178 mgr->ConnectOutput(task, 1, output);
179
180 return task;
181}