]>
Commit | Line | Data |
---|---|---|
2a910c25 | 1 | /* $Id: AliPhiCorrelationsQATask.cxx 47416 2011-02-15 13:55:09Z jgrosseo $ */ |
2 | ||
3 | #include "AliPhiCorrelationsQATask.h" | |
4 | ||
5 | #include <TH2F.h> | |
6 | #include <TParticle.h> | |
7 | #include <TFile.h> | |
8 | ||
9 | #include <AliLog.h> | |
10 | #include <AliESDVertex.h> | |
11 | #include <AliESDEvent.h> | |
12 | #include <AliMCEvent.h> | |
13 | #include <AliStack.h> | |
14 | #include <AliHeader.h> | |
15 | #include <AliAnalysisManager.h> | |
16 | #include <AliCentrality.h> | |
17 | ||
18 | #include "AliESDtrackCuts.h" | |
19 | ||
20 | ClassImp(AliPhiCorrelationsQATask) | |
21 | ||
22 | AliPhiCorrelationsQATask::AliPhiCorrelationsQATask(const char* opt) : | |
23 | AliAnalysisTaskSE("AliPhiCorrelationsQATask"), | |
24 | fOutput(0), | |
25 | fOption(opt), | |
26 | fEsdTrackCuts(0), | |
27 | fEsdTrackCuts2(0), | |
28 | fCheckITS(0), | |
29 | fGlobalTracks(0), | |
30 | fCentralityCorrelation(0), | |
31 | fDCAPrimaries(0), | |
32 | fDCASecondaries(0), | |
33 | fUseUncheckedCentrality(kFALSE) | |
34 | { | |
35 | // | |
36 | // Constructor. Initialization of pointers | |
37 | // | |
38 | ||
39 | // Define input and output slots here | |
40 | DefineOutput(1, TList::Class()); | |
41 | ||
42 | AliLog::SetClassDebugLevel("AliPhiCorrelationsQATask", AliLog::kWarning); | |
43 | } | |
44 | ||
45 | AliPhiCorrelationsQATask::~AliPhiCorrelationsQATask() | |
46 | { | |
47 | // | |
48 | // Destructor | |
49 | // | |
50 | ||
51 | // histograms are in the output list and deleted when the output | |
52 | // list is deleted by the TSelector dtor | |
53 | ||
54 | if (fOutput && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) { | |
55 | delete fOutput; | |
56 | fOutput = 0; | |
57 | } | |
58 | } | |
59 | ||
60 | void AliPhiCorrelationsQATask::UserCreateOutputObjects() | |
61 | { | |
62 | // create result objects and add to output list | |
63 | ||
64 | Printf("AliPhiCorrelationsQATask::CreateOutputObjects"); | |
65 | //AliLog::SetClassDebugLevel("AliPhysicsSelection", AliLog::kDebug); | |
66 | ||
67 | fOutput = new TList; | |
68 | fOutput->SetOwner(); | |
69 | ||
70 | fCentralityCorrelation = new TH2F("fCentralityCorrelation", ";v0 centr;spd centr", 100, 0, 100.001, 100, 0, 100.001); | |
71 | fOutput->Add(fCentralityCorrelation); | |
72 | ||
73 | fEsdTrackCuts = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts(); | |
74 | fEsdTrackCuts->SetMinNClustersTPC(70); | |
75 | // disable DCA cut | |
76 | fEsdTrackCuts->SetMaxDCAToVertexZ(); | |
77 | fEsdTrackCuts->SetMaxDCAToVertexXY(); | |
78 | fEsdTrackCuts->SetDCAToVertex2D(kFALSE); | |
79 | fEsdTrackCuts->SetName("cuts_quality_only"); | |
80 | fEsdTrackCuts->DefineHistograms(); | |
81 | fOutput->Add(fEsdTrackCuts); | |
82 | ||
83 | fEsdTrackCuts2 = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts(); | |
84 | fEsdTrackCuts2->SetMinNClustersTPC(70); | |
85 | fEsdTrackCuts2->SetName("cuts_quality_dca"); | |
86 | fEsdTrackCuts2->DefineHistograms(); | |
87 | fOutput->Add(fEsdTrackCuts2); | |
88 | ||
89 | fGlobalTracks = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(); | |
90 | fGlobalTracks->SetName("global_cuts"); | |
91 | fGlobalTracks->DefineHistograms(); | |
92 | fOutput->Add(fGlobalTracks); | |
93 | ||
94 | fCheckITS = new AliESDtrackCuts; | |
95 | fCheckITS->SetRequireITSRefit(kTRUE); | |
96 | fCheckITS->SetClusterRequirementITS(AliESDtrackCuts::kSPD, | |
97 | AliESDtrackCuts::kAny); | |
98 | fCheckITS->SetDCAToVertex2D(kFALSE); | |
99 | fCheckITS->SetRequireSigmaToVertex(kFALSE); | |
100 | fCheckITS->SetName("check_its"); | |
101 | fCheckITS->DefineHistograms(); | |
102 | fOutput->Add(fCheckITS); | |
103 | ||
104 | fDCAPrimaries = new TH2F("fDCAPrimaries", ";dca_xy;dca_z", 1000, -5, 5, 1000, -5, 5); | |
105 | fDCASecondaries = (TH2F*) fDCAPrimaries->Clone("fDCASecondaries"); | |
106 | ||
107 | fOutput->Add(fDCAPrimaries); | |
108 | fOutput->Add(fDCASecondaries); | |
1a32ecc0 | 109 | |
110 | PostData(1, fOutput); | |
2a910c25 | 111 | } |
112 | ||
113 | void AliPhiCorrelationsQATask::UserExec(Option_t*) | |
114 | { | |
115 | // process the event | |
116 | ||
117 | //Printf("AliPhiCorrelationsQATask::UserExec"); | |
118 | ||
119 | AliESDEvent* esd = (AliESDEvent*) fInputEvent; | |
120 | if (!esd) | |
121 | AliFatal("No input event"); | |
122 | ||
2a910c25 | 123 | // vertex cut |
124 | const AliESDVertex* vtxESD = esd->GetPrimaryVertex(); | |
125 | const AliESDVertex *vtxSPD = esd->GetPrimaryVertexSPD(); | |
126 | if (!vtxESD) | |
127 | return; | |
128 | if (!vtxSPD) | |
129 | return; | |
130 | ||
131 | Double_t vtx[3]; | |
132 | vtxESD->GetXYZ(vtx); | |
133 | if (TMath::Abs(vtx[2]) > 10) | |
134 | return; | |
135 | ||
136 | AliCentrality *centralityObj = esd->GetCentrality(); | |
bf376d34 | 137 | if (centralityObj) |
2a910c25 | 138 | { |
bf376d34 | 139 | Float_t v0Centrality = -1; |
140 | Float_t spdCentrality = -1; | |
141 | ||
142 | if (fUseUncheckedCentrality) | |
143 | { | |
144 | v0Centrality = centralityObj->GetCentralityPercentileUnchecked("V0M"); | |
145 | spdCentrality = centralityObj->GetCentralityPercentileUnchecked("CL1"); | |
146 | } | |
147 | else | |
148 | { | |
149 | v0Centrality = centralityObj->GetCentralityPercentile("V0M"); | |
150 | spdCentrality = centralityObj->GetCentralityPercentile("CL1"); | |
151 | } | |
152 | ||
153 | fCentralityCorrelation->Fill(v0Centrality, spdCentrality); | |
2a910c25 | 154 | } |
2a910c25 | 155 | |
156 | AliStack* stack = 0; | |
157 | if (fMCEvent) | |
158 | { | |
159 | stack = fMCEvent->Stack(); | |
160 | if (!stack) | |
161 | AliFatal("Stack is 0"); | |
162 | } | |
163 | ||
164 | Int_t count = 0; | |
165 | ||
166 | for (Int_t i=0; i<esd->GetNumberOfTracks(); i++) | |
167 | { | |
168 | AliESDtrack* esdTrack = esd->GetTrack(i); | |
169 | ||
170 | if (0) | |
171 | { | |
172 | if (!fGlobalTracks->AcceptTrack(esdTrack)) | |
173 | continue; | |
174 | } | |
175 | ||
176 | if (!fEsdTrackCuts->AcceptTrack(esdTrack)) | |
177 | continue; | |
178 | ||
179 | count++; | |
180 | ||
181 | //if (v0Centrality < 0) | |
182 | // continue; | |
183 | ||
184 | Float_t b[2]; | |
185 | Float_t bCov[3]; | |
186 | esdTrack->GetImpactParameters(b, bCov); | |
187 | ||
188 | Bool_t primary = kTRUE; | |
189 | if (stack) | |
190 | primary = stack->IsPhysicalPrimary(TMath::Abs(esdTrack->GetLabel())); | |
191 | ||
192 | if (primary) | |
193 | fDCAPrimaries->Fill(b[0], b[1]); | |
194 | else | |
195 | fDCASecondaries->Fill(b[0], b[1]); | |
196 | ||
197 | // fill histograms of second object | |
198 | if (!fEsdTrackCuts2->AcceptTrack(esdTrack)) | |
199 | continue; | |
200 | ||
201 | if (fCheckITS->AcceptTrack(esdTrack)) | |
202 | { | |
203 | if (!fGlobalTracks->AcceptTrack(esdTrack)) | |
204 | continue; | |
205 | } | |
206 | ||
59064365 | 207 | /* |
2a910c25 | 208 | // create a tpc only track |
209 | AliESDtrack *track = AliESDtrackCuts::GetTPCOnlyTrack(esd,esdTrack->GetID()); | |
210 | if (!track) | |
211 | continue; | |
212 | ||
213 | if (track->Pt()>0.) | |
214 | { | |
215 | // only constrain tracks above threshold | |
216 | AliExternalTrackParam exParam; | |
217 | // take the B-feild from the ESD, no 3D fieldMap available at this point | |
218 | Bool_t relate = false; | |
219 | relate = track->RelateToVertex(vtxSPD,esd->GetMagneticField(),kVeryBig,&exParam); | |
220 | if(!relate){ | |
221 | delete track; | |
222 | continue; | |
223 | } | |
224 | track->Set(exParam.GetX(),exParam.GetAlpha(),exParam.GetParameter(),exParam.GetCovariance()); | |
225 | } | |
226 | ||
227 | Float_t b2[2]; | |
228 | track->GetImpactParameters(b2,bCov); | |
229 | ||
230 | //Printf("%.2f %.2f %.2f %.2f", b[0], b2[0], b[1], b2[1]); | |
231 | ||
232 | delete track; | |
59064365 | 233 | */ |
2a910c25 | 234 | } |
235 | ||
236 | //Printf("%.2f: %d %d tracks (out of %d)", v0Centrality, centralityObj->GetQuality(), count, esd->GetNumberOfTracks()); | |
237 | } | |
238 | ||
239 | void AliPhiCorrelationsQATask::Terminate(Option_t *) | |
240 | { | |
241 | // terminate | |
242 | ||
243 | Printf("In AliPhiCorrelationsQATask::Terminate..."); | |
244 | ||
245 | fOutput = dynamic_cast<TList*> (GetOutputData(1)); | |
246 | if (!fOutput) | |
247 | { | |
248 | Printf("ERROR: fOutput not available"); | |
249 | return; | |
250 | } | |
251 | ||
252 | fEsdTrackCuts = dynamic_cast<AliESDtrackCuts*> (fOutput->FindObject("cuts_quality_only")); | |
253 | if (!fEsdTrackCuts) | |
254 | { | |
255 | Printf("ERROR: fEsdTrackCuts not available"); | |
256 | return; | |
257 | } | |
258 | ||
259 | fEsdTrackCuts2 = dynamic_cast<AliESDtrackCuts*> (fOutput->FindObject("cuts_quality_dca")); | |
260 | if (!fEsdTrackCuts2) | |
261 | { | |
262 | Printf("ERROR: fEsdTrackCuts2 not available"); | |
263 | return; | |
264 | } | |
265 | ||
266 | TFile* file = TFile::Open("track_cuts.root", "RECREATE"); | |
267 | fEsdTrackCuts->SaveHistograms(); | |
268 | fEsdTrackCuts2->SaveHistograms(); | |
269 | file->Close(); | |
270 | } |