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(AliQA::GetDetName(AliQA::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 Bool_t expert = kFALSE;
84 TH1F * h0 = new TH1F("hTOFHits", "Number of TOF Hits ",301, -1.02, 5.) ;
86 Add2HitsList(h0, 0, expert) ;
88 TH1F * h1 = new TH1F("hTOFHitsTime", "Hits Time Spectrum in TOF (ns)", 2000, 0., 200) ;
90 Add2HitsList(h1, 1, expert) ;
92 TH1F * h2 = new TH1F("hTOFHitsLength", "Length Spectrum in TOF (cm)", 500, 0., 500) ;
94 Add2HitsList(h2, 2, expert) ;
96 TH2F * h3 = new TH2F("hTOFHitsClusMap","Hits vs TOF eta-phi",183, -0.5, 182.5,865,-0.5,864.5) ;
98 Add2HitsList(h3, 3, expert) ;
101 //____________________________________________________________________________
102 void AliTOFQADataMakerSim::InitDigits()
105 // create Digits histograms in Digits subdir
108 Bool_t expert = kFALSE;
110 TH1F * h0 = new TH1F("hTOFDigits", "Number of TOF Digits ",301, -1.02, 5.) ; h0->Sumw2() ;
111 Add2DigitsList(h0, 0, expert) ;
113 TH1F * h1 = new TH1F("hTOFDigitsTime", "Digits Time Spectrum in TOF (ns)", 2000, 0., 200) ;
115 Add2DigitsList(h1, 1, expert) ;
117 TH1F * h2 = new TH1F("hTOFDigitsToT", "Digits ToT Spectrum in TOF (ns)", 500, 0., 50) ;
119 Add2DigitsList(h2, 2, expert) ;
121 TH2F * h3 = new TH2F("hTOFDigitsClusMap","Digits vs TOF eta-phi",183, -0.5, 182.5,865,-0.5,864.5) ;
123 Add2DigitsList(h3, 3, expert) ;
127 //____________________________________________________________________________
128 void AliTOFQADataMakerSim::InitSDigits()
131 // create SDigits histograms in SDigits subdir
134 Bool_t expert = kFALSE;
136 TH1F * h0 = new TH1F("hTOFSDigits", "Number of TOF SDigits ",301, -1.02, 5.) ; h0->Sumw2() ;
137 Add2SDigitsList(h0, 0, expert) ;
139 TH1F * h1 = new TH1F("hTOFSDigitsTime", "SDigits Time Spectrum in TOF (ns)", 2000, 0., 200) ;
141 Add2SDigitsList(h1, 1, expert) ;
143 TH2F * h2 = new TH2F("hTOFSDigitsClusMap","SDigits vs TOF eta-phi",183, -0.5, 182.5,865,-0.5,864.5) ;
145 Add2SDigitsList(h2, 2, expert) ;
149 //____________________________________________________________________________
150 void AliTOFQADataMakerSim::MakeHits(TClonesArray * hits)
153 //make QA data from Hits
159 Int_t nentries=hits->GetEntriesFast();
161 GetHitsData(0)->Fill(-1.) ;
163 GetHitsData(0)->Fill(TMath::Log10(nentries)) ;
167 while ( (hit = dynamic_cast<AliTOFhitT0 *>(next())) ) {
169 GetHitsData(1)->Fill( hit->GetTof()*1.E9) ;//in ns
170 GetHitsData(2)->Fill( hit->GetLen()) ;//in cm
172 in[0] = hit->GetSector();
173 in[1] = hit->GetPlate();
174 in[2]= hit->GetStrip();
175 in[3]= hit->GetPadx();
176 in[4]= hit->GetPadz();
177 GetMapIndeces(in,out);
178 GetHitsData(3)->Fill( out[0],out[1]) ;//hit map
184 //____________________________________________________________________________
185 void AliTOFQADataMakerSim::MakeHits(TTree * hitTree)
188 // make QA data from Hit Tree
191 AliError("can't get the tree with TOF hits !");
195 TBranch * branch = hitTree->GetBranch("TOF") ;
198 AliError("TOF branch in Hit Tree not found") ;
202 static TClonesArray statichits("AliTOFhitT0", 1000);
204 TClonesArray *hits = &statichits;
205 static TClonesArray staticdummy("AliTOFhitT0", 1000);
207 TClonesArray *dummy = &staticdummy;
208 branch->SetAddress(&dummy);
210 for (Int_t ientry = 0 ; ientry < branch->GetEntries() ; ientry++) {
211 branch->GetEntry(ientry) ;
212 for (Int_t ihit = 0 ; ihit < dummy->GetEntries() ; ihit++) {
213 AliTOFhitT0 * hit = dynamic_cast<AliTOFhitT0 *> (dummy->At(ihit)) ;
214 new((*hits)[index]) AliTOFhitT0(*hit) ;
223 //____________________________________________________________________________
224 void AliTOFQADataMakerSim::MakeDigits(TClonesArray * digits)
227 // makes data from Digits
229 Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;
230 Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
234 Int_t nentries=digits->GetEntriesFast();
236 GetDigitsData(0)->Fill(-1.) ;
238 GetDigitsData(0)->Fill(TMath::Log10(nentries)) ;
242 AliTOFdigit * digit ;
243 while ( (digit = dynamic_cast<AliTOFdigit *>(next())) ) {
245 GetDigitsData(1)->Fill( digit->GetTdc()*tdc2ns) ;//in ns
246 GetDigitsData(2)->Fill( digit->GetToT()*tot2ns) ;//in ns
248 in[0] = digit->GetSector();
249 in[1] = digit->GetPlate();
250 in[2] = digit->GetStrip();
251 in[3] = digit->GetPadx();
252 in[4]= digit->GetPadz();
253 GetMapIndeces(in,out);
254 GetDigitsData(3)->Fill( out[0],out[1]) ;//digit map
260 //____________________________________________________________________________
261 void AliTOFQADataMakerSim::MakeDigits(TTree * digitTree)
264 // makes data from Digit Tree
266 TClonesArray * digits = new TClonesArray("AliTOFdigit", 1000) ;
268 TBranch * branch = digitTree->GetBranch("TOF") ;
270 AliError("TOF branch in Digit Tree not found") ;
273 branch->SetAddress(&digits) ;
274 branch->GetEntry(0) ;
278 //____________________________________________________________________________
279 void AliTOFQADataMakerSim::MakeSDigits(TClonesArray * sdigits)
282 // makes data from SDigits
285 Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;
289 Int_t nentries=sdigits->GetEntriesFast();
291 GetSDigitsData(0)->Fill(-1.) ;
293 GetSDigitsData(0)->Fill(TMath::Log10(nentries)) ;
296 TIter next(sdigits) ;
297 AliTOFSDigit * sdigit ;
298 while ( (sdigit = dynamic_cast<AliTOFSDigit *>(next())) ) {
300 for(Int_t i=0;i<sdigit->GetNDigits();i++){
301 GetSDigitsData(1)->Fill( sdigit->GetTdc(i)*tdc2ns) ;//in ns
304 in[0] = sdigit->GetSector();
305 in[1] = sdigit->GetPlate();
306 in[2] = sdigit->GetStrip();
307 in[3] = sdigit->GetPadx();
308 in[4]= sdigit->GetPadz();
309 GetMapIndeces(in,out);
310 GetSDigitsData(2)->Fill( out[0],out[1]) ;//sdigit map
314 //____________________________________________________________________________
315 void AliTOFQADataMakerSim::MakeSDigits(TTree * sdigitTree)
318 // makes data from SDigit Tree
320 TClonesArray * sdigits = new TClonesArray("AliTOFSDigit", 1000) ;
322 TBranch * branch = sdigitTree->GetBranch("TOF") ;
324 AliError("TOF branch in SDigit Tree not found") ;
327 branch->SetAddress(&sdigits) ;
328 branch->GetEntry(0) ;
329 MakeSDigits(sdigits) ;
332 //____________________________________________________________________________
333 void AliTOFQADataMakerSim::StartOfDetectorCycle()
336 //Detector specific actions at start of cycle
340 //____________________________________________________________________________
341 void AliTOFQADataMakerSim::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray ** list)
343 //Detector specific actions at end of cycle
344 // do the QA checking
346 AliQAChecker::Instance()->Run(AliQA::kTOF, task, list) ;
348 //____________________________________________________________________________
349 void AliTOFQADataMakerSim::GetMapIndeces(Int_t* in , Int_t* out)
352 //return appropriate indeces for the theta-phi map
355 Int_t npadX = AliTOFGeometry::NpadX();
356 Int_t npadZ = AliTOFGeometry::NpadZ();
357 Int_t nStripA = AliTOFGeometry::NStripA();
358 Int_t nStripB = AliTOFGeometry::NStripB();
359 Int_t nStripC = AliTOFGeometry::NStripC();
361 Int_t isector = in[0];
362 Int_t iplate = in[1];
363 Int_t istrip = in[2];
367 Int_t stripOffset = 0;
373 stripOffset = nStripC;
376 stripOffset = nStripC+nStripB;
379 stripOffset = nStripC+nStripB+nStripA;
382 stripOffset = nStripC+nStripB+nStripA+nStripB;
385 AliError(Form("Wrong plate number in TOF (%d) !",iplate));
388 Int_t zindex=npadZ*(istrip+stripOffset)+(ipadZ+1);
389 Int_t phiindex=npadX*isector+ipadX+1;