]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMDQADataMakerRec.cxx
Fixed a bug in the function MakeRaws
[u/mrichter/AliRoot.git] / FMD / AliFMDQADataMakerRec.cxx
CommitLineData
c9dd1c4d 1/**************************************************************************
2 * Copyright(c) 2004, 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// --- 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 "AliFMDQADataMakerRec.h"
26#include "AliFMDDigit.h"
27#include "AliFMDRecPoint.h"
28#include "AliQAChecker.h"
29#include "AliESDFMD.h"
30#include "AliFMDParameters.h"
86c6cec8 31#include "AliFMDRawReader.h"
3ceaa9ad 32#include "AliRawReader.h"
c9dd1c4d 33
34//_____________________________________________________________________
35// This is the class that collects the QA data for the FMD during
36// reconstruction.
37//
38// The following data types are picked up:
39// - digits
40// - rec points
41// - esd data
42// The following data types are not supported (yet):
43// - raws
44// Author : Hans Hjersing Dalsgaard, hans.dalsgaard@cern.ch
45//_____________________________________________________________________
46
47ClassImp(AliFMDQADataMakerRec)
48#if 0
49; // For Emacs - do not delete!
50#endif
51
52//_____________________________________________________________________
53AliFMDQADataMakerRec::AliFMDQADataMakerRec() :
54 AliQADataMakerRec(AliQA::GetDetName(AliQA::kFMD),
a7e41e8d 55 "FMD Quality Assurance Data Maker"),
56236ce9 56 fDigitsArray("AliFMDDigit", 1000),
57 fRecPointsArray("AliFMDRecPoints", 1000)
c9dd1c4d 58{
59 // ctor
56236ce9 60
c9dd1c4d 61}
62
63//_____________________________________________________________________
a7e41e8d 64AliFMDQADataMakerRec::AliFMDQADataMakerRec(const AliFMDQADataMakerRec& qadm)
65 : AliQADataMakerRec(AliQA::GetDetName(AliQA::kFMD),
66 "FMD Quality Assurance Data Maker"),
67 fDigitsArray(qadm.fDigitsArray),
68 fRecPointsArray(qadm.fRecPointsArray)
c9dd1c4d 69{
ffa78f64 70 // copy ctor
c9dd1c4d 71 // Parameters:
72 // qadm Object to copy from
73
74}
9bd2ccc2 75//_____________________________________________________________________
a7e41e8d 76AliFMDQADataMakerRec& AliFMDQADataMakerRec::operator = (const AliFMDQADataMakerRec& qadm )
77{
78 fDigitsArray = qadm.fDigitsArray;
79 fRecPointsArray = qadm.fRecPointsArray;
80
81 return *this;
82}
83//_____________________________________________________________________
9bd2ccc2 84AliFMDQADataMakerRec::~AliFMDQADataMakerRec()
85{
56236ce9 86
9bd2ccc2 87}
c9dd1c4d 88
89
90//_____________________________________________________________________
91
92void
92a357bf 93AliFMDQADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX_t task,
c9dd1c4d 94 TObjArray * list)
95{
96 // Detector specific actions at end of cycle
97 // do the QA checking
ffa78f64 98 AliLog::Message(5,"FMD: end of detector cycle",
99 "AliFMDQADataMakerRec","AliFMDQADataMakerRec",
100 "AliFMDQADataMakerRec::EndOfDetectorCycle",
101 "AliFMDQADataMakerRec.cxx",95);
c9dd1c4d 102 AliQAChecker::Instance()->Run(AliQA::kFMD, task, list);
103}
104
105//_____________________________________________________________________
106void AliFMDQADataMakerRec::InitESDs()
107{
108 // create Digits histograms in Digits subdir
109 TH1F* hEnergyOfESD = new TH1F("hEnergyOfESD","Energy distribution",100,0,3);
110 hEnergyOfESD->SetXTitle("Edep/Emip");
111 hEnergyOfESD->SetYTitle("Counts");
112 Add2ESDsList(hEnergyOfESD, 0);
113
114}
115
116//_____________________________________________________________________
86c6cec8 117/*void AliFMDQADataMakerRec::InitDigits()
c9dd1c4d 118{
119 // create Digits histograms in Digits subdir
120 TH1I* hADCCounts = new TH1I("hADCCounts","Dist of ADC counts",
121 1024,0,1024);
c9dd1c4d 122 hADCCounts->SetXTitle("ADC counts");
123 hADCCounts->SetYTitle("");
c9dd1c4d 124 Add2DigitsList(hADCCounts, 0);
c9dd1c4d 125
126}
86c6cec8 127*/
c9dd1c4d 128//_____________________________________________________________________
129void AliFMDQADataMakerRec::InitRecPoints()
130{
131 TH1F* hEnergyOfRecpoints = new TH1F("hEnergyOfRecpoints",
132 "Energy Distribution",100,0,3);
133 hEnergyOfRecpoints->SetXTitle("Edep/Emip");
134 hEnergyOfRecpoints->SetYTitle("");
135 Add2RecPointsList(hEnergyOfRecpoints,0);
136}
137
138//_____________________________________________________________________
139void AliFMDQADataMakerRec::InitRaws()
140{
86c6cec8 141 TH1I* hADCCounts = new TH1I("hADCCounts","Dist of ADC counts",
142 1024,0,1024);
143 hADCCounts->SetXTitle("ADC counts");
144 hADCCounts->SetYTitle("");
145 Add2RawsList(hADCCounts, 0);
146
c9dd1c4d 147}
148
149//_____________________________________________________________________
150void AliFMDQADataMakerRec::MakeESDs(AliESDEvent * esd)
151{
152 if(!esd) {
153 AliError("FMD ESD object not found!!") ;
154 return;
155 }
156 AliESDFMD* fmd = esd->GetFMDData();
157 if (!fmd) return;
158
159 for(UShort_t det=1;det<=3;det++) {
160 for (UShort_t ir = 0; ir < 2; ir++) {
161 Char_t ring = (ir == 0 ? 'I' : 'O');
162 UShort_t nsec = (ir == 0 ? 20 : 40);
163 UShort_t nstr = (ir == 0 ? 512 : 256);
164 for(UShort_t sec =0; sec < nsec; sec++) {
165 for(UShort_t strip = 0; strip < nstr; strip++) {
166 Float_t mult = fmd->Multiplicity(det,ring,sec,strip);
167 if(mult == AliESDFMD::kInvalidMult) continue;
168
169 GetESDsData(0)->Fill(mult);
170 }
171 }
172 }
173 }
174}
175
86c6cec8 176/*
c9dd1c4d 177//_____________________________________________________________________
178void AliFMDQADataMakerRec::MakeDigits(TClonesArray * digits)
179{
180 // makes data from Digits
181 if(!digits) {
ffa78f64 182 AliError("FMD Digit object not found!!") ;
183 return;
c9dd1c4d 184 }
56236ce9 185 for(Int_t i=0;i<digits->GetEntriesFast();i++) {
c9dd1c4d 186 //Raw ADC counts
56236ce9 187 AliFMDDigit* digit = static_cast<AliFMDDigit*>(digits->At(i));
c9dd1c4d 188 GetDigitsData(0)->Fill(digit->Counts());
189 }
190}
191
192//_____________________________________________________________________
193void AliFMDQADataMakerRec::MakeDigits(TTree * digitTree)
194{
195
56236ce9 196 fDigitsArray.Clear();
ffa78f64 197 TBranch* branch = digitTree->GetBranch("FMD");
198 if (!branch) {
c9dd1c4d 199 AliWarning("FMD branch in Digit Tree not found") ;
200 return;
201 }
56236ce9 202 TClonesArray* digitsAddress = &fDigitsArray;
203 branch->SetAddress(&digitsAddress);
ffa78f64 204 branch->GetEntry(0);
56236ce9 205 MakeDigits(digitsAddress);
c9dd1c4d 206}
86c6cec8 207*/
c9dd1c4d 208//_____________________________________________________________________
86c6cec8 209void AliFMDQADataMakerRec::MakeRaws(AliRawReader* rawReader)
c9dd1c4d 210{
86c6cec8 211 fDigitsArray.Clear();
212 AliFMDRawReader fmdReader(rawReader,0);
213 TClonesArray* digitsAddress = &fDigitsArray;
214 fmdReader.ReadAdcs(digitsAddress);
3ceaa9ad 215
216 rawReader->Reset();
217
218 while(rawReader->NextEvent()) {
219
220 for(Int_t i=0;i<fDigitsArray.GetEntriesFast();i++) {
221 //Raw ADC counts
222 AliFMDDigit* digit = static_cast<AliFMDDigit*>(fDigitsArray.At(i));
223 GetRawsData(0)->Fill(digit->Counts());
224 }
86c6cec8 225 }
c9dd1c4d 226
227}
228
229//_____________________________________________________________________
230void AliFMDQADataMakerRec::MakeRecPoints(TTree* clustersTree)
231{
232 // makes data from RecPoints
56236ce9 233 fRecPointsArray.Clear();
c9dd1c4d 234 TBranch *fmdbranch = clustersTree->GetBranch("FMD");
235 if (!fmdbranch) {
236 AliError("can't get the branch with the FMD recpoints !");
237 return;
238 }
239
56236ce9 240 TClonesArray* RecPointsAddress = &fRecPointsArray;
9bd2ccc2 241
56236ce9 242 fmdbranch->SetAddress(&RecPointsAddress);
c9dd1c4d 243 fmdbranch->GetEntry(0);
244
56236ce9 245 TIter next(RecPointsAddress) ;
c9dd1c4d 246 AliFMDRecPoint * rp ;
247 while ((rp = static_cast<AliFMDRecPoint*>(next()))) {
a7e41e8d 248 GetRecPointsData(0)->Fill(rp->Edep()) ;
c9dd1c4d 249 }
c9dd1c4d 250
251}
252
253//_____________________________________________________________________
254void AliFMDQADataMakerRec::StartOfDetectorCycle()
255{
256 // What
257 // to
258 // do?
259}
260//_____________________________________________________________________
261//
262// EOF
263//