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;TOF hit number [10 power];Counts ",301, -1.02, 5.) ;
87 Add2HitsList(h0, 0, !expert, image) ;
89 TH1F * h1 = new TH1F("hTOFHitsTime", "Hits Time Spectrum in TOF (ns);Simulated TOF time [ns];Counts", 2000, 0., 200) ;
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", 500, 0., 500) ;
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) ;
103 //____________________________________________________________________________
104 void AliTOFQADataMakerSim::InitDigits()
107 // create Digits histograms in Digits subdir
110 const Bool_t expert = kTRUE ;
111 const Bool_t image = kTRUE ;
113 TH1F * h0 = new TH1F("hTOFDigits", "Number of TOF Digit;TOF digit number [10 power];Counts ",301, -1.02, 5.) ;
115 Add2DigitsList(h0, 0, !expert, image) ;
117 TH1F * h1 = new TH1F("hTOFDigitsTime", "Digits Time Spectrum in TOF (ns);Digitized TOF time [ns];Counts", 2000, 0., 200) ;
119 Add2DigitsList(h1, 1, !expert, image) ;
121 TH1F * h2 = new TH1F("hTOFDigitsToT", "Digits ToT Spectrum in TOF (ns);Digitized TOF time [ns];Counts", 500, 0., 50) ;
123 Add2DigitsList(h2, 2, !expert, image) ;
125 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) ;
127 h3->GetYaxis()->SetTitleOffset(1.15);
128 Add2DigitsList(h3, 3, !expert, image) ;
132 //____________________________________________________________________________
133 void AliTOFQADataMakerSim::InitSDigits()
136 // create SDigits histograms in SDigits subdir
139 const Bool_t expert = kTRUE ;
140 const Bool_t image = kTRUE ;
142 TH1F * h0 = new TH1F("hTOFSDigits", "Number of TOF SDigits;TOF sdigit number [10 power];Counts ",301, -1.02, 5.) ;
144 Add2SDigitsList(h0, 0, !expert, image) ;
146 TH1F * h1 = new TH1F("hTOFSDigitsTime", "SDigits Time Spectrum in TOF (ns);SDigitized TOF time [ns];Counts", 2000, 0., 200) ;
148 Add2SDigitsList(h1, 1, !expert, image) ;
150 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) ;
152 h2->GetYaxis()->SetTitleOffset(1.15);
153 Add2SDigitsList(h2, 2, !expert, image) ;
157 //____________________________________________________________________________
158 void AliTOFQADataMakerSim::MakeHits(TClonesArray * hits)
161 //make QA data from Hits
164 // Check id histograms already created for this Event Specie
165 if ( ! GetHitsData(0) )
171 Int_t nentries=hits->GetEntriesFast();
173 GetHitsData(0)->Fill(-1.) ;
175 GetHitsData(0)->Fill(TMath::Log10(nentries)) ;
179 while ( (hit = dynamic_cast<AliTOFhitT0 *>(next())) ) {
181 GetHitsData(1)->Fill( hit->GetTof()*1.E9) ;//in ns
182 GetHitsData(2)->Fill( 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 GetHitsData(3)->Fill( out[0],out[1]) ;//hit map
196 //____________________________________________________________________________
197 void AliTOFQADataMakerSim::MakeHits(TTree * hitTree)
200 // make QA data from Hit Tree
203 AliError("can't get the tree with TOF hits !");
207 TBranch * branch = hitTree->GetBranch("TOF") ;
210 AliError("TOF branch in Hit Tree not found") ;
214 static TClonesArray statichits("AliTOFhitT0", 1000);
216 TClonesArray *hits = &statichits;
217 static TClonesArray staticdummy("AliTOFhitT0", 1000);
219 TClonesArray *dummy = &staticdummy;
220 branch->SetAddress(&dummy);
222 for (Int_t ientry = 0 ; ientry < branch->GetEntries() ; ientry++) {
223 branch->GetEntry(ientry) ;
224 for (Int_t ihit = 0 ; ihit < dummy->GetEntries() ; ihit++) {
225 AliTOFhitT0 * hit = dynamic_cast<AliTOFhitT0 *> (dummy->At(ihit)) ;
226 new((*hits)[index]) AliTOFhitT0(*hit) ;
235 //____________________________________________________________________________
236 void AliTOFQADataMakerSim::MakeDigits(TClonesArray * digits)
239 // makes data from Digits
242 // Check id histograms already created for this Event Specie
243 if ( ! GetDigitsData(0) )
246 Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;
247 Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
251 Int_t nentries=digits->GetEntriesFast();
253 GetDigitsData(0)->Fill(-1.) ;
255 GetDigitsData(0)->Fill(TMath::Log10(nentries)) ;
259 AliTOFdigit * digit ;
260 while ( (digit = dynamic_cast<AliTOFdigit *>(next())) ) {
262 GetDigitsData(1)->Fill( digit->GetTdc()*tdc2ns) ;//in ns
263 GetDigitsData(2)->Fill( digit->GetToT()*tot2ns) ;//in ns
265 in[0] = digit->GetSector();
266 in[1] = digit->GetPlate();
267 in[2] = digit->GetStrip();
268 in[3] = digit->GetPadx();
269 in[4]= digit->GetPadz();
270 GetMapIndeces(in,out);
271 GetDigitsData(3)->Fill( out[0],out[1]) ;//digit map
277 //____________________________________________________________________________
278 void AliTOFQADataMakerSim::MakeDigits(TTree * digitTree)
281 // makes data from Digit Tree
283 TClonesArray * digits = new TClonesArray("AliTOFdigit", 1000) ;
285 TBranch * branch = digitTree->GetBranch("TOF") ;
287 AliError("TOF branch in Digit Tree not found") ;
290 branch->SetAddress(&digits) ;
291 branch->GetEntry(0) ;
295 //____________________________________________________________________________
296 void AliTOFQADataMakerSim::MakeSDigits(TClonesArray * sdigits)
299 // makes data from SDigits
302 // Check id histograms already created for this Event Specie
303 if ( ! GetSDigitsData(0) )
306 Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;
310 Int_t nentries=sdigits->GetEntriesFast();
312 GetSDigitsData(0)->Fill(-1.) ;
314 GetSDigitsData(0)->Fill(TMath::Log10(nentries)) ;
317 TIter next(sdigits) ;
318 AliTOFSDigit * sdigit ;
319 while ( (sdigit = dynamic_cast<AliTOFSDigit *>(next())) ) {
321 for(Int_t i=0;i<sdigit->GetNDigits();i++){
322 GetSDigitsData(1)->Fill( sdigit->GetTdc(i)*tdc2ns) ;//in ns
325 in[0] = sdigit->GetSector();
326 in[1] = sdigit->GetPlate();
327 in[2] = sdigit->GetStrip();
328 in[3] = sdigit->GetPadx();
329 in[4]= sdigit->GetPadz();
330 GetMapIndeces(in,out);
331 GetSDigitsData(2)->Fill( out[0],out[1]) ;//sdigit map
335 //____________________________________________________________________________
336 void AliTOFQADataMakerSim::MakeSDigits(TTree * sdigitTree)
339 // makes data from SDigit Tree
341 TClonesArray * sdigits = new TClonesArray("AliTOFSDigit", 1000) ;
343 TBranch * branch = sdigitTree->GetBranch("TOF") ;
345 AliError("TOF branch in SDigit Tree not found") ;
348 branch->SetAddress(&sdigits) ;
349 branch->GetEntry(0) ;
350 MakeSDigits(sdigits) ;
353 //____________________________________________________________________________
354 void AliTOFQADataMakerSim::StartOfDetectorCycle()
357 //Detector specific actions at start of cycle
361 //____________________________________________________________________________
362 void AliTOFQADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
364 //Detector specific actions at end of cycle
365 // do the QA checking
367 AliQAChecker::Instance()->Run(AliQAv1::kTOF, task, list) ;
369 //____________________________________________________________________________
370 void AliTOFQADataMakerSim::GetMapIndeces(Int_t* in , Int_t* out)
373 //return appropriate indeces for the theta-phi map
376 Int_t npadX = AliTOFGeometry::NpadX();
377 Int_t npadZ = AliTOFGeometry::NpadZ();
378 Int_t nStripA = AliTOFGeometry::NStripA();
379 Int_t nStripB = AliTOFGeometry::NStripB();
380 Int_t nStripC = AliTOFGeometry::NStripC();
382 Int_t isector = in[0];
383 Int_t iplate = in[1];
384 Int_t istrip = in[2];
388 Int_t stripOffset = 0;
394 stripOffset = nStripC;
397 stripOffset = nStripC+nStripB;
400 stripOffset = nStripC+nStripB+nStripA;
403 stripOffset = nStripC+nStripB+nStripA+nStripB;
406 AliError(Form("Wrong plate number in TOF (%d) !",iplate));
409 Int_t zindex=npadZ*(istrip+stripOffset)+(ipadZ+1);
410 Int_t phiindex=npadX*isector+ipadX+1;