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