]>
Commit | Line | Data |
---|---|---|
44f32dd2 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | ||
17 | /* $Id: $ */ | |
18 | ||
19 | /* | |
20 | Based on AliPHOSQADataMaker | |
21 | Produces the data needed to calculate the quality assurance. | |
22 | All data must be mergeable objects. | |
23 | P. Christiansen, Lund, January 2008 | |
24 | */ | |
25 | ||
26 | /* | |
27 | Implementation: | |
28 | ||
29 | We have chosen to have the histograms as non-persistent meber to | |
30 | allow better debugging. In the copy constructor we then have to | |
31 | assign the pointers to the existing histograms in the copied | |
32 | list. This have been implemented but not tested. | |
33 | ||
34 | For the QA of the RAW data we use the class, AliTPCdataQA, from the | |
35 | existing TPC Calibration framework (which is more advanced than the | |
36 | standard QA framework) and extract the histograms at the end. This | |
37 | has been tested with zero-suppressed data. The Analyse method of the | |
38 | AliTPCdataQA class is called in the method, EndOfDetectorCycle, and | |
39 | there also: 1d histogram(s) are projected and added to the QA list. | |
40 | */ | |
41 | ||
42 | /* | |
43 | TODO: | |
44 | Sumw2 for RAW histogram(s)? | |
45 | RecPoints and ESD could have many more histograms | |
46 | */ | |
47 | ||
48 | #include "AliTPCQADataMakerRec.h" | |
49 | ||
50 | // --- ROOT system --- | |
51 | #include <TClonesArray.h> | |
be4f1702 | 52 | #include <TString.h> |
53 | #include <TSystem.h> | |
44f32dd2 | 54 | |
55 | // --- Standard library --- | |
56 | ||
57 | // --- AliRoot header files --- | |
58 | #include "AliQAChecker.h" | |
59 | #include "AliESDEvent.h" | |
60 | #include "AliESDtrack.h" | |
61 | #include "AliLog.h" | |
62 | #include "AliTPCCalPad.h" | |
63 | #include "AliTPCClustersRow.h" | |
64 | #include "AliTPCclusterMI.h" | |
65 | ||
66 | ClassImp(AliTPCQADataMakerRec) | |
67 | ||
68 | //____________________________________________________________________________ | |
69 | AliTPCQADataMakerRec::AliTPCQADataMakerRec() : | |
70 | AliQADataMakerRec(AliQA::GetDetName(AliQA::kTPC), | |
71 | "TPC Rec Quality Assurance Data Maker"), | |
72 | fTPCdataQA(0), | |
73 | fHistESDclusters(0),fHistESDratio(0), fHistESDpt(0), | |
74 | fHistRawsOccupancy(0), | |
75 | fHistRecPointsQmaxShort(0), fHistRecPointsQmaxMedium(0), | |
76 | fHistRecPointsQmaxLong(0), fHistRecPointsQShort(0), | |
77 | fHistRecPointsQMedium(0), fHistRecPointsQLong(0), | |
78 | fHistRecPointsRow(0) | |
79 | { | |
80 | // ctor | |
be4f1702 | 81 | for(Int_t i = 0; i < 6; i++) |
82 | fMapping[i] = 0; | |
44f32dd2 | 83 | } |
84 | ||
85 | //____________________________________________________________________________ | |
86 | AliTPCQADataMakerRec::AliTPCQADataMakerRec(const AliTPCQADataMakerRec& qadm) : | |
336156cc | 87 | AliQADataMakerRec(), |
c94a79e1 | 88 | fTPCdataQA(0), |
336156cc | 89 | fHistESDclusters(0), //! Clusters per ESD track |
90 | fHistESDratio(0), //! Ratio of clusters to findables | |
91 | fHistESDpt(0), //! Pt spectrum | |
92 | ||
93 | fHistRawsOccupancy(0),//! Pad occupancy (1 entry per pad) | |
94 | ||
95 | fHistRecPointsQmaxShort(0), //! Qmax (short pads) | |
96 | fHistRecPointsQmaxMedium(0),//! Qmax (medium pads) | |
97 | fHistRecPointsQmaxLong(0), //! Qmax (long pads) | |
98 | fHistRecPointsQShort(0), //! Q (short pads) | |
99 | fHistRecPointsQMedium(0), //! Q (medium pads) | |
100 | fHistRecPointsQLong(0), //! Q (long pads) | |
101 | fHistRecPointsRow(0) //! Row distribution | |
44f32dd2 | 102 | { |
103 | //copy ctor | |
104 | // Does not copy the calibration object, instead InitRaws have to be | |
105 | // called again | |
106 | SetName((const char*)qadm.GetName()) ; | |
107 | SetTitle((const char*)qadm.GetTitle()); | |
108 | ||
be4f1702 | 109 | for(Int_t i = 0; i < 6; i++) |
110 | fMapping[i] = 0; | |
111 | ||
44f32dd2 | 112 | // |
113 | // Associate class histogram objects to the copies in the list | |
114 | // Could also be done with the indexes | |
115 | // | |
116 | fHistESDclusters = (TH1F*)fESDsQAList->FindObject("hESDclusters"); | |
117 | fHistESDratio = (TH1F*)fESDsQAList->FindObject("hESDratio"); | |
118 | fHistESDpt = (TH1F*)fESDsQAList->FindObject("hESDpt"); | |
119 | ||
120 | fHistRawsOccupancy = (TH1F*)fRawsQAList->FindObject("hRawsOccupancy"); | |
121 | ||
122 | fHistRecPointsQmaxShort = | |
123 | (TH1F*)fRecPointsQAList->FindObject("hRecPointsQmaxShort"); | |
124 | fHistRecPointsQmaxMedium = | |
125 | (TH1F*)fRecPointsQAList->FindObject("hRecPointsQmaxMedium"); | |
126 | fHistRecPointsQmaxLong = | |
127 | (TH1F*)fRecPointsQAList->FindObject("hRecPointsQmaxLong"); | |
128 | fHistRecPointsQShort = | |
129 | (TH1F*)fRecPointsQAList->FindObject("hRecPointsQShort"); | |
130 | fHistRecPointsQMedium = | |
131 | (TH1F*)fRecPointsQAList->FindObject("hRecPointsQMedium"); | |
132 | fHistRecPointsQLong = | |
133 | (TH1F*)fRecPointsQAList->FindObject("hRecPointsQLong"); | |
134 | fHistRecPointsRow = | |
135 | (TH1F*)fRecPointsQAList->FindObject("hRecPointsRow"); | |
136 | } | |
137 | ||
138 | //__________________________________________________________________ | |
139 | AliTPCQADataMakerRec& AliTPCQADataMakerRec::operator = (const AliTPCQADataMakerRec& qadm ) | |
140 | { | |
141 | // Equal operator. | |
142 | this->~AliTPCQADataMakerRec(); | |
143 | new(this) AliTPCQADataMakerRec(qadm); | |
144 | return *this; | |
145 | } | |
be4f1702 | 146 | |
147 | //__________________________________________________________________ | |
148 | AliTPCQADataMakerRec::~AliTPCQADataMakerRec() | |
149 | { | |
150 | // Destructor | |
151 | delete fTPCdataQA; | |
152 | ||
153 | for(Int_t i = 0; i < 6; i++) | |
154 | delete fMapping[i]; | |
155 | } | |
44f32dd2 | 156 | |
157 | //____________________________________________________________________________ | |
92a357bf | 158 | void AliTPCQADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray * list) |
44f32dd2 | 159 | { |
160 | //Detector specific actions at end of cycle | |
161 | ||
162 | if(fTPCdataQA) { // do the final step of the QA for Raw data | |
163 | ||
c75bf2f1 | 164 | fTPCdataQA->Analyse(); // 31/1-08 Analyse is now protected against |
165 | // RAW data files with no TPC data | |
44f32dd2 | 166 | |
336156cc | 167 | //Add2RawsList(fTPCdataQA, 0); |
44f32dd2 | 168 | // get the histograms and add them to the output |
c75bf2f1 | 169 | // 31/8-08 Histogram is only added if the Calibration class |
170 | // receives TPC data | |
171 | if(fTPCdataQA->GetNoThreshold()) { | |
172 | fHistRawsOccupancy = fTPCdataQA->GetNoThreshold()->MakeHisto1D(0, 1, -1); | |
336156cc | 173 | //Add2RawsList(fHistRawsOccupancy, 1); |
c75bf2f1 | 174 | } |
44f32dd2 | 175 | } |
176 | ||
177 | AliQAChecker::Instance()->Run(AliQA::kTPC, task, list) ; | |
178 | } | |
179 | ||
180 | //____________________________________________________________________________ | |
181 | void AliTPCQADataMakerRec::InitESDs() | |
182 | { | |
183 | //create ESDs histograms in ESDs subdir | |
184 | fHistESDclusters = | |
185 | new TH1F("hESDclusters", "N TPC clusters per track; N clusters; Counts", | |
186 | 160, 0, 160); | |
187 | fHistESDclusters->Sumw2(); | |
188 | Add2ESDsList(fHistESDclusters, 0); | |
189 | ||
190 | fHistESDratio = | |
191 | new TH1F("hESDratio", "Ratio: TPC clusters / findable; Ratio: cluster/findable; Counts", | |
192 | 100, 0, 1); | |
193 | fHistESDratio->Sumw2(); | |
194 | Add2ESDsList(fHistESDratio, 1); | |
195 | ||
196 | fHistESDpt = | |
197 | new TH1F("hESDpt", "P_{T} distribution; p_{T} [GeV/c]; Counts", | |
198 | 50, 0, 5); | |
199 | fHistESDpt->Sumw2(); | |
200 | Add2ESDsList(fHistESDpt, 2); | |
201 | } | |
202 | ||
203 | //____________________________________________________________________________ | |
204 | void AliTPCQADataMakerRec::InitRaws() | |
205 | { | |
336156cc | 206 | // |
207 | // Adding the raw | |
be4f1702 | 208 | // |
209 | ||
210 | // Modified: 7/7 - 2008 | |
211 | // Laurent Aphecetche pointed out that the mapping was read from file | |
212 | // for each event, so now we read in the map here and set if for | |
213 | // the raw data qa | |
44f32dd2 | 214 | fTPCdataQA = new AliTPCdataQA(); |
be4f1702 | 215 | LoadMaps(); // Load Altro maps |
216 | fTPCdataQA->SetAltroMapping(fMapping); // set Altro mapping | |
217 | fTPCdataQA->SetRangeTime(100, 920); // set time bin interval | |
218 | ||
336156cc | 219 | Add2RawsList(fTPCdataQA, 0); |
44f32dd2 | 220 | } |
221 | ||
222 | //____________________________________________________________________________ | |
223 | void AliTPCQADataMakerRec::InitRecPoints() | |
224 | { | |
225 | fHistRecPointsQmaxShort = | |
226 | new TH1F("hRecPointsQmaxShort", "Qmax distrbution (short pads); Qmax; Counts", | |
227 | 200, 0, 1000); | |
228 | fHistRecPointsQmaxShort->Sumw2(); | |
229 | Add2RecPointsList(fHistRecPointsQmaxShort, 0); | |
230 | ||
231 | fHistRecPointsQmaxMedium = | |
232 | new TH1F("hRecPointsQmaxMedium", "Qmax distrbution (medium pads); Qmax; Counts", | |
233 | 200, 0, 1000); | |
234 | fHistRecPointsQmaxMedium->Sumw2(); | |
235 | Add2RecPointsList(fHistRecPointsQmaxMedium, 1); | |
236 | ||
237 | fHistRecPointsQmaxLong = | |
238 | new TH1F("hRecPointsQmaxLong", "Qmax distrbution (long pads); Qmax; Counts", | |
239 | 200, 0, 1000); | |
240 | fHistRecPointsQmaxLong->Sumw2(); | |
241 | Add2RecPointsList(fHistRecPointsQmaxLong, 2); | |
242 | ||
243 | fHistRecPointsQShort = | |
244 | new TH1F("hRecPointsQShort", "Q distrbution (short pads); Q; Counts", | |
245 | 200, 0, 5000); | |
246 | fHistRecPointsQShort->Sumw2(); | |
247 | Add2RecPointsList(fHistRecPointsQShort, 3); | |
248 | ||
249 | fHistRecPointsQMedium = | |
250 | new TH1F("hRecPointsQMedium", "Q distrbution (medium pads); Q; Counts", | |
251 | 200, 0, 5000); | |
252 | fHistRecPointsQMedium->Sumw2(); | |
253 | Add2RecPointsList(fHistRecPointsQMedium, 4); | |
254 | ||
255 | fHistRecPointsQLong = | |
256 | new TH1F("hRecPointsQLong", "Q distrbution (long pads); Q; Counts", | |
257 | 200, 0, 5000); | |
258 | fHistRecPointsQLong->Sumw2(); | |
259 | Add2RecPointsList(fHistRecPointsQLong, 5); | |
260 | ||
261 | fHistRecPointsRow = | |
262 | new TH1F("hRecPointsRow", "Clusters per row; Row; Counts", | |
263 | 159, 0, 159); | |
264 | fHistRecPointsRow->Sumw2(); | |
265 | Add2RecPointsList(fHistRecPointsRow, 6); | |
266 | } | |
267 | ||
268 | //____________________________________________________________________________ | |
269 | void AliTPCQADataMakerRec::MakeESDs(AliESDEvent * esd) | |
270 | { | |
271 | // make QA data from ESDs | |
272 | ||
273 | const Int_t nESDTracks = esd->GetNumberOfTracks(); | |
274 | Int_t nTPCtracks = 0; | |
275 | for(Int_t i = 0; i < nESDTracks; i++) { | |
276 | ||
277 | AliESDtrack * track = esd->GetTrack(i); | |
278 | ||
279 | if ((track->GetStatus() & AliESDtrack::kTPCrefit)==0) | |
280 | continue; | |
281 | ||
282 | nTPCtracks++; | |
283 | ||
284 | Int_t nTPCclusters = track->GetTPCNcls(); | |
285 | Int_t nTPCclustersFindable = track->GetTPCNclsF(); | |
286 | ||
287 | fHistESDclusters->Fill(nTPCclusters); | |
288 | fHistESDratio->Fill(Float_t(nTPCclusters)/Float_t(nTPCclustersFindable)); | |
289 | fHistESDpt->Fill(track->Pt()); | |
290 | } | |
291 | } | |
292 | ||
293 | //____________________________________________________________________________ | |
294 | void AliTPCQADataMakerRec::MakeRaws(AliRawReader* rawReader) | |
295 | { | |
296 | // | |
297 | // To make QA for the RAW data we use the TPC Calibration framework | |
298 | // to handle the data and then in the end extract the data | |
299 | // | |
300 | fTPCdataQA->ProcessEvent(rawReader); | |
301 | } | |
302 | ||
303 | //____________________________________________________________________________ | |
304 | void AliTPCQADataMakerRec::MakeRecPoints(TTree* recTree) | |
305 | { | |
306 | AliTPCClustersRow *clrow = new AliTPCClustersRow(); | |
307 | clrow->SetClass("AliTPCclusterMI"); | |
308 | clrow->SetArray(0); | |
309 | clrow->GetArray()->ExpandCreateFast(10000); | |
310 | ||
311 | TBranch* branch = recTree->GetBranch("Segment"); | |
312 | branch->SetAddress(&clrow); | |
313 | ||
314 | const Int_t nEntries = Int_t(recTree->GetEntries()); | |
315 | for (Int_t i = 0; i < nEntries; i++) { | |
316 | ||
317 | branch->GetEntry(i); | |
318 | ||
319 | const Int_t nClusters = clrow->GetArray()->GetEntriesFast(); | |
320 | for (Int_t icl=0; icl < nClusters; icl++){ | |
321 | ||
322 | AliTPCclusterMI* cluster = | |
323 | (AliTPCclusterMI*)clrow->GetArray()->At(icl); | |
324 | ||
325 | Float_t Qmax = cluster->GetMax(); | |
326 | Float_t Q = cluster->GetQ(); | |
327 | Int_t row = cluster->GetRow(); | |
328 | ||
329 | if(cluster->GetDetector()<36) { // IROC (short pads) | |
330 | ||
331 | fHistRecPointsQmaxShort->Fill(Qmax); | |
332 | fHistRecPointsQShort->Fill(Q); | |
333 | } else { // OROC (medium and long pads) | |
334 | row += 63; | |
335 | if(cluster->GetRow()<64) { // medium pads | |
336 | ||
337 | fHistRecPointsQmaxMedium->Fill(Qmax); | |
338 | fHistRecPointsQMedium->Fill(Q); | |
339 | } else { // long pads | |
340 | ||
341 | fHistRecPointsQmaxLong->Fill(Qmax); | |
342 | fHistRecPointsQLong->Fill(Q); | |
343 | } | |
344 | } | |
345 | ||
346 | fHistRecPointsRow->Fill(row); | |
347 | } // end loop over clusters | |
348 | } // end loop over tree | |
349 | ||
350 | delete clrow; | |
351 | } | |
be4f1702 | 352 | |
353 | //____________________________________________________________________________ | |
354 | void AliTPCQADataMakerRec::LoadMaps() | |
355 | { | |
356 | TString path = gSystem->Getenv("ALICE_ROOT"); | |
357 | path += "/TPC/mapping/Patch"; | |
358 | ||
359 | for(Int_t i = 0; i < 6; i++) { | |
360 | TString path2 = path; | |
361 | path2 += i; | |
362 | path2 += ".data"; | |
363 | fMapping[i] = new AliTPCAltroMapping(path2.Data()); | |
364 | } | |
365 | } | |
366 |