]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/SPECTRA/Nuclei/B2/macros/AddTaskB2.C
rejecting events with vertex exactly on the bin edge
[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 Double_t GetMeanNtrk(const TString& period, Double_t eta);
20 Double_t GetNSDMeanNtrk(const TString& period, Double_t eta);
21
22 AliAnalysisTaskB2* AddTaskB2(  const TString& species
23                              , const TString& containername
24                              , const TString& trksel
25                              , Int_t pidProc
26                              , const TString& periodname
27                              , Bool_t   simulation       = kFALSE
28                              , Bool_t   heavyIons        = kFALSE
29                              , Double_t maxDCAxy         = 1
30                              , Double_t maxDCAz          = 2
31                              , Double_t maxEta           = 0.8
32                              , Double_t maxY             = 0.5
33                              , Double_t minKNOmult       = -10
34                              , Double_t maxKNOmult       = 10000
35                              , Bool_t   V0AND            = kFALSE
36                              , const TString& ztag       = ""
37                              , Double_t maxVz            = 10
38                              , Double_t minCentrality    = 0
39                              , Double_t maxCentrality    = 20
40                              , Double_t minM2            = 2.
41                              , Double_t maxM2            = 6.)
42 {
43 //
44 // Create, configure and add the analysis task to the analysis manager
45 //
46         using namespace std;
47         
48         // sample config
49         
50         const Double_t kMaxVx     = 1.;
51         const Double_t kMaxVy     = 1.;
52         
53         const Double_t kMaxNSigma = 3.;
54         
55         const Int_t kMaxNSigmaITS = 3;
56         const Int_t kMaxNSigmaTPC = 3;
57         const Int_t kMaxNSigmaTOF = 3;
58         const Int_t kMinTPCnCls   = 70;
59         
60         TString period = periodname;
61         period.ToLower();
62         
63         // Get pointer to the existing analysis manager
64         
65         AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
66         if (!mgr)
67         {
68                 cerr << "AddTaskB2: no analysis manager to connect to" << endl;
69                 return 0;
70         }
71         
72         if (!mgr->GetInputEventHandler())
73         {
74                 cerr << "AddTaskB2: this task requires an input event handler" << endl;
75                 return 0;
76         }
77         
78         // Create and configure the task
79         
80         AliAnalysisTaskB2* task = new AliAnalysisTaskB2(Form("B2.%s",containername.Data()));
81         
82         task->SetParticleSpecies(species);
83         task->SetSimulation(simulation);
84         task->SetHeavyIons(heavyIons);
85         task->SetV0ANDtrigger(V0AND);
86         
87         task->SetMaxNSigmaITS(kMaxNSigmaITS);
88         task->SetMaxNSigmaTPC(kMaxNSigmaTPC);
89         task->SetMaxNSigmaTOF(kMaxNSigmaTOF);
90         
91         Double_t meanNtrk = V0AND ? GetNSDMeanNtrk(period, maxEta) : GetMeanNtrk(period, maxEta);
92         
93         task->SetMeanNtrk(meanNtrk);
94         task->SetKNOmultInterval(minKNOmult, maxKNOmult);
95         task->SetVertexXInterval(-kMaxVx, kMaxVx);
96         task->SetVertexYInterval(-kMaxVy, kMaxVy);
97         task->SetVertexZInterval(-maxVz, maxVz);
98         
99         task->SetEtaInterval(-maxEta, maxEta);
100         task->SetRapidityInterval(-maxY, maxY);
101         task->SetM2Interval(minM2, maxM2);
102         
103         task->SetCentralityInterval(minCentrality, maxCentrality);
104         
105         if(period=="lhc11a_wsdd" || period=="lhc11a_wosdd")
106         {
107                 task->SetNoFastOnlyTrigger();
108         }
109         
110         // histograms
111         
112         gROOT->LoadMacro("$ALICE_ROOT/PWGLF/SPECTRA/Nuclei/B2/macros/CreateHistograms.C");
113         
114         AliLnHistoMap* hMap = CreateHistograms(species, simulation, maxDCAxy, maxEta, maxY, heavyIons);
115         
116         task->SetHistogramMap(hMap);
117         
118         // track selection criteria
119         
120         gROOT->LoadMacro("$ALICE_ROOT/PWGLF/SPECTRA/Nuclei/B2/macros/TrackCuts.C");
121         
122         AliESDtrackCuts* trkCuts = TrackCuts(task, trksel, maxDCAxy, maxDCAz, kMaxNSigma, kMinTPCnCls, maxEta);
123         task->SetESDtrackCuts(trkCuts);
124         
125         // PID
126         
127         gROOT->LoadMacro("$ALICE_ROOT/PWGLF/SPECTRA/Nuclei/B2/macros/BetheBlochParams.C");
128         
129         Double_t bethe[5];
130         BetheBlochParams(bethe, period);
131         
132         gROOT->LoadMacro("$ALICE_ROOT/PWGLF/SPECTRA/Nuclei/B2/macros/PriorProbabilities.C");
133         
134         Double_t prob[9];
135         PriorProbabilities(prob, period, trksel, ztag);
136         
137         AliLnID* lnID = new AliLnID();
138         
139         lnID->SetTPCBetheBlochParams(bethe);
140         lnID->SetPriorProbabilities(prob);
141         lnID->SetPidProcedure(pidProc);
142         
143         if(!simulation) lnID->SetTPCChargeCorrection(2.3);
144         
145         task->SetPID(lnID);
146         
147         // Add task to the manager
148         
149         mgr->AddTask(task);
150         
151         // input and output containers
152         
153         AliAnalysisDataContainer* output = mgr->CreateContainer(containername.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:AliAnalysisTaskB2", AliAnalysisManager::GetCommonFileName()));
154         
155         mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
156         mgr->ConnectOutput(task, 1, output);
157         
158         return task;
159 }
160
161 Double_t GetMeanNtrk(const TString& period, Double_t eta)
162 {
163 //
164 // average track multiplicity <Ntrk> for the given period and eta
165 //
166         if(TMath::Abs(eta) > 0.51) // |eta|<0.8
167         {
168                 if(period =="lhc10b")       return 9.68887; // pass3
169                 if(period =="lhc10d")       return 9.47466; // pass2
170                 if(period =="lhc10e")       return 9.55678; // pass2
171                 
172                 // MC
173                 if(period =="lhc10e21")            return 7.69483;
174         }
175         else // |eta|<0.5
176         {
177                 if(period =="lhc10c900")    return 3.70158; // pass3
178                 if(period =="lhc10b_pass2") return 9.86258;
179                 if(period =="lhc10c_pass2") return 9.61402;
180                 if(period =="lhc10b")       return 5.96104; // pass3
181                 if(period =="lhc10c")       return 5.94719; // pass3
182                 if(period =="lhc10d")       return 5.82333; // pass2
183                 if(period =="lhc10e")       return 5.89367; // pass2
184                 if(period =="lhc11a_wosdd") return 4.28597; // pass3
185                 if(period =="lhc11a_wsdd")  return 4.69927; // pass4
186                 
187                 // MC
188                 if(period =="lhc10e13")            return 3.13712;
189                 if(period =="lhc10f6a")            return 4.41362;
190                 if(period =="lhc10e21")            return 4.74991;
191                 if(period =="lhc11e3a_plus_wosdd") return 3.37669;
192                 if(period =="lhc11e3a_plus_wsdd")  return 3.47885;
193                 
194                 if(period =="lhc12a5a")            return 29.264;
195                 if(period =="lhc12a5bb")           return 31.0288;
196                 if(period =="lhc12a5bc")           return 30.6888;
197                 if(period =="lhc12a5bd")           return 30.3528;
198                 if(period =="lhc12a5be")           return 29.9859;
199                 if(period =="lhc12a5c_wsdd")       return 27.5981;
200         }
201         
202         cerr << "Warning in GetMeanNtrk: no <Ntrk> for period " << period << " and |eta| < " << eta << endl;
203         
204         return 1;
205 }
206
207 Double_t GetNSDMeanNtrk(const TString& period, Double_t eta)
208 {
209 //
210 // average track multiplicity <Ntrk> for the given period and eta
211 // (NSD events)
212 //
213         if(TMath::Abs(eta) > 0.51) // |eta|<0.8
214         {
215                 if(period =="lhc10b")       return 10.0630; // pass3
216                 if(period =="lhc10d")       return 9.77129; // pass2
217                 if(period =="lhc10e")       return 9.90511; // pass2
218                 
219                 // MC
220                 if(period =="lhc10e21")            return 7.91423;
221         }
222         else // |eta|<0.5
223         {
224                 if(period =="lhc10c900")    return 3.84362; // pass3
225                 if(period =="lhc10b")       return 6.18470; // pass3
226                 if(period =="lhc10c")       return 6.16175; // pass3
227                 if(period =="lhc10d")       return 6.03108; // pass2
228                 if(period =="lhc10e")       return 6.10384; // pass2
229                 if(period =="lhc11a_wosdd") return 4.40312; // pass3
230                 if(period =="lhc11a_wsdd")  return 4.87609; // pass4
231                 
232                 // MC
233                 if(period =="lhc10e13")            return 3.33273;
234                 if(period =="lhc10f6a")            return 4.80771;
235                 if(period =="lhc10e21")            return 4.91967;
236                 if(period =="lhc11e3a_plus_wosdd") return 3.4774;
237                 if(period =="lhc11e3a_plus_wsdd")  return 3.6467;
238                 
239                 if(period =="lhc12a5a")            return 29.3414;
240                 if(period =="lhc12a5bb")           return 31.1514;
241                 if(period =="lhc12a5bc")           return 30.7877;
242                 if(period =="lhc12a5bd")           return 30.4706;
243                 if(period =="lhc12a5be")           return 30.1013;
244                 if(period =="lhc12a5c_wsdd")       return 27.6921;
245         }
246         
247         cerr << "Warning in GetNSDMeanNtrk: no <Ntrk> for period " << period << " and |eta| < " << eta << endl;
248         
249         return 1;
250 }