]>
Commit | Line | Data |
---|---|---|
7b59a00b | 1 | #include "TChain.h" |
2 | #include "TTree.h" | |
7b59a00b | 3 | #include "TList.h" |
7b59a00b | 4 | |
5 | #include "AliAnalysisTask.h" | |
6 | #include "AliAnalysisManager.h" | |
7 | ||
75decd62 | 8 | #include "AliGenEventHeader.h" |
7b59a00b | 9 | #include "AliESDEvent.h" |
10 | #include "AliESDInputHandler.h" | |
11 | #include "AliMCEventHandler.h" | |
12 | #include "AliMCEvent.h" | |
13 | #include "AliStack.h" | |
5429dd65 | 14 | #include "AliESDVertex.h" |
e56f08ed | 15 | #include "AliPhysicsSelection.h" |
7b59a00b | 16 | |
5ae0977e | 17 | #include "AliProtonQAAnalysis.h" |
e7df5638 | 18 | #include "AliProtonAnalysisBase.h" |
7b59a00b | 19 | #include "AliAnalysisTaskProtonsQA.h" |
20 | ||
73aba974 | 21 | //----------------------------------------------------------------- |
22 | // AliAnalysisTakProtonsQA class | |
23 | // This is the task to run the \bar{p}/p QA analysis | |
24 | // Origin: Panos Christakoglou | Panos.Christakoglou@cern.ch | |
25 | //----------------------------------------------------------------- | |
7b59a00b | 26 | |
27 | ClassImp(AliAnalysisTaskProtonsQA) | |
5429dd65 | 28 | |
7b59a00b | 29 | //________________________________________________________________________ |
30 | AliAnalysisTaskProtonsQA::AliAnalysisTaskProtonsQA() | |
31 | : AliAnalysisTask(), fESD(0), fMC(0), | |
5661e210 | 32 | fList0(0), fList1(0), fList2(0), fList3(0), |
df201289 | 33 | fList4(0), fList5(0), fList6(0), fList7(0), fList8(0), |
e7df5638 | 34 | fProtonQAAnalysis(0) { |
5429dd65 | 35 | //Dummy constructor |
7b59a00b | 36 | } |
37 | ||
38 | //________________________________________________________________________ | |
39 | AliAnalysisTaskProtonsQA::AliAnalysisTaskProtonsQA(const char *name) | |
5429dd65 | 40 | : AliAnalysisTask(name, ""), fESD(0), fMC(0), |
75decd62 | 41 | fList0(0), fList1(0), fList2(0), fList3(0), |
df201289 | 42 | fList4(0), fList5(0), fList6(0), fList7(0), fList8(0), |
e7df5638 | 43 | fProtonQAAnalysis(0) { |
7b59a00b | 44 | // Constructor |
5429dd65 | 45 | |
7b59a00b | 46 | // Define input and output slots here |
47 | // Input slot #0 works with a TChain | |
48 | DefineInput(0, TChain::Class()); | |
49 | // Output slot #0 writes into a TList container | |
50 | DefineOutput(0, TList::Class()); | |
d4733690 | 51 | DefineOutput(1, TList::Class()); |
52 | DefineOutput(2, TList::Class()); | |
5b8133c7 | 53 | DefineOutput(3, TList::Class()); |
54 | DefineOutput(4, TList::Class()); | |
9c0b9f24 | 55 | DefineOutput(5, TList::Class()); |
75decd62 | 56 | DefineOutput(6, TList::Class()); |
5661e210 | 57 | DefineOutput(7, TList::Class()); |
df201289 | 58 | DefineOutput(8, TList::Class()); |
7b59a00b | 59 | } |
60 | ||
61 | //________________________________________________________________________ | |
62 | void AliAnalysisTaskProtonsQA::ConnectInputData(Option_t *) { | |
63 | // Connect ESD or AOD here | |
64 | // Called once | |
65 | ||
66 | TTree* tree = dynamic_cast<TTree*> (GetInputData(0)); | |
67 | if (!tree) { | |
68 | Printf("ERROR: Could not read chain from input slot 0"); | |
69 | } else { | |
7b59a00b | 70 | AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()); |
71 | ||
72 | if (!esdH) { | |
73 | Printf("ERROR: Could not get ESDInputHandler"); | |
74 | } else | |
75 | fESD = esdH->GetEvent(); | |
76 | } | |
77 | ||
78 | AliMCEventHandler* mcH = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()); | |
79 | if (!mcH) { | |
80 | Printf("ERROR: Could not retrieve MC event handler"); | |
81 | } | |
82 | else | |
83 | fMC = mcH->MCEvent(); | |
84 | } | |
85 | ||
86 | //________________________________________________________________________ | |
87 | void AliAnalysisTaskProtonsQA::CreateOutputObjects() { | |
88 | // Create histograms | |
e7df5638 | 89 | // Called once |
d4733690 | 90 | fList0 = new TList(); |
5429dd65 | 91 | fList0 = fProtonQAAnalysis->GetGlobalQAList(); |
d4733690 | 92 | |
93 | fList1 = new TList(); | |
5429dd65 | 94 | fList1 = fProtonQAAnalysis->GetPDGList(); |
d4733690 | 95 | |
96 | fList2 = new TList(); | |
5429dd65 | 97 | fList2 = fProtonQAAnalysis->GetMCProcessesList(); |
5b8133c7 | 98 | |
99 | fList3 = new TList(); | |
5429dd65 | 100 | fList3 = fProtonQAAnalysis->GetAcceptedCutList(); |
5b8133c7 | 101 | |
102 | fList4 = new TList(); | |
5661e210 | 103 | fList4 = fProtonQAAnalysis->GetRejectedCutList(); |
9c0b9f24 | 104 | |
105 | fList5 = new TList(); | |
5661e210 | 106 | fList5 = fProtonQAAnalysis->GetAcceptedDCAList(); |
75decd62 | 107 | |
108 | fList6 = new TList(); | |
5661e210 | 109 | fList6 = fProtonQAAnalysis->GetEfficiencyQAList(); |
110 | ||
111 | fList7 = new TList(); | |
112 | fList7 = fProtonQAAnalysis->GetVertexQAList(); | |
df201289 | 113 | |
114 | fList8 = new TList(); | |
115 | fList8 = fProtonQAAnalysis->GetCutEfficiencyList(); | |
7b59a00b | 116 | } |
117 | ||
118 | //________________________________________________________________________ | |
119 | void AliAnalysisTaskProtonsQA::Exec(Option_t *) { | |
120 | // Main loop | |
121 | // Called for each event | |
122 | ||
123 | if (!fESD) { | |
124 | Printf("ERROR: fESD not available"); | |
125 | return; | |
126 | } | |
5429dd65 | 127 | |
7b59a00b | 128 | if (!fMC) { |
129 | Printf("ERROR: Could not retrieve MC event"); | |
130 | return; | |
131 | } | |
132 | ||
75decd62 | 133 | AliGenEventHeader *header = fMC->GenEventHeader(); |
134 | if (!header) { | |
135 | Printf("ERROR: Could not retrieve the header"); | |
136 | return; | |
137 | } | |
138 | ||
7b59a00b | 139 | AliStack* stack = fMC->Stack(); |
140 | if (!stack) { | |
141 | Printf("ERROR: Could not retrieve the stack"); | |
142 | return; | |
143 | } | |
e56f08ed | 144 | //online trigger |
145 | if(dynamic_cast<AliProtonAnalysisBase*>(fProtonQAAnalysis->GetProtonAnalysisBaseObject())->IsEventTriggered(fESD,dynamic_cast<AliProtonAnalysisBase*>(fProtonQAAnalysis->GetProtonAnalysisBaseObject())->GetTriggerMode())) { | |
146 | //offline trigger | |
147 | if(dynamic_cast<AliProtonAnalysisBase*>(fProtonQAAnalysis->GetProtonAnalysisBaseObject())->IsOfflineTriggerUsed()) { | |
148 | AliPhysicsSelection *gPhysicselection = dynamic_cast<AliPhysicsSelection *>(dynamic_cast<AliProtonAnalysisBase*>(fProtonQAAnalysis->GetProtonAnalysisBaseObject())->GetPhysicsSelectionObject()); | |
149 | if(gPhysicselection->IsCollisionCandidate(fESD)) { | |
150 | fProtonQAAnalysis->RunVertexQA(header, | |
151 | fESD); | |
152 | const AliESDVertex *vertex = dynamic_cast<AliProtonAnalysisBase*>(fProtonQAAnalysis->GetProtonAnalysisBaseObject())->GetVertex(fESD,dynamic_cast<AliProtonAnalysisBase*>(fProtonQAAnalysis->GetProtonAnalysisBaseObject())->GetAnalysisMode(),dynamic_cast<AliProtonAnalysisBase*>(fProtonQAAnalysis->GetProtonAnalysisBaseObject())->GetVxMax(),dynamic_cast<AliProtonAnalysisBase*>(fProtonQAAnalysis->GetProtonAnalysisBaseObject())->GetVyMax(),dynamic_cast<AliProtonAnalysisBase*>(fProtonQAAnalysis->GetProtonAnalysisBaseObject())->GetVzMax()); | |
153 | if(vertex) { | |
154 | fProtonQAAnalysis->RunQAAnalysis(stack, fESD, vertex); | |
155 | fProtonQAAnalysis->RunMCAnalysis(stack); | |
156 | fProtonQAAnalysis->RunPIDEfficiencyAnalysis(stack, fESD, vertex); | |
157 | fProtonQAAnalysis->RunReconstructionEfficiencyAnalysis(fMC,fESD,vertex); | |
158 | fProtonQAAnalysis->RunCutEfficiencyAnalysis(stack, fESD, vertex); | |
159 | }//accepted vertex | |
160 | }//offline trigger | |
161 | }//offline trigger used | |
162 | }//online trigger | |
5429dd65 | 163 | |
7b59a00b | 164 | // Post output data. |
d4733690 | 165 | PostData(0, fList0); |
166 | PostData(1, fList1); | |
167 | PostData(2, fList2); | |
5b8133c7 | 168 | PostData(3, fList3); |
169 | PostData(4, fList4); | |
9c0b9f24 | 170 | PostData(5, fList5); |
75decd62 | 171 | PostData(6, fList6); |
5661e210 | 172 | PostData(7, fList7); |
df201289 | 173 | PostData(8, fList8); |
7b59a00b | 174 | } |
175 | ||
176 | //________________________________________________________________________ | |
177 | void AliAnalysisTaskProtonsQA::Terminate(Option_t *) { | |
178 | // Draw result to the screen | |
179 | // Called once at the end of the query | |
180 | ||
d4733690 | 181 | fList0 = dynamic_cast<TList*> (GetOutputData(0)); |
182 | if (!fList0) { | |
5429dd65 | 183 | Printf("ERROR: fList0 not available"); |
184 | return; | |
185 | } | |
186 | fList1 = dynamic_cast<TList*> (GetOutputData(1)); | |
187 | if (!fList1) { | |
188 | Printf("ERROR: fList1 not available"); | |
189 | return; | |
190 | } | |
191 | fList2 = dynamic_cast<TList*> (GetOutputData(2)); | |
192 | if (!fList2) { | |
193 | Printf("ERROR: fList2 not available"); | |
194 | return; | |
195 | } | |
196 | fList3 = dynamic_cast<TList*> (GetOutputData(3)); | |
197 | if (!fList3) { | |
198 | Printf("ERROR: fList3 not available"); | |
199 | return; | |
200 | } | |
201 | fList4 = dynamic_cast<TList*> (GetOutputData(4)); | |
202 | if (!fList4) { | |
203 | Printf("ERROR: fList4 not available"); | |
7b59a00b | 204 | return; |
205 | } | |
5429dd65 | 206 | fList5 = dynamic_cast<TList*> (GetOutputData(5)); |
207 | if (!fList5) { | |
208 | Printf("ERROR: fList5 not available"); | |
209 | return; | |
210 | } | |
e7df5638 | 211 | fList6 = dynamic_cast<TList*> (GetOutputData(6)); |
212 | if (!fList6) { | |
213 | Printf("ERROR: fList6 not available"); | |
214 | return; | |
5429dd65 | 215 | } |
e7df5638 | 216 | fList7 = dynamic_cast<TList*> (GetOutputData(7)); |
217 | if (!fList7) { | |
218 | Printf("ERROR: fList7 not available"); | |
219 | return; | |
5429dd65 | 220 | } |
df201289 | 221 | fList8 = dynamic_cast<TList*> (GetOutputData(8)); |
222 | if (!fList8) { | |
223 | Printf("ERROR: fList8 not available"); | |
224 | return; | |
225 | } | |
7b59a00b | 226 | } |
227 | ||
228 |