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
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.
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.
44 Sumw2 for RAW histogram(s)?
45 RecPoints and ESD could have many more histograms
48 #include "AliTPCQADataMakerRec.h"
50 // --- ROOT system ---
51 #include <TClonesArray.h>
53 // --- Standard library ---
55 // --- AliRoot header files ---
56 #include "AliQAChecker.h"
57 #include "AliESDEvent.h"
58 #include "AliESDtrack.h"
60 #include "AliTPCCalPad.h"
61 #include "AliTPCClustersRow.h"
62 #include "AliTPCclusterMI.h"
64 ClassImp(AliTPCQADataMakerRec)
66 //____________________________________________________________________________
67 AliTPCQADataMakerRec::AliTPCQADataMakerRec() :
68 AliQADataMakerRec(AliQA::GetDetName(AliQA::kTPC),
69 "TPC Rec Quality Assurance Data Maker"),
71 fHistESDclusters(0),fHistESDratio(0), fHistESDpt(0),
72 fHistRawsOccupancy(0),
73 fHistRecPointsQmaxShort(0), fHistRecPointsQmaxMedium(0),
74 fHistRecPointsQmaxLong(0), fHistRecPointsQShort(0),
75 fHistRecPointsQMedium(0), fHistRecPointsQLong(0),
81 //____________________________________________________________________________
82 AliTPCQADataMakerRec::AliTPCQADataMakerRec(const AliTPCQADataMakerRec& qadm) :
85 fHistESDclusters(0), //! Clusters per ESD track
86 fHistESDratio(0), //! Ratio of clusters to findables
87 fHistESDpt(0), //! Pt spectrum
89 fHistRawsOccupancy(0),//! Pad occupancy (1 entry per pad)
91 fHistRecPointsQmaxShort(0), //! Qmax (short pads)
92 fHistRecPointsQmaxMedium(0),//! Qmax (medium pads)
93 fHistRecPointsQmaxLong(0), //! Qmax (long pads)
94 fHistRecPointsQShort(0), //! Q (short pads)
95 fHistRecPointsQMedium(0), //! Q (medium pads)
96 fHistRecPointsQLong(0), //! Q (long pads)
97 fHistRecPointsRow(0) //! Row distribution
100 // Does not copy the calibration object, instead InitRaws have to be
102 SetName((const char*)qadm.GetName()) ;
103 SetTitle((const char*)qadm.GetTitle());
106 // Associate class histogram objects to the copies in the list
107 // Could also be done with the indexes
109 fHistESDclusters = (TH1F*)fESDsQAList->FindObject("hESDclusters");
110 fHistESDratio = (TH1F*)fESDsQAList->FindObject("hESDratio");
111 fHistESDpt = (TH1F*)fESDsQAList->FindObject("hESDpt");
113 fHistRawsOccupancy = (TH1F*)fRawsQAList->FindObject("hRawsOccupancy");
115 fHistRecPointsQmaxShort =
116 (TH1F*)fRecPointsQAList->FindObject("hRecPointsQmaxShort");
117 fHistRecPointsQmaxMedium =
118 (TH1F*)fRecPointsQAList->FindObject("hRecPointsQmaxMedium");
119 fHistRecPointsQmaxLong =
120 (TH1F*)fRecPointsQAList->FindObject("hRecPointsQmaxLong");
121 fHistRecPointsQShort =
122 (TH1F*)fRecPointsQAList->FindObject("hRecPointsQShort");
123 fHistRecPointsQMedium =
124 (TH1F*)fRecPointsQAList->FindObject("hRecPointsQMedium");
125 fHistRecPointsQLong =
126 (TH1F*)fRecPointsQAList->FindObject("hRecPointsQLong");
128 (TH1F*)fRecPointsQAList->FindObject("hRecPointsRow");
131 //__________________________________________________________________
132 AliTPCQADataMakerRec& AliTPCQADataMakerRec::operator = (const AliTPCQADataMakerRec& qadm )
135 this->~AliTPCQADataMakerRec();
136 new(this) AliTPCQADataMakerRec(qadm);
140 //____________________________________________________________________________
141 void AliTPCQADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray * list)
143 //Detector specific actions at end of cycle
145 if(fTPCdataQA) { // do the final step of the QA for Raw data
147 fTPCdataQA->Analyse(); // 31/1-08 Analyse is now protected against
148 // RAW data files with no TPC data
150 //Add2RawsList(fTPCdataQA, 0);
151 // get the histograms and add them to the output
152 // 31/8-08 Histogram is only added if the Calibration class
154 if(fTPCdataQA->GetNoThreshold()) {
155 fHistRawsOccupancy = fTPCdataQA->GetNoThreshold()->MakeHisto1D(0, 1, -1);
156 //Add2RawsList(fHistRawsOccupancy, 1);
160 AliQAChecker::Instance()->Run(AliQA::kTPC, task, list) ;
163 //____________________________________________________________________________
164 void AliTPCQADataMakerRec::InitESDs()
166 //create ESDs histograms in ESDs subdir
168 new TH1F("hESDclusters", "N TPC clusters per track; N clusters; Counts",
170 fHistESDclusters->Sumw2();
171 Add2ESDsList(fHistESDclusters, 0);
174 new TH1F("hESDratio", "Ratio: TPC clusters / findable; Ratio: cluster/findable; Counts",
176 fHistESDratio->Sumw2();
177 Add2ESDsList(fHistESDratio, 1);
180 new TH1F("hESDpt", "P_{T} distribution; p_{T} [GeV/c]; Counts",
183 Add2ESDsList(fHistESDpt, 2);
186 //____________________________________________________________________________
187 void AliTPCQADataMakerRec::InitRaws()
192 fTPCdataQA = new AliTPCdataQA();
193 fTPCdataQA->SetRangeTime(100, 920); // take all 1000 time bins
194 Add2RawsList(fTPCdataQA, 0);
197 //____________________________________________________________________________
198 void AliTPCQADataMakerRec::InitRecPoints()
200 fHistRecPointsQmaxShort =
201 new TH1F("hRecPointsQmaxShort", "Qmax distrbution (short pads); Qmax; Counts",
203 fHistRecPointsQmaxShort->Sumw2();
204 Add2RecPointsList(fHistRecPointsQmaxShort, 0);
206 fHistRecPointsQmaxMedium =
207 new TH1F("hRecPointsQmaxMedium", "Qmax distrbution (medium pads); Qmax; Counts",
209 fHistRecPointsQmaxMedium->Sumw2();
210 Add2RecPointsList(fHistRecPointsQmaxMedium, 1);
212 fHistRecPointsQmaxLong =
213 new TH1F("hRecPointsQmaxLong", "Qmax distrbution (long pads); Qmax; Counts",
215 fHistRecPointsQmaxLong->Sumw2();
216 Add2RecPointsList(fHistRecPointsQmaxLong, 2);
218 fHistRecPointsQShort =
219 new TH1F("hRecPointsQShort", "Q distrbution (short pads); Q; Counts",
221 fHistRecPointsQShort->Sumw2();
222 Add2RecPointsList(fHistRecPointsQShort, 3);
224 fHistRecPointsQMedium =
225 new TH1F("hRecPointsQMedium", "Q distrbution (medium pads); Q; Counts",
227 fHistRecPointsQMedium->Sumw2();
228 Add2RecPointsList(fHistRecPointsQMedium, 4);
230 fHistRecPointsQLong =
231 new TH1F("hRecPointsQLong", "Q distrbution (long pads); Q; Counts",
233 fHistRecPointsQLong->Sumw2();
234 Add2RecPointsList(fHistRecPointsQLong, 5);
237 new TH1F("hRecPointsRow", "Clusters per row; Row; Counts",
239 fHistRecPointsRow->Sumw2();
240 Add2RecPointsList(fHistRecPointsRow, 6);
243 //____________________________________________________________________________
244 void AliTPCQADataMakerRec::MakeESDs(AliESDEvent * esd)
246 // make QA data from ESDs
248 const Int_t nESDTracks = esd->GetNumberOfTracks();
249 Int_t nTPCtracks = 0;
250 for(Int_t i = 0; i < nESDTracks; i++) {
252 AliESDtrack * track = esd->GetTrack(i);
254 if ((track->GetStatus() & AliESDtrack::kTPCrefit)==0)
259 Int_t nTPCclusters = track->GetTPCNcls();
260 Int_t nTPCclustersFindable = track->GetTPCNclsF();
262 fHistESDclusters->Fill(nTPCclusters);
263 fHistESDratio->Fill(Float_t(nTPCclusters)/Float_t(nTPCclustersFindable));
264 fHistESDpt->Fill(track->Pt());
268 //____________________________________________________________________________
269 void AliTPCQADataMakerRec::MakeRaws(AliRawReader* rawReader)
272 // To make QA for the RAW data we use the TPC Calibration framework
273 // to handle the data and then in the end extract the data
275 fTPCdataQA->ProcessEvent(rawReader);
278 //____________________________________________________________________________
279 void AliTPCQADataMakerRec::MakeRecPoints(TTree* recTree)
281 AliTPCClustersRow *clrow = new AliTPCClustersRow();
282 clrow->SetClass("AliTPCclusterMI");
284 clrow->GetArray()->ExpandCreateFast(10000);
286 TBranch* branch = recTree->GetBranch("Segment");
287 branch->SetAddress(&clrow);
289 const Int_t nEntries = Int_t(recTree->GetEntries());
290 for (Int_t i = 0; i < nEntries; i++) {
294 const Int_t nClusters = clrow->GetArray()->GetEntriesFast();
295 for (Int_t icl=0; icl < nClusters; icl++){
297 AliTPCclusterMI* cluster =
298 (AliTPCclusterMI*)clrow->GetArray()->At(icl);
300 Float_t Qmax = cluster->GetMax();
301 Float_t Q = cluster->GetQ();
302 Int_t row = cluster->GetRow();
304 if(cluster->GetDetector()<36) { // IROC (short pads)
306 fHistRecPointsQmaxShort->Fill(Qmax);
307 fHistRecPointsQShort->Fill(Q);
308 } else { // OROC (medium and long pads)
310 if(cluster->GetRow()<64) { // medium pads
312 fHistRecPointsQmaxMedium->Fill(Qmax);
313 fHistRecPointsQMedium->Fill(Q);
314 } else { // long pads
316 fHistRecPointsQmaxLong->Fill(Qmax);
317 fHistRecPointsQLong->Fill(Q);
321 fHistRecPointsRow->Fill(row);
322 } // end loop over clusters
323 } // end loop over tree