macro to run standalone ESD filtering
[u/mrichter/AliRoot.git] / PWGPP / PilotTrain / AddTaskQAsym.C
1 AliAnalysisTaskQASym * AddTaskQAsym(Int_t runNumber, 
2                                     UInt_t maskMB,
3                                     UInt_t maskHM,
4                                     UInt_t maskEM,
5                                     UInt_t maskMU)
6
7 {
8   // Creates a QA task exploiting simple symmetries phi, eta +/-, charge ...
9   
10   // Get the pointer to the existing analysis manager via the static access method.
11   //==============================================================================
12   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
13   if (!mgr) {
14     ::Error("AddTaskQAsym", "No analysis manager to connect to.");
15     return NULL;
16   }  
17   
18   // Check the analysis type using the event handlers connected to the analysis manager.
19   //==============================================================================
20   if (!mgr->GetInputEventHandler()) {
21     ::Error("AddTasQAsym", "This task requires an input event handler");
22     return NULL;
23   }
24    TString inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
25   
26    // Configure analysis
27    //===========================================================================
28    
29  
30    //Task for global tracks
31    AliAnalysisTaskQASym *task0 = new AliAnalysisTaskQASym("AliAnalysisTaskQASym_Global");
32    task0->SetTrackType(0);
33    task0->SelectCollisionCandidates(maskMB); // default setting: kMB = min bias trigger
34    task0->SetNChargedRange(30,50); // comparison of different trigger settings
35    //Task for global tracks (high multiplicity)
36    AliAnalysisTaskQASym *task0HM = new AliAnalysisTaskQASym("AliAnalysisTaskQASym_Global_HighMult");
37    task0HM->SetTrackType(0);
38    task0HM->SelectCollisionCandidates(maskHM);
39    task0HM->SetNChargedRange(30,50); 
40    //Task for global tracks (EMCAL trigger)
41    AliAnalysisTaskQASym *task0EM = new AliAnalysisTaskQASym("AliAnalysisTaskQASym_Global_EMCAL");
42    task0EM->SetTrackType(0);
43    task0EM->SelectCollisionCandidates(maskEM); 
44    task0EM->SetNChargedRange(30,50);
45    //Task for global tracks (Muon trigger)
46    AliAnalysisTaskQASym *task0MU = new AliAnalysisTaskQASym("AliAnalysisTaskQASym_Global_MUON");
47    task0MU->SetTrackType(0);
48    task0MU->SelectCollisionCandidates(maskMU); 
49    task0MU->SetNChargedRange(30,50);
50
51
52    //Task for ITS tracks 
53    AliAnalysisTaskQASym *task1 = new AliAnalysisTaskQASym("AliAnalysisTaskQASym_ITS");
54    task1->SetTrackType(1);
55    task1->SetStandAloneTrack(kFALSE);
56    task1->SelectCollisionCandidates(maskMB);
57    task1->SetNChargedRange(30,50); 
58    //Task for ITS tracks SA
59    AliAnalysisTaskQASym *task1sa = new AliAnalysisTaskQASym("AliAnalysisTaskQASym_ITS_SA");
60    task1sa->SetTrackType(1);
61    task1sa->SetStandAloneTrack(kTRUE);
62    task1sa->SelectCollisionCandidates(maskMB);
63    task1sa->SetNChargedRange(30,50); 
64    //Task for TPC tracks 
65    AliAnalysisTaskQASym *task2 = new AliAnalysisTaskQASym("AliAnalysisTaskQASym_TPC");
66    task2->SetTrackType(2);
67    task2->SelectCollisionCandidates(maskMB);
68    task2->SetNChargedRange(30,50); 
69
70    //cuts for global tracks
71    AliESDtrackCuts* esdTrackCutsL0 = new AliESDtrackCuts("AliESDtrackCuts0","Global");
72    esdTrackCutsL0->SetMinNClustersTPC(70);
73    esdTrackCutsL0->SetRequireTPCRefit(kTRUE);
74    esdTrackCutsL0->SetRequireITSRefit(kTRUE);
75    esdTrackCutsL0->SetMaxDCAToVertexXY(3.);
76    esdTrackCutsL0->SetMaxDCAToVertexZ(3.);
77    esdTrackCutsL0->SetAcceptKinkDaughters(kFALSE);
78    
79    //cuts for ITS tracks
80    AliESDtrackCuts* esdTrackCutsL1 = new AliESDtrackCuts("AliESDtrackCuts1","ITS");
81    esdTrackCutsL1->SetMaxDCAToVertexXY(3.);
82    esdTrackCutsL1->SetMaxDCAToVertexZ(3.);
83    esdTrackCutsL1->SetAcceptKinkDaughters(kFALSE);
84    esdTrackCutsL1->SetRequireITSRefit(kTRUE);
85    esdTrackCutsL1->SetRequireITSStandAlone(kTRUE); 
86
87    //cuts for ITS tracks SA
88    AliESDtrackCuts* esdTrackCutsL1sa = new AliESDtrackCuts("AliESDtrackCuts1sa","ITS_SA");
89    esdTrackCutsL1sa->SetMaxDCAToVertexXY(3.);
90    esdTrackCutsL1sa->SetMaxDCAToVertexZ(3.);
91    esdTrackCutsL1sa->SetAcceptKinkDaughters(kFALSE);
92    esdTrackCutsL1sa->SetRequireITSRefit(kTRUE);
93    esdTrackCutsL1sa->SetRequireITSPureStandAlone(kTRUE);
94    
95    //cuts for TPC tracks
96    AliESDtrackCuts* esdTrackCutsL2 = new AliESDtrackCuts("AliESDtrackCuts2","TPC");
97    esdTrackCutsL2->SetRequireTPCRefit(kFALSE);
98    esdTrackCutsL2->SetAcceptKinkDaughters(kFALSE);
99    //jacek's cuts:
100    esdTrackCutsL2->SetMinNClustersTPC(70);
101    // cut on max ncl=160 in Task
102    esdTrackCutsL2->SetMaxDCAToVertexXY(3.);
103    esdTrackCutsL2->SetMaxDCAToVertexZ(3.);
104    esdTrackCutsL2->SetMaxChi2PerClusterTPC(3.999);
105    //cut minChi=0 in task
106    //esdTrackCutsL2->SetPRange(0.15,16); // not needed for QA
107    //esdTrackCutsL2->SetEtaRange(-0.8, 0.7999); // not needed for QA
108   
109
110    task0->SetCuts(esdTrackCutsL0);
111    task0HM->SetCuts(esdTrackCutsL0);
112    task0EM->SetCuts(esdTrackCutsL0);
113    task0MU->SetCuts(esdTrackCutsL0);
114    task1->SetCuts(esdTrackCutsL1);
115    task1sa->SetCuts(esdTrackCutsL1sa);
116    task2->SetCuts(esdTrackCutsL2);
117
118    mgr->AddTask(task0);
119    mgr->AddTask(task0HM);
120    mgr->AddTask(task0EM);
121    mgr->AddTask(task0MU);
122    mgr->AddTask(task1);
123    mgr->AddTask(task1sa);
124    mgr->AddTask(task2);
125   
126    AliAnalysisDataContainer *cout0    = 0;
127    AliAnalysisDataContainer *cout0HM  = 0;
128    AliAnalysisDataContainer *cout0EM  = 0;
129    AliAnalysisDataContainer *cout0MU  = 0;
130    AliAnalysisDataContainer *cout1    = 0;
131    AliAnalysisDataContainer *cout1sa  = 0;
132    AliAnalysisDataContainer *cout2    = 0;
133    
134    if(runNumber>0){ 
135     cout0 =  mgr->CreateContainer("QAsymHists_Global",TList::Class(),
136                                   AliAnalysisManager::kOutputContainer, Form("run%d.root",runNumber));
137     cout0HM =  mgr->CreateContainer("QAsymHists_Global_HighMult",TList::Class(),
138                                     AliAnalysisManager::kOutputContainer, Form("run%d.root",runNumber));
139     cout0EM =  mgr->CreateContainer("QAsymHists_Global_Emcal",TList::Class(),
140                                     AliAnalysisManager::kOutputContainer, Form("run%d.root",runNumber));
141     cout0MU =  mgr->CreateContainer("QAsymHists_Global_Muon",TList::Class(),
142                                     AliAnalysisManager::kOutputContainer, Form("run%d.root",runNumber));
143     cout1 =  mgr->CreateContainer("QAsymHists_ITS",TList::Class(),
144                                   AliAnalysisManager::kOutputContainer, Form("run%d.root",runNumber));
145     cout1sa =  mgr->CreateContainer("QAsymHists_ITS_SA",TList::Class(),
146                                     AliAnalysisManager::kOutputContainer, Form("run%d.root",runNumber));
147     cout2 =  mgr->CreateContainer("QAsymHists_TPC",TList::Class(),
148                                   AliAnalysisManager::kOutputContainer, Form("run%d.root",runNumber));
149    }
150    
151    else{
152       cout0 = mgr->CreateContainer("QAsymHists_Global",TList::Class(),
153                                  AliAnalysisManager::kOutputContainer, 
154                                  Form("%s:PWGPP_QAsymHists",AliAnalysisManager::GetCommonFileName()));
155       cout0HM = mgr->CreateContainer("QAsymHists_Global_HighMult",TList::Class(),
156                                    AliAnalysisManager::kOutputContainer, 
157                                    Form("%s:PWGPP_QAsymHists",AliAnalysisManager::GetCommonFileName()));
158       cout0EM = mgr->CreateContainer("QAsymHists_Global_Emcal",TList::Class(),
159                                      AliAnalysisManager::kOutputContainer, 
160                                      Form("%s:PWGPP_QAsymHists",AliAnalysisManager::GetCommonFileName()));
161       cout0MU = mgr->CreateContainer("QAsymHists_Global_Muon",TList::Class(),
162                                      AliAnalysisManager::kOutputContainer, 
163                                      Form("%s:PWGPP_QAsymHists",AliAnalysisManager::GetCommonFileName()));
164       cout1 = mgr->CreateContainer("QAsymHists_ITS",TList::Class(),
165                                    AliAnalysisManager::kOutputContainer, 
166                                  Form("%s:PWGPP_QAsymHists",AliAnalysisManager::GetCommonFileName()));
167       cout1sa = mgr->CreateContainer("QAsymHists_ITS_SA",TList::Class(),
168                                      AliAnalysisManager::kOutputContainer, 
169                                      Form("%s:PWGPP_QAsymHists",AliAnalysisManager::GetCommonFileName()));
170       cout2 = mgr->CreateContainer("QAsymHists_TPC",TList::Class(),
171                                    AliAnalysisManager::kOutputContainer, 
172                                  Form("%s:PWGPP_QAsymHists",AliAnalysisManager::GetCommonFileName()));
173    }
174
175
176    mgr->ConnectInput  (task0,   0, mgr->GetCommonInputContainer());
177    mgr->ConnectInput  (task0HM, 0, mgr->GetCommonInputContainer());
178    mgr->ConnectInput  (task0EM, 0, mgr->GetCommonInputContainer());
179    mgr->ConnectInput  (task0MU, 0, mgr->GetCommonInputContainer());
180    mgr->ConnectInput  (task1,   0, mgr->GetCommonInputContainer());
181    mgr->ConnectInput  (task1sa, 0, mgr->GetCommonInputContainer());
182    mgr->ConnectInput  (task2,   0, mgr->GetCommonInputContainer());
183
184    mgr->ConnectOutput (task0,   1, cout0);
185    mgr->ConnectOutput (task0HM, 1, cout0HM);
186    mgr->ConnectOutput (task0EM, 1, cout0EM);
187    mgr->ConnectOutput (task0MU, 1, cout0MU);
188    mgr->ConnectOutput (task1,   1, cout1);
189    mgr->ConnectOutput (task1sa, 1, cout1sa);
190    mgr->ConnectOutput (task2,   1, cout2);
191   
192    return task0;
193
194 }
195
196