]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMDQADataMakerRec.cxx
Added QA code from Hans Hjersing Dalsgaard <canute@nbi.dk>
[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),
53 "FMD Quality Assurance Data Maker")
54{
55 // ctor
56}
57
58//_____________________________________________________________________
59AliFMDQADataMakerRec::AliFMDQADataMakerRec(const AliFMDQADataMakerRec& qadm) :
60 AliQADataMakerRec()
61{
62 //copy ctor
63 // Parameters:
64 // qadm Object to copy from
65
66}
67
68
69//_____________________________________________________________________
70
71void
72AliFMDQADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX task,
73 TObjArray * list)
74{
75 // Detector specific actions at end of cycle
76 // do the QA checking
77 AliLog::Message(5,"FMD: end of detector cycle","AliFMDQADataMakerRec","AliFMDQADataMakerRec","AliFMDQADataMakerRec::EndOfDetectorCycle","AliFMDQADataMakerRec.cxx",95);
78 AliQAChecker::Instance()->Run(AliQA::kFMD, task, list);
79}
80
81//_____________________________________________________________________
82void AliFMDQADataMakerRec::InitESDs()
83{
84 // create Digits histograms in Digits subdir
85 TH1F* hEnergyOfESD = new TH1F("hEnergyOfESD","Energy distribution",100,0,3);
86 hEnergyOfESD->SetXTitle("Edep/Emip");
87 hEnergyOfESD->SetYTitle("Counts");
88 Add2ESDsList(hEnergyOfESD, 0);
89
90}
91
92//_____________________________________________________________________
93void AliFMDQADataMakerRec::InitDigits()
94{
95 // create Digits histograms in Digits subdir
96 TH1I* hADCCounts = new TH1I("hADCCounts","Dist of ADC counts",
97 1024,0,1024);
98 // TH1F* hEnergyOfDigits = new TH1F("hEnergyOfDigits", "Energy distribution",
99 // 100,0,3);
100 hADCCounts->SetXTitle("ADC counts");
101 hADCCounts->SetYTitle("");
102 // hEnergyOfDigits->SetXTitle("Edep/Emip");
103 // hEnergyOfDigits->SetYTitle("Counts");
104 Add2DigitsList(hADCCounts, 0);
105 // Add2DigitsList(hEnergyOfDigits, 1);
106
107}
108
109//_____________________________________________________________________
110void AliFMDQADataMakerRec::InitRecPoints()
111{
112 TH1F* hEnergyOfRecpoints = new TH1F("hEnergyOfRecpoints",
113 "Energy Distribution",100,0,3);
114 hEnergyOfRecpoints->SetXTitle("Edep/Emip");
115 hEnergyOfRecpoints->SetYTitle("");
116 Add2RecPointsList(hEnergyOfRecpoints,0);
117}
118
119//_____________________________________________________________________
120void AliFMDQADataMakerRec::InitRaws()
121{
122
123}
124
125//_____________________________________________________________________
126void AliFMDQADataMakerRec::MakeESDs(AliESDEvent * esd)
127{
128 if(!esd) {
129 AliError("FMD ESD object not found!!") ;
130 return;
131 }
132 AliESDFMD* fmd = esd->GetFMDData();
133 if (!fmd) return;
134
135 for(UShort_t det=1;det<=3;det++) {
136 for (UShort_t ir = 0; ir < 2; ir++) {
137 Char_t ring = (ir == 0 ? 'I' : 'O');
138 UShort_t nsec = (ir == 0 ? 20 : 40);
139 UShort_t nstr = (ir == 0 ? 512 : 256);
140 for(UShort_t sec =0; sec < nsec; sec++) {
141 for(UShort_t strip = 0; strip < nstr; strip++) {
142 Float_t mult = fmd->Multiplicity(det,ring,sec,strip);
143 if(mult == AliESDFMD::kInvalidMult) continue;
144
145 GetESDsData(0)->Fill(mult);
146 }
147 }
148 }
149 }
150}
151
152//_____________________________________________________________________
153void AliFMDQADataMakerRec::MakeDigits(TClonesArray * digits)
154{
155 // makes data from Digits
156 if(!digits) {
157 AliError("FMD Digit object not found!!") ;
158 return;
159 }
160 for(Int_t i=0;i<digits->GetEntries();i++) {
161 //Raw ADC counts
162 AliFMDDigit* digit = static_cast<AliFMDDigit*>(digits->At(i));
163 GetDigitsData(0)->Fill(digit->Counts());
164 }
165}
166
167//_____________________________________________________________________
168void AliFMDQADataMakerRec::MakeDigits(TTree * digitTree)
169{
170
171 TClonesArray* digits = new TClonesArray("AliFMDDigit", 1000) ;
172 TBranch* branch = digitTree->GetBranch("FMD") ;
173 if (!branch ) {
174 AliWarning("FMD branch in Digit Tree not found") ;
175 return;
176 }
177
178 branch->SetAddress(&digits) ;
179 branch->GetEntry(0) ;
180 MakeDigits(digits) ;
181}
182
183//_____________________________________________________________________
184void AliFMDQADataMakerRec::MakeRaws(AliRawReader* rawReader)
185{
186
187}
188
189//_____________________________________________________________________
190void AliFMDQADataMakerRec::MakeRecPoints(TTree* clustersTree)
191{
192 // makes data from RecPoints
193 TBranch *fmdbranch = clustersTree->GetBranch("FMD");
194 if (!fmdbranch) {
195 AliError("can't get the branch with the FMD recpoints !");
196 return;
197 }
198
199 TClonesArray * fmdrecpoints = new TClonesArray("AliFMDRecPoint", 1000) ;
200 fmdbranch->SetAddress(&fmdrecpoints);
201 fmdbranch->GetEntry(0);
202
203 TIter next(fmdrecpoints) ;
204 AliFMDRecPoint * rp ;
205 while ((rp = static_cast<AliFMDRecPoint*>(next()))) {
206 GetRecPointsData(0)->Fill(rp->Particles()) ;
207 }
208 fmdrecpoints->Delete();
209 delete fmdrecpoints;
210
211}
212
213//_____________________________________________________________________
214void AliFMDQADataMakerRec::StartOfDetectorCycle()
215{
216 // What
217 // to
218 // do?
219}
220//_____________________________________________________________________
221//
222// EOF
223//