]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMDQADataMakerRec.cxx
MergeQA is now an intrinsic part of AliReconstruction
[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"
b995fc28 33#include "AliFMDAltroMapping.h"
c9dd1c4d 34
35//_____________________________________________________________________
36// This is the class that collects the QA data for the FMD during
37// reconstruction.
38//
39// The following data types are picked up:
c9dd1c4d 40// - rec points
41// - esd data
c9dd1c4d 42// - raws
43// Author : Hans Hjersing Dalsgaard, hans.dalsgaard@cern.ch
44//_____________________________________________________________________
45
46ClassImp(AliFMDQADataMakerRec)
47#if 0
48; // For Emacs - do not delete!
49#endif
50
51//_____________________________________________________________________
52AliFMDQADataMakerRec::AliFMDQADataMakerRec() :
4e25ac79 53 AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kFMD),
a7e41e8d 54 "FMD Quality Assurance Data Maker"),
198942c7 55 fDigitsArray("AliFMDDigit", 0),
56 fRecPointsArray("AliFMDRecPoint", 1000)
c9dd1c4d 57{
58 // ctor
56236ce9 59
c9dd1c4d 60}
61
62//_____________________________________________________________________
a7e41e8d 63AliFMDQADataMakerRec::AliFMDQADataMakerRec(const AliFMDQADataMakerRec& qadm)
4e25ac79 64 : AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kFMD),
a7e41e8d 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{
56236ce9 85
9bd2ccc2 86}
c9dd1c4d 87
88
89//_____________________________________________________________________
90
91void
4e25ac79 92AliFMDQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task,
57acd2d2 93 TObjArray ** list)
c9dd1c4d 94{
95 // Detector specific actions at end of cycle
96 // do the QA checking
ffa78f64 97 AliLog::Message(5,"FMD: end of detector cycle",
98 "AliFMDQADataMakerRec","AliFMDQADataMakerRec",
99 "AliFMDQADataMakerRec::EndOfDetectorCycle",
100 "AliFMDQADataMakerRec.cxx",95);
4e25ac79 101 AliQAChecker::Instance()->Run(AliQAv1::kFMD, task, list);
c9dd1c4d 102}
103
104//_____________________________________________________________________
105void AliFMDQADataMakerRec::InitESDs()
106{
107 // create Digits histograms in Digits subdir
7d297381 108 const Bool_t expert = kTRUE ;
109 const Bool_t image = kTRUE ;
110
c9dd1c4d 111 TH1F* hEnergyOfESD = new TH1F("hEnergyOfESD","Energy distribution",100,0,3);
112 hEnergyOfESD->SetXTitle("Edep/Emip");
113 hEnergyOfESD->SetYTitle("Counts");
7d297381 114 Add2ESDsList(hEnergyOfESD, 0, !expert, image);
c9dd1c4d 115
116}
117
44ed7a66 118//_____________________________________________________________________
119void AliFMDQADataMakerRec::InitDigits()
120{
121 // create Digits histograms in Digits subdir
122 const Bool_t expert = kTRUE ;
123 const Bool_t image = kTRUE ;
124
db72ff3b 125 TH1I* hADCCounts = new TH1I("hADCCounts","Dist of ADC counts;ADC counts;Counts",1024,0,1024);
44ed7a66 126 Add2DigitsList(hADCCounts, 0, !expert, image);
127}
128
129
c9dd1c4d 130//_____________________________________________________________________
131void AliFMDQADataMakerRec::InitRecPoints()
132{
7d297381 133 // create Reconstructed Points histograms in RecPoints subdir
134 const Bool_t expert = kTRUE ;
135 const Bool_t image = kTRUE ;
136
c9dd1c4d 137 TH1F* hEnergyOfRecpoints = new TH1F("hEnergyOfRecpoints",
138 "Energy Distribution",100,0,3);
139 hEnergyOfRecpoints->SetXTitle("Edep/Emip");
db72ff3b 140 hEnergyOfRecpoints->SetYTitle("Counts");
7d297381 141 Add2RecPointsList(hEnergyOfRecpoints,0, !expert, image);
c9dd1c4d 142}
143
144//_____________________________________________________________________
145void AliFMDQADataMakerRec::InitRaws()
146{
7d297381 147 // create Raws histograms in Raws subdir
148 const Bool_t expert = kTRUE ;
149 const Bool_t saveCorr = kTRUE ;
150 const Bool_t image = kTRUE ;
151
b4da452d 152 TH1I* hADCCounts;
153 for(Int_t det = 1; det<=3; det++) {
154 Int_t firstring = (det==1 ? 1 : 0);
155 for(Int_t iring = firstring;iring<=1;iring++) {
c18fe410 156 Char_t ring = (iring == 1 ? 'I' : 'O');
157 hADCCounts = new TH1I(Form("hADCCounts_FMD%d%c",
db72ff3b 158 det, ring), "ADC counts;Amplitude [ADC counts];Counts",
c18fe410 159 1024,0,1023);
160
161 Int_t index1 = GetHalfringIndex(det, ring, 0,1);
7d297381 162 Add2RawsList(hADCCounts, index1, expert, !image, !saveCorr);
c18fe410 163
b4da452d 164 for(Int_t b = 0; b<=1;b++) {
165
c18fe410 166 //Hexadecimal board numbers 0x0, 0x1, 0x10, 0x11;
b4da452d 167 UInt_t board = (iring == 1 ? 0 : 1);
168 board = board + b*16;
c18fe410 169
b4da452d 170
171 hADCCounts = new TH1I(Form("hADCCounts_FMD%d%c_board%d",
db72ff3b 172 det, ring, board), "ADC counts;Amplitude [ADC counts];Counts",
198942c7 173 1024,0,1023);
b4da452d 174 hADCCounts->SetXTitle("ADC counts");
175 hADCCounts->SetYTitle("");
c18fe410 176 Int_t index2 = GetHalfringIndex(det, ring, board/16,0);
7d297381 177 Add2RawsList(hADCCounts, index2, !expert, image, !saveCorr);
c18fe410 178
b4da452d 179 }
180 }
181 }
c9dd1c4d 182}
183
184//_____________________________________________________________________
185void AliFMDQADataMakerRec::MakeESDs(AliESDEvent * esd)
186{
187 if(!esd) {
188 AliError("FMD ESD object not found!!") ;
189 return;
190 }
191 AliESDFMD* fmd = esd->GetFMDData();
192 if (!fmd) return;
193
194 for(UShort_t det=1;det<=3;det++) {
195 for (UShort_t ir = 0; ir < 2; ir++) {
196 Char_t ring = (ir == 0 ? 'I' : 'O');
197 UShort_t nsec = (ir == 0 ? 20 : 40);
198 UShort_t nstr = (ir == 0 ? 512 : 256);
199 for(UShort_t sec =0; sec < nsec; sec++) {
200 for(UShort_t strip = 0; strip < nstr; strip++) {
201 Float_t mult = fmd->Multiplicity(det,ring,sec,strip);
202 if(mult == AliESDFMD::kInvalidMult) continue;
203
204 GetESDsData(0)->Fill(mult);
205 }
206 }
207 }
208 }
209}
210
44ed7a66 211
c9dd1c4d 212//_____________________________________________________________________
213void AliFMDQADataMakerRec::MakeDigits(TClonesArray * digits)
214{
215 // makes data from Digits
216 if(!digits) {
ffa78f64 217 AliError("FMD Digit object not found!!") ;
218 return;
c9dd1c4d 219 }
56236ce9 220 for(Int_t i=0;i<digits->GetEntriesFast();i++) {
c9dd1c4d 221 //Raw ADC counts
56236ce9 222 AliFMDDigit* digit = static_cast<AliFMDDigit*>(digits->At(i));
c9dd1c4d 223 GetDigitsData(0)->Fill(digit->Counts());
224 }
225}
226
227//_____________________________________________________________________
228void AliFMDQADataMakerRec::MakeDigits(TTree * digitTree)
229{
230
56236ce9 231 fDigitsArray.Clear();
ffa78f64 232 TBranch* branch = digitTree->GetBranch("FMD");
233 if (!branch) {
c9dd1c4d 234 AliWarning("FMD branch in Digit Tree not found") ;
235 return;
236 }
56236ce9 237 TClonesArray* digitsAddress = &fDigitsArray;
238 branch->SetAddress(&digitsAddress);
ffa78f64 239 branch->GetEntry(0);
56236ce9 240 MakeDigits(digitsAddress);
c9dd1c4d 241}
44ed7a66 242
c9dd1c4d 243//_____________________________________________________________________
86c6cec8 244void AliFMDQADataMakerRec::MakeRaws(AliRawReader* rawReader)
c9dd1c4d 245{
198942c7 246
86c6cec8 247 AliFMDRawReader fmdReader(rawReader,0);
248 TClonesArray* digitsAddress = &fDigitsArray;
3ceaa9ad 249
250 rawReader->Reset();
78328afd 251
c18fe410 252 digitsAddress->Clear();
253 fmdReader.ReadAdcs(digitsAddress);
254 for(Int_t i=0;i<digitsAddress->GetEntriesFast();i++) {
255 //Raw ADC counts
b995fc28 256 AliFMDDigit* digit = static_cast<AliFMDDigit*>(digitsAddress->At(i));
257 UShort_t det = digit->Detector();
258 Char_t ring = digit->Ring();
259 UShort_t sec = digit->Sector();
260 // UShort_t strip = digit->Strip();
261 AliFMDParameters* pars = AliFMDParameters::Instance();
262 Short_t board = pars->GetAltroMap()->Sector2Board(ring, sec);
c18fe410 263
264 Int_t index1 = GetHalfringIndex(det, ring, 0, 1);
265 GetRawsData(index1)->Fill(digit->Counts());
266 Int_t index2 = GetHalfringIndex(det, ring, board/16,0);
267 GetRawsData(index2)->Fill(digit->Counts());
268
269 }
c9dd1c4d 270}
271
272//_____________________________________________________________________
273void AliFMDQADataMakerRec::MakeRecPoints(TTree* clustersTree)
274{
275 // makes data from RecPoints
198942c7 276 AliFMDParameters* pars = AliFMDParameters::Instance();
56236ce9 277 fRecPointsArray.Clear();
c9dd1c4d 278 TBranch *fmdbranch = clustersTree->GetBranch("FMD");
279 if (!fmdbranch) {
280 AliError("can't get the branch with the FMD recpoints !");
281 return;
282 }
283
56236ce9 284 TClonesArray* RecPointsAddress = &fRecPointsArray;
9bd2ccc2 285
56236ce9 286 fmdbranch->SetAddress(&RecPointsAddress);
c9dd1c4d 287 fmdbranch->GetEntry(0);
56236ce9 288 TIter next(RecPointsAddress) ;
c9dd1c4d 289 AliFMDRecPoint * rp ;
290 while ((rp = static_cast<AliFMDRecPoint*>(next()))) {
198942c7 291
292 GetRecPointsData(0)->Fill(rp->Edep()/pars->GetEdepMip()) ;
293
c9dd1c4d 294 }
c9dd1c4d 295
296}
297
298//_____________________________________________________________________
299void AliFMDQADataMakerRec::StartOfDetectorCycle()
300{
301 // What
302 // to
303 // do?
304}
305//_____________________________________________________________________
b4da452d 306Int_t AliFMDQADataMakerRec::GetHalfringIndex(UShort_t det,
307 Char_t ring,
c18fe410 308 UShort_t board,
309 UShort_t monitor) {
b4da452d 310
311 UShort_t iring = (ring == 'I' ? 1 : 0);
312
c18fe410 313 Int_t index = ( ((det-1) << 3) | (iring << 2) | (board << 1) | (monitor << 0));
b4da452d 314
315 return index-2;
316
317}
318
319//_____________________________________________________________________
320
321
c9dd1c4d 322//
323// EOF
324//