Compilation warning fixed
[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"
31
32//_____________________________________________________________________
33// This is the class that collects the QA data for the FMD during
34// reconstruction.
35//
36// The following data types are picked up:
37// - digits
38// - rec points
39// - esd data
40// The following data types are not supported (yet):
41// - raws
42// Author : Hans Hjersing Dalsgaard, hans.dalsgaard@cern.ch
43//_____________________________________________________________________
44
45ClassImp(AliFMDQADataMakerRec)
46#if 0
47; // For Emacs - do not delete!
48#endif
49
50//_____________________________________________________________________
51AliFMDQADataMakerRec::AliFMDQADataMakerRec() :
52 AliQADataMakerRec(AliQA::GetDetName(AliQA::kFMD),
a7e41e8d 53 "FMD Quality Assurance Data Maker"),
54 fDigitsArray(0),
55 fRecPointsArray(0)
c9dd1c4d 56{
57 // ctor
9bd2ccc2 58 fDigitsArray = new TClonesArray("AliFMDDigit", 1000) ;
59 fRecPointsArray = new TClonesArray("AliFMDRecPoints", 1000) ;
c9dd1c4d 60}
61
62//_____________________________________________________________________
a7e41e8d 63AliFMDQADataMakerRec::AliFMDQADataMakerRec(const AliFMDQADataMakerRec& qadm)
64 : AliQADataMakerRec(AliQA::GetDetName(AliQA::kFMD),
65 "FMD Quality Assurance Data Maker"),
66 fDigitsArray(qadm.fDigitsArray),
67 fRecPointsArray(qadm.fRecPointsArray)
c9dd1c4d 68{
ffa78f64 69 // copy ctor
c9dd1c4d 70 // Parameters:
71 // qadm Object to copy from
72
73}
9bd2ccc2 74//_____________________________________________________________________
a7e41e8d 75AliFMDQADataMakerRec& AliFMDQADataMakerRec::operator = (const AliFMDQADataMakerRec& qadm )
76{
77 fDigitsArray = qadm.fDigitsArray;
78 fRecPointsArray = qadm.fRecPointsArray;
79
80 return *this;
81}
82//_____________________________________________________________________
9bd2ccc2 83AliFMDQADataMakerRec::~AliFMDQADataMakerRec()
84{
85 delete fDigitsArray;
86 delete fRecPointsArray;
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//_____________________________________________________________________
117void AliFMDQADataMakerRec::InitDigits()
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}
127
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{
141
142}
143
144//_____________________________________________________________________
145void AliFMDQADataMakerRec::MakeESDs(AliESDEvent * esd)
146{
147 if(!esd) {
148 AliError("FMD ESD object not found!!") ;
149 return;
150 }
151 AliESDFMD* fmd = esd->GetFMDData();
152 if (!fmd) return;
153
154 for(UShort_t det=1;det<=3;det++) {
155 for (UShort_t ir = 0; ir < 2; ir++) {
156 Char_t ring = (ir == 0 ? 'I' : 'O');
157 UShort_t nsec = (ir == 0 ? 20 : 40);
158 UShort_t nstr = (ir == 0 ? 512 : 256);
159 for(UShort_t sec =0; sec < nsec; sec++) {
160 for(UShort_t strip = 0; strip < nstr; strip++) {
161 Float_t mult = fmd->Multiplicity(det,ring,sec,strip);
162 if(mult == AliESDFMD::kInvalidMult) continue;
163
164 GetESDsData(0)->Fill(mult);
165 }
166 }
167 }
168 }
169}
170
171//_____________________________________________________________________
172void AliFMDQADataMakerRec::MakeDigits(TClonesArray * digits)
173{
174 // makes data from Digits
175 if(!digits) {
ffa78f64 176 AliError("FMD Digit object not found!!") ;
177 return;
c9dd1c4d 178 }
9bd2ccc2 179 for(Int_t i=0;i<fDigitsArray->GetEntriesFast();i++) {
c9dd1c4d 180 //Raw ADC counts
9bd2ccc2 181 AliFMDDigit* digit = static_cast<AliFMDDigit*>(fDigitsArray->At(i));
c9dd1c4d 182 GetDigitsData(0)->Fill(digit->Counts());
183 }
184}
185
186//_____________________________________________________________________
187void AliFMDQADataMakerRec::MakeDigits(TTree * digitTree)
188{
189
9bd2ccc2 190 fDigitsArray->Clear();
ffa78f64 191 TBranch* branch = digitTree->GetBranch("FMD");
192 if (!branch) {
c9dd1c4d 193 AliWarning("FMD branch in Digit Tree not found") ;
194 return;
195 }
196
9bd2ccc2 197 branch->SetAddress(&fDigitsArray);
ffa78f64 198 branch->GetEntry(0);
9bd2ccc2 199 MakeDigits(fDigitsArray);
c9dd1c4d 200}
201
202//_____________________________________________________________________
c61a7285 203void AliFMDQADataMakerRec::MakeRaws(AliRawReader* /*rawReader*/)
c9dd1c4d 204{
205
206}
207
208//_____________________________________________________________________
209void AliFMDQADataMakerRec::MakeRecPoints(TTree* clustersTree)
210{
211 // makes data from RecPoints
9bd2ccc2 212 fRecPointsArray->Clear();
c9dd1c4d 213 TBranch *fmdbranch = clustersTree->GetBranch("FMD");
214 if (!fmdbranch) {
215 AliError("can't get the branch with the FMD recpoints !");
216 return;
217 }
218
9bd2ccc2 219
220 fmdbranch->SetAddress(&fRecPointsArray);
c9dd1c4d 221 fmdbranch->GetEntry(0);
222
9bd2ccc2 223 TIter next(fRecPointsArray) ;
c9dd1c4d 224 AliFMDRecPoint * rp ;
225 while ((rp = static_cast<AliFMDRecPoint*>(next()))) {
a7e41e8d 226 GetRecPointsData(0)->Fill(rp->Edep()) ;
c9dd1c4d 227 }
c9dd1c4d 228
229}
230
231//_____________________________________________________________________
232void AliFMDQADataMakerRec::StartOfDetectorCycle()
233{
234 // What
235 // to
236 // do?
237}
238//_____________________________________________________________________
239//
240// EOF
241//