]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/AliTPCQADataMakerRec.cxx
- fixing mistake
[u/mrichter/AliRoot.git] / TPC / AliTPCQADataMakerRec.cxx
CommitLineData
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>
ce0175fa 54#include <TBox.h>
5e10013b 55#include <TLine.h>
44f32dd2 56
57// --- Standard library ---
58
59// --- AliRoot header files ---
60#include "AliQAChecker.h"
61#include "AliESDEvent.h"
62#include "AliESDtrack.h"
63#include "AliLog.h"
64#include "AliTPCCalPad.h"
adcdb395 65#include "AliTPCCalROC.h"
44f32dd2 66#include "AliTPCClustersRow.h"
67#include "AliTPCclusterMI.h"
44ed7a66 68#include "AliSimDigits.h"
44f32dd2 69
70ClassImp(AliTPCQADataMakerRec)
71
72//____________________________________________________________________________
73AliTPCQADataMakerRec::AliTPCQADataMakerRec() :
ce0175fa 74AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kTPC),
75 "TPC Rec Quality Assurance Data Maker"),
76 fTPCdataQA(NULL),
77 fBeautifyOption(1), // 0:no beautify, !=0:beautify RAW
78 fOccHighLimit(1e-4), // high limit for accepting occupancy values
79 fQmaxLowLimit(8), // low limit for accepting Qmax values
80 fQmaxHighLimit(40) // high limit for accepting Qmax values
44f32dd2 81{
82 // ctor
57acd2d2 83 fTPCdataQA = new AliTPCdataQA*[AliRecoParam::kNSpecies] ;
84 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
85 fTPCdataQA[specie] = NULL ;
86
be4f1702 87 for(Int_t i = 0; i < 6; i++)
88 fMapping[i] = 0;
44f32dd2 89}
90
91//____________________________________________________________________________
92AliTPCQADataMakerRec::AliTPCQADataMakerRec(const AliTPCQADataMakerRec& qadm) :
336156cc 93 AliQADataMakerRec(),
ce0175fa 94 fTPCdataQA(NULL),
95 fBeautifyOption(qadm.GetBeautifyOption()),
96 fOccHighLimit(qadm.GetOccHighLimit()),
97 fQmaxLowLimit(qadm.GetQmaxLowLimit()),
98 fQmaxHighLimit(qadm.GetQmaxHighLimit())
44f32dd2 99{
100 //copy ctor
101 // Does not copy the calibration object, instead InitRaws have to be
102 // called again
103 SetName((const char*)qadm.GetName()) ;
104 SetTitle((const char*)qadm.GetTitle());
105
57acd2d2 106 fTPCdataQA = new AliTPCdataQA*[AliRecoParam::kNSpecies] ;
107 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
108 fTPCdataQA[specie] = NULL ;
109
be4f1702 110 for(Int_t i = 0; i < 6; i++)
111 fMapping[i] = 0;
112
44f32dd2 113 //
114 // Associate class histogram objects to the copies in the list
115 // Could also be done with the indexes
116 //
57acd2d2 117
44f32dd2 118}
119
120//__________________________________________________________________
121AliTPCQADataMakerRec& AliTPCQADataMakerRec::operator = (const AliTPCQADataMakerRec& qadm )
122{
123 // Equal operator.
124 this->~AliTPCQADataMakerRec();
125 new(this) AliTPCQADataMakerRec(qadm);
126 return *this;
127}
be4f1702 128
129//__________________________________________________________________
130AliTPCQADataMakerRec::~AliTPCQADataMakerRec()
131{
132 // Destructor
57acd2d2 133 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
134 if ( fTPCdataQA[specie] != NULL )
135 delete fTPCdataQA[specie] ;
136 delete[] fTPCdataQA;
be4f1702 137
138 for(Int_t i = 0; i < 6; i++)
139 delete fMapping[i];
140}
44f32dd2 141
142//____________________________________________________________________________
4e25ac79 143void AliTPCQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
44f32dd2 144{
145 //Detector specific actions at end of cycle
57acd2d2 146
147 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
4e25ac79 148 if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) )
57acd2d2 149 continue ;
150 if(fTPCdataQA[specie] != NULL) { // do the final step of the QA for Raw data
44f32dd2 151
57acd2d2 152 fTPCdataQA[specie]->Analyse(); // 31/1-08 Analyse is now protected against
c75bf2f1 153 // RAW data files with no TPC data
57acd2d2 154
5e232cd6 155 SetEventSpecie(AliRecoParam::ConvertIndex(specie)) ;
ce0175fa 156 TH1F * histRawsOccupancy = (TH1F*)GetRawsData(kRawsOccupancy) ;
157 TH1F * histRawsOccupancyVsSector = (TH1F*)GetRawsData(kRawsOccupancyVsSector) ;
158 TH1F * histRawsNClustersPerEventVsSector = (TH1F*)GetRawsData(kRawsNClustersPerEventVsSector) ;
159 TH1F * histRawsQVsSector = (TH1F*)GetRawsData(kRawsQVsSector) ;
160 TH1F * histRawsQmaxVsSector = (TH1F*)GetRawsData(kRawsQmaxVsSector) ;
161 TH1F * histRawsOccupancyVsEvent = (TH1F*)GetRawsData(kRawsOccupancyVsEvent) ;
162 TH1F * histRawsNclustersVsEvent = (TH1F*)GetRawsData(kRawsNclustersVsEvent) ;
57acd2d2 163 if ( !histRawsOccupancy ||
ce0175fa 164 !histRawsOccupancyVsSector ||
165 !histRawsNClustersPerEventVsSector ||
166 !histRawsQVsSector ||
167 !histRawsQmaxVsSector ||
168 !histRawsOccupancyVsEvent ||
169 !histRawsNclustersVsEvent ) {
57acd2d2 170 AliError("Something very wrong here, corrupted memory ?????. Please check\n") ;
171 continue ;
172 }
173
174 //Add2RawsList(fTPCdataQA, 0);
175 // get the histograms and add them to the output
176 // 31/8-08 Histogram is only added if the Calibration class
177 // receives TPC data
178 const Int_t eventCounter = fTPCdataQA[specie]->GetEventCounter();
179 if(eventCounter>0) { // some TPC data has been processed
180
181 // Reset histograms and refill them
182 histRawsOccupancy->Reset();
183 histRawsOccupancyVsSector->Reset();
184 histRawsNClustersPerEventVsSector->Reset();
185 histRawsQVsSector->Reset();
186 histRawsQmaxVsSector->Reset();
adcdb395 187
ce0175fa 188 TH1F* hNormOcc = new TH1F("hNormOcc", 0, 72, 0, 72);
189 hNormOcc->Sumw2();
190 TH1F* hNormNclusters = new TH1F("hNormNclusters", 0, 72, 0, 72);
191 hNormNclusters->Sumw2();
57acd2d2 192
193 for (Int_t iSec = 0; iSec < 72; iSec++) {
adcdb395 194
57acd2d2 195 AliTPCCalROC* occupancyROC =
196 fTPCdataQA[specie]->GetNoThreshold()->GetCalROC(iSec);
197 AliTPCCalROC* nclusterROC =
198 fTPCdataQA[specie]->GetNLocalMaxima()->GetCalROC(iSec);
199 AliTPCCalROC* qROC =
200 fTPCdataQA[specie]->GetMeanCharge()->GetCalROC(iSec);
201 AliTPCCalROC* qmaxROC =
202 fTPCdataQA[specie]->GetMaxCharge()->GetCalROC(iSec);
203
204 const Int_t nRows = occupancyROC->GetNrows();
205 for (Int_t iRow = 0; iRow < nRows; iRow++) {
206
57acd2d2 207 const Int_t nPads = occupancyROC->GetNPads(iRow);
208 for (Int_t iPad = 0; iPad < nPads; iPad++) {
ce0175fa 209
57acd2d2 210 histRawsOccupancy->Fill(occupancyROC->GetValue(iRow, iPad));
ce0175fa 211 hNormOcc->Fill(iSec);
57acd2d2 212 histRawsOccupancyVsSector
ce0175fa 213 ->Fill(iSec, occupancyROC->GetValue(iRow, iPad));
214
57acd2d2 215 const Int_t nClusters = TMath::Nint(nclusterROC->GetValue(iRow, iPad));
adcdb395 216
ce0175fa 217 if(nClusters>0) {
218
219 hNormNclusters->Fill(iSec,nClusters);
57acd2d2 220 histRawsNClustersPerEventVsSector->Fill(iSec, nClusters);
ce0175fa 221 histRawsQVsSector->Fill(iSec,
222 nClusters*qROC->GetValue(iRow, iPad));
223 histRawsQmaxVsSector->Fill(iSec,
224 nClusters*qmaxROC->GetValue(iRow, iPad));
57acd2d2 225 }
226 }
227 }
228 } // end loop over sectors
adcdb395 229
ce0175fa 230 // update event histograms - copy info from TPDdataQA histos
231 TH1F* hQAOccVsEvent = fTPCdataQA[specie]->GetHistOccupancyVsEvent();
232 TH1F* hQANclVsEvent = fTPCdataQA[specie]->GetHistNclustersVsEvent();
233
234 // the two event histograms should have the same number of bins
235 const Int_t nBins = hQAOccVsEvent->GetXaxis()->GetNbins();
236 for(Int_t bin = 1; bin <= nBins; bin++) {
237
238 histRawsOccupancyVsEvent->SetBinContent(bin, hQAOccVsEvent->GetBinContent(bin));
239 histRawsNclustersVsEvent->SetBinContent(bin, hQANclVsEvent->GetBinContent(bin));
240 }
241
242 histRawsOccupancyVsEvent->GetXaxis()->SetRange(hQAOccVsEvent->GetXaxis()->GetFirst(), hQAOccVsEvent->GetXaxis()->GetLast());
243 histRawsNclustersVsEvent->GetXaxis()->SetRange(hQANclVsEvent->GetXaxis()->GetFirst(), hQANclVsEvent->GetXaxis()->GetLast());
244
57acd2d2 245 // Normalize histograms
ce0175fa 246 histRawsOccupancyVsSector->Divide(hNormOcc);
57acd2d2 247 histRawsNClustersPerEventVsSector->Scale(1.0/Float_t(eventCounter));
ce0175fa 248 histRawsQVsSector->Divide(hNormNclusters);
249 histRawsQmaxVsSector->Divide(hNormNclusters);
250 delete hNormOcc;
251 delete hNormNclusters;
252
253 if(fBeautifyOption!=0) {
254 // Help make the histogram easier to interpret for the DQM shifter
255
256 histRawsOccupancyVsSector->ResetBit(AliQAv1::GetQABit());
257 histRawsQmaxVsSector->ResetBit(AliQAv1::GetQABit());
258
259 histRawsOccupancyVsSector->SetMinimum(0.0);
260 if(histRawsOccupancyVsSector->GetMaximum()<1.5*fOccHighLimit)
261 histRawsOccupancyVsSector->SetMaximum(1.5*fOccHighLimit);
262
263 histRawsQmaxVsSector->SetMinimum(0.0);
264 if(histRawsQmaxVsSector->GetMaximum()<1.5*fQmaxHighLimit)
265 histRawsQmaxVsSector->SetMaximum(1.5*fQmaxHighLimit);
266
267 Double_t xminOcc = histRawsOccupancyVsSector->GetXaxis()->GetXmin();
268 Double_t xmaxOcc = histRawsOccupancyVsSector->GetXaxis()->GetXmax();
269 Double_t yminOcc = histRawsOccupancyVsSector->GetMinimum();
270 Double_t ymaxOcc = histRawsOccupancyVsSector->GetMaximum();
271
272 Double_t xminQmax = histRawsQmaxVsSector->GetXaxis()->GetXmin();
273 Double_t xmaxQmax = histRawsQmaxVsSector->GetXaxis()->GetXmax();
5e10013b 274// Double_t yminQmax = histRawsQmaxVsSector->GetMinimum();
275// Double_t ymaxQmax = histRawsQmaxVsSector->GetMaximum();
ce0175fa 276
5e10013b 277 // For reasons not understood the following stopped working
278 // in the DQM and instead lines were adopted:
279// TBox* boxOccOk = new TBox(xminOcc,0,xmaxOcc,fOccHighLimit);
280// boxOccOk->SetFillColor(kGreen);
281// histRawsOccupancyVsSector->GetListOfFunctions()->Add(boxOccOk);
282
283 TLine* lineOccMin = new TLine(xminOcc,0,xmaxOcc,0);
284 lineOccMin->SetLineColor(kGreen);
285 lineOccMin->SetLineWidth(2);
286 histRawsOccupancyVsSector->GetListOfFunctions()->Add(lineOccMin);
287
288 TLine* lineOccMax = new TLine(xminOcc,fOccHighLimit, xmaxOcc,fOccHighLimit);
289 lineOccMax->SetLineColor(kGreen);
290 lineOccMax->SetLineWidth(2);
291 histRawsOccupancyVsSector->GetListOfFunctions()->Add(lineOccMax);
292
293
294 // For some reason this dtopped working
295// TBox* boxQmaxOk = new TBox(xminQmax,fQmaxLowLimit,xmaxQmax,fQmaxHighLimit);
296// boxQmaxOk->SetFillColor(kGreen);
297// histRawsQmaxVsSector->GetListOfFunctions()->Add(boxQmaxOk);
298
299 TLine* lineQmaxMin = new TLine(xminQmax,fQmaxLowLimit, xmaxQmax,fQmaxLowLimit);
300 lineQmaxMin->SetLineColor(kGreen);
301 lineQmaxMin->SetLineWidth(2);
302 histRawsQmaxVsSector->GetListOfFunctions()->Add(lineQmaxMin);
303
304 TLine* lineQmaxMax = new TLine(xminQmax,fQmaxHighLimit, xmaxQmax,fQmaxHighLimit);
305 lineQmaxMax->SetLineColor(kGreen);
306 lineQmaxMax->SetLineWidth(2);
307 histRawsQmaxVsSector->GetListOfFunctions()->Add(lineQmaxMax);
ce0175fa 308
309
310 for(Int_t bin = 1; bin <= 72; bin++) {
311
312 if(histRawsOccupancyVsSector->GetBinContent(bin)<=0 ||
313 histRawsOccupancyVsSector->GetBinContent(bin)>fOccHighLimit) {
314
315 histRawsOccupancyVsSector->SetBit(AliQAv1::GetQABit());
316
317 TBox* boxErr =
318 new TBox(histRawsOccupancyVsSector->GetXaxis()->GetBinLowEdge(bin), yminOcc,
319 histRawsOccupancyVsSector->GetXaxis()->GetBinUpEdge(bin), ymaxOcc);
320 boxErr->SetFillColor(kRed);
5e10013b 321 // histRawsOccupancyVsSector->GetListOfFunctions()->Add(boxErr);
ce0175fa 322 }
323
324 if(histRawsQmaxVsSector->GetBinContent(bin)<fQmaxLowLimit||
325 histRawsQmaxVsSector->GetBinContent(bin)>fQmaxHighLimit) {
326
327 // Mark that histogram has error
328 histRawsQmaxVsSector->SetBit(AliQAv1::GetQABit());
329
5e10013b 330 // For reasons not understood the following stopped working
331 // in the DQM and instead lines were adopted:
332// TBox* boxErr =
333// new TBox(histRawsQmaxVsSector->GetXaxis()->GetBinLowEdge(bin), yminQmax,
334// histRawsQmaxVsSector->GetXaxis()->GetBinUpEdge(bin), ymaxQmax);
335// boxErr->SetFillColor(kRed);
336 // histRawsQmaxVsSector->GetListOfFunctions()->Add(boxErr);
ce0175fa 337 }
338 }
339
5e10013b 340 // For reasons not understood the following stopped working
341 // in the DQM and instead lines were adopted:
ce0175fa 342 // Now we have to add a copy of the histograms to draw
343 // because the boxes covers the data points
5e10013b 344// TH1F* hOccCopy = new TH1F(*histRawsOccupancyVsSector);
345// hOccCopy->SetOption("SAME P");
346// histRawsOccupancyVsSector->GetListOfFunctions()->Add(hOccCopy);
ce0175fa 347
5e10013b 348// TH1F* hQmaxCopy = new TH1F(*histRawsQmaxVsSector);
349// hQmaxCopy->SetOption("SAME P");
350// histRawsQmaxVsSector->GetListOfFunctions()->Add(hQmaxCopy);
ce0175fa 351
352 } // end beautify
57acd2d2 353 }
c75bf2f1 354 }
44f32dd2 355 }
4e25ac79 356 AliQAChecker::Instance()->Run(AliQAv1::kTPC, task, list) ;
44f32dd2 357}
358
ce0175fa 359
44f32dd2 360//____________________________________________________________________________
361void AliTPCQADataMakerRec::InitESDs()
362{
363 //create ESDs histograms in ESDs subdir
7d297381 364 const Bool_t expert = kTRUE ;
365 const Bool_t image = kTRUE ;
366
57acd2d2 367 TH1F * histESDclusters =
44f32dd2 368 new TH1F("hESDclusters", "N TPC clusters per track; N clusters; Counts",
369 160, 0, 160);
57acd2d2 370 histESDclusters->Sumw2();
7d297381 371 Add2ESDsList(histESDclusters, KClusters, !expert, image);
44f32dd2 372
57acd2d2 373 TH1F * histESDratio =
44f32dd2 374 new TH1F("hESDratio", "Ratio: TPC clusters / findable; Ratio: cluster/findable; Counts",
375 100, 0, 1);
57acd2d2 376 histESDratio->Sumw2();
7d297381 377 Add2ESDsList(histESDratio, kRatio, !expert, image);
44f32dd2 378
57acd2d2 379 TH1F * histESDpt =
44f32dd2 380 new TH1F("hESDpt", "P_{T} distribution; p_{T} [GeV/c]; Counts",
381 50, 0, 5);
57acd2d2 382 histESDpt->Sumw2();
7d297381 383 Add2ESDsList(histESDpt, kPt, !expert, image);
ce0175fa 384
385 // This means we are not running DQM so do not beautify
386 SetBeautifyOption(0);
44f32dd2 387}
388
389//____________________________________________________________________________
390void AliTPCQADataMakerRec::InitRaws()
391{
336156cc 392 //
393 // Adding the raw
be4f1702 394 //
395
396 // Modified: 7/7 - 2008
397 // Laurent Aphecetche pointed out that the mapping was read from file
398 // for each event, so now we read in the map here and set if for
399 // the raw data qa
7d297381 400 const Bool_t expert = kTRUE ;
401 const Bool_t saveCorr = kTRUE ;
402 const Bool_t image = kTRUE ;
403
57acd2d2 404 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
ce0175fa 405
406 // It might happen that we will be in this method a few times because
407 // we create all dataQAs at the first call to this method
408 if(fTPCdataQA[specie]!=0) // data QA already created
409 continue;
5e232cd6 410 fTPCdataQA[specie] = new AliTPCdataQA(AliRecoParam::ConvertIndex(specie));
57acd2d2 411 LoadMaps(); // Load Altro maps
412 fTPCdataQA[specie]->SetAltroMapping(fMapping); // set Altro mapping
413 fTPCdataQA[specie]->SetRangeTime(100, 920); // set time bin interval
7d297381 414// Add2RawsList(fTPCdataQA, kTPCdataQ, !expert, image, !saveCorrA); // This is used by the AMORE monitoring <------- THIS WILL FAIL (YS)
57acd2d2 415 }
be4f1702 416
57acd2d2 417 TH1F * histRawsOccupancy =
adcdb395 418 new TH1F("hRawsOccupancy", "Occupancy (all pads); Occupancy; Counts",
419 100, 0, 1);
57acd2d2 420 histRawsOccupancy->Sumw2();
556a0e5b 421 Add2RawsList(histRawsOccupancy, kRawsOccupancy, expert, !image, !saveCorr);
57acd2d2 422
423 TH1F * histRawsOccupancyVsSector =
adcdb395 424 new TH1F("hRawsOccupancyVsSector", "Occupancy vs sector; Sector; Occupancy",
425 72, 0, 72);
57acd2d2 426 histRawsOccupancyVsSector->Sumw2();
ce0175fa 427 histRawsOccupancyVsSector->SetMarkerStyle(20);
428 histRawsOccupancyVsSector->SetOption("P");
429 histRawsOccupancyVsSector->SetStats(kFALSE);
430 Add2RawsList(histRawsOccupancyVsSector, kRawsOccupancyVsSector, !expert, image, !saveCorr);
adcdb395 431
57acd2d2 432 TH1F * histRawsNClustersPerEventVsSector =
adcdb395 433 new TH1F("hRawsNClustersPerEventVsSector", "Nclusters per event vs sector; Sector; Nclusters per event",
434 72, 0, 72);
57acd2d2 435 histRawsNClustersPerEventVsSector->Sumw2();
556a0e5b 436 Add2RawsList(histRawsNClustersPerEventVsSector, kRawsNClustersPerEventVsSector, expert, !image, !saveCorr);
adcdb395 437
57acd2d2 438 TH1F * histRawsQVsSector =
ce0175fa 439 new TH1F("hRawsQVsSector", "<Q> vs sector; Sector; <Q>",
440 72, 0, 72);
57acd2d2 441 histRawsQVsSector->Sumw2();
556a0e5b 442 Add2RawsList(histRawsQVsSector, kRawsQVsSector, expert, !image, !saveCorr);
adcdb395 443
57acd2d2 444 TH1F * histRawsQmaxVsSector =
ce0175fa 445 new TH1F("hRawsQmaxVsSector", "<Qmax> vs sector; Sector; <Qmax>",
446 72, 0, 72);
57acd2d2 447 histRawsQmaxVsSector->Sumw2();
ce0175fa 448 histRawsQmaxVsSector->SetMarkerStyle(20);
449 histRawsQmaxVsSector->SetOption("P");
450 histRawsQmaxVsSector->SetStats(kFALSE);
451 Add2RawsList(histRawsQmaxVsSector, kRawsQmaxVsSector, !expert, image, !saveCorr);
452
453 // Get histogram information from data QA to build copy
454 TH1F* hOccHelp = fTPCdataQA[0]->GetHistOccupancyVsEvent();
455 TH1F * histRawsOccupancyVsEvent =
456 new TH1F("hRawsOccupancyVsEvent", hOccHelp->GetTitle(),
457 hOccHelp->GetXaxis()->GetNbins(),
458 hOccHelp->GetXaxis()->GetXmin(), hOccHelp->GetXaxis()->GetXmax());
556a0e5b 459 histRawsOccupancyVsEvent->GetXaxis()->SetTitle(hOccHelp->GetXaxis()->GetTitle());
460 histRawsOccupancyVsEvent->GetYaxis()->SetTitle(hOccHelp->GetYaxis()->GetTitle());
ce0175fa 461 histRawsOccupancyVsEvent->SetMarkerStyle(20);
462 histRawsOccupancyVsEvent->SetOption("P");
463 histRawsOccupancyVsEvent->SetStats(kFALSE);
464 Add2RawsList(histRawsOccupancyVsEvent, kRawsOccupancyVsEvent, !expert, image, !saveCorr);
465
466 // Get histogram information from data QA to build copy
467 TH1F* hNclHelp = fTPCdataQA[0]->GetHistNclustersVsEvent();
468 TH1F * histRawsNclustersVsEvent =
469 new TH1F("hRawsNclustersVsEvent", hNclHelp->GetTitle(),
470 hNclHelp->GetXaxis()->GetNbins(),
471 hNclHelp->GetXaxis()->GetXmin(), hNclHelp->GetXaxis()->GetXmax());
556a0e5b 472 histRawsNclustersVsEvent->GetXaxis()->SetTitle(hNclHelp->GetXaxis()->GetTitle());
473 histRawsNclustersVsEvent->GetYaxis()->SetTitle(hNclHelp->GetYaxis()->GetTitle());
ce0175fa 474 histRawsNclustersVsEvent->SetMarkerStyle(20);
475 histRawsNclustersVsEvent->SetOption("P");
476 histRawsNclustersVsEvent->SetStats(kFALSE);
477 Add2RawsList(histRawsNclustersVsEvent, kRawsNclustersVsEvent, !expert, image, !saveCorr);
44f32dd2 478}
479
44ed7a66 480//____________________________________________________________________________
481void AliTPCQADataMakerRec::InitDigits()
482{
483 const Bool_t expert = kTRUE ;
484 const Bool_t image = kTRUE ;
485 TH1F * histDigitsADC =
486 new TH1F("hDigitsADC", "Digit ADC distribution; ADC; Counts",
487 1000, 0, 1000);
488 histDigitsADC->Sumw2();
489 Add2DigitsList(histDigitsADC, kDigitsADC, !expert, image);
ce0175fa 490
491 // This means we are not running DQM so do not beautify
492 SetBeautifyOption(0);
44ed7a66 493}
494
44f32dd2 495//____________________________________________________________________________
496void AliTPCQADataMakerRec::InitRecPoints()
497{
7d297381 498 const Bool_t expert = kTRUE ;
499 const Bool_t image = kTRUE ;
500
57acd2d2 501 TH1F * histRecPointsQmaxShort =
44f32dd2 502 new TH1F("hRecPointsQmaxShort", "Qmax distrbution (short pads); Qmax; Counts",
adcdb395 503 100, 0, 300);
57acd2d2 504 histRecPointsQmaxShort->Sumw2();
7d297381 505 Add2RecPointsList(histRecPointsQmaxShort, kQmaxShort, !expert, image);
44f32dd2 506
57acd2d2 507 TH1F * histRecPointsQmaxMedium =
44f32dd2 508 new TH1F("hRecPointsQmaxMedium", "Qmax distrbution (medium pads); Qmax; Counts",
adcdb395 509 100, 0, 300);
57acd2d2 510 histRecPointsQmaxMedium->Sumw2();
7d297381 511 Add2RecPointsList(histRecPointsQmaxMedium, kQmaxMedium, !expert, image);
44f32dd2 512
57acd2d2 513 TH1F * histRecPointsQmaxLong =
44f32dd2 514 new TH1F("hRecPointsQmaxLong", "Qmax distrbution (long pads); Qmax; Counts",
adcdb395 515 100, 0, 300);
57acd2d2 516 histRecPointsQmaxLong->Sumw2();
7d297381 517 Add2RecPointsList(histRecPointsQmaxLong, kQmaxLong, !expert, image);
44f32dd2 518
57acd2d2 519 TH1F * histRecPointsQShort =
44f32dd2 520 new TH1F("hRecPointsQShort", "Q distrbution (short pads); Q; Counts",
adcdb395 521 100, 0, 2000);
57acd2d2 522 histRecPointsQShort->Sumw2();
7d297381 523 Add2RecPointsList(histRecPointsQShort, kQShort, !expert, image);
44f32dd2 524
57acd2d2 525 TH1F * histRecPointsQMedium =
44f32dd2 526 new TH1F("hRecPointsQMedium", "Q distrbution (medium pads); Q; Counts",
adcdb395 527 100, 0, 2000);
57acd2d2 528 histRecPointsQMedium->Sumw2();
7d297381 529 Add2RecPointsList(histRecPointsQMedium, kQMedium, !expert, image);
44f32dd2 530
57acd2d2 531 TH1F * histRecPointsQLong =
44f32dd2 532 new TH1F("hRecPointsQLong", "Q distrbution (long pads); Q; Counts",
adcdb395 533 100, 0, 2000);
57acd2d2 534 histRecPointsQLong->Sumw2();
7d297381 535 Add2RecPointsList(histRecPointsQLong, kQLong, !expert, image);
44f32dd2 536
57acd2d2 537 TH1F * histRecPointsRow =
44f32dd2 538 new TH1F("hRecPointsRow", "Clusters per row; Row; Counts",
539 159, 0, 159);
57acd2d2 540 histRecPointsRow->Sumw2();
7d297381 541 Add2RecPointsList(histRecPointsRow, kRow, !expert, image);
ce0175fa 542
543 // This means we are not running DQM so do not beautify
544 SetBeautifyOption(0);
44f32dd2 545}
546
547//____________________________________________________________________________
548void AliTPCQADataMakerRec::MakeESDs(AliESDEvent * esd)
549{
550 // make QA data from ESDs
eca4fa66 551
44f32dd2 552 const Int_t nESDTracks = esd->GetNumberOfTracks();
553 Int_t nTPCtracks = 0;
554 for(Int_t i = 0; i < nESDTracks; i++) {
555
556 AliESDtrack * track = esd->GetTrack(i);
557
558 if ((track->GetStatus() & AliESDtrack::kTPCrefit)==0)
559 continue;
560
561 nTPCtracks++;
562
563 Int_t nTPCclusters = track->GetTPCNcls();
564 Int_t nTPCclustersFindable = track->GetTPCNclsF();
47a596d8 565 if ( nTPCclustersFindable<=0) continue;
57acd2d2 566 GetESDsData(KClusters)->Fill(nTPCclusters);
567 GetESDsData(kRatio)->Fill(Float_t(nTPCclusters)/Float_t(nTPCclustersFindable));
568 GetESDsData(kPt)->Fill(track->Pt());
44f32dd2 569 }
570}
571
572//____________________________________________________________________________
573void AliTPCQADataMakerRec::MakeRaws(AliRawReader* rawReader)
574{
575 //
576 // To make QA for the RAW data we use the TPC Calibration framework
577 // to handle the data and then in the end extract the data
578 //
eca4fa66 579
60f9f416 580 GetRawsData(0); // dummy call to init raw data
eca4fa66 581 rawReader->Reset() ;
6252ceeb 582 if (! fTPCdataQA[AliRecoParam::AConvert(fEventSpecie)] ) {
583 AliError("Something unexpected here!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") ;
584 } else {
585 fTPCdataQA[AliRecoParam::AConvert(fEventSpecie)]->ProcessEvent(rawReader);
586 }
587}
44f32dd2 588
44ed7a66 589//____________________________________________________________________________
590void AliTPCQADataMakerRec::MakeDigits(TTree* digitTree)
591{
6252ceeb 592
44ed7a66 593 TBranch* branch = digitTree->GetBranch("Segment");
594 AliSimDigits* digArray = 0;
595 branch->SetAddress(&digArray);
596
597 Int_t nEntries = Int_t(digitTree->GetEntries());
598
599 for (Int_t n = 0; n < nEntries; n++) {
600
601 digitTree->GetEvent(n);
602
603 if (digArray->First())
604 do {
605 Float_t dig = digArray->CurrentDigit();
606
607 GetDigitsData(kDigitsADC)->Fill(dig);
608 } while (digArray->Next());
609 }
610}
611
44f32dd2 612//____________________________________________________________________________
613void AliTPCQADataMakerRec::MakeRecPoints(TTree* recTree)
614{
eca4fa66 615
c75ba816 616 AliTPCClustersRow clrow;
617 clrow.SetClass("AliTPCclusterMI");
618 clrow.SetArray(0);
619 clrow.GetArray()->ExpandCreateFast(10000);
620 AliTPCClustersRow * pclrow = &clrow;
44f32dd2 621 TBranch* branch = recTree->GetBranch("Segment");
c75ba816 622
623 branch->SetAddress(&pclrow);
44f32dd2 624
625 const Int_t nEntries = Int_t(recTree->GetEntries());
626 for (Int_t i = 0; i < nEntries; i++) {
627
628 branch->GetEntry(i);
629
c75ba816 630 const Int_t nClusters = clrow.GetArray()->GetEntriesFast();
44f32dd2 631 for (Int_t icl=0; icl < nClusters; icl++){
632
633 AliTPCclusterMI* cluster =
c75ba816 634 (AliTPCclusterMI*)clrow.GetArray()->At(icl);
44f32dd2 635
636 Float_t Qmax = cluster->GetMax();
637 Float_t Q = cluster->GetQ();
638 Int_t row = cluster->GetRow();
639
640 if(cluster->GetDetector()<36) { // IROC (short pads)
641
57acd2d2 642 GetRecPointsData(kQmaxShort)->Fill(Qmax);
643 GetRecPointsData(kQShort)->Fill(Q);
44f32dd2 644 } else { // OROC (medium and long pads)
645 row += 63;
646 if(cluster->GetRow()<64) { // medium pads
647
57acd2d2 648 GetRecPointsData(kQmaxMedium)->Fill(Qmax);
649 GetRecPointsData(kQMedium)->Fill(Q);
44f32dd2 650 } else { // long pads
651
57acd2d2 652 GetRecPointsData(kQmaxLong)->Fill(Qmax);
653 GetRecPointsData(kQLong)->Fill(Q);
44f32dd2 654 }
655 }
656
57acd2d2 657 GetRecPointsData(kRow)->Fill(row);
44f32dd2 658 } // end loop over clusters
659 } // end loop over tree
660
44f32dd2 661}
be4f1702 662
663//____________________________________________________________________________
664void AliTPCQADataMakerRec::LoadMaps()
665{
666 TString path = gSystem->Getenv("ALICE_ROOT");
667 path += "/TPC/mapping/Patch";
668
669 for(Int_t i = 0; i < 6; i++) {
ce0175fa 670
671 if(fMapping[i]!=0) // mapping already loaded
672 continue;
be4f1702 673 TString path2 = path;
674 path2 += i;
675 path2 += ".data";
676 fMapping[i] = new AliTPCAltroMapping(path2.Data());
677 }
678}
679
556a0e5b 680//____________________________________________________________________________
5e10013b 681void AliTPCQADataMakerRec::ResetDetector(AliQAv1::TASKINDEX_t task)
556a0e5b 682{
5e10013b 683 // Overwrites general method for RAW data.
556a0e5b 684 // The AliTPCdataQA elements that does the internal processing are
685 // in the case they have processed data deleted and new are created
686
5e10013b 687 if ( task != AliQAv1::kRAWS )
688 AliQADataMakerRec::ResetDetector(task);
689
556a0e5b 690 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
691
692 if ( fTPCdataQA[specie] != NULL) { // exist
693
694 if(fTPCdataQA[specie]->GetEventCounter()>0) { // has processed data
695
696 // old configuration
697 Int_t firstTime = fTPCdataQA[specie]->GetFirstTimeBin();
698 Int_t lastTime = fTPCdataQA[specie]->GetLastTimeBin();
699 Int_t minADC = fTPCdataQA[specie]->GetAdcMin();
700 Int_t maxADC = fTPCdataQA[specie]->GetAdcMax();
701 Int_t maxEvents = fTPCdataQA[specie]->GetMaxEvents();
702 Int_t eventsPerBin = fTPCdataQA[specie]->GetEventsPerBin();
703
704 //delete old
705 delete fTPCdataQA[specie];
706
707 // create new
708 fTPCdataQA[specie] = new AliTPCdataQA(AliRecoParam::ConvertIndex(specie));
709 // configure new
710 LoadMaps(); // Load Altro maps
711 fTPCdataQA[specie]->SetAltroMapping(fMapping);
712 fTPCdataQA[specie]->SetRangeTime(firstTime, lastTime);
713 fTPCdataQA[specie]->SetRangeAdc(minADC, maxADC);
714 fTPCdataQA[specie]->SetMaxEvents(maxEvents);
715 fTPCdataQA[specie]->SetEventsPerBin(eventsPerBin);
716 }
717 }
718 }
719}