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