]> git.uio.no Git - u/mrichter/AliRoot.git/blame - VZERO/AliVZEROQADataMakerSim.cxx
Temporary protections, to be investigated in more details by the detector experts
[u/mrichter/AliRoot.git] / VZERO / AliVZEROQADataMakerSim.cxx
CommitLineData
508b9fc0 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: AliVZEROQADataMakerSim.cxx 23123 2007-12-18 09:08:18Z hristov $ */
18
19//---
20// Produces the data needed to calculate the quality assurance.
21// All data must be mergeable objects.
22// Author : BC
23//---
24
25// --- ROOT system ---
26#include <TClonesArray.h>
27#include <TFile.h>
28#include <TH1F.h>
29#include <TDirectory.h>
30// --- Standard library ---
31
32// --- AliRoot header files ---
33#include "AliESDEvent.h"
34#include "AliLog.h"
35#include "AliVZEROdigit.h"
36#include "AliVZEROhit.h"
37#include "AliVZEROQADataMakerSim.h"
38#include "AliQAChecker.h"
39
40ClassImp(AliVZEROQADataMakerSim)
41
42//____________________________________________________________________________
43 AliVZEROQADataMakerSim::AliVZEROQADataMakerSim() :
4e25ac79 44 AliQADataMakerSim(AliQAv1::GetDetName(AliQAv1::kVZERO), "VZERO Quality Assurance Data Maker")
508b9fc0 45
46{
47 // constructor
48
49
50}
51
52//____________________________________________________________________________
53AliVZEROQADataMakerSim::AliVZEROQADataMakerSim(const AliVZEROQADataMakerSim& qadm) :
54 AliQADataMakerSim()
55{
56 //copy constructor
57
58 SetName((const char*)qadm.GetName()) ;
59 SetTitle((const char*)qadm.GetTitle());
60}
61
62//__________________________________________________________________
63AliVZEROQADataMakerSim& AliVZEROQADataMakerSim::operator = (const AliVZEROQADataMakerSim& qadm )
64{
65 // Assign operator.
66 this->~AliVZEROQADataMakerSim();
67 new(this) AliVZEROQADataMakerSim(qadm);
68 return *this;
69}
70//____________________________________________________________________________
4e25ac79 71void AliVZEROQADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
508b9fc0 72{
73 //Detector specific actions at end of cycle
74 // do the QA checking
4e25ac79 75 AliQAChecker::Instance()->Run(AliQAv1::kVZERO, task, list) ;
508b9fc0 76}
77
78
79//____________________________________________________________________________
80void AliVZEROQADataMakerSim::InitHits()
81{
508b9fc0 82
83 // create Hits histograms in Hits subdir
7d297381 84 const Bool_t expert = kTRUE ;
85 const Bool_t image = kTRUE ;
095fab41 86
87 TH1I * h0 = new TH1I("hHitMultiplicity", "Hit multiplicity distribution in VZERO", 300, 0, 299) ;
508b9fc0 88 h0->Sumw2() ;
7d297381 89 Add2HitsList(h0, 0, !expert, image) ;
095fab41 90
91 TH1I * h1 = new TH1I("hHitCellNumber", "Hit cell distribution in VZERO", 80, 0, 79) ;
92 h1->Sumw2() ;
7d297381 93 Add2HitsList(h1, 1, !expert, image) ;
508b9fc0 94
508b9fc0 95}
96
97//____________________________________________________________________________
98void AliVZEROQADataMakerSim::InitDigits()
99{
100 // create Digits histograms in Digits subdir
7d297381 101 const Bool_t expert = kTRUE ;
102 const Bool_t image = kTRUE ;
508b9fc0 103
a3f8715e 104 char TDCname[100];
105 char ADCname[100];
095fab41 106 TH1I *fhDigTDC[64];
107 TH1I *fhDigADC[64];
a3f8715e 108 char texte[100];
508b9fc0 109
110 // create Digits histograms in Digits subdir
095fab41 111 TH1I * h0 = new TH1I("hDigitMultiplicity", "Digits multiplicity distribution in VZERO", 100, 0, 99) ;
508b9fc0 112 h0->Sumw2() ;
7d297381 113 Add2DigitsList(h0, 0, !expert, image) ;
508b9fc0 114
115 for (Int_t i=0; i<64; i++)
116 {
117 sprintf(TDCname, "hDigitTDC%d", i);
118 sprintf(texte,"Digit TDC in cell %d",i);
095fab41 119 fhDigTDC[i] = new TH1I(TDCname,texte,300,0.,149.);
508b9fc0 120
121 sprintf(ADCname,"hDigitADC%d",i);
122 sprintf(texte,"Digit ADC in cell %d",i);
095fab41 123 fhDigADC[i]= new TH1I(ADCname,texte,1024,0.,1023.);
508b9fc0 124
7d297381 125 Add2DigitsList(fhDigTDC[i],i+1, !expert, image);
126 Add2DigitsList(fhDigADC[i],i+1+64, !expert, image);
508b9fc0 127 }
128}
129
130
131//____________________________________________________________________________
132void AliVZEROQADataMakerSim::MakeHits(TClonesArray * hits)
133{
134 //make QA data from Hits
135
136 GetHitsData(0)->Fill(hits->GetEntriesFast()) ; // fills Hit multiplicity
137 Int_t nhits = hits->GetEntriesFast();
138 for (Int_t ihit=0;ihit<nhits;ihit++)
139 {
140 AliVZEROhit * VZEROHit = (AliVZEROhit*) hits->UncheckedAt(ihit);
141 if (!VZEROHit) {
142 AliError("The unchecked hit doesn't exist");
143 break;
144 }
095fab41 145 GetHitsData(1)->Fill(VZEROHit->Cell());
508b9fc0 146 }
147}
148
149
150//____________________________________________________________________________
151
152void AliVZEROQADataMakerSim::MakeHits(TTree *hitTree)
153{
154 //fills QA histos for Hits
155 TClonesArray * hits = new TClonesArray("AliVZEROhit", 1000);
156
157 TBranch * branch = hitTree->GetBranch("VZERO") ;
158 if ( ! branch ) {
159 AliWarning("VZERO branch in Hit Tree not found") ;
160 } else {
161
162 if (branch) {
163 branch->SetAddress(&hits);
164 }else{
165 AliError("Branch VZERO hit not found");
166 exit(111);
167 }
168 Int_t ntracks = (Int_t) hitTree->GetEntries();
169
170 if (ntracks<=0) return;
171 // Start loop on tracks in the hits containers
172 for (Int_t track=0; track<ntracks;track++) {
173 branch->GetEntry(track);
174 GetHitsData(0)->Fill(hits->GetEntriesFast()) ; // fills Hit multiplicity
175 Int_t nhits = hits->GetEntriesFast();
176 for (Int_t ihit=0;ihit<nhits;ihit++)
177 {
178 AliVZEROhit * VZEROHit = (AliVZEROhit*) hits->UncheckedAt(ihit);
179 if (!VZEROHit) {
180 AliError("The unchecked hit doesn't exist");
181 break;
182 }
095fab41 183 GetHitsData(1)->Fill(VZEROHit->Cell());
508b9fc0 184 }
185 }
186 }
187}
188
189
190//____________________________________________________________________________
191void AliVZEROQADataMakerSim::MakeDigits(TClonesArray * digits)
192{
193 // makes data from Digits
194
195 GetDigitsData(0)->Fill(digits->GetEntriesFast()) ;
196 TIter next(digits) ;
197 AliVZEROdigit *VZERODigit ;
198 while ( (VZERODigit = dynamic_cast<AliVZEROdigit *>(next())) ) {
199 Int_t PMNumber = VZERODigit->PMNumber();
200 GetDigitsData(PMNumber +1)->Fill( VZERODigit->Time()) ; // in 100 of picoseconds
201 GetDigitsData(PMNumber +1+64)->Fill( VZERODigit->ADC()) ;
202 }
203}
204
205
206//____________________________________________________________________________
207void AliVZEROQADataMakerSim::MakeDigits(TTree *digitTree)
208{
209 // makes data from Digit Tree
210
095fab41 211 TClonesArray * digits = new TClonesArray("AliVZEROdigit", 1000) ;
508b9fc0 212
095fab41 213 TBranch * branch = digitTree->GetBranch("VZERODigit") ;
508b9fc0 214 if ( ! branch ) {
215 AliWarning("VZERO branch in Digit Tree not found") ;
216 } else {
217 branch->SetAddress(&digits) ;
218 branch->GetEntry(0) ;
219 MakeDigits(digits) ;
220 }
221}
222
223
224//____________________________________________________________________________
225void AliVZEROQADataMakerSim::StartOfDetectorCycle()
226{
227 //Detector specific actions at start of cycle
228
229}