1 /**************************************************************************
2 * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
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
28 Major changes to accomodate updates of general DQM/QA changes to have per
29 trigger histograms (for a given event specie).
31 1) One instance of AliTPCdataQA only. (This also solves some old wishes by
32 offline team to use less memory because event the 2d arrays for this object
33 is not used). This now has a new flag for only keeping DQM info event by
34 event! For this reason there is no need for a special DQM reset any more
37 2) Fill the histogram for each event. The histograms are no longer filled
38 from the AliTPCdataQA but per event.
40 3) Use profiles for the RAW info. By adding the profiles event by event we
41 get the correct event averages WITHOUT having to normalize in the end!
42 Results should therefore also be directly mergable when that feature will
43 come. (none of the other histograms are merged).
45 This means that from the DQM/QA point of view the TPC DQM is now fully
46 standard and should ease future developments.
51 The "beautification" of the online DQM histograms have been moved to
54 The per event RAW histograms have been modified in AliTPCdataQA and
55 the copies have therefore also been modified here.
57 The AliTPCdataQA can now be configured a bit from here: time bin
58 range (extended default range to 1-1000, event range at start:
59 0-100000, 1000 events per bin). (At least the parameters are not
65 For the QA of the RAW data we use the class, AliTPCdataQA, from the
66 existing TPC Calibration framework (which is more advanced than the
67 standard QA framework) and extract the histograms at the end. The
68 Analyse method of the AliTPCdataQA class is called in the method,
69 EndOfDetectorCycle, and there also: 1d histogram(s) are projected
70 and added to the QA list.
73 #include "AliTPCQADataMakerRec.h"
75 // --- ROOT system ---
76 #include <TClonesArray.h>
84 #include <TProfile2D.h>
86 // --- Standard library ---
88 // --- AliRoot header files ---
89 #include "AliQAChecker.h"
90 #include "AliESDEvent.h"
91 #include "AliESDtrack.h"
93 #include "AliTPCCalPad.h"
94 #include "AliTPCCalROC.h"
95 #include "AliTPCClustersRow.h"
96 #include "AliTPCclusterMI.h"
97 #include "AliSimDigits.h"
98 #include <AliDetectorRecoParam.h>
101 ClassImp(AliTPCQADataMakerRec)
103 //____________________________________________________________________________
104 AliTPCQADataMakerRec::AliTPCQADataMakerRec() :
105 AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kTPC),
106 "TPC Rec Quality Assurance Data Maker"),
109 fRawLastTimeBin(1000)
113 for(Int_t i = 0; i < 6; i++)
117 //____________________________________________________________________________
118 AliTPCQADataMakerRec::AliTPCQADataMakerRec(const AliTPCQADataMakerRec& qadm) :
121 fRawFirstTimeBin(qadm.GetRawFirstTimeBin()),
122 fRawLastTimeBin(qadm.GetRawLastTimeBin())
125 // Does not copy the calibration object, instead InitRaws have to be
127 SetName((const char*)qadm.GetName()) ;
128 SetTitle((const char*)qadm.GetTitle());
130 for(Int_t i = 0; i < 6; i++)
134 //__________________________________________________________________
135 AliTPCQADataMakerRec& AliTPCQADataMakerRec::operator = (const AliTPCQADataMakerRec& qadm )
138 this->~AliTPCQADataMakerRec();
139 new(this) AliTPCQADataMakerRec(qadm);
143 //__________________________________________________________________
144 AliTPCQADataMakerRec::~AliTPCQADataMakerRec()
149 for(Int_t i = 0; i < 6; i++)
153 //____________________________________________________________________________
154 void AliTPCQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
156 //Detector specific actions at end of cycle
157 ResetEventTrigClasses();
159 AliQAChecker::Instance()->Run(AliQAv1::kTPC, task, list) ;
163 //____________________________________________________________________________
164 void AliTPCQADataMakerRec::InitESDs()
166 //create ESDs histograms in ESDs subdir
167 const Bool_t expert = kTRUE ;
168 const Bool_t image = kTRUE ;
170 TH1F * histESDclusters =
171 new TH1F("hESDclusters", "N TPC clusters per track; N clusters; Counts",
173 histESDclusters->Sumw2();
174 Add2ESDsList(histESDclusters, kClusters, !expert, image);
176 TH1F * histESDratio =
177 new TH1F("hESDratio", "Ratio: TPC clusters / findable; Ratio: cluster/findable; Counts",
179 histESDratio->Sumw2();
180 Add2ESDsList(histESDratio, kRatio, !expert, image);
183 new TH1F("hESDpt", "P_{T} distribution; p_{T} [GeV/c]; Counts",
186 Add2ESDsList(histESDpt, kPt, !expert, image);
188 ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line
191 //____________________________________________________________________________
192 void AliTPCQADataMakerRec::InitRaws()
198 // Modified: 7/7 - 2008
199 // Laurent Aphecetche pointed out that the mapping was read from file
200 // for each event, so now we read in the map here and set if for
202 const Bool_t expert = kTRUE ;
203 const Bool_t saveCorr = kTRUE ;
204 const Bool_t image = kTRUE ;
206 // It might happen that we will be in this method a few times
207 // (we create the dataQA at the first call to this method)
209 fTPCdataQA = new AliTPCdataQA();
210 LoadMaps(); // Load Altro maps
211 fTPCdataQA->SetAltroMapping(fMapping); // set Altro mapping
212 fTPCdataQA->SetRangeTime(fRawFirstTimeBin, fRawLastTimeBin); // set time bin interval
213 fTPCdataQA->SetIsDQM(kTRUE);
216 TProfile * histRawsOccupancyVsSector =
217 new TProfile("hRawsOccupancyVsSector", "Occupancy vs sector; Sector; Occupancy",
219 histRawsOccupancyVsSector->SetMarkerStyle(20);
220 histRawsOccupancyVsSector->SetOption("P");
221 histRawsOccupancyVsSector->SetStats(kFALSE);
222 if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib )
223 Add2RawsList(histRawsOccupancyVsSector, kRawsOccupancyVsSector, expert, image, !saveCorr);
225 Add2RawsList(histRawsOccupancyVsSector, kRawsOccupancyVsSector, !expert, image, !saveCorr);
227 TProfile * histRawsQVsSector =
228 new TProfile("hRawsQVsSector", "<Q> vs sector; Sector; <Q>",
230 Add2RawsList(histRawsQVsSector, kRawsQVsSector, expert, !image, !saveCorr);
232 TProfile * histRawsQmaxVsSector =
233 new TProfile("hRawsQmaxVsSector", "<Qmax> vs sector; Sector; <Qmax>",
235 histRawsQmaxVsSector->SetMarkerStyle(20);
236 histRawsQmaxVsSector->SetOption("P");
237 histRawsQmaxVsSector->SetStats(kFALSE);
238 if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib )
239 Add2RawsList(histRawsQmaxVsSector, kRawsQmaxVsSector, expert, image, !saveCorr);
241 Add2RawsList(histRawsQmaxVsSector, kRawsQmaxVsSector, !expert, image, !saveCorr);
243 TProfile2D * histRawsOccupancy2dVsSector =
244 new TProfile2D("hRawsOccupancy2dVsSector", "Occupancy vs sector; Sector; Patch",
246 histRawsOccupancy2dVsSector->SetOption("COLZ");
247 histRawsOccupancy2dVsSector->SetStats(kFALSE);
248 if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib )
249 Add2RawsList(histRawsOccupancy2dVsSector, kRawsOccupancy2dVsSector, expert, image, !saveCorr);
251 Add2RawsList(histRawsOccupancy2dVsSector, kRawsOccupancy2dVsSector, !expert, image, !saveCorr);
254 ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line
257 //____________________________________________________________________________
258 void AliTPCQADataMakerRec::InitDigits()
260 const Bool_t expert = kTRUE ;
261 const Bool_t image = kTRUE ;
262 TH1F * histDigitsADC =
263 new TH1F("hDigitsADC", "Digit ADC distribution; ADC; Counts",
265 histDigitsADC->Sumw2();
266 Add2DigitsList(histDigitsADC, kDigitsADC, !expert, image);
268 ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
271 //____________________________________________________________________________
272 void AliTPCQADataMakerRec::InitRecPoints()
274 const Bool_t expert = kTRUE ;
275 const Bool_t image = kTRUE ;
277 TH1F * histRecPointsQmaxShort =
278 new TH1F("hRecPointsQmaxShort", "Qmax distrbution (short pads); Qmax; Counts",
280 histRecPointsQmaxShort->Sumw2();
281 Add2RecPointsList(histRecPointsQmaxShort, kQmaxShort, !expert, image);
283 TH1F * histRecPointsQmaxMedium =
284 new TH1F("hRecPointsQmaxMedium", "Qmax distrbution (medium pads); Qmax; Counts",
286 histRecPointsQmaxMedium->Sumw2();
287 Add2RecPointsList(histRecPointsQmaxMedium, kQmaxMedium, !expert, image);
289 TH1F * histRecPointsQmaxLong =
290 new TH1F("hRecPointsQmaxLong", "Qmax distrbution (long pads); Qmax; Counts",
292 histRecPointsQmaxLong->Sumw2();
293 Add2RecPointsList(histRecPointsQmaxLong, kQmaxLong, !expert, image);
295 TH1F * histRecPointsQShort =
296 new TH1F("hRecPointsQShort", "Q distrbution (short pads); Q; Counts",
298 histRecPointsQShort->Sumw2();
299 Add2RecPointsList(histRecPointsQShort, kQShort, !expert, image);
301 TH1F * histRecPointsQMedium =
302 new TH1F("hRecPointsQMedium", "Q distrbution (medium pads); Q; Counts",
304 histRecPointsQMedium->Sumw2();
305 Add2RecPointsList(histRecPointsQMedium, kQMedium, !expert, image);
307 TH1F * histRecPointsQLong =
308 new TH1F("hRecPointsQLong", "Q distrbution (long pads); Q; Counts",
310 histRecPointsQLong->Sumw2();
311 Add2RecPointsList(histRecPointsQLong, kQLong, !expert, image);
313 TH1F * histRecPointsRow =
314 new TH1F("hRecPointsRow", "Clusters per row; Row; Counts",
316 histRecPointsRow->Sumw2();
317 Add2RecPointsList(histRecPointsRow, kRow, !expert, image);
319 ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last line
322 //____________________________________________________________________________
323 void AliTPCQADataMakerRec::MakeESDs(AliESDEvent * esd)
325 // make QA data from ESDs
327 const Int_t nESDTracks = esd->GetNumberOfTracks();
328 Int_t nTPCtracks = 0;
329 for(Int_t i = 0; i < nESDTracks; i++) {
331 AliESDtrack * track = esd->GetTrack(i);
333 if ((track->GetStatus() & AliESDtrack::kTPCrefit)==0)
338 Int_t nTPCclusters = track->GetTPCNcls();
339 Int_t nTPCclustersFindable = track->GetTPCNclsF();
340 if ( nTPCclustersFindable<=0) continue;
341 FillESDsData(kClusters,nTPCclusters);
342 FillESDsData(kRatio,Float_t(nTPCclusters)/Float_t(nTPCclustersFindable));
343 FillESDsData(kPt,track->Pt());
346 IncEvCountCycleESDs();
347 IncEvCountTotalESDs();
351 //____________________________________________________________________________
352 void AliTPCQADataMakerRec::MakeRaws(AliRawReader* rawReader)
355 // To make QA for the RAW data we use the TPC Calibration framework
356 // to handle the data and then in the end extract the data
359 GetRawsData(0); // dummy call to init raw data
363 AliError("No TPC data QA (no call to InitRaws?)!!!!") ;
366 if(fTPCdataQA->GetIsDQM() == kFALSE)
367 AliError("Data QA has to be initialized as DQM!!!!") ;
370 fTPCdataQA->ResetProfiles();
372 if(fTPCdataQA->ProcessEvent(rawReader)) { // means that TPC data was processed
374 fTPCdataQA->FillOccupancyProfile();
377 TObjArray *arrRW = GetMatchingRawsData(kRawsOccupancyVsSector); // all kRawsOccupancyVsSector clones matching to triggers
378 for (int ih=arrRW->GetEntriesFast();ih--;) {
379 TProfile* hRawsOccupancyVsSector = dynamic_cast<TProfile*>(arrRW->At(ih));
380 if (hRawsOccupancyVsSector) hRawsOccupancyVsSector->Add(fTPCdataQA->GetHistOccVsSector());
382 arrRW = GetMatchingRawsData(kRawsOccupancy2dVsSector);
383 for (int ih=arrRW->GetEntriesFast();ih--;) {
384 TProfile2D* hRawsOccupancy2dVsSector = dynamic_cast<TProfile2D*>(arrRW->At(ih));
385 if (hRawsOccupancy2dVsSector) hRawsOccupancy2dVsSector->Add(fTPCdataQA->GetHistOcc2dVsSector());
387 arrRW = GetMatchingRawsData(kRawsQVsSector);
388 for (int ih=arrRW->GetEntriesFast();ih--;) {
389 TProfile* hRawsQVsSector = dynamic_cast<TProfile*>(arrRW->At(ih));
390 if (hRawsQVsSector) hRawsQVsSector->Add(fTPCdataQA->GetHistQVsSector());
392 arrRW = GetMatchingRawsData(kRawsQmaxVsSector);
393 for (int ih=arrRW->GetEntriesFast();ih--;) {
394 TProfile* hRawsQmaxVsSector = dynamic_cast<TProfile*>(arrRW->At(ih));
395 if (hRawsQmaxVsSector) hRawsQmaxVsSector->Add(fTPCdataQA->GetHistQmaxVsSector());
398 IncEvCountCycleRaws();
399 IncEvCountTotalRaws();
405 //____________________________________________________________________________
406 void AliTPCQADataMakerRec::MakeDigits(TTree* digitTree)
409 TBranch* branch = digitTree->GetBranch("Segment");
410 AliSimDigits* digArray = 0;
411 branch->SetAddress(&digArray);
413 Int_t nEntries = Int_t(digitTree->GetEntries());
415 for (Int_t n = 0; n < nEntries; n++) {
417 digitTree->GetEvent(n);
419 if (digArray->First())
421 Float_t dig = digArray->CurrentDigit();
423 FillDigitsData(kDigitsADC,dig);
424 } while (digArray->Next());
427 IncEvCountCycleDigits();
428 IncEvCountTotalDigits();
432 //____________________________________________________________________________
433 void AliTPCQADataMakerRec::MakeRecPoints(TTree* recTree)
436 AliTPCClustersRow* clrow = 0x0;
437 TBranch* branch = recTree->GetBranch("Segment");
438 branch->SetAddress(&clrow);
439 TClonesArray * clarray = 0x0;
441 const Int_t nEntries = Int_t(recTree->GetEntries());
442 for (Int_t i = 0; i < nEntries; i++) {
446 clarray = clrow->GetArray();
448 if (!clarray) continue;
450 const Int_t nClusters = clarray->GetEntriesFast();
451 for (Int_t icl=0; icl < nClusters; icl++){
453 AliTPCclusterMI* cluster =
454 (AliTPCclusterMI*)clarray->At(icl);
456 Float_t Qmax = cluster->GetMax();
457 Float_t Q = cluster->GetQ();
458 Int_t row = cluster->GetRow();
460 if(cluster->GetDetector()<36) { // IROC (short pads)
462 FillRecPointsData(kQmaxShort,Qmax);
463 FillRecPointsData(kQShort,Q);
464 } else { // OROC (medium and long pads)
466 if(cluster->GetRow()<64) { // medium pads
468 FillRecPointsData(kQmaxMedium,Qmax);
469 FillRecPointsData(kQMedium,Q);
470 } else { // long pads
472 FillRecPointsData(kQmaxLong,Qmax);
473 FillRecPointsData(kQLong,Q);
477 FillRecPointsData(kRow,row);
478 } // end loop over clusters
479 } // end loop over tree
481 IncEvCountCycleRecPoints();
482 IncEvCountTotalRecPoints();
486 //____________________________________________________________________________
487 void AliTPCQADataMakerRec::LoadMaps()
489 TString path = gSystem->Getenv("ALICE_ROOT");
490 path += "/TPC/mapping/Patch";
492 for(Int_t i = 0; i < 6; i++) {
494 if(fMapping[i]!=0) // mapping already loaded
496 TString path2 = path;
499 fMapping[i] = new AliTPCAltroMapping(path2.Data());