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>
34 #include "AliTOFdigit.h"
35 #include "AliTOFSDigit.h"
36 #include "AliTOFhitT0.h"
37 #include "AliTOFQADataMakerSim.h"
38 #include "AliQAChecker.h"
39 #include "AliTOFGeometry.h"
42 ClassImp(AliTOFQADataMakerSim)
44 //____________________________________________________________________________
45 AliTOFQADataMakerSim::AliTOFQADataMakerSim() :
46 AliQADataMakerSim(AliQAv1::GetDetName(AliQAv1::kTOF), "TOF Quality Assurance Data Maker")
53 //____________________________________________________________________________
54 AliTOFQADataMakerSim::AliTOFQADataMakerSim(const AliTOFQADataMakerSim& qadm) :
60 SetName((const char*)qadm.GetName()) ;
61 SetTitle((const char*)qadm.GetTitle());
64 //__________________________________________________________________
65 AliTOFQADataMakerSim& AliTOFQADataMakerSim::operator = (const AliTOFQADataMakerSim& qadm )
68 // assignment operator.
70 this->~AliTOFQADataMakerSim();
71 new(this) AliTOFQADataMakerSim(qadm);
75 //____________________________________________________________________________
76 void AliTOFQADataMakerSim::InitHits()
79 // create Hits histograms in Hits subdir
82 const Bool_t expert = kTRUE ;
83 const Bool_t image = kTRUE ;
85 TH1F * h0 = new TH1F("hTOFHits", "Number of TOF Hits per event;TOF hit number;Counts ",101, -1., 100.) ;
87 Add2HitsList(h0, 0, !expert, image) ;
89 TH1F * h1 = new TH1F("hTOFHitsTime", "Hits Time Spectrum in TOF (ns);Simulated TOF time [ns];Counts", 25000, 0., 610.) ;
91 Add2HitsList(h1, 1, !expert, image) ;
93 TH1F * h2 = new TH1F("hTOFHitsLength", "Length Spectrum in TOF (cm);Track length from primary vertex till hit TOF pad [cm];Counts", 700, 0., 700) ;
95 Add2HitsList(h2, 2, !expert, image) ;
97 TH2F * h3 = new TH2F("hTOFHitsClusMap","Hits vs TOF eta-phi;2*strip+padz (eta);48*sector+padx (phi)",183, -0.5, 182.5,865,-0.5,864.5) ;
99 h3->GetYaxis()->SetTitleOffset(1.15);
100 Add2HitsList(h3, 3, !expert, image) ;
102 ClonePerTrigClass(AliQAv1::kHITS); // this should be the last line
105 //____________________________________________________________________________
106 void AliTOFQADataMakerSim::InitDigits()
109 // create Digits histograms in Digits subdir
112 const Bool_t expert = kTRUE ;
113 const Bool_t image = kTRUE ;
115 TH1F * h0 = new TH1F("hTOFDigits", "Number of TOF Digit per event;TOF digit number;Counts ",101, -1., 100.) ;
117 Add2DigitsList(h0, 0, !expert, image) ;
119 TH1F * h1 = new TH1F("hTOFDigitsTime", "Digits Time Spectrum in TOF (ns);Digitized TOF time [ns];Counts", 25000, 0., 610.) ;
121 Add2DigitsList(h1, 1, !expert, image) ;
123 TH1F * h2 = new TH1F("hTOFDigitsToT", "Digits ToT Spectrum in TOF (ns);Digitized ToT time [ns];Counts", 1000, 0., 48.8) ;
125 Add2DigitsList(h2, 2, !expert, image) ;
127 TH2F * h3 = new TH2F("hTOFDigitsClusMap","Digits vs TOF eta-phi;2*strip+padz (eta);48*sector+padx (phi)",183, -0.5, 182.5,865,-0.5,864.5) ;
129 h3->GetYaxis()->SetTitleOffset(1.15);
130 Add2DigitsList(h3, 3, !expert, image) ;
132 ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
135 //____________________________________________________________________________
136 void AliTOFQADataMakerSim::InitSDigits()
139 // create SDigits histograms in SDigits subdir
142 const Bool_t expert = kTRUE ;
143 const Bool_t image = kTRUE ;
145 TH1F * h0 = new TH1F("hTOFSDigits", "Number of TOF SDigits per event;TOF sdigit number;Counts ",101, -1., 100.) ;
147 Add2SDigitsList(h0, 0, !expert, image) ;
149 TH1F * h1 = new TH1F("hTOFSDigitsTime", "SDigits Time Spectrum in TOF (ns);SDigitized TOF time [ns];Counts", 25000, 0., 610) ;
151 Add2SDigitsList(h1, 1, !expert, image) ;
153 TH2F * h2 = new TH2F("hTOFSDigitsClusMap","SDigits vs TOF eta-phi;2*strip+padz (eta);48*sector+padx (phi)",183, -0.5, 182.5,865,-0.5,864.5) ;
155 h2->GetYaxis()->SetTitleOffset(1.15);
156 Add2SDigitsList(h2, 2, !expert, image) ;
158 ClonePerTrigClass(AliQAv1::kSDIGITS); // this should be the last line
161 //____________________________________________________________________________
162 void AliTOFQADataMakerSim::MakeHits()
165 //make QA data from Hits
171 Int_t nentries= fHitsArray->GetEntriesFast();
173 FillHitsData(0,-1.) ;
175 FillHitsData(0,nentries) ;
177 TIter next(fHitsArray) ;
179 while ( (hit = dynamic_cast<AliTOFhitT0 *>(next())) ) {
181 FillHitsData(1, hit->GetTof()*1.E9) ;//in ns
182 FillHitsData(2, hit->GetLen()) ;//in cm
184 in[0] = hit->GetSector();
185 in[1] = hit->GetPlate();
186 in[2]= hit->GetStrip();
187 in[3]= hit->GetPadx();
188 in[4]= hit->GetPadz();
189 GetMapIndeces(in,out);
190 FillHitsData(3, out[0],out[1]) ;//hit map
195 //____________________________________________________________________________
196 void AliTOFQADataMakerSim::MakeHits(TTree * hitTree)
199 // make QA data from Hit Tree
202 AliError("can't get the tree with TOF hits !");
206 TBranch * branch = hitTree->GetBranch("TOF") ;
209 AliError("TOF branch in Hit Tree not found") ;
214 fHitsArray->Clear() ;
216 fHitsArray = new TClonesArray("AliTOFhitT0", 1000) ;
218 branch->SetAddress(&fHitsArray);
219 for (Int_t ientry = 0 ; ientry < branch->GetEntries() ; ientry++) {
220 branch->GetEntry(ientry) ;
222 fHitsArray->Clear() ;
225 IncEvCountCycleHits();
226 IncEvCountTotalHits();
230 //____________________________________________________________________________
231 void AliTOFQADataMakerSim::MakeDigits()
234 // makes data from Digits
237 Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;
238 Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
242 Int_t nentries=fDigitsArray->GetEntriesFast();
244 FillDigitsData(0,-1.) ;
246 FillDigitsData(0,nentries) ;
249 TIter next(fDigitsArray) ;
250 AliTOFdigit * digit ;
251 while ( (digit = dynamic_cast<AliTOFdigit *>(next())) ) {
253 FillDigitsData(1, digit->GetTdc()*tdc2ns) ;//in ns
254 FillDigitsData(2, digit->GetToT()*tot2ns) ;//in ns
256 in[0] = digit->GetSector();
257 in[1] = digit->GetPlate();
258 in[2] = digit->GetStrip();
259 in[3] = digit->GetPadx();
260 in[4]= digit->GetPadz();
261 GetMapIndeces(in,out);
262 FillDigitsData(3, out[0],out[1]) ;//digit map
268 //____________________________________________________________________________
269 void AliTOFQADataMakerSim::MakeDigits(TTree * digitTree)
272 // makes data from Digit Tree
275 fDigitsArray->Clear() ;
277 fDigitsArray = new TClonesArray("AliTOFdigit", 1000) ;
279 TBranch * branch = digitTree->GetBranch("TOF") ;
281 AliError("TOF branch in Digit Tree not found") ;
284 branch->SetAddress(&fDigitsArray);
288 IncEvCountCycleDigits();
289 IncEvCountTotalDigits();
293 //____________________________________________________________________________
294 void AliTOFQADataMakerSim::MakeSDigits()
297 // makes data from SDigits
300 Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;
304 Int_t nentries=fSDigitsArray->GetEntriesFast();
306 FillSDigitsData(0,-1.) ;
308 FillSDigitsData(0,nentries) ;
311 TIter next(fSDigitsArray) ;
312 AliTOFSDigit * sdigit ;
313 while ( (sdigit = dynamic_cast<AliTOFSDigit *>(next())) ) {
315 for(Int_t i=0;i<sdigit->GetNDigits();i++){
316 FillSDigitsData(1, sdigit->GetTdc(i)*tdc2ns) ;//in ns
319 in[0] = sdigit->GetSector();
320 in[1] = sdigit->GetPlate();
321 in[2] = sdigit->GetStrip();
322 in[3] = sdigit->GetPadx();
323 in[4]= sdigit->GetPadz();
324 GetMapIndeces(in,out);
325 FillSDigitsData(2, out[0],out[1]) ;//sdigit map
329 //____________________________________________________________________________
330 void AliTOFQADataMakerSim::MakeSDigits(TTree * sdigitTree)
333 // makes data from SDigit Tree
336 fSDigitsArray->Clear() ;
338 fSDigitsArray = new TClonesArray("AliTOFSDigit", 1000) ;
340 TBranch * branch = sdigitTree->GetBranch("TOF") ;
342 AliError("TOF branch in SDigit Tree not found") ;
345 branch->SetAddress(&fSDigitsArray);
349 IncEvCountCycleSDigits();
350 IncEvCountTotalSDigits();
354 //____________________________________________________________________________
355 void AliTOFQADataMakerSim::StartOfDetectorCycle()
358 //Detector specific actions at start of cycle
362 //____________________________________________________________________________
363 void AliTOFQADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
365 //Detector specific actions at end of cycle
366 // do the QA checking
367 ResetEventTrigClasses();
368 AliQAChecker::Instance()->Run(AliQAv1::kTOF, task, list) ;
370 //____________________________________________________________________________
371 void AliTOFQADataMakerSim::GetMapIndeces(Int_t* in , Int_t* out)
374 //return appropriate indeces for the theta-phi map
377 Int_t npadX = AliTOFGeometry::NpadX();
378 Int_t npadZ = AliTOFGeometry::NpadZ();
379 Int_t nStripA = AliTOFGeometry::NStripA();
380 Int_t nStripB = AliTOFGeometry::NStripB();
381 Int_t nStripC = AliTOFGeometry::NStripC();
383 Int_t isector = in[0];
384 Int_t iplate = in[1];
385 Int_t istrip = in[2];
389 Int_t stripOffset = 0;
395 stripOffset = nStripC;
398 stripOffset = nStripC+nStripB;
401 stripOffset = nStripC+nStripB+nStripA;
404 stripOffset = nStripC+nStripB+nStripA+nStripB;
407 AliError(Form("Wrong plate number in TOF (%d) !",iplate));
410 Int_t zindex=npadZ*(istrip+stripOffset)+(ipadZ+1);
411 Int_t phiindex=npadX*isector+ipadX+1;