1 /**************************************************************************
2 * Copyright(c) 1998-1999, 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 **************************************************************************/
16 ///////////////////////////////////////////////////////////////////////
18 // Produces the data needed to calculate the TOF quality assurance. //
19 // QA objects are 1 & 2 Dimensional histograms. //
20 // author: S.Arcelli //
22 ///////////////////////////////////////////////////////////////////////
24 #include <TClonesArray.h>
29 #include "AliESDEvent.h"
30 #include "AliESDtrack.h"
31 #include "AliTOFcluster.h"
32 #include "AliTOFQADataMakerRec.h"
33 #include "AliQAChecker.h"
34 #include "AliRawReader.h"
35 #include "AliTOFRawStream.h"
36 #include "AliTOFrawData.h"
39 ClassImp(AliTOFQADataMakerRec)
41 //____________________________________________________________________________
42 AliTOFQADataMakerRec::AliTOFQADataMakerRec() :
43 AliQADataMakerRec(AliQA::GetDetName(AliQA::kTOF), "TOF Quality Assurance Data Maker")
50 //____________________________________________________________________________
51 AliTOFQADataMakerRec::AliTOFQADataMakerRec(const AliTOFQADataMakerRec& qadm) :
57 SetName((const char*)qadm.GetName()) ;
58 SetTitle((const char*)qadm.GetTitle());
61 //__________________________________________________________________
62 AliTOFQADataMakerRec& AliTOFQADataMakerRec::operator = (const AliTOFQADataMakerRec& qadm )
65 // assignment operator.
67 this->~AliTOFQADataMakerRec();
68 new(this) AliTOFQADataMakerRec(qadm);
72 //____________________________________________________________________________
73 void AliTOFQADataMakerRec::InitRaws()
76 // create Raws histograms in Raws subdir
78 TH1F * h0 = new TH1F("hTOFRaws", "Number of TOF Raws ",301, -1.02, 5.) ; h0->Sumw2() ;
81 TH1F * h1 = new TH1F("hTOFRawsTime", "Raws Time Spectrum in TOF (ns)", 2000, 0., 200) ;
85 TH1F * h2 = new TH1F("hTOFRawsToT", "Raws ToT Spectrum in TOF (ns)", 500, 0., 50) ;
89 TH2F * h3 = new TH2F("hTOFRawsClusMap","Raws vs TOF eta-phi",183, -0.5, 182.5,865,-0.5,864.5) ;
95 //____________________________________________________________________________
96 void AliTOFQADataMakerRec::InitRecPoints()
99 // create RecPoints histograms in RecPoints subdir
101 TH1F * h0 = new TH1F("hTOFRecPoints", "Number of TOF RecPoints ",301, -1.02, 5.) ; h0->Sumw2() ;
102 Add2RecPointsList(h0, 0) ;
104 TH1F * h1 = new TH1F("hTOFRecPointsTime", "RecPoints Time Spectrum in TOF (ns)", 2000, 0., 200) ;
106 Add2RecPointsList(h1, 1) ;
108 TH1F * h2 = new TH1F("hTOFRecPointsRawTime", "RecPoints raw Time Spectrum in TOF (ns)", 2000, 0., 200) ;
110 Add2RecPointsList(h2, 2) ;
112 TH1F * h3 = new TH1F("hTOFRecPointsToT", "RecPoints ToT Spectrum in TOF (ns)", 500, 0., 50) ;
114 Add2RecPointsList(h3, 3) ;
116 TH2F * h4 = new TH2F("hTOFRecPointsClusMap","RecPoints vs TOF eta-phi",183, -0.5, 182.5,865,-0.5,864.5) ;
118 Add2RecPointsList(h4, 4) ;
122 //____________________________________________________________________________
123 void AliTOFQADataMakerRec::InitESDs()
126 //create ESDs histograms in ESDs subdir
128 TH1F * h0 = new TH1F("hTOFESDs", "Number of matched TOF tracks over ESDs", 250, -1., 4.) ;
130 Add2ESDsList(h0, 0) ;
132 TH1F * h1 = new TH1F("hTOFESDsTime", "Time Spectrum in TOF (ns)", 2000, 0., 200) ;
134 Add2ESDsList(h1, 1) ;
136 TH1F * h2 = new TH1F("hTOFESDsRawTime", "raw Time Spectrum in TOF (ns)", 2000, 0., 200) ;
138 Add2ESDsList(h2, 2) ;
140 TH1F * h3 = new TH1F("hTOFESDsToT", "ToT Spectrum in TOF (ns)", 500, 0., 50) ;
142 Add2ESDsList(h3, 3) ;
144 TH1F * h4 = new TH1F("hTOFESDsPID", "Fraction of matched TOF tracks with good PID glag", 100, 0., 1.) ;
146 Add2ESDsList(h4, 4) ;
149 //____________________________________________________________________________
150 void AliTOFQADataMakerRec::MakeRaws(AliRawReader* rawReader)
153 // makes data from Raws
156 Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;
157 Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
164 TClonesArray * clonesRawData;
165 AliTOFRawStream tofInput(rawReader);
166 for (Int_t iDDL = 0; iDDL < AliTOFGeometry::NDDL()*AliTOFGeometry::NSectors(); iDDL++){
168 tofInput.LoadRawData(iDDL);
169 clonesRawData = (TClonesArray*)tofInput.GetRawData();
170 for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
171 AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
172 if (!tofRawDatum->GetTOT() || !tofRawDatum->GetTOF()) continue;
174 GetRawsData(1)->Fill( tofRawDatum->GetTOF()*tdc2ns) ;//in ns
175 GetRawsData(2)->Fill( tofRawDatum->GetTOT()*tot2ns) ;//in ns
177 tofInput.EquipmentId2VolumeId(iDDL,
178 tofRawDatum->GetTRM(),
179 tofRawDatum->GetTRMchain(),
180 tofRawDatum->GetTDC(),
181 tofRawDatum->GetTDCchannel(),
184 GetMapIndeces(in,out);
185 GetRawsData(3)->Fill( out[0],out[1]) ;//raw map
189 clonesRawData->Clear();
195 GetRawsData(0)->Fill(-1.) ;
197 GetRawsData(0)->Fill(TMath::Log10(nentries)) ;
201 //____________________________________________________________________________
202 void AliTOFQADataMakerRec::MakeRecPoints(TTree * clustersTree)
205 // Make data from Clusters
208 Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;
209 Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
214 TBranch *branch=clustersTree->GetBranch("TOF");
216 AliError("can't get the branch with the TOF clusters !");
220 TClonesArray dummy("AliTOFcluster",10000), *clusters=&dummy;
221 branch->SetAddress(&clusters);
224 clustersTree->GetEvent(0);
226 Int_t nentries=clusters->GetEntriesFast();
228 GetRecPointsData(0)->Fill(-1.) ;
230 GetRecPointsData(0)->Fill(TMath::Log10(nentries)) ;
233 TIter next(clusters) ;
235 while ( (c = dynamic_cast<AliTOFcluster *>(next())) ) {
236 GetRecPointsData(1)->Fill(c->GetTDC()*tdc2ns);
237 GetRecPointsData(2)->Fill(c->GetTDCRAW()*tdc2ns);
238 GetRecPointsData(3)->Fill(c->GetToT()*tot2ns);
240 in[0] = c->GetDetInd(0);
241 in[1] = c->GetDetInd(1);
242 in[2] = c->GetDetInd(2);
243 in[3] = c->GetDetInd(4); //X and Z indeces inverted in RecPoints
244 in[4] = c->GetDetInd(3); //X and Z indeces inverted in RecPoints
246 GetMapIndeces(in,out);
247 GetRecPointsData(4)->Fill(out[0],out[1]);
252 //____________________________________________________________________________
253 void AliTOFQADataMakerRec::MakeESDs(AliESDEvent * esd)
256 // make QA data from ESDs
258 Int_t ntrk = esd->GetNumberOfTracks() ;
262 AliESDtrack *track=esd->GetTrack(ntrk);
263 Double_t tofTime=track->GetTOFsignal()*1E-3;//in ns
264 Double_t tofTimeRaw=track->GetTOFsignalRaw()*1E-3;//in ns
265 Double_t tofToT=track->GetTOFsignalToT(); //in ns
266 if(!(tofTime>0))continue;
268 GetESDsData(1)->Fill(tofTime);
269 GetESDsData(2)->Fill(tofTimeRaw);
270 GetESDsData(3)->Fill(tofToT);
271 //check how many tracks where ESD PID is ok
272 UInt_t status=track->GetStatus();
273 if (((status&AliESDtrack::kESDpid)==0) ||
274 ((status&AliESDtrack::kTOFpid)==0)) continue;
280 GetESDsData(0)->Fill(-1.) ;
282 GetESDsData(0)->Fill(TMath::Log10(nentries)) ;
285 if(ntof>0)GetESDsData(4)->Fill(ntofpid/ntof) ;
289 //____________________________________________________________________________
290 void AliTOFQADataMakerRec::StartOfDetectorCycle()
293 //Detector specific actions at start of cycle
297 //____________________________________________________________________________
298 void AliTOFQADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX task, TObjArray * list)
300 //Detector specific actions at end of cycle
301 // do the QA checking
303 AliQAChecker::Instance()->Run(AliQA::kTOF, task, list) ;
305 //____________________________________________________________________________
306 void AliTOFQADataMakerRec::GetMapIndeces(Int_t* in , Int_t* out)
309 //return appropriate indeces for the theta-phi map
312 Int_t npadX = AliTOFGeometry::NpadX();
313 Int_t npadZ = AliTOFGeometry::NpadZ();
314 Int_t nStripA = AliTOFGeometry::NStripA();
315 Int_t nStripB = AliTOFGeometry::NStripB();
316 Int_t nStripC = AliTOFGeometry::NStripC();
318 Int_t isector = in[0];
319 Int_t iplate = in[1];
320 Int_t istrip = in[2];
324 Int_t stripOffset = 0;
330 stripOffset = nStripC;
333 stripOffset = nStripC+nStripB;
336 stripOffset = nStripC+nStripB+nStripA;
339 stripOffset = nStripC+nStripB+nStripA+nStripB;
342 AliError(Form("Wrong plate number in TOF (%d) !",iplate));
345 Int_t zindex=npadZ*(istrip+stripOffset)+(ipadZ+1);
346 Int_t phiindex=npadX*isector+ipadX+1;