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