1 /* *********************************************************************************
2 * File : AddTaskNetParticle.C
3 * Authors : Jochen Thaeder <jochen@thaeder.de>
4 * Michael Weber <m.weber@cern.ch>
5 * *********************************************************************************
6 * Configuring NetParticle Task:
8 * name -> Name of the task, containing particle type :
9 * Currently : Proton, Pion, Kaon, Charge
10 * isModeDist -> Fill Distributions
11 * isModeEff -> Fill Efficiency/Contamination ThnSparse
12 * isModeDCA -> Fill DCA ThnSparse
13 * isModeQA -> Fill QA ThnSparse
14 * isModeAOD -> Use AOD input
15 * isCreateCSC -> Prepare for CrossSectionCorrection
16 * - requires isModeEff to be set
18 * modeCSC -> Use differnt Pt cut for
21 * modeCuts -> Different Cut scenarios
24 * modePID -> PID Strategy
25 * -1 : Default -> 7 (modeCuts=0) and 5 (modeCuts=1)
26 * 0 : TPC(TPClow+TPCHigh)
29 * 3 : ITS+TPC(TPClow+TPCHigh)
30 * 4 : TPC(TPClow+TPCHigh)+TOF
31 * 5 : TPC(TPClow+TPCHigh)+TOF for pT >= fMinPtForTOFRequired TOF is required, below, only used if there
32 * 6 : TPC(TPClow+TPCHigh)+ITS+TOF with TOF only for those tracks which have TOF information
33 * 7 : TPC(TPClow+TPCHigh)+ITS+TOF for pT >= fMinPtForTOFRequired TOF is required, below, only used if there
34 * 8 : TPC(TPClow+TPCHigh)+ITS+TOF
36 * *********************************************************************************
39 * *********************************************************************************
40 * - OUTPUT CONTAINER : #N = 5
41 * (1) - Standard Output, Distributions
42 * (2) - Efficiency ThnSparse
43 * (3) - Contamination ThnSparse
47 ********************************************************************************* */
49 AliAnalysisTask *AddTaskNetParticle(const Char_t * name = "jthaeder_NetProton",
50 Bool_t isModeDist, Bool_t isModeEff, Bool_t isModeDCA, Bool_t isModeQA = kFALSE,
51 Bool_t isCreateCSC = kFALSE, Bool_t isModeAOD = kFALSE, Int_t modeCSC = 0, Int_t modeCuts = 0, Int_t modePID = -1) {
53 // TURN OFF QA for now
59 if (isCreateCSC && !isModeEff) {
60 Error("AddTaskNetParticle", "Creating CrossSectionCorrection needs 'isModeEff' to be set.");
64 // ----------------------------------------------
65 // -- Get the current analysis manager
66 // ----------------------------------------------
67 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
69 Error("AddTaskNetParticle", "No analysis manager found.");
73 // ----------------------------------------------
75 // ----------------------------------------------
76 Bool_t isMC = (mgr->GetMCtruthEventHandler() != NULL);
78 Info("AddTaskNetParticle", "This task has MC.");
80 // ----------------------------------------------
82 // ----------------------------------------------
83 AliAnalysisTaskNetParticle *task = new AliAnalysisTaskNetParticle("AliAnalysisTaskNetParticle");
85 Error("AddTaskNetParticle", "Task could not be created.");
89 // ----------------------------------------------
91 // ----------------------------------------------
95 task->SetModeEffCreation(1); // => 1 = on | 0 = off (default)
97 task->SetModeDCACreation(1); // => 1 = on | 0 = off (default)
99 task->SetModeDistCreation(1); // => 1 = on | 0 = off (default)
101 task->SetIsAOD(1); // => 1 = AOD | 0 = ESD (default)
102 task->SetTrackFilterBit(1024); // 1024 = RAA cuts
105 task->SetModeQACreation(1); // => 1 = on | 0 = off (default)
107 // ----------------------------------------------
108 // -- Create helper class
109 // ----------------------------------------------
110 AliAnalysisNetParticleHelper *helper = new AliAnalysisNetParticleHelper;
112 Error("AddTaskNetParticle", "Helper could not be created.");
117 task->SetNetParticleHelper(helper);
119 // ----------------------------------------------
120 // -- Set particle type
121 // ----------------------------------------------
122 Float_t minPt, maxPt, minPtEff, maxPtEff, minPtForTOF, etaMax, etaMaxEff, nSigmaITS, nSigmaTPC, nSigmaTPClow, nSigmaTOF;
125 if (sName.Contains("Proton")) {
126 helper->SetParticleSpecies(AliPID::kProton);
127 minPtForTOF = 0.69; // minPtForTOF = 0.21;
128 maxPtForTPClow = 0.69;
129 minPt = 0.5; maxPt = 2.0; // minPt = 0.22; maxPt = 4.5;
130 minPtEff = 0.5; maxPtEff = 2.0; // minPtEff = 0.22; maxPtEff = 4.5;
133 nSigmaITS = 4.0; nSigmaTPC = 4.0; nSigmaTPClow = 3.0; nSigmaTOF = 4.0;
135 if (modePID == -1) { // default
136 pidStrategy = 7; // 7: ITS + TPC + TOF (using minPtForTOF)
138 pidStrategy = 5; // 5: TPC + TOF (using minPtForTOF)
141 pidStrategy = modePID;
144 if (isCreateCSC && modeCSC == 1)
145 minPtForTOF = maxPtEff;
147 else if (sName.Contains("Pion")) {
148 helper->SetParticleSpecies(AliPID::kPion);
149 minPt = 0.3; maxPt = 0.6;
150 minPtEff = 0.2; maxPtEff = 1.0;
152 etaMax = 99.99; // 0.8 ->> eta cut off for now
153 etaMaxEff = 99.99; // 0.9 ->> eta cut off for now
154 nSigmaITS = 2.5; nSigmaTPC = 2.5; nSigmaTOF = 2.5;
157 else if (sName.Contains("Kaon")) {
158 helper->SetParticleSpecies(AliPID::kKaon);
159 minPt = 0.5; maxPt = 1.4;
160 minPtEff = 0.1; maxPtEff = 2.5;
162 etaMax = 99.99; // 0.8 ->> eta cut off for now
163 etaMaxEff = 99.99; // 0.9 ->> eta cut off for now
164 nSigmaITS = 2.5; nSigmaTPC = 2.5; nSigmaTOF = 2.5;
167 else if (sName.Contains("Charge")) {
168 helper->SetUsePID(kFALSE);
169 minPt = 0.3; maxPt = 2.5;
170 minPtEff = 0.1; maxPtEff = 3.0;
174 nSigmaITS = -1.; nSigmaTPC = -1.; nSigmaTOF = -1.;
178 Error("AddTaskNetParticle", "Unknown Particle type.");
183 // ----------------------------------------------
184 // -- Read Environment Variables
185 // ----------------------------------------------
187 in.open("setRunENV.txt");
193 TObjArray *arr = current.Tokenize('=');
197 TObjString* oKey = dynamic_cast<TObjString*>(arr->At(0));
198 TObjString* oValue = dynamic_cast<TObjString*>(arr->At(1));
202 TString key(oKey->GetString());
203 TString value(oValue->GetString());
205 if (!key.CompareTo("NETPARTICLE_PID_STRATEGY")) {
206 pidStrategy = value.Atoi();
207 printf(">>>> USE NETPARTICLE_PID_STRATEGY %d\n", pidStrategy);
209 if (!key.CompareTo("NETPARTICLE_NSIGMAMAX_ITS")) {
210 nSigmaITS = value.Atof();
211 printf(">>>> USE NETPARTICLE_NSIGMAMAX_ITS %.2f\n", nSigmaITS);
213 if (!key.CompareTo("NETPARTICLE_NSIGMAMAX_TPC")) {
214 nSigmaTPC = value.Atof();
215 printf(">>>> USE NETPARTICLE_NSIGMAMAX_TPC %.2f\n", nSigmaTPC);
217 if (!key.CompareTo("NETPARTICLE_NSIGMAMAX_TOF")) {
218 nSigmaTOF = value.Atof();
219 printf(">>>> USE NETPARTICLE_NSIGMAMAX_TOF %.2f\n", nSigmaTOF);
228 // ----------------------------------------------
230 // ----------------------------------------------
233 task->SetESDTrackCutMode(modeCuts); // => 0 = normal | 1 = LF
235 // -- Set analysis ranges
236 task->SetEtaMax(etaMax); // eta cut
237 task->SetEtaMaxEff(etaMaxEff); // eta cut for efficiency
238 task->SetPtRange(minPt, maxPt); // pt cut range for the analysis
239 task->SetPtRangeEff(minPtEff, maxPtEff); // pt cut range for the correction / efficiency / contamination creation
241 // ----------------------------------------------
242 // -- Configure cuts - helper class
243 // ----------------------------------------------
245 // -- Set standard event cuts
246 helper->SetVertexZMax(10.);
247 helper->SetCentralityBinMax(7);
249 // -- Set track event cuts
250 helper->SetRapidityMax(0.5);
251 // helper->SetRapidityMax(0.2);
252 helper->SetMinTrackLengthMC(70.);
253 helper->SetNSigmaMaxCdd(0.); // 3. || ->> Turn off sigmaDCA cuts for now
254 helper->SetNSigmaMaxCzz(0.); // 3. || ->> Turn off sigmaDCA cuts for now
255 helper->SetPhiRange(0., 3.88); // Only used if requested in task - default is TwoPi
258 helper->SetPIDStrategy(pidStrategy);
259 helper->SetNSigmaMaxITS(nSigmaITS);
260 helper->SetNSigmaMaxTPC(nSigmaTPC);
261 helper->SetNSigmaMaxTPClow(nSigmaTPClow);
262 helper->SetNSigmaMaxTOF(nSigmaTOF);
263 helper->SetMinPtForTOFRequired(minPtForTOF);
264 helper->SetMaxPtForTPClow(maxPtForTPClow);
266 // -- Set N sub samples
267 helper->SetNSubSamples(20);
269 // ----------------------------------------------
270 // -- Add task to the ANALYSIS manager
271 // ----------------------------------------------
274 // ----------------------------------------------
275 // -- data containers - input
276 // ----------------------------------------------
277 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
279 // ----------------------------------------------
280 // -- data containers - output
281 // ----------------------------------------------
282 TString outputFileName = "";
283 TString outputQAFileName = "";
285 outputFileName = Form("%s:%s", AliAnalysisManager::GetCommonFileName(), name);
286 outputQAFileName = Form("%s:%s", AliAnalysisManager::GetCommonFileName(), name);
289 outputFileName = Form("%s.root", name);
290 outputQAFileName = Form("%sQA.root", name);
293 AliAnalysisDataContainer *coutput = mgr->CreateContainer(name, TList::Class(), AliAnalysisManager::kOutputContainer, outputFileName);
294 AliAnalysisDataContainer *coutputEff = mgr->CreateContainer(Form("%s_eff", name), TList::Class(), AliAnalysisManager::kOutputContainer, outputFileName);
295 AliAnalysisDataContainer *coutputCont = mgr->CreateContainer(Form("%s_cont", name), TList::Class(), AliAnalysisManager::kOutputContainer, outputFileName);
296 AliAnalysisDataContainer *coutputDca = mgr->CreateContainer(Form("%s_dca", name), TList::Class(), AliAnalysisManager::kOutputContainer, outputFileName);
298 AliAnalysisDataContainer *coutputQA = mgr->CreateContainer(Form("%sQA", name), TList::Class(), AliAnalysisManager::kOutputContainer, outputQAFileName);
300 mgr->ConnectInput (task, 0, cinput );
301 mgr->ConnectOutput (task, 1, coutput);
302 mgr->ConnectOutput (task, 2, coutputEff);
303 mgr->ConnectOutput (task, 3, coutputCont);
304 mgr->ConnectOutput (task, 4, coutputDca);
305 mgr->ConnectOutput (task, 5, coutputQA);