PMD QA classes
[u/mrichter/AliRoot.git] / PMD / AliPMDQADataMakerRec.cxx
CommitLineData
a9523c3e 1/**************************************************************************
2 * Copyright(c) 1998-1999, 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
16
17/*
18 Produces the data needed to calculate the quality assurance.
19 All data must be mergeable objects.
20 B.K. Nandi
21*/
22
23// --- ROOT system ---
24#include <TClonesArray.h>
25#include <TFile.h>
26#include <TH1F.h>
27#include <TH1I.h>
28#include <TH2F.h>
29
30// --- Standard library ---
31
32// --- AliRoot header files ---
33
34#include "AliESDEvent.h"
35#include "AliLog.h"
36#include "AliPMDQADataMakerRec.h"
37#include "AliQAChecker.h"
38#include "AliPMDrecpoint1.h"
39#include "AliPMDRawStream.h"
40#include "AliPMDddldata.h"
41#include "AliPMDUtility.h"
42#include "AliESDPmdTrack.h"
43//#include "AliPMDRecoParam.h"
44
45ClassImp(AliPMDQADataMakerRec)
46
47//____________________________________________________________________________
48 AliPMDQADataMakerRec::AliPMDQADataMakerRec() :
49 AliQADataMakerRec(AliQA::GetDetName(AliQA::kPMD), "PMD Quality Assurance Data Maker")
50{
51 // ctor
52}
53
54//____________________________________________________________________________
55AliPMDQADataMakerRec::AliPMDQADataMakerRec(const AliPMDQADataMakerRec& qadm) :
56 AliQADataMakerRec()
57{
58 //copy ctor
59 SetName((const char*)qadm.GetName()) ;
60 SetTitle((const char*)qadm.GetTitle());
61}
62
63//__________________________________________________________________
64AliPMDQADataMakerRec& AliPMDQADataMakerRec::operator = (const AliPMDQADataMakerRec& qadm )
65{
66 // Equal operator.
67 this->~AliPMDQADataMakerRec();
68 new(this) AliPMDQADataMakerRec(qadm);
69 return *this;
70}
71
72
73//____________________________________________________________________________
74void AliPMDQADataMakerRec::InitRaws()
75{
76 // create Raws histograms in Raws subdir
77
78 TH1F * h0 = new TH1F("hPreDdl0Edep","DDL0 Energy Distribution PRE(PMD)", 100, 0, 2000);
79 h0->Sumw2();
80 Add2RawsList(h0, 0);
81
82 TH1F * h1 = new TH1F("hPreDdl1Edep","DDL1 Energy Distribution PRE(PMD)", 100, 0, 2000);
83 h1->Sumw2();
84 Add2RawsList(h1, 1);
85
86 TH1F * h2 = new TH1F("hPreDdl2Edep","DDL2 Energy Distribution PRE(PMD)", 100, 0, 2000);
87 h2->Sumw2();
88 Add2RawsList(h2, 2);
89
90 TH1F * h3 = new TH1F("hPreDdl3Edep","DDL3 Energy Distribution PRE(PMD)", 100, 0, 2000);
91 h3->Sumw2();
92 Add2RawsList(h3, 3);
93
94 TH1F * h4 = new TH1F("hCpvDdl4Edep","DDL4 Energy Distribution CPV(PMD)", 100, 0, 2000);
95 h4->Sumw2();
96 Add2RawsList(h4, 4);
97
98 TH1F * h5 = new TH1F("hCpvDdl5Edep","DDL5 Energy Distribution CPV(PMD)", 100, 0, 2000);
99 h5->Sumw2();
100 Add2RawsList(h5, 5);
101
102
103}
104//____________________________________________________________________________
105void AliPMDQADataMakerRec::InitRecPoints()
106{
107 // create Reconstructed Points histograms in RecPoints subdir
108
109/*
110 TH2F * h0 = new TH2F("hPreXY","RecPoints Y vs X PRE(PMD)", 100,-100.,100.,100,-100.,100.);
111 Add2RecPointsList(h0,0) ;
112
113 TH2F * h1 = new TH2F("hCpvXY","RecPoints Y vs X CPV(PMD)", 100,-100.,100.,100,-100.,100.);
114 Add2RecPointsList(h1,1) ;
115*/
116
117 TH1F * h0 = new TH1F("hPreClADC","Cluster ADC of PRE(PMD) plane",500,0.,5000.);
118 h0->Sumw2();
119 Add2RecPointsList(h0, 0) ;
120
121 TH1F * h1 = new TH1F("hCpvClADC","Cluster ADC of CPV(PMD) plane",500,0.,5000.);
122 h1->Sumw2();
123 Add2RecPointsList(h1, 1) ;
124
125
126 TH1I * h2 = new TH1I("hPreClMult","Cluster Multiplicity of PRE(PMD) plane",100,0.,10000.);
127 h2->Sumw2();
128 Add2RecPointsList(h2, 2) ;
129
130 TH1I * h3 = new TH1I("hCpvClMult","Cluster Multiplicity of CPV(PMD) plane",100,0.,10000.);
131 h3->Sumw2();
132 Add2RecPointsList(h3, 3) ;
133
134
135}
136
137//____________________________________________________________________________
138
139void AliPMDQADataMakerRec::InitESDs()
140{
141 //Create histograms to controll ESD
142
143 TH1F * h0 = new TH1F("hPreClADC","Cluster ADC of PRE(PMD) plane",500,0.,5000.);
144 h0->Sumw2();
145 Add2ESDsList(h0, 0) ;
146
147 TH1F * h1 = new TH1F("hCpvClADC","Cluster ADC of CPV(PMD) plane",500,0.,5000.);
148 h1->Sumw2();
149 Add2ESDsList(h1, 1) ;
150
151 TH1I * h2 = new TH1I("hPreClMult","Cluster Multiplicity of PRE(PMD) plane",100,0.,10000.);
152 h2->Sumw2();
153 Add2ESDsList(h2, 2) ;
154
155 TH1I * h3 = new TH1I("hCpvClMult","Cluster Multiplicity of CPV(PMD) plane",100,0.,10000.);
156 h3->Sumw2();
157 Add2ESDsList(h3, 3) ;
158
159}
160
161//____________________________________________________________________________
162void AliPMDQADataMakerRec::MakeRaws(AliRawReader* rawReader)
163{
164 //Fill prepared histograms with Raw digit properties
165
166 TObjArray pmdddlcont;
167 AliPMDRawStream stream(rawReader);
168
169
170
171 Int_t iddl = -1;
172 while ((iddl = stream.DdlData(&pmdddlcont)) >=0)
173 {
174 Int_t ientries = pmdddlcont.GetEntries();
175 //printf(" ======= DDLNO = %d ientries = %d \n", iddl, ientries);
176 for (Int_t ient = 0; ient < ientries; ient++)
177 {
178 AliPMDddldata *pmdddl = (AliPMDddldata*)pmdddlcont.UncheckedAt(ient);
179 //Int_t det = pmdddl->GetDetector();
180 //Int_t smn = pmdddl->GetSMN();
181 //Int_t mcm = pmdddl->GetMCM();
182 //Int_t chno = pmdddl->GetChannel();
183 //Int_t row = pmdddl->GetRow();
184 //Int_t col = pmdddl->GetColumn();
185 Int_t sig = pmdddl->GetSignal();
186 //cout<<sig<<endl;
187
188 if (iddl == 0) GetRawsData(0)->Fill(sig);
189 if (iddl == 1) GetRawsData(1)->Fill(sig);
190 if (iddl == 2) GetRawsData(2)->Fill(sig);
191 if (iddl == 3) GetRawsData(3)->Fill(sig);
192 if (iddl == 4) GetRawsData(4)->Fill(sig);
193 if (iddl == 5) GetRawsData(5)->Fill(sig);
194
195
196 }
197
198 pmdddlcont.Delete();
199 }
200}
201//____________________________________________________________________________
202void AliPMDQADataMakerRec::MakeRecPoints(TTree * clustersTree)
203{
204 // makes data from RecPoints
205
206 Int_t premul = 0, cpvmul = 0;
207 AliPMDrecpoint1 * recpoint;
208
209 TClonesArray * recpoints = new TClonesArray("AliPMDrecpoint1", 1000) ;
210
211 TBranch * branch = clustersTree->GetBranch("PMDRecpoint") ;
212 branch->SetAddress(&recpoints) ;
213
214 if ( ! branch )
215 {
216 AliWarning("PMD branch in SDigit Tree not found") ;
217 }
218 else
219 {
220 for (Int_t imod = 0; imod < branch->GetEntries(); imod++)
221 {
222 branch->GetEntry(imod) ;
223
224 TIter next(recpoints) ;
225
226 while ( (recpoint = dynamic_cast<AliPMDrecpoint1 *>(next())) )
227 {
228 //Float_t xpos = recpoint->GetClusX();
229 //Float_t ypos = recpoint->GetClusY();
230 if(recpoint->GetDetector() == 0)
231 {
232 GetRecPointsData(0)->Fill(recpoint->GetClusADC());
233 premul++;
234 }
235 if(recpoint->GetDetector() == 1)
236 {
237 GetRecPointsData(1)->Fill(recpoint->GetClusADC());
238 cpvmul++;
239 }
240
241 }
242
243 }
244 }
245
246 GetRecPointsData(2)->Fill(premul);
247 GetRecPointsData(3)->Fill(cpvmul);
248}
249
250//____________________________________________________________________________
251
252void AliPMDQADataMakerRec::MakeESDs(AliESDEvent * esd)
253{
254 // make QA data from ESDs
255
256 Int_t premul = 0, cpvmul = 0;
257 for (Int_t icl = 0; icl < esd->GetNumberOfPmdTracks(); icl++)
258 {
259 AliESDPmdTrack *pmdtr = esd->GetPmdTrack(icl);
260
261 //Int_t det = pmdtr->GetDetector();
262 //Float_t clsX = pmdtr->GetClusterX();
263 //Float_t clsY = pmdtr->GetClusterY();
264 //Float_t clsZ = pmdtr->GetClusterZ();
265 //Float_t ncell = pmdtr->GetClusterCells();
266 Float_t adc = pmdtr->GetClusterADC();
267 //Float_t pid = pmdtr->GetClusterPID();
268
269 if (pmdtr->GetDetector() == 0)
270 {
271 GetESDsData(0)->Fill(adc);
272 premul++;
273 }
274 if (pmdtr->GetDetector() == 1)
275 {
276 GetESDsData(1)->Fill(adc) ;
277 cpvmul++;
278 }
279 }
280
281 GetESDsData(2)->Fill(premul) ;
282 GetESDsData(3)->Fill(cpvmul) ;
283}
284
285//____________________________________________________________________________
286
287void AliPMDQADataMakerRec::StartOfDetectorCycle()
288{
289 //Detector specific actions at start of cycle
290
291}
292//____________________________________________________________________________
293void AliPMDQADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray * list)
294{
295 //Detector specific actions at end of cycle
296 // do the QA checking
297 AliQAChecker::Instance()->Run(AliQA::kPMD, task, list) ;
298}