]>
Commit | Line | Data |
---|---|---|
c841b89f | 1 | AliAnalysisTaskSEITSsaSpectra *AddTaskITSsaSpectra(Bool_t optNtuple=kFALSE,Bool_t readMC=kFALSE,Int_t LowMult=0,Int_t UpMult=9999){ |
2 | // Creates, configures and attaches to the train the task for pi, K , p spectra | |
c790580b | 3 | // with ITS standalone tracks |
4 | // Get the pointer to the existing analysis manager via the static access method. | |
5 | //============================================================================== | |
6 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
7 | if (!mgr) { | |
8 | ::Error("AddTaskITSsaSpectra", "No analysis manager to connect to."); | |
9 | return NULL; | |
10 | } | |
11 | ||
12 | // Check the analysis type using the event handlers connected to the analysis manager. | |
13 | //============================================================================== | |
14 | if (!mgr->GetInputEventHandler()) { | |
15 | ::Error("AddTaskITSsaSpectra", "This task requires an input event handler"); | |
16 | return NULL; | |
17 | } | |
18 | ||
19 | TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD" | |
20 | if(type.Contains("AOD")){ | |
21 | ::Error("AddTaskITSsaSpectra", "This task requires to run on ESD"); | |
22 | return NULL; | |
23 | } | |
24 | ||
c841b89f | 25 | //Bool_t isMC=kFALSE; |
26 | //if (mgr->GetMCtruthEventHandler()) isMC=kTRUE; | |
c790580b | 27 | |
c841b89f | 28 | // Add MC handler (for kinematics) |
29 | if(readMC){ | |
30 | AliMCEventHandler* handler = new AliMCEventHandler; | |
31 | handler->SetReadTR(kFALSE); | |
32 | mgr->SetMCtruthEventHandler(handler); | |
33 | } | |
c790580b | 34 | // Create and configure the task |
35 | AliAnalysisTaskSEITSsaSpectra *taskits = new AliAnalysisTaskSEITSsaSpectra(); | |
36 | taskits->SelectCollisionCandidates(); | |
c841b89f | 37 | taskits->SetReadMC(readMC); |
c790580b | 38 | taskits->SetFillNtuple(optNtuple); |
c841b89f | 39 | taskits->SetMultBin(LowMult,UpMult); |
40 | ||
c790580b | 41 | mgr->AddTask(taskits); |
42 | ||
43 | // Create ONLY the output containers for the data produced by the task. | |
44 | // Get and connect other common input/output containers via the manager as below | |
45 | //============================================================================== | |
46 | TString outputFileName = AliAnalysisManager::GetCommonFileName(); | |
47 | outputFileName += ":PWG2SpectraITSsa"; | |
48 | ||
c841b89f | 49 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(Form("clistITSsaMult%ito%i",LowMult,UpMult), |
c790580b | 50 | TList::Class(), |
51 | AliAnalysisManager::kOutputContainer, | |
52 | outputFileName ); | |
53 | ||
54 | mgr->ConnectInput(taskits, 0, mgr->GetCommonInputContainer()); | |
55 | mgr->ConnectOutput(taskits, 1, coutput1); | |
56 | return taskits; | |
57 | } |