restore threshold getters after parameter dynamics update (fw v. >= A012)
[u/mrichter/AliRoot.git] / FMD / AliFMDQADataMakerSim.cxx
CommitLineData
c9dd1c4d 1/**************************************************************************
ffa78f64 2 * Copyright(c) 2004, ALICE Experiment at CERN, All rights reserved. *
c9dd1c4d 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// --- ROOT system ---
16#include <iostream>
17#include <TClonesArray.h>
18#include <TFile.h>
19#include <TH1F.h>
20#include <TH1I.h>
21
22// --- AliRoot header files ---
23#include "AliESDEvent.h"
24#include "AliLog.h"
25#include "AliFMDQADataMakerSim.h"
26#include "AliFMDDigit.h"
27#include "AliFMDHit.h"
28#include "AliQAChecker.h"
29#include "AliFMDParameters.h"
028cb80b 30#include "AliFMDSDigit.h"
c9dd1c4d 31
32//_____________________________________________________________________
33// This is the class that collects the QA data for the FMD during simulation.
34// The following data types are picked up:
35// - hits
36// - digits
37// The following data types are not supported (yet):
38// - raws
39// - sdigits
40// Author : Hans Hjersing Dalsgaard, Niels Bohr Institute, hans.dalsgaard@cern.ch
41//_____________________________________________________________________
42
43ClassImp(AliFMDQADataMakerSim)
ffa78f64 44#if 0
45; // This line is for Emacs - do not delete!
46#endif
c9dd1c4d 47//_____________________________________________________________________
ffa78f64 48AliFMDQADataMakerSim::AliFMDQADataMakerSim()
4e25ac79 49 : AliQADataMakerSim(AliQAv1::GetDetName(AliQAv1::kFMD),
6252ceeb 50 "FMD Quality Assurance Data Maker")
c9dd1c4d 51{
52 // ctor
56236ce9 53
c9dd1c4d 54}
55
56//_____________________________________________________________________
f2597905 57AliFMDQADataMakerSim::AliFMDQADataMakerSim(const AliFMDQADataMakerSim& /*qadm*/)
6252ceeb 58 : AliQADataMakerSim()
c9dd1c4d 59{
75609cab 60 // copy ctor
61 //
c9dd1c4d 62 // Parameters:
63 // qadm Object to copy from
64
65}
9bd2ccc2 66//_____________________________________________________________________
75609cab 67AliFMDQADataMakerSim&
68AliFMDQADataMakerSim::operator = (const AliFMDQADataMakerSim& )
a7e41e8d 69{
a7e41e8d 70
71 return *this;
72}
73//_____________________________________________________________________
9bd2ccc2 74AliFMDQADataMakerSim::~AliFMDQADataMakerSim()
75{
56236ce9 76
9bd2ccc2 77}
c9dd1c4d 78
79//_____________________________________________________________________
4e25ac79 80void AliFMDQADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task,
57acd2d2 81 TObjArray ** list)
c9dd1c4d 82{
83 //Detector specific actions at end of cycle
84 // do the QA checking
92664bc8 85 ResetEventTrigClasses(); // reset triggers list to select all histos
ffa78f64 86 AliLog::Message(5,"FMD: end of detector cycle",
87 "AliFMDQADataMakerSim","AliFMDQADataMakerSim",
88 "AliFMDQADataMakerSim::EndOfDetectorCycle",
89 "AliFMDQADataMakerSim.cxx",83);
4e25ac79 90 AliQAChecker::Instance()->Run(AliQAv1::kFMD, task, list) ;
c9dd1c4d 91
92}
028cb80b 93//_____________________________________________________________________
94void AliFMDQADataMakerSim::InitSDigits()
95{
96 // create SDigits histograms in SDigits subdir
7d297381 97 const Bool_t expert = kTRUE ;
98 const Bool_t image = kTRUE ;
99
75609cab 100 TH1I* hADCCounts = new TH1I("hADCCounts",
101 "Dist of ADC counts;ADC counts;Entries",
102 1024,0,1024);
028cb80b 103 hADCCounts->SetXTitle("ADC counts");
7d297381 104 Add2SDigitsList(hADCCounts, 0, !expert, image);
92664bc8 105 //
106 ClonePerTrigClass(AliQAv1::kSDIGITS); // this should be the last line
028cb80b 107}
c9dd1c4d 108
109//____________________________________________________________________
110void AliFMDQADataMakerSim::InitHits()
111{
112 // create Digits histograms in Digits subdir
7d297381 113 const Bool_t expert = kTRUE ;
114 const Bool_t image = kTRUE ;
115
75609cab 116 TH1F* hEnergyOfHits = new TH1F("hEnergyOfHits",
117 "Energy distribution;Energy [MeV];Counts",
118 100,0,3);
c9dd1c4d 119 hEnergyOfHits->SetXTitle("Edep");
120 hEnergyOfHits->SetYTitle("Counts");
7d297381 121 Add2HitsList(hEnergyOfHits, 0, !expert, image);
92664bc8 122 //
123 ClonePerTrigClass(AliQAv1::kHITS); // this should be the last line
c9dd1c4d 124}
125
126//_____________________________________________________________________
127void AliFMDQADataMakerSim::InitDigits()
128{
129 // create Digits histograms in Digits subdir
7d297381 130 const Bool_t expert = kTRUE ;
131 const Bool_t image = kTRUE ;
132
75609cab 133 TH1I* hADCCounts = new TH1I("hADCCounts",
134 "Dist of ADC counts; ADC counts;Entries",
135 1024,0,1024);
c9dd1c4d 136 hADCCounts->SetXTitle("ADC counts");
7d297381 137 Add2DigitsList(hADCCounts, 0, !expert, image);
92664bc8 138 //
139 ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
c9dd1c4d 140}
141
142//_____________________________________________________________________
6252ceeb 143void AliFMDQADataMakerSim::MakeHits()
c9dd1c4d 144{
eca4fa66 145 // Check id histograms already created for this Event Specie
146 if ( ! GetHitsData(0) )
147 InitHits() ;
148
6252ceeb 149 TIter next(fHitsArray);
c9dd1c4d 150 AliFMDHit * hit;
92664bc8 151 while ((hit = static_cast<AliFMDHit *>(next()))) FillHitsData(0,hit->Edep()/hit->Length()*0.032);
152 //
c9dd1c4d 153}
154
155//_____________________________________________________________________
156void AliFMDQADataMakerSim::MakeHits(TTree * hitTree)
157{
158 // make QA data from Hit Tree
75609cab 159 //
160 // Parameters:
161 // hitTree Hits container
162 //
163 if (!fHitsArray)
6252ceeb 164 fHitsArray = new TClonesArray("AliFMDHit", 1000) ;
75609cab 165 fHitsArray->Clear() ;
56236ce9 166
c9dd1c4d 167 TBranch * branch = hitTree->GetBranch("FMD") ;
168 if (!branch) {
169 AliWarning("FMD branch in Hit Tree not found") ;
170 return;
171 }
6252ceeb 172
173 branch->SetAddress(&fHitsArray) ;
92664bc8 174 //
c9dd1c4d 175 for (Int_t ientry = 0 ; ientry < branch->GetEntries() ; ientry++) {
176 branch->GetEntry(ientry);
6252ceeb 177 MakeHits(); //tmp);
178 fHitsArray->Clear() ;
92664bc8 179 }
180 //
181 IncEvCountCycleHits();
182 IncEvCountTotalHits();
183 //
c9dd1c4d 184}
185
186//_____________________________________________________________________
6252ceeb 187void AliFMDQADataMakerSim::MakeDigits()
c9dd1c4d 188{
189 // makes data from Digits
75609cab 190 //
191 // Parameters:
192 // none
6252ceeb 193 if(!fDigitsArray) return;
194
195 for(Int_t i = 0 ; i < fDigitsArray->GetEntriesFast() ; i++) {
c9dd1c4d 196 //Raw ADC counts
6252ceeb 197 AliFMDDigit* digit = static_cast<AliFMDDigit*>(fDigitsArray->At(i));
92664bc8 198 FillDigitsData(0,digit->Counts());
c9dd1c4d 199 }
92664bc8 200 //
c9dd1c4d 201}
202
203//_____________________________________________________________________
204void AliFMDQADataMakerSim::MakeDigits(TTree * digitTree)
205{
75609cab 206 // Make data from digits.
207 //
208 // Parameters:
209 // digitTree Tree holding digits.
92664bc8 210 // RS: counters are incremented in MakeDigits()
c9dd1c4d 211
75609cab 212 if (!fDigitsArray)
6252ceeb 213 fDigitsArray = new TClonesArray("AliFMDDigit", 1000) ;
75609cab 214 fDigitsArray->Clear();
6252ceeb 215
c9dd1c4d 216 TBranch * branch = digitTree->GetBranch("FMD") ;
217 if (!branch) {
218 AliWarning("FMD branch in Digit Tree not found") ;
219 return;
220 }
6252ceeb 221 branch->SetAddress(&fDigitsArray) ;
75609cab 222
223 if (fDigitsArray) fDigitsArray->Clear();
224
c9dd1c4d 225 branch->GetEntry(0) ;
6252ceeb 226 MakeDigits() ;
92664bc8 227 //
228 IncEvCountCycleDigits();
229 IncEvCountTotalDigits();
230 //
c9dd1c4d 231}
232
028cb80b 233//_____________________________________________________________________
6252ceeb 234void AliFMDQADataMakerSim::MakeSDigits()
028cb80b 235{
236 // makes data from Digits
75609cab 237 //
238 // Parameters:
239 // none
6252ceeb 240 if(!fSDigitsArray) return;
028cb80b 241
92664bc8 242 for(Int_t i = 0 ; i < fSDigitsArray->GetEntriesFast() ; i++) {
028cb80b 243 //Raw ADC counts
6252ceeb 244 AliFMDSDigit* sdigit = static_cast<AliFMDSDigit*>(fSDigitsArray->At(i));
92664bc8 245 FillSDigitsData(0,sdigit->Counts());
028cb80b 246 }
92664bc8 247 //
028cb80b 248}
249
250//_____________________________________________________________________
251void AliFMDQADataMakerSim::MakeSDigits(TTree * sdigitTree)
252{
75609cab 253 // Make data from digits.
254 //
255 // Parameters:
256 // digitTree Tree holding digits.
92664bc8 257 //
75609cab 258 if (!fSDigitsArray)
6252ceeb 259 fSDigitsArray = new TClonesArray("AliFMDSDigit", 1000) ;
75609cab 260 fSDigitsArray->Clear() ;
261
028cb80b 262 TBranch * branch = sdigitTree->GetBranch("FMD") ;
263 if (!branch) {
264 AliWarning("FMD branch in SDigit Tree not found") ;
265 return;
266 }
6252ceeb 267 branch->SetAddress(&fSDigitsArray) ;
028cb80b 268 branch->GetEntry(0) ;
6252ceeb 269 MakeSDigits() ;
92664bc8 270 //
271 IncEvCountCycleSDigits();
272 IncEvCountTotalSDigits();
273 //
028cb80b 274}
275
c9dd1c4d 276//_____________________________________________________________________
277void AliFMDQADataMakerSim::StartOfDetectorCycle()
278{
75609cab 279 // Does
280 // not
281 // do
282 // anything
c9dd1c4d 283}
284//_____________________________________________________________________
285//
286// EOF
287//