]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSQADataMakerSim.cxx
Fix
[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
80b9610c 57 // Initialization for each subdetector
8dc34e37 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");
92664bc8 108 ResetEventTrigClasses(); // reset triggers list to select all histos
109 ResetEvCountCycle();
110 //
8dc34e37 111 if(fSubDetector == 0 || fSubDetector == 1) fSPDDataMaker->StartOfDetectorCycle();
8dc34e37 112 if(fSubDetector == 0 || fSubDetector == 2) fSDDDataMaker->StartOfDetectorCycle();
113 if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->StartOfDetectorCycle();
04236e67 114}
115
116//____________________________________________________________________________
4e25ac79 117void AliITSQADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray** list)
04236e67 118{
92664bc8 119 //
80b9610c 120 AliInfo(Form("End of Dedetctor Cycle called for %s\n",AliQAv1::GetTaskName(task).Data() ));
92664bc8 121 ResetEventTrigClasses(); // reset triggers list to select all histos
122 //
04236e67 123 // launch the QA checking
57acd2d2 124 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
92664bc8 125 if (! IsValidEventSpecie(specie, list) ) continue;
126 SetEventSpecie(AliRecoParam::ConvertIndex(specie));
127 //
128 Int_t idnumber=list[specie]->GetUniqueID();
129 //printf("specie %s \t id number == %d\n",AliRecoParam::GetEventSpecieName(specie),idnumber);
130 if(idnumber==0) {
131 //AliInfo(Form("No check for %s\n",AliQAv1::GetTaskName(task).Data() ))
132 continue;
133 } //skip kDigitsR and not filled TobjArray specie
80b9610c 134 else{
92664bc8 135 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSDM instantiates checker with Run(AliQAv1::kITS, task, list)\n");
136 if(fSubDetector == 0 || fSubDetector == 1) fSPDDataMaker->EndOfDetectorCycle(task, list); //[specie]);
137 if(fSubDetector == 0 || fSubDetector == 2) fSDDDataMaker->EndOfDetectorCycle(task, list); //[specie]);
138 if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->EndOfDetectorCycle(task, list); //[specie]);
139 //
140 AliQAChecker *qac = AliQAChecker::Instance();
141 AliITSQAChecker *qacb = (AliITSQAChecker *) qac->GetDetQAChecker(0);
142 Int_t subdet=GetSubDet();
143 qacb->SetSubDet(subdet);
144
145 if(subdet== 0 ){
146 qacb->SetTaskOffset(fSPDDataMaker->GetOffset(task,specie),fSDDDataMaker->GetOffset(task,specie),fSSDDataMaker->GetOffset(task,specie)); //Setting the offset for the QAChecker list
80b9610c 147 qacb->SetHisto(fSPDDataMaker->GetTaskHisto(task), fSDDDataMaker->GetTaskHisto(task), fSSDDataMaker->GetTaskHisto(task));
92664bc8 148 }
149 else
150 if(subdet!=0){
151 Int_t offset=GetDetTaskOffset(subdet, task);
152 qacb->SetDetTaskOffset(subdet,offset);
153 Int_t histo=GetDetTaskHisto(subdet, task);
154 qacb->SetDetHisto(subdet,histo);
80b9610c 155 }
92664bc8 156 qac->Run( AliQAv1::kITS , task, list);
157 }//end else unique id
80b9610c 158 }//end for
04236e67 159}
160
8dc34e37 161//____________________________________________________________________________
162void AliITSQADataMakerSim::InitDigits()
163{
80b9610c 164
9b94f977 165 // Initialization for Digits data
80b9610c 166 fDigitsQAList[AliRecoParam::AConvert(fEventSpecie)]->SetUniqueID(60);
9b94f977 167 if(fSubDetector == 0 || fSubDetector == 1) {
168 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM:: SPD InitDigits\n");
169
170 fSPDDataMaker->InitDigits();
171 }
172 if(fSubDetector == 0 || fSubDetector == 2) {
173 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM:: SDD InitDigits\n");
174
175 fSDDDataMaker->SetOffset(AliQAv1::kDIGITS, fDigitsQAList[AliRecoParam::AConvert(fEventSpecie)]->GetEntries(),AliRecoParam::AConvert(fEventSpecie));
176 fSDDDataMaker->InitDigits();
177 }
178 if(fSubDetector == 0 || fSubDetector == 3) {
179 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM:: SSD InitDigits\n");
180
181 fSSDDataMaker->SetOffset(AliQAv1::kDIGITS, fDigitsQAList[AliRecoParam::AConvert(fEventSpecie)]->GetEntries(),AliRecoParam::AConvert(fEventSpecie));
182 fSSDDataMaker->InitDigits();
183 }
92664bc8 184 //
185 ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
8dc34e37 186}
187
188//____________________________________________________________________________
6252ceeb 189void AliITSQADataMakerSim::MakeDigits()
8dc34e37 190{
eca4fa66 191 // Fill QA for digits
92664bc8 192 if(fSubDetector == 0 || fSubDetector == 1) fSPDDataMaker->MakeDigits();
193 if(fSubDetector == 0 || fSubDetector == 2) fSDDDataMaker->MakeDigits();
6252ceeb 194 if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->MakeDigits();
92664bc8 195 //
196 IncEvCountCycleDigits();
197 IncEvCountTotalDigits();
198 //
8dc34e37 199}
200
201//____________________________________________________________________________
202void AliITSQADataMakerSim::MakeDigits(TTree * digits)
203{
eca4fa66 204 // Fill QA for digits
92664bc8 205 if(fSubDetector == 0 || fSubDetector == 1) fSPDDataMaker->MakeDigits(digits);
206 if(fSubDetector == 0 || fSubDetector == 2) fSDDDataMaker->MakeDigits(digits);
8dc34e37 207 if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->MakeDigits(digits);
92664bc8 208 //
209 IncEvCountCycleDigits();
210 IncEvCountTotalDigits();
211 //
8dc34e37 212}
213
214//____________________________________________________________________________
215void AliITSQADataMakerSim::InitSDigits()
216{
9b94f977 217 // Initialization for SDigits
80b9610c 218 fSDigitsQAList[AliRecoParam::AConvert(fEventSpecie)]->SetUniqueID(70);
8dc34e37 219 if(fSubDetector == 0 || fSubDetector == 1) {
5379c4a3 220 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM:: SPD InitSDigits\n");
4a903927 221
8dc34e37 222 fSPDDataMaker->InitSDigits();
223 }
4a903927 224 if(fSubDetector == 0 || fSubDetector == 2){
5379c4a3 225 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM:: SDD InitSDigits\n");
4a903927 226
227 fSDDDataMaker->SetOffset(AliQAv1::kSDIGITS, fSDigitsQAList [AliRecoParam::AConvert(fEventSpecie)]->GetEntries(),AliRecoParam::AConvert(fEventSpecie));
228 fSDDDataMaker->InitSDigits();
8dc34e37 229 }
230 if(fSubDetector == 0 || fSubDetector == 3) {
5379c4a3 231 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM:: SSD InitSDigits\n");
4a903927 232
233 fSSDDataMaker->SetOffset(AliQAv1::kSDIGITS, fSDigitsQAList [AliRecoParam::AConvert(fEventSpecie)]->GetEntries(),AliRecoParam::AConvert(fEventSpecie));
234 fSSDDataMaker->InitSDigits();
8dc34e37 235 }
92664bc8 236 //
237 ClonePerTrigClass(AliQAv1::kSDIGITS); // this should be the last line
8dc34e37 238}
239
240//____________________________________________________________________________
6252ceeb 241void AliITSQADataMakerSim::MakeSDigits()
8dc34e37 242{
9b94f977 243 // Fill QA for sdigits
92664bc8 244 if(fSubDetector == 0 || fSubDetector == 1) fSPDDataMaker->MakeSDigits();
245 if(fSubDetector == 0 || fSubDetector == 2) fSDDDataMaker->MakeSDigits();
6252ceeb 246 if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->MakeSDigits();
92664bc8 247 //
248 IncEvCountCycleSDigits();
249 IncEvCountTotalSDigits();
250 //
8dc34e37 251}
252
253//____________________________________________________________________________
254void AliITSQADataMakerSim::MakeSDigits(TTree * sdigits)
255{
256 // Fill QA for recpoints
92664bc8 257 if(fSubDetector == 0 || fSubDetector == 1) fSPDDataMaker->MakeSDigits(sdigits);
258 if(fSubDetector == 0 || fSubDetector == 2) fSDDDataMaker->MakeSDigits(sdigits);
8dc34e37 259 if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->MakeSDigits(sdigits);
92664bc8 260 //
261 IncEvCountCycleSDigits();
262 IncEvCountTotalSDigits();
263 //
8dc34e37 264}
265
266//____________________________________________________________________________
267void AliITSQADataMakerSim::InitHits()
268{
eca4fa66 269 // Initialization for hits
9b94f977 270 fHitsQAList[AliRecoParam::AConvert(fEventSpecie)]->SetUniqueID(50);
8dc34e37 271 if(fSubDetector == 0 || fSubDetector == 1) {
5379c4a3 272 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM:: SPD InitHits\n");
8dc34e37 273 fSPDDataMaker->InitHits();
274 }
275 if(fSubDetector == 0 || fSubDetector == 2) {
5379c4a3 276 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM:: SDD InitHits\n");
4a903927 277
278 fSDDDataMaker->SetOffset(AliQAv1::kHITS, fHitsQAList[AliRecoParam::AConvert(fEventSpecie)]->GetEntries(),AliRecoParam::AConvert(fEventSpecie));
279 fSDDDataMaker->InitHits();
8dc34e37 280 }
281 if(fSubDetector == 0 || fSubDetector == 3) {
5379c4a3 282 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM:: SSD InitHits\n");
4a903927 283
284 fSSDDataMaker->SetOffset(AliQAv1::kHITS, fHitsQAList[AliRecoParam::AConvert(fEventSpecie)]->GetEntries(),AliRecoParam::AConvert(fEventSpecie));
285 fSSDDataMaker->InitHits();
8dc34e37 286 }
92664bc8 287 //
288 ClonePerTrigClass(AliQAv1::kHITS); // this should be the last line
8dc34e37 289}
290
291//____________________________________________________________________________
6252ceeb 292void AliITSQADataMakerSim::MakeHits()
8dc34e37 293{
eca4fa66 294 // Fill QA for hits
92664bc8 295 if(fSubDetector == 0 || fSubDetector == 1) fSPDDataMaker->MakeHits();
296 if(fSubDetector == 0 || fSubDetector == 2) fSDDDataMaker->MakeHits();
6252ceeb 297 if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->MakeHits();
92664bc8 298 //
299 IncEvCountCycleHits();
300 IncEvCountTotalHits();
301 //
8dc34e37 302}
303
304//____________________________________________________________________________
305void AliITSQADataMakerSim::MakeHits(TTree * hits)
306{
eca4fa66 307 // Fill QA for hits
92664bc8 308 if(fSubDetector == 0 || fSubDetector == 1) fSPDDataMaker->MakeHits(hits);
309 if(fSubDetector == 0 || fSubDetector == 2) fSDDDataMaker->MakeHits(hits);
8dc34e37 310 if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->MakeHits(hits);
92664bc8 311 //
312 IncEvCountCycleHits();
313 IncEvCountTotalHits();
314 //
8dc34e37 315}
614c7e17 316
317//_________________________________________________________________
4e25ac79 318Int_t AliITSQADataMakerSim::GetDetTaskOffset(Int_t subdet,AliQAv1::TASKINDEX_t task)
614c7e17 319{
9b94f977 320
321 //return the offset for each subdetector
614c7e17 322 switch(subdet)
323 {
614c7e17 324 Int_t offset;
325 case 1:
326 offset=fSPDDataMaker->GetOffset(task);
327 return offset;
328 break;
329 case 2:
330 offset=fSDDDataMaker->GetOffset(task);
331 return offset;
332 break;
333 case 3:
334 offset=fSSDDataMaker->GetOffset(task);
335 return offset;
336 break;
337 default:
338 AliWarning("No specific subdetector (SPD, SDD, SSD) selected!! Offset set to zero \n");
339 offset=0;
340 return offset;
341 break;
342 }
343 //return offset;
344}
80b9610c 345
346//_________________________________________________________________
347Int_t AliITSQADataMakerSim::GetDetTaskHisto(Int_t subdet,AliQAv1::TASKINDEX_t task)
348{
9b94f977 349 //return of the number of histograms for each task and for each sub detector
80b9610c 350 switch(subdet)
351 {
352
353 Int_t histo;
354 case 1:
355 histo=fSPDDataMaker->GetOffset(task);
356 return histo;
357 break;
358 case 2:
359 histo=fSDDDataMaker->GetOffset(task);
360 return histo;
361 break;
362 case 3:
363 histo=fSSDDataMaker->GetOffset(task);
364 return histo;
365 break;
366 default:
367 AliWarning("No specific subdetector (SPD, SDD, SSD) selected!! Offset set to zero \n");
368 histo=0;
369 return histo;
370 break;
371 }
372 //return offset;
373}