more secure string operations
[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
44f32dd2 24
1267cf3a 25 Updated June 2010:
26 ==================
44f32dd2 27
1267cf3a 28 The "beautification" of the online DQM histograms have been moved to
29 an amore macro.
30
31 The per event RAW histograms have been modified in AliTPCdataQA and
32 the copies have therefore also been modified here.
33
34 The AliTPCdataQA can now be configured a bit from here: time bin
35 range (extended default range to 1-1000, event range at start:
36 0-100000, 1000 events per bin). (At least the parameters are not
37 hardcoded:-)
38
39 Implementation:
40 ===============
44f32dd2 41
42 For the QA of the RAW data we use the class, AliTPCdataQA, from the
43 existing TPC Calibration framework (which is more advanced than the
1267cf3a 44 standard QA framework) and extract the histograms at the end. The
45 Analyse method of the AliTPCdataQA class is called in the method,
46 EndOfDetectorCycle, and there also: 1d histogram(s) are projected
47 and added to the QA list.
44f32dd2 48*/
49
50#include "AliTPCQADataMakerRec.h"
51
52// --- ROOT system ---
53#include <TClonesArray.h>
be4f1702 54#include <TString.h>
55#include <TSystem.h>
ce0175fa 56#include <TBox.h>
5e10013b 57#include <TLine.h>
1267cf3a 58#include <TAxis.h>
44f32dd2 59
60// --- Standard library ---
61
62// --- AliRoot header files ---
63#include "AliQAChecker.h"
64#include "AliESDEvent.h"
65#include "AliESDtrack.h"
66#include "AliLog.h"
67#include "AliTPCCalPad.h"
adcdb395 68#include "AliTPCCalROC.h"
44f32dd2 69#include "AliTPCClustersRow.h"
70#include "AliTPCclusterMI.h"
44ed7a66 71#include "AliSimDigits.h"
44f32dd2 72
1267cf3a 73
44f32dd2 74ClassImp(AliTPCQADataMakerRec)
75
76//____________________________________________________________________________
77AliTPCQADataMakerRec::AliTPCQADataMakerRec() :
ce0175fa 78AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kTPC),
79 "TPC Rec Quality Assurance Data Maker"),
1267cf3a 80fTPCdataQA(NULL),
81fRawMaxEvents(100000),
82fRawEventsPerBin(1000),
83fRawFirstTimeBin(1),
84fRawLastTimeBin(1000)
44f32dd2 85{
86 // ctor
57acd2d2 87 fTPCdataQA = new AliTPCdataQA*[AliRecoParam::kNSpecies] ;
88 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
89 fTPCdataQA[specie] = NULL ;
90
be4f1702 91 for(Int_t i = 0; i < 6; i++)
92 fMapping[i] = 0;
44f32dd2 93}
94
95//____________________________________________________________________________
96AliTPCQADataMakerRec::AliTPCQADataMakerRec(const AliTPCQADataMakerRec& qadm) :
336156cc 97 AliQADataMakerRec(),
ce0175fa 98 fTPCdataQA(NULL),
1267cf3a 99 fRawMaxEvents(qadm.GetRawMaxEvents()),
100 fRawEventsPerBin(qadm.GetRawEventsPerBin()),
101 fRawFirstTimeBin(qadm.GetRawFirstTimeBin()),
102 fRawLastTimeBin(qadm.GetRawLastTimeBin())
44f32dd2 103{
104 //copy ctor
105 // Does not copy the calibration object, instead InitRaws have to be
106 // called again
107 SetName((const char*)qadm.GetName()) ;
108 SetTitle((const char*)qadm.GetTitle());
109
57acd2d2 110 fTPCdataQA = new AliTPCdataQA*[AliRecoParam::kNSpecies] ;
111 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
112 fTPCdataQA[specie] = NULL ;
113
be4f1702 114 for(Int_t i = 0; i < 6; i++)
115 fMapping[i] = 0;
116
44f32dd2 117 //
118 // Associate class histogram objects to the copies in the list
119 // Could also be done with the indexes
120 //
57acd2d2 121
44f32dd2 122}
123
124//__________________________________________________________________
125AliTPCQADataMakerRec& AliTPCQADataMakerRec::operator = (const AliTPCQADataMakerRec& qadm )
126{
127 // Equal operator.
128 this->~AliTPCQADataMakerRec();
129 new(this) AliTPCQADataMakerRec(qadm);
130 return *this;
131}
be4f1702 132
133//__________________________________________________________________
134AliTPCQADataMakerRec::~AliTPCQADataMakerRec()
135{
136 // Destructor
57acd2d2 137 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
138 if ( fTPCdataQA[specie] != NULL )
139 delete fTPCdataQA[specie] ;
140 delete[] fTPCdataQA;
be4f1702 141
142 for(Int_t i = 0; i < 6; i++)
143 delete fMapping[i];
144}
44f32dd2 145
146//____________________________________________________________________________
4e25ac79 147void AliTPCQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
44f32dd2 148{
149 //Detector specific actions at end of cycle
57acd2d2 150
151 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
4e25ac79 152 if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) )
57acd2d2 153 continue ;
154 if(fTPCdataQA[specie] != NULL) { // do the final step of the QA for Raw data
44f32dd2 155
57acd2d2 156 fTPCdataQA[specie]->Analyse(); // 31/1-08 Analyse is now protected against
c75bf2f1 157 // RAW data files with no TPC data
57acd2d2 158
5e232cd6 159 SetEventSpecie(AliRecoParam::ConvertIndex(specie)) ;
ce0175fa 160 TH1F * histRawsOccupancy = (TH1F*)GetRawsData(kRawsOccupancy) ;
161 TH1F * histRawsOccupancyVsSector = (TH1F*)GetRawsData(kRawsOccupancyVsSector) ;
162 TH1F * histRawsNClustersPerEventVsSector = (TH1F*)GetRawsData(kRawsNClustersPerEventVsSector) ;
163 TH1F * histRawsQVsSector = (TH1F*)GetRawsData(kRawsQVsSector) ;
164 TH1F * histRawsQmaxVsSector = (TH1F*)GetRawsData(kRawsQmaxVsSector) ;
165 TH1F * histRawsOccupancyVsEvent = (TH1F*)GetRawsData(kRawsOccupancyVsEvent) ;
166 TH1F * histRawsNclustersVsEvent = (TH1F*)GetRawsData(kRawsNclustersVsEvent) ;
57acd2d2 167 if ( !histRawsOccupancy ||
ce0175fa 168 !histRawsOccupancyVsSector ||
169 !histRawsNClustersPerEventVsSector ||
170 !histRawsQVsSector ||
171 !histRawsQmaxVsSector ||
172 !histRawsOccupancyVsEvent ||
173 !histRawsNclustersVsEvent ) {
57acd2d2 174 AliError("Something very wrong here, corrupted memory ?????. Please check\n") ;
175 continue ;
176 }
177
178 //Add2RawsList(fTPCdataQA, 0);
179 // get the histograms and add them to the output
180 // 31/8-08 Histogram is only added if the Calibration class
181 // receives TPC data
182 const Int_t eventCounter = fTPCdataQA[specie]->GetEventCounter();
183 if(eventCounter>0) { // some TPC data has been processed
184
185 // Reset histograms and refill them
186 histRawsOccupancy->Reset();
187 histRawsOccupancyVsSector->Reset();
188 histRawsNClustersPerEventVsSector->Reset();
189 histRawsQVsSector->Reset();
190 histRawsQmaxVsSector->Reset();
adcdb395 191
ce0175fa 192 TH1F* hNormOcc = new TH1F("hNormOcc", 0, 72, 0, 72);
193 hNormOcc->Sumw2();
194 TH1F* hNormNclusters = new TH1F("hNormNclusters", 0, 72, 0, 72);
195 hNormNclusters->Sumw2();
57acd2d2 196
197 for (Int_t iSec = 0; iSec < 72; iSec++) {
adcdb395 198
57acd2d2 199 AliTPCCalROC* occupancyROC =
200 fTPCdataQA[specie]->GetNoThreshold()->GetCalROC(iSec);
201 AliTPCCalROC* nclusterROC =
202 fTPCdataQA[specie]->GetNLocalMaxima()->GetCalROC(iSec);
203 AliTPCCalROC* qROC =
204 fTPCdataQA[specie]->GetMeanCharge()->GetCalROC(iSec);
205 AliTPCCalROC* qmaxROC =
206 fTPCdataQA[specie]->GetMaxCharge()->GetCalROC(iSec);
207
208 const Int_t nRows = occupancyROC->GetNrows();
209 for (Int_t iRow = 0; iRow < nRows; iRow++) {
210
57acd2d2 211 const Int_t nPads = occupancyROC->GetNPads(iRow);
212 for (Int_t iPad = 0; iPad < nPads; iPad++) {
ce0175fa 213
57acd2d2 214 histRawsOccupancy->Fill(occupancyROC->GetValue(iRow, iPad));
ce0175fa 215 hNormOcc->Fill(iSec);
57acd2d2 216 histRawsOccupancyVsSector
ce0175fa 217 ->Fill(iSec, occupancyROC->GetValue(iRow, iPad));
218
57acd2d2 219 const Int_t nClusters = TMath::Nint(nclusterROC->GetValue(iRow, iPad));
adcdb395 220
ce0175fa 221 if(nClusters>0) {
222
223 hNormNclusters->Fill(iSec,nClusters);
57acd2d2 224 histRawsNClustersPerEventVsSector->Fill(iSec, nClusters);
ce0175fa 225 histRawsQVsSector->Fill(iSec,
226 nClusters*qROC->GetValue(iRow, iPad));
227 histRawsQmaxVsSector->Fill(iSec,
228 nClusters*qmaxROC->GetValue(iRow, iPad));
57acd2d2 229 }
230 }
231 }
232 } // end loop over sectors
adcdb395 233
ce0175fa 234 // update event histograms - copy info from TPDdataQA histos
1267cf3a 235 const TH1F* hQAOccVsEvent = fTPCdataQA[specie]->GetHistOccupancyVsEvent();
236 const TH1F* hQANclVsEvent = fTPCdataQA[specie]->GetHistNclustersVsEvent();
ce0175fa 237
1267cf3a 238 // In case the histogram limits have changed we have to update
239 // them here
240 if(histRawsOccupancy->GetXaxis()->GetXmax()!=
241 hQAOccVsEvent->GetXaxis()->GetXmax()) {
242
243 histRawsOccupancyVsEvent->GetXaxis()->Set(histRawsOccupancyVsEvent->GetXaxis()->GetNbins(), hQAOccVsEvent->GetXaxis()->GetXmin(), hQAOccVsEvent->GetXaxis()->GetXmax());
244
245 histRawsNclustersVsEvent->GetXaxis()->Set(histRawsOccupancyVsEvent->GetXaxis()->GetNbins(), hQANclVsEvent->GetXaxis()->GetXmin(), hQANclVsEvent->GetXaxis()->GetXmax());
246 }
247
248 // reset the number of entries
249 histRawsOccupancyVsEvent->SetEntries(0);
250 histRawsNclustersVsEvent->SetEntries(0);
251
ce0175fa 252 // the two event histograms should have the same number of bins
253 const Int_t nBins = hQAOccVsEvent->GetXaxis()->GetNbins();
254 for(Int_t bin = 1; bin <= nBins; bin++) {
255
256 histRawsOccupancyVsEvent->SetBinContent(bin, hQAOccVsEvent->GetBinContent(bin));
257 histRawsNclustersVsEvent->SetBinContent(bin, hQANclVsEvent->GetBinContent(bin));
258 }
259
57acd2d2 260 // Normalize histograms
ce0175fa 261 histRawsOccupancyVsSector->Divide(hNormOcc);
57acd2d2 262 histRawsNClustersPerEventVsSector->Scale(1.0/Float_t(eventCounter));
ce0175fa 263 histRawsQVsSector->Divide(hNormNclusters);
264 histRawsQmaxVsSector->Divide(hNormNclusters);
265 delete hNormOcc;
266 delete hNormNclusters;
1267cf3a 267
57acd2d2 268 }
c75bf2f1 269 }
44f32dd2 270 }
4e25ac79 271 AliQAChecker::Instance()->Run(AliQAv1::kTPC, task, list) ;
44f32dd2 272}
273
ce0175fa 274
44f32dd2 275//____________________________________________________________________________
276void AliTPCQADataMakerRec::InitESDs()
277{
278 //create ESDs histograms in ESDs subdir
7d297381 279 const Bool_t expert = kTRUE ;
280 const Bool_t image = kTRUE ;
281
57acd2d2 282 TH1F * histESDclusters =
44f32dd2 283 new TH1F("hESDclusters", "N TPC clusters per track; N clusters; Counts",
284 160, 0, 160);
57acd2d2 285 histESDclusters->Sumw2();
7d297381 286 Add2ESDsList(histESDclusters, KClusters, !expert, image);
44f32dd2 287
57acd2d2 288 TH1F * histESDratio =
44f32dd2 289 new TH1F("hESDratio", "Ratio: TPC clusters / findable; Ratio: cluster/findable; Counts",
290 100, 0, 1);
57acd2d2 291 histESDratio->Sumw2();
7d297381 292 Add2ESDsList(histESDratio, kRatio, !expert, image);
44f32dd2 293
57acd2d2 294 TH1F * histESDpt =
44f32dd2 295 new TH1F("hESDpt", "P_{T} distribution; p_{T} [GeV/c]; Counts",
296 50, 0, 5);
57acd2d2 297 histESDpt->Sumw2();
7d297381 298 Add2ESDsList(histESDpt, kPt, !expert, image);
44f32dd2 299}
300
301//____________________________________________________________________________
302void AliTPCQADataMakerRec::InitRaws()
303{
336156cc 304 //
305 // Adding the raw
be4f1702 306 //
307
308 // Modified: 7/7 - 2008
309 // Laurent Aphecetche pointed out that the mapping was read from file
310 // for each event, so now we read in the map here and set if for
311 // the raw data qa
7d297381 312 const Bool_t expert = kTRUE ;
313 const Bool_t saveCorr = kTRUE ;
314 const Bool_t image = kTRUE ;
315
57acd2d2 316 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
ce0175fa 317
318 // It might happen that we will be in this method a few times because
319 // we create all dataQAs at the first call to this method
320 if(fTPCdataQA[specie]!=0) // data QA already created
321 continue;
1267cf3a 322
323 fTPCdataQA[specie] =
324 new AliTPCdataQA(AliRecoParam::ConvertIndex(specie));
57acd2d2 325 LoadMaps(); // Load Altro maps
326 fTPCdataQA[specie]->SetAltroMapping(fMapping); // set Altro mapping
1267cf3a 327 fTPCdataQA[specie]->SetRangeTime(fRawFirstTimeBin, fRawLastTimeBin); // set time bin interval
328 fTPCdataQA[specie]->SetMaxEvents(fRawMaxEvents);
329 fTPCdataQA[specie]->SetEventsPerBin(fRawEventsPerBin);
7d297381 330// Add2RawsList(fTPCdataQA, kTPCdataQ, !expert, image, !saveCorrA); // This is used by the AMORE monitoring <------- THIS WILL FAIL (YS)
57acd2d2 331 }
be4f1702 332
57acd2d2 333 TH1F * histRawsOccupancy =
adcdb395 334 new TH1F("hRawsOccupancy", "Occupancy (all pads); Occupancy; Counts",
335 100, 0, 1);
57acd2d2 336 histRawsOccupancy->Sumw2();
556a0e5b 337 Add2RawsList(histRawsOccupancy, kRawsOccupancy, expert, !image, !saveCorr);
57acd2d2 338
339 TH1F * histRawsOccupancyVsSector =
adcdb395 340 new TH1F("hRawsOccupancyVsSector", "Occupancy vs sector; Sector; Occupancy",
341 72, 0, 72);
57acd2d2 342 histRawsOccupancyVsSector->Sumw2();
ce0175fa 343 histRawsOccupancyVsSector->SetMarkerStyle(20);
344 histRawsOccupancyVsSector->SetOption("P");
345 histRawsOccupancyVsSector->SetStats(kFALSE);
346 Add2RawsList(histRawsOccupancyVsSector, kRawsOccupancyVsSector, !expert, image, !saveCorr);
adcdb395 347
57acd2d2 348 TH1F * histRawsNClustersPerEventVsSector =
adcdb395 349 new TH1F("hRawsNClustersPerEventVsSector", "Nclusters per event vs sector; Sector; Nclusters per event",
350 72, 0, 72);
57acd2d2 351 histRawsNClustersPerEventVsSector->Sumw2();
556a0e5b 352 Add2RawsList(histRawsNClustersPerEventVsSector, kRawsNClustersPerEventVsSector, expert, !image, !saveCorr);
adcdb395 353
57acd2d2 354 TH1F * histRawsQVsSector =
ce0175fa 355 new TH1F("hRawsQVsSector", "<Q> vs sector; Sector; <Q>",
356 72, 0, 72);
57acd2d2 357 histRawsQVsSector->Sumw2();
556a0e5b 358 Add2RawsList(histRawsQVsSector, kRawsQVsSector, expert, !image, !saveCorr);
adcdb395 359
57acd2d2 360 TH1F * histRawsQmaxVsSector =
ce0175fa 361 new TH1F("hRawsQmaxVsSector", "<Qmax> vs sector; Sector; <Qmax>",
362 72, 0, 72);
57acd2d2 363 histRawsQmaxVsSector->Sumw2();
ce0175fa 364 histRawsQmaxVsSector->SetMarkerStyle(20);
365 histRawsQmaxVsSector->SetOption("P");
366 histRawsQmaxVsSector->SetStats(kFALSE);
367 Add2RawsList(histRawsQmaxVsSector, kRawsQmaxVsSector, !expert, image, !saveCorr);
368
369 // Get histogram information from data QA to build copy
1267cf3a 370 const TH1F* hOccHelp = fTPCdataQA[0]->GetHistOccupancyVsEvent();
ce0175fa 371 TH1F * histRawsOccupancyVsEvent =
1267cf3a 372 CreateEventsHistCopy(hOccHelp, "hRawsOccupancyVsEvent");
f07c697e 373 Add2RawsList(histRawsOccupancyVsEvent, kRawsOccupancyVsEvent, expert, !image, !saveCorr);
1267cf3a 374
ce0175fa 375 // Get histogram information from data QA to build copy
1267cf3a 376 const TH1F* hNclHelp = fTPCdataQA[0]->GetHistNclustersVsEvent();
ce0175fa 377 TH1F * histRawsNclustersVsEvent =
1267cf3a 378 CreateEventsHistCopy(hNclHelp, "hRawsNclustersVsEvent");
f07c697e 379 Add2RawsList(histRawsNclustersVsEvent, kRawsNclustersVsEvent, expert, !image, !saveCorr);
44f32dd2 380}
381
382//____________________________________________________________________________
44ed7a66 383void AliTPCQADataMakerRec::InitDigits()
384{
385 const Bool_t expert = kTRUE ;
386 const Bool_t image = kTRUE ;
387 TH1F * histDigitsADC =
388 new TH1F("hDigitsADC", "Digit ADC distribution; ADC; Counts",
389 1000, 0, 1000);
390 histDigitsADC->Sumw2();
391 Add2DigitsList(histDigitsADC, kDigitsADC, !expert, image);
392}
393
394//____________________________________________________________________________
44f32dd2 395void AliTPCQADataMakerRec::InitRecPoints()
396{
7d297381 397 const Bool_t expert = kTRUE ;
398 const Bool_t image = kTRUE ;
399
57acd2d2 400 TH1F * histRecPointsQmaxShort =
44f32dd2 401 new TH1F("hRecPointsQmaxShort", "Qmax distrbution (short pads); Qmax; Counts",
adcdb395 402 100, 0, 300);
57acd2d2 403 histRecPointsQmaxShort->Sumw2();
7d297381 404 Add2RecPointsList(histRecPointsQmaxShort, kQmaxShort, !expert, image);
44f32dd2 405
57acd2d2 406 TH1F * histRecPointsQmaxMedium =
44f32dd2 407 new TH1F("hRecPointsQmaxMedium", "Qmax distrbution (medium pads); Qmax; Counts",
adcdb395 408 100, 0, 300);
57acd2d2 409 histRecPointsQmaxMedium->Sumw2();
7d297381 410 Add2RecPointsList(histRecPointsQmaxMedium, kQmaxMedium, !expert, image);
44f32dd2 411
57acd2d2 412 TH1F * histRecPointsQmaxLong =
44f32dd2 413 new TH1F("hRecPointsQmaxLong", "Qmax distrbution (long pads); Qmax; Counts",
adcdb395 414 100, 0, 300);
57acd2d2 415 histRecPointsQmaxLong->Sumw2();
7d297381 416 Add2RecPointsList(histRecPointsQmaxLong, kQmaxLong, !expert, image);
44f32dd2 417
57acd2d2 418 TH1F * histRecPointsQShort =
44f32dd2 419 new TH1F("hRecPointsQShort", "Q distrbution (short pads); Q; Counts",
adcdb395 420 100, 0, 2000);
57acd2d2 421 histRecPointsQShort->Sumw2();
7d297381 422 Add2RecPointsList(histRecPointsQShort, kQShort, !expert, image);
44f32dd2 423
57acd2d2 424 TH1F * histRecPointsQMedium =
44f32dd2 425 new TH1F("hRecPointsQMedium", "Q distrbution (medium pads); Q; Counts",
adcdb395 426 100, 0, 2000);
57acd2d2 427 histRecPointsQMedium->Sumw2();
7d297381 428 Add2RecPointsList(histRecPointsQMedium, kQMedium, !expert, image);
44f32dd2 429
57acd2d2 430 TH1F * histRecPointsQLong =
44f32dd2 431 new TH1F("hRecPointsQLong", "Q distrbution (long pads); Q; Counts",
adcdb395 432 100, 0, 2000);
57acd2d2 433 histRecPointsQLong->Sumw2();
7d297381 434 Add2RecPointsList(histRecPointsQLong, kQLong, !expert, image);
44f32dd2 435
57acd2d2 436 TH1F * histRecPointsRow =
44f32dd2 437 new TH1F("hRecPointsRow", "Clusters per row; Row; Counts",
438 159, 0, 159);
57acd2d2 439 histRecPointsRow->Sumw2();
7d297381 440 Add2RecPointsList(histRecPointsRow, kRow, !expert, image);
44f32dd2 441}
442
443//____________________________________________________________________________
444void AliTPCQADataMakerRec::MakeESDs(AliESDEvent * esd)
445{
446 // make QA data from ESDs
eca4fa66 447
44f32dd2 448 const Int_t nESDTracks = esd->GetNumberOfTracks();
449 Int_t nTPCtracks = 0;
450 for(Int_t i = 0; i < nESDTracks; i++) {
451
452 AliESDtrack * track = esd->GetTrack(i);
453
454 if ((track->GetStatus() & AliESDtrack::kTPCrefit)==0)
455 continue;
456
457 nTPCtracks++;
458
459 Int_t nTPCclusters = track->GetTPCNcls();
460 Int_t nTPCclustersFindable = track->GetTPCNclsF();
47a596d8 461 if ( nTPCclustersFindable<=0) continue;
57acd2d2 462 GetESDsData(KClusters)->Fill(nTPCclusters);
463 GetESDsData(kRatio)->Fill(Float_t(nTPCclusters)/Float_t(nTPCclustersFindable));
464 GetESDsData(kPt)->Fill(track->Pt());
44f32dd2 465 }
466}
467
468//____________________________________________________________________________
469void AliTPCQADataMakerRec::MakeRaws(AliRawReader* rawReader)
470{
471 //
472 // To make QA for the RAW data we use the TPC Calibration framework
473 // to handle the data and then in the end extract the data
474 //
eca4fa66 475
60f9f416 476 GetRawsData(0); // dummy call to init raw data
eca4fa66 477 rawReader->Reset() ;
6252ceeb 478 if (! fTPCdataQA[AliRecoParam::AConvert(fEventSpecie)] ) {
479 AliError("Something unexpected here!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") ;
480 } else {
481 fTPCdataQA[AliRecoParam::AConvert(fEventSpecie)]->ProcessEvent(rawReader);
482 }
483}
44f32dd2 484
485//____________________________________________________________________________
44ed7a66 486void AliTPCQADataMakerRec::MakeDigits(TTree* digitTree)
487{
6252ceeb 488
44ed7a66 489 TBranch* branch = digitTree->GetBranch("Segment");
490 AliSimDigits* digArray = 0;
491 branch->SetAddress(&digArray);
492
493 Int_t nEntries = Int_t(digitTree->GetEntries());
494
495 for (Int_t n = 0; n < nEntries; n++) {
496
497 digitTree->GetEvent(n);
498
499 if (digArray->First())
500 do {
501 Float_t dig = digArray->CurrentDigit();
502
503 GetDigitsData(kDigitsADC)->Fill(dig);
504 } while (digArray->Next());
505 }
506}
507
508//____________________________________________________________________________
44f32dd2 509void AliTPCQADataMakerRec::MakeRecPoints(TTree* recTree)
510{
c75ba816 511
8305642e 512 AliTPCClustersRow* clrow = 0x0;
513 TBranch* branch = recTree->GetBranch("Segment");
514 branch->SetAddress(&clrow);
515 TClonesArray * clarray = 0x0;
44f32dd2 516
517 const Int_t nEntries = Int_t(recTree->GetEntries());
518 for (Int_t i = 0; i < nEntries; i++) {
519
520 branch->GetEntry(i);
741dac00 521
8305642e 522 clarray = clrow->GetArray();
741dac00 523
8305642e 524 if (!clarray) continue;
741dac00 525
8305642e 526 const Int_t nClusters = clarray->GetEntriesFast();
44f32dd2 527 for (Int_t icl=0; icl < nClusters; icl++){
528
529 AliTPCclusterMI* cluster =
8305642e 530 (AliTPCclusterMI*)clarray->At(icl);
44f32dd2 531
532 Float_t Qmax = cluster->GetMax();
533 Float_t Q = cluster->GetQ();
534 Int_t row = cluster->GetRow();
535
536 if(cluster->GetDetector()<36) { // IROC (short pads)
537
57acd2d2 538 GetRecPointsData(kQmaxShort)->Fill(Qmax);
539 GetRecPointsData(kQShort)->Fill(Q);
44f32dd2 540 } else { // OROC (medium and long pads)
541 row += 63;
542 if(cluster->GetRow()<64) { // medium pads
543
57acd2d2 544 GetRecPointsData(kQmaxMedium)->Fill(Qmax);
545 GetRecPointsData(kQMedium)->Fill(Q);
44f32dd2 546 } else { // long pads
547
57acd2d2 548 GetRecPointsData(kQmaxLong)->Fill(Qmax);
549 GetRecPointsData(kQLong)->Fill(Q);
44f32dd2 550 }
551 }
552
57acd2d2 553 GetRecPointsData(kRow)->Fill(row);
44f32dd2 554 } // end loop over clusters
555 } // end loop over tree
44f32dd2 556}
be4f1702 557
558//____________________________________________________________________________
559void AliTPCQADataMakerRec::LoadMaps()
560{
561 TString path = gSystem->Getenv("ALICE_ROOT");
562 path += "/TPC/mapping/Patch";
563
564 for(Int_t i = 0; i < 6; i++) {
ce0175fa 565
566 if(fMapping[i]!=0) // mapping already loaded
567 continue;
be4f1702 568 TString path2 = path;
569 path2 += i;
570 path2 += ".data";
571 fMapping[i] = new AliTPCAltroMapping(path2.Data());
572 }
573}
574
556a0e5b 575//____________________________________________________________________________
5e10013b 576void AliTPCQADataMakerRec::ResetDetector(AliQAv1::TASKINDEX_t task)
556a0e5b 577{
5e10013b 578 // Overwrites general method for RAW data.
556a0e5b 579 // The AliTPCdataQA elements that does the internal processing are
580 // in the case they have processed data deleted and new are created
581
5e10013b 582 if ( task != AliQAv1::kRAWS )
583 AliQADataMakerRec::ResetDetector(task);
584
556a0e5b 585 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
586
587 if ( fTPCdataQA[specie] != NULL) { // exist
588
589 if(fTPCdataQA[specie]->GetEventCounter()>0) { // has processed data
590
591 // old configuration
592 Int_t firstTime = fTPCdataQA[specie]->GetFirstTimeBin();
593 Int_t lastTime = fTPCdataQA[specie]->GetLastTimeBin();
594 Int_t minADC = fTPCdataQA[specie]->GetAdcMin();
595 Int_t maxADC = fTPCdataQA[specie]->GetAdcMax();
556a0e5b 596
597 //delete old
598 delete fTPCdataQA[specie];
599
600 // create new
601 fTPCdataQA[specie] = new AliTPCdataQA(AliRecoParam::ConvertIndex(specie));
602 // configure new
603 LoadMaps(); // Load Altro maps
604 fTPCdataQA[specie]->SetAltroMapping(fMapping);
605 fTPCdataQA[specie]->SetRangeTime(firstTime, lastTime);
606 fTPCdataQA[specie]->SetRangeAdc(minADC, maxADC);
1267cf3a 607 // Here we want to restore the default configuration because
608 // the max events and events are adjusted for the last run
609 fTPCdataQA[specie]->SetMaxEvents(fRawMaxEvents);
610 fTPCdataQA[specie]->SetEventsPerBin(fRawEventsPerBin);
556a0e5b 611 }
612 }
613 }
614}
1267cf3a 615
616//____________________________________________________________________________
617TH1F* AliTPCQADataMakerRec::CreateEventsHistCopy(const TH1F* hist,
618 const Char_t* copyName)
619{
620 // This method is used to create a copy of the event histograms
621
622 TH1F* histCopy = new TH1F(copyName, hist->GetTitle(),
623 hist->GetXaxis()->GetNbins(),
624 hist->GetXaxis()->GetXmin(),
625 hist->GetXaxis()->GetXmax());
626 histCopy->GetXaxis()->SetTitle(hist->GetXaxis()->GetTitle());
627 histCopy->GetYaxis()->SetTitle(hist->GetYaxis()->GetTitle());
628 histCopy->SetMarkerStyle(20);
629 histCopy->SetOption("P");
630 histCopy->SetStats(kFALSE);
631
632 return histCopy;
633}