Added QA for digits during reconstruction (Yves)
[u/mrichter/AliRoot.git] / T0 / AliT0QADataMakerSim.cxx
CommitLineData
04236e67 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/* $Id$ */
18
19//---
20// Produces the data needed to calculate the quality assurance.
21// All data must be mergeable objects.
22// A. Mastroserio
23//---
24
25// --- ROOT system ---
26#include <TClonesArray.h>
27#include <TFile.h>
28#include <TH1F.h>
9778caa8 29#include <TH2F.h>
04236e67 30#include <TDirectory.h>
31// --- Standard library ---
32
33// --- AliRoot header files ---
34#include "AliESDEvent.h"
35#include "AliLog.h"
36#include "AliT0digit.h"
37#include "AliT0hit.h"
38#include "AliT0RecPoint.h"
39#include "AliT0QADataMakerSim.h"
40#include "AliQAChecker.h"
41#include "AliT0RawReader.h"
42
43ClassImp(AliT0QADataMakerSim)
44
45//____________________________________________________________________________
46 AliT0QADataMakerSim::AliT0QADataMakerSim() :
4e25ac79 47 AliQADataMakerSim(AliQAv1::GetDetName(AliQAv1::kT0), "T0 Quality Assurance Data Maker")
04236e67 48
49{
50 // ctor
51 /*
52 for(Int_t i=0; i<24; i++) {
53 fhHitsTime[i]=0x0;
54 fhDigCFD[i]=0x0;
55 fhDigLEDamp[i]=0x0;
56 fhRecCFD[i]=0x0;
57 fhRecLEDamp[i]=0x0;
58 fhRecQTC[i]=0x0;
59 }
60 */
61 // fDetectorDir = fOutput->GetDirectory(GetName()) ;
62// if (!fDetectorDir)
63// fDetectorDir = fOutput->mkdir(GetName()) ;
64}
65
66//____________________________________________________________________________
67AliT0QADataMakerSim::AliT0QADataMakerSim(const AliT0QADataMakerSim& qadm) :
68 AliQADataMakerSim()
69{
70 //copy ctor
71 /*
72 for(Int_t i=0; i<24; i++) {
73 fhHitsTime[i]=0x0;
74 fhDigCFD[i]=0x0;
75 fhDigLEDamp[i]=0x0;
76 fhRecCFD[i]=0x0;
77 fhRecLEDamp[i]=0x0;
78 fhRecQTC[i]=0x0;
79 }
80 */
81 SetName((const char*)qadm.GetName()) ;
82 SetTitle((const char*)qadm.GetTitle());
83}
84
85//__________________________________________________________________
86AliT0QADataMakerSim& AliT0QADataMakerSim::operator = (const AliT0QADataMakerSim& qadm )
87{
88 // Equal operator.
89 this->~AliT0QADataMakerSim();
90 new(this) AliT0QADataMakerSim(qadm);
91 return *this;
92}
93//____________________________________________________________________________
4e25ac79 94void AliT0QADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
04236e67 95{
96 //Detector specific actions at end of cycle
97 // do the QA checking
4e25ac79 98 AliQAChecker::Instance()->Run(AliQAv1::kT0, task, list) ;
04236e67 99}
100
101//____________________________________________________________________________
102void AliT0QADataMakerSim::StartOfDetectorCycle()
103{
104 //Detector specific actions at start of cycle
105
106}
107
108//____________________________________________________________________________
109void AliT0QADataMakerSim::InitHits()
110{
111 // create Hits histograms in Hits subdir
9778caa8 112 // create Hits histograms in Hits subdir
7d297381 113 const Bool_t expert = kTRUE ;
114 const Bool_t image = kTRUE ;
115
04236e67 116 TString timename;
9778caa8 117
118 TH2F *fhHitsTimeA = new TH2F("hHitsTimeA", "Hits Efficiency", 25, 0, 25, 100,12,15 );
7d297381 119 Add2HitsList(fhHitsTimeA,0, !expert, image);
9778caa8 120 TH2F *fhHitsTimeC = new TH2F("hHitsTimeC", "Hits Efficiency", 25, 0, 25, 100,2,5 );
7d297381 121 Add2HitsList(fhHitsTimeC,1, !expert, image);
04236e67 122}
123
124//____________________________________________________________________________
125void AliT0QADataMakerSim::InitDigits()
126{
127 // create Digits histograms in Digits subdir
7d297381 128 const Bool_t expert = kTRUE ;
129 const Bool_t image = kTRUE ;
9778caa8 130
04236e67 131 TH2F * fhDigCFD = new TH2F("fhDigCFD", " CFD digits",25,-0.5,24.5,100,100,1000);
132 Add2DigitsList( fhDigCFD,0);
133 TH2F *fhDigLEDamp = new TH2F("fhDigLEDamp", " LED-CFD digits",25,-0.5,24.5,100,100,1000);
7d297381 134 Add2DigitsList( fhDigLEDamp,1, !expert, image);
04236e67 135 TH2F * fhDigQTC = new TH2F("fhDigQTC", " QTC digits",25,-0.5,24.5,100,100,1000);
7d297381 136 Add2DigitsList( fhDigQTC,2, !expert, image);
04236e67 137
04236e67 138
9778caa8 139
04236e67 140}
141
142//____________________________________________________________________________
143
144void AliT0QADataMakerSim::MakeHits(TTree *hitTree)
145{
146 //fills QA histos for Hits
147 TClonesArray * hits = new TClonesArray("AliT0hit", 1000);
148
149 TBranch * branch = hitTree->GetBranch("T0") ;
150 if ( ! branch ) {
151 AliWarning("T0 branch in Hit Tree not found") ;
152 } else {
153
154 if (branch) {
155 branch->SetAddress(&hits);
156 }else{
157 AliError("Branch T0 hit not found");
158 exit(111);
159 }
160 Int_t ntracks = (Int_t) hitTree->GetEntries();
161
162 if (ntracks<=0) return;
163 // Start loop on tracks in the hits containers
164 for (Int_t track=0; track<ntracks;track++) {
165 branch->GetEntry(track);
166 Int_t nhits = hits->GetEntriesFast();
167 for (Int_t ihit=0;ihit<nhits;ihit++)
168 {
169 AliT0hit * startHit = (AliT0hit*) hits->UncheckedAt(ihit);
170 if (!startHit) {
171 AliError("The unchecked hit doesn't exist");
9778caa8 172 continue;
04236e67 173 }
174 Int_t pmt=startHit->Pmt();
9778caa8 175 Float_t time = 0.001 * startHit->Time();
176 if(pmt<13)GetHitsData(1)->Fill(pmt,time) ;
177 if(pmt>12)GetHitsData(0)->Fill(pmt,time) ;
04236e67 178 }
179 }
180 }
181}
182
183//____________________________________________________________________________
184void AliT0QADataMakerSim::MakeDigits( TTree *digitsTree)
185{
186 //fills QA histos for Digits
187
188 TArrayI *digCFD = new TArrayI(24);
189 TArrayI *digLED = new TArrayI(24);
190 TArrayI *digQT0 = new TArrayI(24);
191 TArrayI *digQT1 = new TArrayI(24);
192 Int_t refpoint=0;
193
9778caa8 194 TBranch *brDigits=digitsTree->GetBranch("T0");
04236e67 195 AliT0digit *fDigits = new AliT0digit() ;
196 if (brDigits) {
197 brDigits->SetAddress(&fDigits);
198 }else{
199 AliError(Form("EXEC Branch T0 digits not found"));
200 return;
201 }
04236e67 202 digitsTree->GetEvent(0);
203 digitsTree->GetEntry(0);
204 brDigits->GetEntry(0);
205 fDigits->GetTimeCFD(*digCFD);
206 fDigits->GetTimeLED(*digLED);
207 fDigits->GetQT0(*digQT0);
208 fDigits->GetQT1(*digQT1);
209 refpoint = fDigits->RefPoint();
210 for (Int_t i=0; i<24; i++)
211 {
212 if (digCFD->At(i)>0) {
213 Int_t cfd=digCFD->At(i)- refpoint;
9778caa8 214 GetDigitsData(0) ->Fill(i,cfd);
215 GetDigitsData(1) -> Fill(i,(digLED->At(i) - digCFD->At(i)));
216 GetDigitsData(2) -> Fill(i, (digQT1->At(i) - digQT0->At(i)));
04236e67 217 }
218 }
219
220 delete digCFD;
221 delete digLED;
222 delete digQT0;
223 delete digQT1;
224
225}