1.The QA data created on demand according to the event species at filling time. 2...
[u/mrichter/AliRoot.git] / ITS / AliITSQADataMakerSim.cxx
CommitLineData
04236e67 1/**************************************************************************
2 * Copyright(c) 2007-2009, 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/* $Id$ */
17
18// *************************************************************
19// Checks the quality assurance
20// by comparing with reference data
21// contained in a DB
22// -------------------------------------------------------------
8dc34e37 23// W. Ferrarese + P. Cerello Feb 2008
04236e67 24// INFN Torino
25
26// --- ROOT system ---
04236e67 27#include <TTree.h>
57acd2d2 28#include <TMath.h>
04236e67 29// --- Standard library ---
30
31// --- AliRoot header files ---
32#include "AliITSQADataMakerSim.h"
8dc34e37 33#include "AliITSQASPDDataMakerSim.h"
34#include "AliITSQASDDDataMakerSim.h"
35#include "AliITSQASSDDataMakerSim.h"
04236e67 36#include "AliLog.h"
4e25ac79 37#include "AliQAv1.h"
04236e67 38#include "AliQAChecker.h"
5dfa9b71 39#include "AliITSQAChecker.h"
8dc34e37 40#include "AliRawReader.h"
04236e67 41
42ClassImp(AliITSQADataMakerSim)
43
44//____________________________________________________________________________
8dc34e37 45AliITSQADataMakerSim::AliITSQADataMakerSim(Short_t subDet) :
4e25ac79 46AliQADataMakerSim(AliQAv1::GetDetName(AliQAv1::kITS), "ITS Quality Assurance Data Maker"),
8dc34e37 47fSubDetector(subDet),
48fSPDDataMaker(NULL),
49fSDDDataMaker(NULL),
50fSSDDataMaker(NULL)
51{
52 //ctor used to discriminate OnLine-Offline analysis
53 if(fSubDetector < 0 || fSubDetector > 3) {
54 AliError("Error: fSubDetector number out of range; return\n");
55 }
56
57 // Initialization for RAW data
58 if(fSubDetector == 0 || fSubDetector == 1) {
5379c4a3 59 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM::Create SPD DataMakerSim\n");
8dc34e37 60 fSPDDataMaker = new AliITSQASPDDataMakerSim(this);
61 }
62 if(fSubDetector == 0 || fSubDetector == 2) {
5379c4a3 63 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM::Create SDD DataMakerSim\n");
8dc34e37 64 //printf("AliITSQADM::Create SDD DataMakerSim\n");
65 fSDDDataMaker = new AliITSQASDDDataMakerSim(this);
66 }
67 if(fSubDetector == 0 || fSubDetector == 3) {
5379c4a3 68 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM::Create SSD DataMakerSim\n");
8dc34e37 69 fSSDDataMaker = new AliITSQASSDDataMakerSim(this);
70 }
04236e67 71}
72
73//____________________________________________________________________________
8dc34e37 74AliITSQADataMakerSim::~AliITSQADataMakerSim(){
75 // destructor
76 if(fSPDDataMaker)delete fSPDDataMaker;
77 if(fSDDDataMaker)delete fSDDDataMaker;
78 if(fSSDDataMaker)delete fSSDDataMaker;
04236e67 79}
80
81//____________________________________________________________________________
82AliITSQADataMakerSim::AliITSQADataMakerSim(const AliITSQADataMakerSim& qadm) :
8dc34e37 83AliQADataMakerSim(),
84fSubDetector(qadm.fSubDetector),
85fSPDDataMaker(NULL),
86fSDDDataMaker(NULL),
87fSSDDataMaker(NULL)
04236e67 88{
89 //copy ctor
90 SetName((const char*)qadm.GetName()) ;
8dc34e37 91 SetTitle((const char*)qadm.GetTitle());
04236e67 92}
93
94//__________________________________________________________________
95AliITSQADataMakerSim& AliITSQADataMakerSim::operator = (const AliITSQADataMakerSim& qac )
96{
97 // Equal operator.
98 this->~AliITSQADataMakerSim();
99 new(this) AliITSQADataMakerSim(qac);
100 return *this;
101}
102
103//____________________________________________________________________________
85f5e9c2 104void AliITSQADataMakerSim::StartOfDetectorCycle()
04236e67 105{
106 //Detector specific actions at start of cycle
5379c4a3 107 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM::Start of ITS Cycle\n");
8dc34e37 108
109 if(fSubDetector == 0 || fSubDetector == 1) fSPDDataMaker->StartOfDetectorCycle();
8dc34e37 110 if(fSubDetector == 0 || fSubDetector == 2) fSDDDataMaker->StartOfDetectorCycle();
111 if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->StartOfDetectorCycle();
04236e67 112}
113
114//____________________________________________________________________________
4e25ac79 115void AliITSQADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray** list)
04236e67 116{
117 // launch the QA checking
57acd2d2 118 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
5379c4a3 119 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSDM instantiates checker with Run(AliQAv1::kITS, task, list)\n");
57acd2d2 120 if(fSubDetector == 0 || fSubDetector == 1) fSPDDataMaker->EndOfDetectorCycle(task, list[specie]);
121 if(fSubDetector == 0 || fSubDetector == 2) fSDDDataMaker->EndOfDetectorCycle(task, list[specie]);
122 if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->EndOfDetectorCycle(task, list[specie]);
04236e67 123
8bb2fdfd 124
125 AliQAChecker *qac = AliQAChecker::Instance();
126 AliITSQAChecker *qacb = (AliITSQAChecker *) qac->GetDetQAChecker(0);
127 Int_t subdet=GetSubDet();
128 qacb->SetSubDet(subdet);
614c7e17 129
8bb2fdfd 130 if(subdet== 0 ){
131 qacb->SetTaskOffset(fSPDDataMaker->GetOffset(task),fSDDDataMaker->GetOffset(task),fSSDDataMaker->GetOffset(task)); //Setting the offset for the QAChecker list
614c7e17 132 }
8bb2fdfd 133 else
134 if(subdet!=0){
135 Int_t offset=GetDetTaskOffset(subdet, task);
136 qacb->SetDetTaskOffset(subdet,offset);
137 }
4e25ac79 138 qac->Run( AliQAv1::kITS , task, list);
8bb2fdfd 139 }
04236e67 140}
141
8dc34e37 142//____________________________________________________________________________
143void AliITSQADataMakerSim::InitDigits()
144{
145 // Initialization for RAW data
146 if(fSubDetector == 0 || fSubDetector == 1) {
5379c4a3 147 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM:: SPD InitDigits\n");
8dc34e37 148 fSPDDataMaker->InitDigits();
149 }
150 if(fSubDetector == 0 || fSubDetector == 2) {
5379c4a3 151 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM:: SDD InitDigits\n");
8dc34e37 152 fSDDDataMaker->InitDigits();
153 }
154 if(fSubDetector == 0 || fSubDetector == 3) {
5379c4a3 155 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM:: SSD InitDigits\n");
8dc34e37 156 fSSDDataMaker->InitDigits();
157 }
158}
159
160//____________________________________________________________________________
161void AliITSQADataMakerSim::MakeDigits(TClonesArray * digits)
162{
eca4fa66 163 // Fill QA for digits
164 if(fSubDetector == 0 || fSubDetector == 1) {
165 Int_t rv = fSPDDataMaker->MakeDigits(digits) ;
166 if ( rv != 0 )
167 fSDDDataMaker->SetOffset(AliQAv1::kDIGITS, fDigitsQAList [AliRecoParam::AConvert(fEventSpecie)]->GetEntries());
168 }
169
170 if(fSubDetector == 0 || fSubDetector == 2) {
171 Int_t rv = fSDDDataMaker->MakeDigits(digits) ;
172 if ( rv != 0 )
173 fSSDDataMaker->SetOffset(AliQAv1::kDIGITS, fDigitsQAList [AliRecoParam::AConvert(fEventSpecie)]->GetEntries());
174 }
175
8dc34e37 176 if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->MakeDigits(digits);
177}
178
179//____________________________________________________________________________
180void AliITSQADataMakerSim::MakeDigits(TTree * digits)
181{
eca4fa66 182 // Fill QA for digits
183 if(fSubDetector == 0 || fSubDetector == 1) {
184 Int_t rv = fSPDDataMaker->MakeDigits(digits) ;
185 if ( rv != 0 )
186 fSDDDataMaker->SetOffset(AliQAv1::kDIGITS, fDigitsQAList [AliRecoParam::AConvert(fEventSpecie)]->GetEntries());
187 }
188
189 if(fSubDetector == 0 || fSubDetector == 2){
190 Int_t rv = fSDDDataMaker->MakeDigits(digits) ;
191 if ( rv != 0 )
192 fSSDDataMaker->SetOffset(AliQAv1::kDIGITS, fDigitsQAList [AliRecoParam::AConvert(fEventSpecie)]->GetEntries());
193 }
194
8dc34e37 195 if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->MakeDigits(digits);
196}
197
198//____________________________________________________________________________
199void AliITSQADataMakerSim::InitSDigits()
200{
201 // Initialization for RECPOINTS
202 if(fSubDetector == 0 || fSubDetector == 1) {
5379c4a3 203 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM:: SPD InitSDigits\n");
8dc34e37 204 fSPDDataMaker->InitSDigits();
205 }
206 if(fSubDetector == 0 || fSubDetector == 2) {
5379c4a3 207 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM:: SDD InitSDigits\n");
8dc34e37 208 fSDDDataMaker->InitSDigits();
209 }
210 if(fSubDetector == 0 || fSubDetector == 3) {
5379c4a3 211 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM:: SSD InitSDigits\n");
8dc34e37 212 fSSDDataMaker->InitSDigits();
213 }
214}
215
216//____________________________________________________________________________
217void AliITSQADataMakerSim::MakeSDigits(TClonesArray * sdigits)
218{
219 // Fill QA for recpoints
eca4fa66 220 if(fSubDetector == 0 || fSubDetector == 1){
221 Int_t rv = fSPDDataMaker->MakeSDigits(sdigits) ;
222 if ( rv != 0 )
223 fSDDDataMaker->SetOffset(AliQAv1::kSDIGITS, fSDigitsQAList [AliRecoParam::AConvert(fEventSpecie)]->GetEntries());
224 }
225
226 if(fSubDetector == 0 || fSubDetector == 2) {
227 Int_t rv = fSDDDataMaker->MakeSDigits(sdigits) ;
228 if ( rv != 0 )
229 fSSDDataMaker->SetOffset(AliQAv1::kSDIGITS, fSDigitsQAList [AliRecoParam::AConvert(fEventSpecie)]->GetEntries());
230 }
231
8dc34e37 232 if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->MakeSDigits(sdigits);
233}
234
235//____________________________________________________________________________
236void AliITSQADataMakerSim::MakeSDigits(TTree * sdigits)
237{
238 // Fill QA for recpoints
eca4fa66 239 if(fSubDetector == 0 || fSubDetector == 1){
240 Int_t rv = fSPDDataMaker->MakeSDigits(sdigits) ;
241 if ( rv != 0 )
242 fSDDDataMaker->SetOffset(AliQAv1::kSDIGITS, fSDigitsQAList [AliRecoParam::AConvert(fEventSpecie)]->GetEntries());
243 }
244
245 if(fSubDetector == 0 || fSubDetector == 2){
246 Int_t rv = fSDDDataMaker->MakeSDigits(sdigits) ;
247 if ( rv != 0 )
248 fSSDDataMaker->SetOffset(AliQAv1::kSDIGITS, fSDigitsQAList [AliRecoParam::AConvert(fEventSpecie)]->GetEntries());
249 }
250
8dc34e37 251 if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->MakeSDigits(sdigits);
252}
253
254//____________________________________________________________________________
255void AliITSQADataMakerSim::InitHits()
256{
eca4fa66 257 // Initialization for hits
8dc34e37 258 if(fSubDetector == 0 || fSubDetector == 1) {
5379c4a3 259 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM:: SPD InitHits\n");
8dc34e37 260 fSPDDataMaker->InitHits();
261 }
262 if(fSubDetector == 0 || fSubDetector == 2) {
5379c4a3 263 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM:: SDD InitHits\n");
8dc34e37 264 fSDDDataMaker->InitHits();
265 }
266 if(fSubDetector == 0 || fSubDetector == 3) {
5379c4a3 267 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM:: SSD InitHits\n");
8dc34e37 268 fSSDDataMaker->InitHits();
269 }
270}
271
272//____________________________________________________________________________
273void AliITSQADataMakerSim::MakeHits(TClonesArray * hits)
274{
eca4fa66 275 // Fill QA for hits
276 if(fSubDetector == 0 || fSubDetector == 1) {
277 Int_t rv = fSPDDataMaker->MakeHits(hits) ;
278 if ( rv != 0 )
279 fSDDDataMaker->SetOffset(AliQAv1::kHITS, fHitsQAList [AliRecoParam::AConvert(fEventSpecie)]->GetEntries());
280 }
281
282 if(fSubDetector == 0 || fSubDetector == 2) {
283 Int_t rv = fSDDDataMaker->MakeHits(hits) ;
284 if ( rv != 0 )
285 fSSDDataMaker->SetOffset(AliQAv1::kHITS, fHitsQAList [AliRecoParam::AConvert(fEventSpecie)]->GetEntries());
286 }
287
8dc34e37 288 if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->MakeHits(hits);
289}
290
291//____________________________________________________________________________
292void AliITSQADataMakerSim::MakeHits(TTree * hits)
293{
eca4fa66 294 // Fill QA for hits
295 if(fSubDetector == 0 || fSubDetector == 1) {
296 Int_t rv = fSPDDataMaker->MakeHits(hits) ;
297 if ( rv != 0 )
298 fSDDDataMaker->SetOffset(AliQAv1::kHITS, fHitsQAList [AliRecoParam::AConvert(fEventSpecie)]->GetEntries());
299 }
300 if(fSubDetector == 0 || fSubDetector == 2) {
301 Int_t rv = fSDDDataMaker->MakeHits(hits) ;
302 if ( rv != 0 )
303 fSSDDataMaker->SetOffset(AliQAv1::kHITS, fHitsQAList [AliRecoParam::AConvert(fEventSpecie)]->GetEntries());
304 }
305
8dc34e37 306 if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->MakeHits(hits);
307}
614c7e17 308
309//_________________________________________________________________
4e25ac79 310Int_t AliITSQADataMakerSim::GetDetTaskOffset(Int_t subdet,AliQAv1::TASKINDEX_t task)
614c7e17 311{
312 switch(subdet)
313 {
314
315 Int_t offset;
316 case 1:
317 offset=fSPDDataMaker->GetOffset(task);
318 return offset;
319 break;
320 case 2:
321 offset=fSDDDataMaker->GetOffset(task);
322 return offset;
323 break;
324 case 3:
325 offset=fSSDDataMaker->GetOffset(task);
326 return offset;
327 break;
328 default:
329 AliWarning("No specific subdetector (SPD, SDD, SSD) selected!! Offset set to zero \n");
330 offset=0;
331 return offset;
332 break;
333 }
334 //return offset;
335}