Line data Source code
1 : /**************************************************************************
2 : * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 : * *
4 : * Author: The ALICE Off-line Project. *
5 : * Contributors are mentioned in the code where appropriate. *
6 : * *
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 : **************************************************************************/
15 :
16 : ///////////////////////////////////////////////////////////////////////
17 : // //
18 : // Produces the data needed to calculate the TOF quality assurance. //
19 : // QA objects are 1 & 2 Dimensional histograms. //
20 : // author: S.Arcelli //
21 : // //
22 : ///////////////////////////////////////////////////////////////////////
23 :
24 : #include <TClonesArray.h>
25 : //#include <TFile.h>
26 : //#include <TH1I.h>
27 : #include <TH1F.h>
28 : #include <TH2F.h>
29 : #include <TTree.h>
30 : #include <TMath.h>
31 :
32 : #include "AliLog.h"
33 :
34 : #include "AliTOFdigit.h"
35 : #include "AliTOFSDigit.h"
36 : #include "AliTOFhitT0.h"
37 : #include "AliTOFQADataMakerSim.h"
38 : #include "AliQAChecker.h"
39 : #include "AliTOFGeometry.h"
40 :
41 :
42 26 : ClassImp(AliTOFQADataMakerSim)
43 :
44 : //____________________________________________________________________________
45 : AliTOFQADataMakerSim::AliTOFQADataMakerSim() :
46 3 : AliQADataMakerSim(AliQAv1::GetDetName(AliQAv1::kTOF), "TOF Quality Assurance Data Maker")
47 5 : {
48 : //
49 : // ctor
50 : //
51 2 : }
52 :
53 : //____________________________________________________________________________
54 : AliTOFQADataMakerSim::AliTOFQADataMakerSim(const AliTOFQADataMakerSim& qadm) :
55 0 : AliQADataMakerSim()
56 0 : {
57 : //
58 : //copy ctor
59 : //
60 0 : SetName((const char*)qadm.GetName()) ;
61 0 : SetTitle((const char*)qadm.GetTitle());
62 0 : }
63 :
64 : //__________________________________________________________________
65 : AliTOFQADataMakerSim& AliTOFQADataMakerSim::operator = (const AliTOFQADataMakerSim& qadm )
66 : {
67 : //
68 : // assignment operator.
69 : //
70 0 : this->~AliTOFQADataMakerSim();
71 0 : new(this) AliTOFQADataMakerSim(qadm);
72 0 : return *this;
73 0 : }
74 :
75 : //____________________________________________________________________________
76 : void AliTOFQADataMakerSim::InitHits()
77 : {
78 : //
79 : // create Hits histograms in Hits subdir
80 : //
81 :
82 : const Bool_t expert = kTRUE ;
83 : const Bool_t image = kTRUE ;
84 :
85 2 : TH1F * h0 = new TH1F("hTOFHits", "Number of TOF Hits per event;TOF hit number;Counts ",101, -1., 100.) ;
86 1 : h0->Sumw2() ;
87 1 : Add2HitsList(h0, 0, !expert, image) ;
88 :
89 1 : TH1F * h1 = new TH1F("hTOFHitsTime", "Hits Time Spectrum in TOF (ns);Simulated TOF time [ns];Counts", 25000, 0., 610.) ;
90 1 : h1->Sumw2() ;
91 1 : Add2HitsList(h1, 1, !expert, image) ;
92 :
93 1 : TH1F * h2 = new TH1F("hTOFHitsLength", "Length Spectrum in TOF (cm);Track length from primary vertex till hit TOF pad [cm];Counts", 700, 0., 700) ;
94 1 : h2->Sumw2() ;
95 1 : Add2HitsList(h2, 2, !expert, image) ;
96 :
97 1 : 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) ;
98 1 : h3->Sumw2() ;
99 1 : h3->GetYaxis()->SetTitleOffset(1.15);
100 1 : Add2HitsList(h3, 3, !expert, image) ;
101 : //
102 1 : ClonePerTrigClass(AliQAv1::kHITS); // this should be the last line
103 1 : }
104 :
105 : //____________________________________________________________________________
106 : void AliTOFQADataMakerSim::InitDigits()
107 : {
108 : //
109 : // create Digits histograms in Digits subdir
110 : //
111 :
112 : const Bool_t expert = kTRUE ;
113 : const Bool_t image = kTRUE ;
114 :
115 2 : TH1F * h0 = new TH1F("hTOFDigits", "Number of TOF Digit per event;TOF digit number;Counts ",101, -1., 100.) ;
116 1 : h0->Sumw2() ;
117 1 : Add2DigitsList(h0, 0, !expert, image) ;
118 :
119 1 : TH1F * h1 = new TH1F("hTOFDigitsTime", "Digits Time Spectrum in TOF (ns);Digitized TOF time [ns];Counts", 25000, 0., 610.) ;
120 1 : h1->Sumw2() ;
121 1 : Add2DigitsList(h1, 1, !expert, image) ;
122 :
123 1 : TH1F * h2 = new TH1F("hTOFDigitsToT", "Digits ToT Spectrum in TOF (ns);Digitized ToT time [ns];Counts", 1000, 0., 48.8) ;
124 1 : h2->Sumw2() ;
125 1 : Add2DigitsList(h2, 2, !expert, image) ;
126 :
127 1 : 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) ;
128 1 : h3->Sumw2() ;
129 1 : h3->GetYaxis()->SetTitleOffset(1.15);
130 1 : Add2DigitsList(h3, 3, !expert, image) ;
131 : //
132 1 : ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
133 1 : }
134 :
135 : //____________________________________________________________________________
136 : void AliTOFQADataMakerSim::InitSDigits()
137 : {
138 : //
139 : // create SDigits histograms in SDigits subdir
140 : //
141 :
142 : const Bool_t expert = kTRUE ;
143 : const Bool_t image = kTRUE ;
144 :
145 2 : TH1F * h0 = new TH1F("hTOFSDigits", "Number of TOF SDigits per event;TOF sdigit number;Counts ",101, -1., 100.) ;
146 1 : h0->Sumw2() ;
147 1 : Add2SDigitsList(h0, 0, !expert, image) ;
148 :
149 1 : TH1F * h1 = new TH1F("hTOFSDigitsTime", "SDigits Time Spectrum in TOF (ns);SDigitized TOF time [ns];Counts", 25000, 0., 610) ;
150 1 : h1->Sumw2() ;
151 1 : Add2SDigitsList(h1, 1, !expert, image) ;
152 :
153 1 : 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) ;
154 1 : h2->Sumw2() ;
155 1 : h2->GetYaxis()->SetTitleOffset(1.15);
156 1 : Add2SDigitsList(h2, 2, !expert, image) ;
157 : //
158 1 : ClonePerTrigClass(AliQAv1::kSDIGITS); // this should be the last line
159 1 : }
160 :
161 : //____________________________________________________________________________
162 : void AliTOFQADataMakerSim::MakeHits()
163 : {
164 : //
165 : //make QA data from Hits
166 : //
167 :
168 224 : Int_t in[5];
169 112 : Int_t out[5];
170 :
171 112 : Int_t nentries= fHitsArray->GetEntriesFast();
172 224 : if(nentries<=0) {
173 174 : FillHitsData(0,-1.) ;
174 62 : } else{
175 50 : FillHitsData(0,nentries) ;
176 : }
177 112 : TIter next(fHitsArray) ;
178 : AliTOFhitT0 * hit ;
179 784 : while ( (hit = dynamic_cast<AliTOFhitT0 *>(next())) ) {
180 :
181 84 : FillHitsData(1, hit->GetTof()*1.E9) ;//in ns
182 84 : FillHitsData(2, hit->GetLen()) ;//in cm
183 :
184 84 : in[0] = hit->GetSector();
185 84 : in[1] = hit->GetPlate();
186 84 : in[2]= hit->GetStrip();
187 84 : in[3]= hit->GetPadx();
188 84 : in[4]= hit->GetPadz();
189 84 : GetMapIndeces(in,out);
190 84 : FillHitsData(3, out[0],out[1]) ;//hit map
191 : }
192 112 : }
193 :
194 :
195 : //____________________________________________________________________________
196 : void AliTOFQADataMakerSim::MakeHits(TTree * hitTree)
197 : {
198 : //
199 : // make QA data from Hit Tree
200 : //
201 8 : if(!hitTree){
202 0 : AliError("can't get the tree with TOF hits !");
203 0 : return;
204 : }
205 :
206 4 : TBranch * branch = hitTree->GetBranch("TOF") ;
207 :
208 4 : if (!branch ) {
209 0 : AliError("TOF branch in Hit Tree not found") ;
210 0 : return;
211 : }
212 :
213 4 : if (fHitsArray)
214 3 : fHitsArray->Clear() ;
215 : else
216 2 : fHitsArray = new TClonesArray("AliTOFhitT0", 1000) ;
217 :
218 4 : branch->SetAddress(&fHitsArray);
219 232 : for (Int_t ientry = 0 ; ientry < branch->GetEntries() ; ientry++) {
220 112 : branch->GetEntry(ientry) ;
221 112 : MakeHits() ;
222 112 : fHitsArray->Clear() ;
223 : }
224 : //
225 4 : IncEvCountCycleHits();
226 4 : IncEvCountTotalHits();
227 : //
228 8 : }
229 :
230 : //____________________________________________________________________________
231 : void AliTOFQADataMakerSim::MakeDigits()
232 : {
233 : //
234 : // makes data from Digits
235 : //
236 :
237 8 : Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;
238 4 : Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
239 4 : Int_t in[5];
240 4 : Int_t out[5];
241 :
242 4 : Int_t nentries=fDigitsArray->GetEntriesFast();
243 8 : if(nentries<=0){
244 4 : FillDigitsData(0,-1.) ;
245 0 : }else{
246 4 : FillDigitsData(0,nentries) ;
247 : }
248 :
249 4 : TIter next(fDigitsArray) ;
250 : AliTOFdigit * digit ;
251 416 : while ( (digit = dynamic_cast<AliTOFdigit *>(next())) ) {
252 :
253 100 : FillDigitsData(1, digit->GetTdc()*tdc2ns) ;//in ns
254 100 : FillDigitsData(2, digit->GetToT()*tot2ns) ;//in ns
255 :
256 100 : in[0] = digit->GetSector();
257 100 : in[1] = digit->GetPlate();
258 100 : in[2] = digit->GetStrip();
259 100 : in[3] = digit->GetPadx();
260 100 : in[4]= digit->GetPadz();
261 100 : GetMapIndeces(in,out);
262 100 : FillDigitsData(3, out[0],out[1]) ;//digit map
263 : }
264 :
265 4 : }
266 :
267 :
268 : //____________________________________________________________________________
269 : void AliTOFQADataMakerSim::MakeDigits(TTree * digitTree)
270 : {
271 : //
272 : // makes data from Digit Tree
273 : //
274 8 : if (fDigitsArray)
275 3 : fDigitsArray->Clear() ;
276 : else
277 2 : fDigitsArray = new TClonesArray("AliTOFdigit", 1000) ;
278 :
279 4 : TBranch * branch = digitTree->GetBranch("TOF") ;
280 4 : if ( ! branch ) {
281 0 : AliError("TOF branch in Digit Tree not found") ;
282 0 : return;
283 : }
284 4 : branch->SetAddress(&fDigitsArray);
285 4 : branch->GetEntry(0);
286 4 : MakeDigits();
287 : //
288 4 : IncEvCountCycleDigits();
289 4 : IncEvCountTotalDigits();
290 : //
291 8 : }
292 :
293 : //____________________________________________________________________________
294 : void AliTOFQADataMakerSim::MakeSDigits()
295 : {
296 : //
297 : // makes data from SDigits
298 : //
299 :
300 8 : Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;
301 4 : Int_t in[5];
302 4 : Int_t out[5];
303 :
304 4 : Int_t nentries=fSDigitsArray->GetEntriesFast();
305 8 : if(nentries<=0){
306 4 : FillSDigitsData(0,-1.) ;
307 0 : }else{
308 4 : FillSDigitsData(0,nentries) ;
309 : }
310 :
311 4 : TIter next(fSDigitsArray) ;
312 : AliTOFSDigit * sdigit ;
313 416 : while ( (sdigit = dynamic_cast<AliTOFSDigit *>(next())) ) {
314 :
315 400 : for(Int_t i=0;i<sdigit->GetNDigits();i++){
316 200 : FillSDigitsData(1, sdigit->GetTdc(i)*tdc2ns) ;//in ns
317 : }
318 :
319 100 : in[0] = sdigit->GetSector();
320 100 : in[1] = sdigit->GetPlate();
321 100 : in[2] = sdigit->GetStrip();
322 100 : in[3] = sdigit->GetPadx();
323 100 : in[4]= sdigit->GetPadz();
324 100 : GetMapIndeces(in,out);
325 100 : FillSDigitsData(2, out[0],out[1]) ;//sdigit map
326 : }
327 4 : }
328 :
329 : //____________________________________________________________________________
330 : void AliTOFQADataMakerSim::MakeSDigits(TTree * sdigitTree)
331 : {
332 : //
333 : // makes data from SDigit Tree
334 : //
335 8 : if (fSDigitsArray)
336 3 : fSDigitsArray->Clear() ;
337 : else
338 2 : fSDigitsArray = new TClonesArray("AliTOFSDigit", 1000) ;
339 :
340 4 : TBranch * branch = sdigitTree->GetBranch("TOF") ;
341 4 : if ( ! branch ) {
342 0 : AliError("TOF branch in SDigit Tree not found") ;
343 0 : return;
344 : }
345 4 : branch->SetAddress(&fSDigitsArray);
346 4 : branch->GetEntry(0);
347 4 : MakeSDigits();
348 : //
349 4 : IncEvCountCycleSDigits();
350 4 : IncEvCountTotalSDigits();
351 : //
352 8 : }
353 :
354 : //____________________________________________________________________________
355 : void AliTOFQADataMakerSim::StartOfDetectorCycle()
356 : {
357 : //
358 : //Detector specific actions at start of cycle
359 : //to be implemented
360 12 : }
361 :
362 : //____________________________________________________________________________
363 : void AliTOFQADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
364 : {
365 : //Detector specific actions at end of cycle
366 : // do the QA checking
367 18 : ResetEventTrigClasses();
368 9 : AliQAChecker::Instance()->Run(AliQAv1::kTOF, task, list) ;
369 9 : }
370 : //____________________________________________________________________________
371 : void AliTOFQADataMakerSim::GetMapIndeces(Int_t* in , Int_t* out)
372 : {
373 : //
374 : //return appropriate indeces for the theta-phi map
375 : //
376 :
377 568 : Int_t npadX = AliTOFGeometry::NpadX();
378 284 : Int_t npadZ = AliTOFGeometry::NpadZ();
379 284 : Int_t nStripA = AliTOFGeometry::NStripA();
380 284 : Int_t nStripB = AliTOFGeometry::NStripB();
381 284 : Int_t nStripC = AliTOFGeometry::NStripC();
382 :
383 284 : Int_t isector = in[0];
384 284 : Int_t iplate = in[1];
385 284 : Int_t istrip = in[2];
386 284 : Int_t ipadX = in[3];
387 284 : Int_t ipadZ = in[4];
388 :
389 : Int_t stripOffset = 0;
390 284 : switch (iplate) {
391 : case 0:
392 : stripOffset = 0;
393 25 : break;
394 : case 1:
395 : stripOffset = nStripC;
396 35 : break;
397 : case 2:
398 195 : stripOffset = nStripC+nStripB;
399 195 : break;
400 : case 3:
401 28 : stripOffset = nStripC+nStripB+nStripA;
402 28 : break;
403 : case 4:
404 1 : stripOffset = nStripC+nStripB+nStripA+nStripB;
405 1 : break;
406 : default:
407 0 : AliError(Form("Wrong plate number in TOF (%d) !",iplate));
408 0 : break;
409 : };
410 284 : Int_t zindex=npadZ*(istrip+stripOffset)+(ipadZ+1);
411 284 : Int_t phiindex=npadX*isector+ipadX+1;
412 284 : out[0]=zindex;
413 284 : out[1]=phiindex;
414 :
415 284 : }
|