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>
83 // --- Standard library ---
85 // --- AliRoot header files ---
86 #include "AliQAChecker.h"
87 #include "AliESDEvent.h"
88 #include "AliESDtrack.h"
90 #include "AliTPCCalPad.h"
91 #include "AliTPCCalROC.h"
92 #include "AliTPCClustersRow.h"
93 #include "AliTPCclusterMI.h"
94 #include "AliSimDigits.h"
97 ClassImp(AliTPCQADataMakerRec)
99 //____________________________________________________________________________
100 AliTPCQADataMakerRec::AliTPCQADataMakerRec() :
101 AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kTPC),
102 "TPC Rec Quality Assurance Data Maker"),
105 fRawLastTimeBin(1000)
109 for(Int_t i = 0; i < 6; i++)
113 //____________________________________________________________________________
114 AliTPCQADataMakerRec::AliTPCQADataMakerRec(const AliTPCQADataMakerRec& qadm) :
117 fRawFirstTimeBin(qadm.GetRawFirstTimeBin()),
118 fRawLastTimeBin(qadm.GetRawLastTimeBin())
121 // Does not copy the calibration object, instead InitRaws have to be
123 SetName((const char*)qadm.GetName()) ;
124 SetTitle((const char*)qadm.GetTitle());
126 for(Int_t i = 0; i < 6; i++)
130 //__________________________________________________________________
131 AliTPCQADataMakerRec& AliTPCQADataMakerRec::operator = (const AliTPCQADataMakerRec& qadm )
134 this->~AliTPCQADataMakerRec();
135 new(this) AliTPCQADataMakerRec(qadm);
139 //__________________________________________________________________
140 AliTPCQADataMakerRec::~AliTPCQADataMakerRec()
145 for(Int_t i = 0; i < 6; i++)
149 //____________________________________________________________________________
150 void AliTPCQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
152 //Detector specific actions at end of cycle
153 ResetEventTrigClasses();
155 AliQAChecker::Instance()->Run(AliQAv1::kTPC, task, list) ;
159 //____________________________________________________________________________
160 void AliTPCQADataMakerRec::InitESDs()
162 //create ESDs histograms in ESDs subdir
163 const Bool_t expert = kTRUE ;
164 const Bool_t image = kTRUE ;
166 TH1F * histESDclusters =
167 new TH1F("hESDclusters", "N TPC clusters per track; N clusters; Counts",
169 histESDclusters->Sumw2();
170 Add2ESDsList(histESDclusters, kClusters, !expert, image);
172 TH1F * histESDratio =
173 new TH1F("hESDratio", "Ratio: TPC clusters / findable; Ratio: cluster/findable; Counts",
175 histESDratio->Sumw2();
176 Add2ESDsList(histESDratio, kRatio, !expert, image);
179 new TH1F("hESDpt", "P_{T} distribution; p_{T} [GeV/c]; Counts",
182 Add2ESDsList(histESDpt, kPt, !expert, image);
184 ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line
187 //____________________________________________________________________________
188 void AliTPCQADataMakerRec::InitRaws()
194 // Modified: 7/7 - 2008
195 // Laurent Aphecetche pointed out that the mapping was read from file
196 // for each event, so now we read in the map here and set if for
198 const Bool_t expert = kTRUE ;
199 const Bool_t saveCorr = kTRUE ;
200 const Bool_t image = kTRUE ;
202 // It might happen that we will be in this method a few times
203 // (we create the dataQA at the first call to this method)
205 fTPCdataQA = new AliTPCdataQA();
206 LoadMaps(); // Load Altro maps
207 fTPCdataQA->SetAltroMapping(fMapping); // set Altro mapping
208 fTPCdataQA->SetRangeTime(fRawFirstTimeBin, fRawLastTimeBin); // set time bin interval
209 fTPCdataQA->SetIsDQM(kTRUE);
212 TProfile * histRawsOccupancyVsSector =
213 new TProfile("hRawsOccupancyVsSector", "Occupancy vs sector; Sector; Occupancy",
215 histRawsOccupancyVsSector->SetMarkerStyle(20);
216 histRawsOccupancyVsSector->SetOption("P");
217 histRawsOccupancyVsSector->SetStats(kFALSE);
218 Add2RawsList(histRawsOccupancyVsSector, kRawsOccupancyVsSector, !expert, image, !saveCorr);
220 TProfile * histRawsQVsSector =
221 new TProfile("hRawsQVsSector", "<Q> vs sector; Sector; <Q>",
223 Add2RawsList(histRawsQVsSector, kRawsQVsSector, expert, !image, !saveCorr);
225 TProfile * histRawsQmaxVsSector =
226 new TProfile("hRawsQmaxVsSector", "<Qmax> vs sector; Sector; <Qmax>",
228 histRawsQmaxVsSector->SetMarkerStyle(20);
229 histRawsQmaxVsSector->SetOption("P");
230 histRawsQmaxVsSector->SetStats(kFALSE);
231 Add2RawsList(histRawsQmaxVsSector, kRawsQmaxVsSector, !expert, image, !saveCorr);
233 ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line
236 //____________________________________________________________________________
237 void AliTPCQADataMakerRec::InitDigits()
239 const Bool_t expert = kTRUE ;
240 const Bool_t image = kTRUE ;
241 TH1F * histDigitsADC =
242 new TH1F("hDigitsADC", "Digit ADC distribution; ADC; Counts",
244 histDigitsADC->Sumw2();
245 Add2DigitsList(histDigitsADC, kDigitsADC, !expert, image);
247 ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
250 //____________________________________________________________________________
251 void AliTPCQADataMakerRec::InitRecPoints()
253 const Bool_t expert = kTRUE ;
254 const Bool_t image = kTRUE ;
256 TH1F * histRecPointsQmaxShort =
257 new TH1F("hRecPointsQmaxShort", "Qmax distrbution (short pads); Qmax; Counts",
259 histRecPointsQmaxShort->Sumw2();
260 Add2RecPointsList(histRecPointsQmaxShort, kQmaxShort, !expert, image);
262 TH1F * histRecPointsQmaxMedium =
263 new TH1F("hRecPointsQmaxMedium", "Qmax distrbution (medium pads); Qmax; Counts",
265 histRecPointsQmaxMedium->Sumw2();
266 Add2RecPointsList(histRecPointsQmaxMedium, kQmaxMedium, !expert, image);
268 TH1F * histRecPointsQmaxLong =
269 new TH1F("hRecPointsQmaxLong", "Qmax distrbution (long pads); Qmax; Counts",
271 histRecPointsQmaxLong->Sumw2();
272 Add2RecPointsList(histRecPointsQmaxLong, kQmaxLong, !expert, image);
274 TH1F * histRecPointsQShort =
275 new TH1F("hRecPointsQShort", "Q distrbution (short pads); Q; Counts",
277 histRecPointsQShort->Sumw2();
278 Add2RecPointsList(histRecPointsQShort, kQShort, !expert, image);
280 TH1F * histRecPointsQMedium =
281 new TH1F("hRecPointsQMedium", "Q distrbution (medium pads); Q; Counts",
283 histRecPointsQMedium->Sumw2();
284 Add2RecPointsList(histRecPointsQMedium, kQMedium, !expert, image);
286 TH1F * histRecPointsQLong =
287 new TH1F("hRecPointsQLong", "Q distrbution (long pads); Q; Counts",
289 histRecPointsQLong->Sumw2();
290 Add2RecPointsList(histRecPointsQLong, kQLong, !expert, image);
292 TH1F * histRecPointsRow =
293 new TH1F("hRecPointsRow", "Clusters per row; Row; Counts",
295 histRecPointsRow->Sumw2();
296 Add2RecPointsList(histRecPointsRow, kRow, !expert, image);
298 ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last line
301 //____________________________________________________________________________
302 void AliTPCQADataMakerRec::MakeESDs(AliESDEvent * esd)
304 // make QA data from ESDs
306 const Int_t nESDTracks = esd->GetNumberOfTracks();
307 Int_t nTPCtracks = 0;
308 for(Int_t i = 0; i < nESDTracks; i++) {
310 AliESDtrack * track = esd->GetTrack(i);
312 if ((track->GetStatus() & AliESDtrack::kTPCrefit)==0)
317 Int_t nTPCclusters = track->GetTPCNcls();
318 Int_t nTPCclustersFindable = track->GetTPCNclsF();
319 if ( nTPCclustersFindable<=0) continue;
320 FillESDsData(kClusters,nTPCclusters);
321 FillESDsData(kRatio,Float_t(nTPCclusters)/Float_t(nTPCclustersFindable));
322 FillESDsData(kPt,track->Pt());
325 IncEvCountCycleESDs();
326 IncEvCountTotalESDs();
330 //____________________________________________________________________________
331 void AliTPCQADataMakerRec::MakeRaws(AliRawReader* rawReader)
334 // To make QA for the RAW data we use the TPC Calibration framework
335 // to handle the data and then in the end extract the data
338 GetRawsData(0); // dummy call to init raw data
342 AliError("No TPC data QA (no call to InitRaws?)!!!!") ;
345 if(fTPCdataQA->GetIsDQM() == kFALSE)
346 AliError("Data QA has to be initialized as DQM!!!!") ;
349 fTPCdataQA->ResetProfiles();
351 if(fTPCdataQA->ProcessEvent(rawReader)) { // means that TPC data was processed
353 fTPCdataQA->FillOccupancyProfile();
356 TObjArray *arrRW = GetMatchingRawsData(kRawsOccupancyVsSector); // all kRawsOccupancyVsSector clones matching to triggers
357 for (int ih=arrRW->GetEntriesFast();ih--;) {
358 TProfile* hRawsOccupancyVsSector = dynamic_cast<TProfile*>(arrRW->At(ih));
359 if (hRawsOccupancyVsSector) hRawsOccupancyVsSector->Add(fTPCdataQA->GetHistOccVsSector());
361 arrRW = GetMatchingRawsData(kRawsQVsSector);
362 for (int ih=arrRW->GetEntriesFast();ih--;) {
363 TProfile* hRawsQVsSector = dynamic_cast<TProfile*>(arrRW->At(ih));
364 if (hRawsQVsSector) hRawsQVsSector->Add(fTPCdataQA->GetHistQVsSector());
366 arrRW = GetMatchingRawsData(kRawsQmaxVsSector);
367 for (int ih=arrRW->GetEntriesFast();ih--;) {
368 TProfile* hRawsQmaxVsSector = dynamic_cast<TProfile*>(arrRW->At(ih));
369 if (hRawsQmaxVsSector) hRawsQmaxVsSector->Add(fTPCdataQA->GetHistQmaxVsSector());
372 IncEvCountCycleRaws();
373 IncEvCountTotalRaws();
379 //____________________________________________________________________________
380 void AliTPCQADataMakerRec::MakeDigits(TTree* digitTree)
383 TBranch* branch = digitTree->GetBranch("Segment");
384 AliSimDigits* digArray = 0;
385 branch->SetAddress(&digArray);
387 Int_t nEntries = Int_t(digitTree->GetEntries());
389 for (Int_t n = 0; n < nEntries; n++) {
391 digitTree->GetEvent(n);
393 if (digArray->First())
395 Float_t dig = digArray->CurrentDigit();
397 FillDigitsData(kDigitsADC,dig);
398 } while (digArray->Next());
401 IncEvCountCycleDigits();
402 IncEvCountTotalDigits();
406 //____________________________________________________________________________
407 void AliTPCQADataMakerRec::MakeRecPoints(TTree* recTree)
410 AliTPCClustersRow* clrow = 0x0;
411 TBranch* branch = recTree->GetBranch("Segment");
412 branch->SetAddress(&clrow);
413 TClonesArray * clarray = 0x0;
415 const Int_t nEntries = Int_t(recTree->GetEntries());
416 for (Int_t i = 0; i < nEntries; i++) {
420 clarray = clrow->GetArray();
422 if (!clarray) continue;
424 const Int_t nClusters = clarray->GetEntriesFast();
425 for (Int_t icl=0; icl < nClusters; icl++){
427 AliTPCclusterMI* cluster =
428 (AliTPCclusterMI*)clarray->At(icl);
430 Float_t Qmax = cluster->GetMax();
431 Float_t Q = cluster->GetQ();
432 Int_t row = cluster->GetRow();
434 if(cluster->GetDetector()<36) { // IROC (short pads)
436 FillRecPointsData(kQmaxShort,Qmax);
437 FillRecPointsData(kQShort,Q);
438 } else { // OROC (medium and long pads)
440 if(cluster->GetRow()<64) { // medium pads
442 FillRecPointsData(kQmaxMedium,Qmax);
443 FillRecPointsData(kQMedium,Q);
444 } else { // long pads
446 FillRecPointsData(kQmaxLong,Qmax);
447 FillRecPointsData(kQLong,Q);
451 FillRecPointsData(kRow,row);
452 } // end loop over clusters
453 } // end loop over tree
455 IncEvCountCycleRecPoints();
456 IncEvCountTotalRecPoints();
460 //____________________________________________________________________________
461 void AliTPCQADataMakerRec::LoadMaps()
463 TString path = gSystem->Getenv("ALICE_ROOT");
464 path += "/TPC/mapping/Patch";
466 for(Int_t i = 0; i < 6; i++) {
468 if(fMapping[i]!=0) // mapping already loaded
470 TString path2 = path;
473 fMapping[i] = new AliTPCAltroMapping(path2.Data());