Fixes for bug #49914: Compilation breaks in trunk, and bug #48629: Trunk cannot read...
[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) {
59 AliDebug(1,"AliITSQADM::Create SPD DataMakerSim\n");
60 fSPDDataMaker = new AliITSQASPDDataMakerSim(this);
61 }
62 if(fSubDetector == 0 || fSubDetector == 2) {
63 AliDebug(1,"AliITSQADM::Create SDD DataMakerSim\n");
64 //printf("AliITSQADM::Create SDD DataMakerSim\n");
65 fSDDDataMaker = new AliITSQASDDDataMakerSim(this);
66 }
67 if(fSubDetector == 0 || fSubDetector == 3) {
68 AliDebug(1,"AliITSQADM::Create SSD DataMakerSim\n");
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
107 AliDebug(1,"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++) {
119 SetEventSpecie(specie) ;
4e25ac79 120 AliDebug(1,"AliITSDM instantiates checker with Run(AliQAv1::kITS, task, list)\n");
57acd2d2 121 if(fSubDetector == 0 || fSubDetector == 1) fSPDDataMaker->EndOfDetectorCycle(task, list[specie]);
122 if(fSubDetector == 0 || fSubDetector == 2) fSDDDataMaker->EndOfDetectorCycle(task, list[specie]);
123 if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->EndOfDetectorCycle(task, list[specie]);
04236e67 124
8bb2fdfd 125
126 AliQAChecker *qac = AliQAChecker::Instance();
127 AliITSQAChecker *qacb = (AliITSQAChecker *) qac->GetDetQAChecker(0);
128 Int_t subdet=GetSubDet();
129 qacb->SetSubDet(subdet);
614c7e17 130
8bb2fdfd 131 if(subdet== 0 ){
132 qacb->SetTaskOffset(fSPDDataMaker->GetOffset(task),fSDDDataMaker->GetOffset(task),fSSDDataMaker->GetOffset(task)); //Setting the offset for the QAChecker list
614c7e17 133 }
8bb2fdfd 134 else
135 if(subdet!=0){
136 Int_t offset=GetDetTaskOffset(subdet, task);
137 qacb->SetDetTaskOffset(subdet,offset);
138 }
4e25ac79 139 qac->Run( AliQAv1::kITS , task, list);
8bb2fdfd 140 }
04236e67 141}
142
8dc34e37 143//____________________________________________________________________________
144void AliITSQADataMakerSim::InitDigits()
145{
146 // Initialization for RAW data
147 if(fSubDetector == 0 || fSubDetector == 1) {
148 AliDebug(1,"AliITSQADM:: SPD InitDigits\n");
149 fSPDDataMaker->InitDigits();
150 }
151 if(fSubDetector == 0 || fSubDetector == 2) {
152 AliDebug(1,"AliITSQADM:: SDD InitDigits\n");
8dc34e37 153 fSDDDataMaker->InitDigits();
154 }
155 if(fSubDetector == 0 || fSubDetector == 3) {
156 AliDebug(1,"AliITSQADM:: SSD InitDigits\n");
157 fSSDDataMaker->InitDigits();
158 }
159}
160
161//____________________________________________________________________________
162void AliITSQADataMakerSim::MakeDigits(TClonesArray * digits)
163{
164 // Fill QA for RAW
165 if(fSubDetector == 0 || fSubDetector == 1) fSPDDataMaker->MakeDigits(digits);
8dc34e37 166 if(fSubDetector == 0 || fSubDetector == 2) fSDDDataMaker->MakeDigits(digits);
167 if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->MakeDigits(digits);
168}
169
170//____________________________________________________________________________
171void AliITSQADataMakerSim::MakeDigits(TTree * digits)
172{
173 // Fill QA for RAW
174 if(fSubDetector == 0 || fSubDetector == 1) fSPDDataMaker->MakeDigits(digits);
8dc34e37 175 if(fSubDetector == 0 || fSubDetector == 2) fSDDDataMaker->MakeDigits(digits);
176 if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->MakeDigits(digits);
177}
178
179//____________________________________________________________________________
180void AliITSQADataMakerSim::InitSDigits()
181{
182 // Initialization for RECPOINTS
183 if(fSubDetector == 0 || fSubDetector == 1) {
184 AliDebug(1,"AliITSQADM:: SPD InitSDigits\n");
185 fSPDDataMaker->InitSDigits();
186 }
187 if(fSubDetector == 0 || fSubDetector == 2) {
188 AliDebug(1,"AliITSQADM:: SDD InitSDigits\n");
8dc34e37 189 fSDDDataMaker->InitSDigits();
190 }
191 if(fSubDetector == 0 || fSubDetector == 3) {
192 AliDebug(1,"AliITSQADM:: SSD InitSDigits\n");
193 fSSDDataMaker->InitSDigits();
194 }
195}
196
197//____________________________________________________________________________
198void AliITSQADataMakerSim::MakeSDigits(TClonesArray * sdigits)
199{
200 // Fill QA for recpoints
c71529b0 201 if(fSubDetector == 0 || fSubDetector == 1) fSPDDataMaker->MakeSDigits(sdigits);
8dc34e37 202 if(fSubDetector == 0 || fSubDetector == 2) fSDDDataMaker->MakeSDigits(sdigits);
203 if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->MakeSDigits(sdigits);
204}
205
206//____________________________________________________________________________
207void AliITSQADataMakerSim::MakeSDigits(TTree * sdigits)
208{
209 // Fill QA for recpoints
c71529b0 210 if(fSubDetector == 0 || fSubDetector == 1) fSPDDataMaker->MakeSDigits(sdigits);
8dc34e37 211 if(fSubDetector == 0 || fSubDetector == 2) fSDDDataMaker->MakeSDigits(sdigits);
212 if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->MakeSDigits(sdigits);
213}
214
215//____________________________________________________________________________
216void AliITSQADataMakerSim::InitHits()
217{
218 // Initialization for RECPOINTS
219 if(fSubDetector == 0 || fSubDetector == 1) {
220 AliDebug(1,"AliITSQADM:: SPD InitHits\n");
221 fSPDDataMaker->InitHits();
222 }
223 if(fSubDetector == 0 || fSubDetector == 2) {
224 AliDebug(1,"AliITSQADM:: SDD InitHits\n");
8dc34e37 225 fSDDDataMaker->InitHits();
226 }
227 if(fSubDetector == 0 || fSubDetector == 3) {
228 AliDebug(1,"AliITSQADM:: SSD InitHits\n");
229 fSSDDataMaker->InitHits();
230 }
231}
232
233//____________________________________________________________________________
234void AliITSQADataMakerSim::MakeHits(TClonesArray * hits)
235{
236 // Fill QA for recpoints
237 if(fSubDetector == 0 || fSubDetector == 1) fSPDDataMaker->MakeHits(hits);
8dc34e37 238 if(fSubDetector == 0 || fSubDetector == 2) fSDDDataMaker->MakeHits(hits);
239 if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->MakeHits(hits);
240}
241
242//____________________________________________________________________________
243void AliITSQADataMakerSim::MakeHits(TTree * hits)
244{
245 // Fill QA for recpoints
246 if(fSubDetector == 0 || fSubDetector == 1) fSPDDataMaker->MakeHits(hits);
8dc34e37 247 if(fSubDetector == 0 || fSubDetector == 2) fSDDDataMaker->MakeHits(hits);
248 if(fSubDetector == 0 || fSubDetector == 3) fSSDDataMaker->MakeHits(hits);
249}
614c7e17 250
251//_________________________________________________________________
252
4e25ac79 253Int_t AliITSQADataMakerSim::GetDetTaskOffset(Int_t subdet,AliQAv1::TASKINDEX_t task)
614c7e17 254{
255 switch(subdet)
256 {
257
258 Int_t offset;
259 case 1:
260 offset=fSPDDataMaker->GetOffset(task);
261 return offset;
262 break;
263 case 2:
264 offset=fSDDDataMaker->GetOffset(task);
265 return offset;
266 break;
267 case 3:
268 offset=fSSDDataMaker->GetOffset(task);
269 return offset;
270 break;
271 default:
272 AliWarning("No specific subdetector (SPD, SDD, SSD) selected!! Offset set to zero \n");
273 offset=0;
274 return offset;
275 break;
276 }
277 //return offset;
278}