]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/SPECTRA/Nuclei/B2/macros/AddTaskB2.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / Nuclei / B2 / macros / AddTaskB2.C
CommitLineData
6b91e8c0 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
68a84436 19AliAnalysisTaskB2* AddTaskB2( const TString& species
20 , const TString& containername
f4d6dd11 21 , const TString& trksel
22 , Int_t pidProc
23 , const TString& periodname
68a84436 24 , Bool_t simulation = kFALSE
25 , Bool_t heavyIons = kFALSE
f4d6dd11 26 , Double_t maxDCAxy = 1
27 , Double_t maxDCAz = 2
68a84436 28 , Double_t maxEta = 0.8
29 , Double_t maxY = 0.5
dc8b5f72 30 , Bool_t ntrkMultTrigger = 0
f4d6dd11 31 , Double_t minKNOmult = -10
32 , Double_t maxKNOmult = 10000
68a84436 33 , Bool_t V0AND = kFALSE
7421dabb 34 , const TString& ztag = ""
68a84436 35 , Double_t maxVz = 10
2b4e5f2c 36 , Bool_t momentumCorr = kFALSE
5b88d60e 37 , const TString& binSize = ""
b3f10f7e 38 , Bool_t xRowsTPC = 0
39 , Int_t minTPCnClsOrXRows = 70
f4d6dd11 40 , Double_t minCentrality = 0
41 , Double_t maxCentrality = 20
42 , Double_t minM2 = 2.
43 , Double_t maxM2 = 6.)
6b91e8c0 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.;
6b91e8c0 54
6b91e8c0 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;
6b91e8c0 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
68a84436 81 AliAnalysisTaskB2* task = new AliAnalysisTaskB2(Form("B2.%s",containername.Data()));
6b91e8c0 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
dc8b5f72 92 task->SetNtrkMultTrigger(ntrkMultTrigger);
93
d3df3140 94 gROOT->LoadMacro("$ALICE_ROOT/PWGLF/SPECTRA/Nuclei/B2/macros/MeanNtrk.C");
95 Double_t meanNtrk = MeanNtrk(period, maxEta, V0AND);
f4d6dd11 96
97 task->SetMeanNtrk(meanNtrk);
6b91e8c0 98 task->SetKNOmultInterval(minKNOmult, maxKNOmult);
99 task->SetVertexXInterval(-kMaxVx, kMaxVx);
100 task->SetVertexYInterval(-kMaxVy, kMaxVy);
68a84436 101 task->SetVertexZInterval(-maxVz, maxVz);
6b91e8c0 102
052278a6 103 task->SetEtaInterval(-maxEta, maxEta);
104 task->SetRapidityInterval(-maxY, maxY);
f4d6dd11 105 task->SetM2Interval(minM2, maxM2);
f3e91ba1 106
6b91e8c0 107 task->SetCentralityInterval(minCentrality, maxCentrality);
108
109 if(period=="lhc11a_wsdd" || period=="lhc11a_wosdd")
110 {
111 task->SetNoFastOnlyTrigger();
112 }
113
2b4e5f2c 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
6b91e8c0 125 // histograms
126
127 gROOT->LoadMacro("$ALICE_ROOT/PWGLF/SPECTRA/Nuclei/B2/macros/CreateHistograms.C");
128
5b88d60e 129 AliLnHistoMap* hMap = CreateHistograms(species, binSize, simulation, maxDCAxy, maxEta, maxY, heavyIons);
6b91e8c0 130
131 task->SetHistogramMap(hMap);
132
133 // track selection criteria
134
135 gROOT->LoadMacro("$ALICE_ROOT/PWGLF/SPECTRA/Nuclei/B2/macros/TrackCuts.C");
136
b3f10f7e 137 AliESDtrackCuts* trkCuts = TrackCuts(task, trksel, maxDCAxy, maxDCAz, kMaxNSigma, xRowsTPC, minTPCnClsOrXRows, maxEta);
6b91e8c0 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];
7421dabb 150 PriorProbabilities(prob, period, trksel, ztag);
6b91e8c0 151
152 AliLnID* lnID = new AliLnID();
153
154 lnID->SetTPCBetheBlochParams(bethe);
155 lnID->SetPriorProbabilities(prob);
156 lnID->SetPidProcedure(pidProc);
157
ec499c6d 158 if(!simulation) lnID->SetTPCChargeCorrection(2.3);
159
6b91e8c0 160 task->SetPID(lnID);
161
162 // Add task to the manager
163
164 mgr->AddTask(task);
165
166 // input and output containers
167
68a84436 168 AliAnalysisDataContainer* output = mgr->CreateContainer(containername.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:AliAnalysisTaskB2", AliAnalysisManager::GetCommonFileName()));
6b91e8c0 169
170 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
b2c24401 171 mgr->ConnectOutput(task, 1, output);
6b91e8c0 172
173 return task;
174}