1.The QA data created on demand according to the event species at filling time. 2...
[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),
9bd2ccc2 50 "FMD Quality Assurance Data Maker"),
028cb80b 51 fSDigitsArray("AliFMDSDigit", 1000),
56236ce9 52 fDigitsArray("AliFMDDigit", 1000),
53 fHitsArray("AliFMDHit", 10)
c9dd1c4d 54{
55 // ctor
56236ce9 56
c9dd1c4d 57}
58
59//_____________________________________________________________________
a7e41e8d 60AliFMDQADataMakerSim::AliFMDQADataMakerSim(const AliFMDQADataMakerSim& qadm)
61 : AliQADataMakerSim(),
028cb80b 62 fSDigitsArray(qadm.fSDigitsArray),
a7e41e8d 63 fDigitsArray(qadm.fDigitsArray),
64 fHitsArray(qadm.fHitsArray)
c9dd1c4d 65{
66 //copy ctor
a7e41e8d 67
c9dd1c4d 68 // Parameters:
69 // qadm Object to copy from
70
71}
9bd2ccc2 72//_____________________________________________________________________
a7e41e8d 73AliFMDQADataMakerSim& AliFMDQADataMakerSim::operator = (const AliFMDQADataMakerSim& qadm )
74{
028cb80b 75 fSDigitsArray = qadm.fSDigitsArray;
a7e41e8d 76 fDigitsArray = qadm.fDigitsArray;
77 fHitsArray = qadm.fHitsArray;
78
79 return *this;
80}
81//_____________________________________________________________________
9bd2ccc2 82AliFMDQADataMakerSim::~AliFMDQADataMakerSim()
83{
56236ce9 84
9bd2ccc2 85}
c9dd1c4d 86
87//_____________________________________________________________________
4e25ac79 88void AliFMDQADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task,
57acd2d2 89 TObjArray ** list)
c9dd1c4d 90{
91 //Detector specific actions at end of cycle
92 // do the QA checking
ffa78f64 93 AliLog::Message(5,"FMD: end of detector cycle",
94 "AliFMDQADataMakerSim","AliFMDQADataMakerSim",
95 "AliFMDQADataMakerSim::EndOfDetectorCycle",
96 "AliFMDQADataMakerSim.cxx",83);
4e25ac79 97 AliQAChecker::Instance()->Run(AliQAv1::kFMD, task, list) ;
c9dd1c4d 98
99}
028cb80b 100//_____________________________________________________________________
101void AliFMDQADataMakerSim::InitSDigits()
102{
103 // create SDigits histograms in SDigits subdir
7d297381 104 const Bool_t expert = kTRUE ;
105 const Bool_t image = kTRUE ;
106
db72ff3b 107 TH1I* hADCCounts = new TH1I("hADCCounts","Dist of ADC counts;ADC counts;Entries",1024,0,1024);
028cb80b 108 hADCCounts->SetXTitle("ADC counts");
7d297381 109 Add2SDigitsList(hADCCounts, 0, !expert, image);
028cb80b 110}
c9dd1c4d 111
112//____________________________________________________________________
113void AliFMDQADataMakerSim::InitHits()
114{
115 // create Digits histograms in Digits subdir
7d297381 116 const Bool_t expert = kTRUE ;
117 const Bool_t image = kTRUE ;
118
db72ff3b 119 TH1F* hEnergyOfHits = new TH1F("hEnergyOfHits","Energy distribution;Energy [MeV];Counts",100,0,3);
c9dd1c4d 120 hEnergyOfHits->SetXTitle("Edep");
121 hEnergyOfHits->SetYTitle("Counts");
7d297381 122 Add2HitsList(hEnergyOfHits, 0, !expert, image);
c9dd1c4d 123}
124
125//_____________________________________________________________________
126void AliFMDQADataMakerSim::InitDigits()
127{
128 // create Digits histograms in Digits subdir
7d297381 129 const Bool_t expert = kTRUE ;
130 const Bool_t image = kTRUE ;
131
db72ff3b 132 TH1I* hADCCounts = new TH1I("hADCCounts","Dist of ADC counts; ADC counts;Entries",1024,0,1024);
c9dd1c4d 133 hADCCounts->SetXTitle("ADC counts");
7d297381 134 Add2DigitsList(hADCCounts, 0, !expert, image);
c9dd1c4d 135}
136
137//_____________________________________________________________________
138void AliFMDQADataMakerSim::MakeHits(TClonesArray * hits)
139{
eca4fa66 140 // Check id histograms already created for this Event Specie
141 if ( ! GetHitsData(0) )
142 InitHits() ;
143
a7e41e8d 144 TIter next(hits);
c9dd1c4d 145 AliFMDHit * hit;
146 while ((hit = static_cast<AliFMDHit *>(next())))
147 GetHitsData(0)->Fill(hit->Edep()/hit->Length()*0.032);
148}
149
150//_____________________________________________________________________
151void AliFMDQADataMakerSim::MakeHits(TTree * hitTree)
152{
153 // make QA data from Hit Tree
154
56236ce9 155 fHitsArray.Clear();
156
c9dd1c4d 157 TBranch * branch = hitTree->GetBranch("FMD") ;
158 if (!branch) {
159 AliWarning("FMD branch in Hit Tree not found") ;
160 return;
161 }
56236ce9 162
163 TClonesArray* hitsAddress = &fHitsArray;
164
165 branch->SetAddress(&hitsAddress) ;
c9dd1c4d 166
167 for (Int_t ientry = 0 ; ientry < branch->GetEntries() ; ientry++) {
168 branch->GetEntry(ientry);
56236ce9 169 MakeHits(hitsAddress); //tmp);
c9dd1c4d 170 }
9bd2ccc2 171
c9dd1c4d 172}
173
174//_____________________________________________________________________
175void AliFMDQADataMakerSim::MakeDigits(TClonesArray * digits)
176{
177 // makes data from Digits
178 if(!digits) return;
179
eca4fa66 180 // Check id histograms already created for this Event Specie
181 if ( ! GetDigitsData(0) )
182 InitDigits() ;
183
56236ce9 184 for(Int_t i = 0 ; i < digits->GetEntriesFast() ; i++) {
c9dd1c4d 185 //Raw ADC counts
186 AliFMDDigit* digit = static_cast<AliFMDDigit*>(digits->At(i));
187 GetDigitsData(0)->Fill(digit->Counts());
188 }
189}
190
191//_____________________________________________________________________
192void AliFMDQADataMakerSim::MakeDigits(TTree * digitTree)
193{
194
56236ce9 195 fDigitsArray.Clear();
c9dd1c4d 196 TBranch * branch = digitTree->GetBranch("FMD") ;
197 if (!branch) {
198 AliWarning("FMD branch in Digit Tree not found") ;
199 return;
200 }
56236ce9 201 TClonesArray* digitAddress = &fDigitsArray;
202 branch->SetAddress(&digitAddress) ;
c9dd1c4d 203 branch->GetEntry(0) ;
56236ce9 204 MakeDigits(digitAddress) ;
c9dd1c4d 205}
206
028cb80b 207//_____________________________________________________________________
208void AliFMDQADataMakerSim::MakeSDigits(TClonesArray * sdigits)
209{
210 // makes data from Digits
211 if(!sdigits) return;
212
eca4fa66 213 // Check id histograms already created for this Event Specie
214 if ( ! GetSDigitsData(0) )
215 InitSDigits() ;
216
028cb80b 217 for(Int_t i = 0 ; i < sdigits->GetEntriesFast() ; i++) {
218 //Raw ADC counts
219 AliFMDSDigit* sdigit = static_cast<AliFMDSDigit*>(sdigits->At(i));
220 GetSDigitsData(0)->Fill(sdigit->Counts());
221 }
222}
223
224//_____________________________________________________________________
225void AliFMDQADataMakerSim::MakeSDigits(TTree * sdigitTree)
226{
227
228 fSDigitsArray.Clear();
229 TBranch * branch = sdigitTree->GetBranch("FMD") ;
230 if (!branch) {
231 AliWarning("FMD branch in SDigit Tree not found") ;
232 return;
233 }
234 TClonesArray* sdigitAddress = &fSDigitsArray;
235 branch->SetAddress(&sdigitAddress) ;
236 branch->GetEntry(0) ;
237 MakeSDigits(sdigitAddress) ;
238}
239
c9dd1c4d 240//_____________________________________________________________________
241void AliFMDQADataMakerSim::StartOfDetectorCycle()
242{
243
244}
245//_____________________________________________________________________
246//
247// EOF
248//