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