Reduced QA output (Yves)
[u/mrichter/AliRoot.git] / ITS / AliITSQASSDDataMakerSim.cxx
CommitLineData
7a0e5776 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// -------------------------------------------------------------
23// W. Ferrarese + P. Cerello Feb 2008
24// INFN Torino
25// SSD QA part: P. Christakoglou - NIKHEF/UU
26
27// --- ROOT system ---
28#include <TTree.h>
29#include <TH1.h>
30#include <TH2.h>
31#include <TMath.h>
32// --- Standard library ---
33
34// --- AliRoot header files ---
35#include "AliITS.h"
36#include "AliITSmodule.h"
37#include "AliITShit.h"
38#include "AliITSdigit.h"
39#include "AliITSpListItem.h"
40#include "AliRun.h"
41#include "AliITSQADataMakerSim.h"
42#include "AliITSQASSDDataMakerSim.h"
43#include "AliLog.h"
4e25ac79 44#include "AliQAv1.h"
7a0e5776 45#include "AliQAChecker.h"
46#include "AliRawReader.h"
47
48ClassImp(AliITSQASSDDataMakerSim)
49
50//____________________________________________________________________________
51AliITSQASSDDataMakerSim::AliITSQASSDDataMakerSim(AliITSQADataMakerSim *aliITSQADataMakerSim) :
52TObject(),
53fAliITSQADataMakerSim(aliITSQADataMakerSim),
54//fSSDhTask(0),
55fSSDhHTask(0),
56fSSDhSTask(0),
57fSSDhDTask(0),
58fGenOffsetH(0),
59fGenOffsetS(0),
60fGenOffsetD(0)
61{
62 //ctor used to discriminate OnLine-Offline analysis
63}
64
65//____________________________________________________________________________
66AliITSQASSDDataMakerSim::AliITSQASSDDataMakerSim(const AliITSQASSDDataMakerSim& qadm) :
67TObject(),
68fAliITSQADataMakerSim(qadm.fAliITSQADataMakerSim),
69//fSSDhTask(qadm.fSSDhTask),
70fSSDhHTask(qadm.fSSDhHTask),
71fSSDhSTask(qadm.fSSDhSTask),
72fSSDhDTask(qadm.fSSDhDTask),
73fGenOffsetH(qadm.fGenOffsetH),
74fGenOffsetS(qadm.fGenOffsetS),
75fGenOffsetD(qadm.fGenOffsetD)
76{
77 //copy ctor
78 fAliITSQADataMakerSim->SetName((const char*)qadm.fAliITSQADataMakerSim->GetName()) ;
79 fAliITSQADataMakerSim->SetTitle((const char*)qadm.fAliITSQADataMakerSim->GetTitle());
80 }
81
82//__________________________________________________________________
83AliITSQASSDDataMakerSim& AliITSQASSDDataMakerSim::operator = (const AliITSQASSDDataMakerSim& qac ) {
84 // Equal operator.
85 this->~AliITSQASSDDataMakerSim();
86 new(this) AliITSQASSDDataMakerSim(qac);
87 return *this;
88}
89
90//____________________________________________________________________________
91void AliITSQASSDDataMakerSim::StartOfDetectorCycle() {
92 //Detector specific actions at start of cycle
5379c4a3 93 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM::Start of SSD Cycle\n");
7a0e5776 94}
95
96//____________________________________________________________________________
4e25ac79 97void AliITSQASSDDataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t /*task*/, TObjArray* /*list*/) {
7a0e5776 98 // launch the QA checking
5379c4a3 99 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSDM instantiates checker with Run(AliQAv1::kITS, task, list)\n");
7a0e5776 100
4e25ac79 101// AliQAChecker::Instance()->Run( AliQAv1::kITS , task, list);
7a0e5776 102}
103
104//____________________________________________________________________________
105void AliITSQASSDDataMakerSim::InitDigits() {
106 // Initialization for DIGIT data - SSD -
7d297381 107 const Bool_t expert = kTRUE ;
108 const Bool_t image = kTRUE ;
109
57acd2d2 110 fGenOffsetD = (fAliITSQADataMakerSim->fDigitsQAList[AliRecoParam::kDefault])->GetEntries();
7a0e5776 111
112 // custom code here
113 TH1F *fHistSSDModule = new TH1F("fHistSSDDigitsModule",
114 ";SSD Module Number;N_{DIGITS}",
115 1698,499.5,2197.5);
116 fAliITSQADataMakerSim->Add2DigitsList(fHistSSDModule,
7d297381 117 fGenOffsetD + 0, !expert, image);
7a0e5776 118 fSSDhDTask += 1;
119 TH2F *fHistSSDModuleStrip = new TH2F("fHistSSDDigitsModuleStrip",
120 ";N_{Strip};N_{Module}",
121 1540,0,1540,1698,499.5,2197.5);
122 fAliITSQADataMakerSim->Add2DigitsList(fHistSSDModuleStrip,
7d297381 123 fGenOffsetD + 1, !expert, image);
7a0e5776 124 fSSDhDTask += 1;
125
5379c4a3 126 AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SSD Digits histograms booked\n",fSSDhDTask));
7a0e5776 127
128}
129
130//____________________________________________________________________________
131void AliITSQASSDDataMakerSim::MakeDigits(TTree *digits) {
132 // Fill QA for DIGIT - SSD -
133 AliITS *fITS = (AliITS*)gAlice->GetModule("ITS");
134 fITS->SetTreeAddress();
135 TClonesArray *iSSDdigits = fITS->DigitsAddress(2);
136 for(Int_t iModule = 500; iModule < 2198; iModule++) {
137 iSSDdigits->Clear();
138 digits->GetEvent(iModule);
139 Int_t ndigits = iSSDdigits->GetEntries();
140 fAliITSQADataMakerSim->GetDigitsData(fGenOffsetD + 0)->Fill(iModule,ndigits);
141 if(ndigits != 0)
5379c4a3 142 AliDebug(AliQAv1::GetQADebugLevel(),Form("Module: %d - Digits: %d",iModule,ndigits));
7a0e5776 143
144 for (Int_t iDigit = 0; iDigit < ndigits; iDigit++) {
145 AliITSdigit *dig = (AliITSdigit*)iSSDdigits->UncheckedAt(iDigit);
146 Int_t fStripNumber = (dig->GetCoord1() == 0) ? dig->GetCoord2() : dig->GetCoord2() + fgkNumberOfPSideStrips;
147 ((TH2F *)fAliITSQADataMakerSim->GetDigitsData(fGenOffsetD + 1))->Fill(fStripNumber,iModule,dig->GetSignal());
148 }//digit loop
149 }//module loop
150}
151
152//____________________________________________________________________________
153void AliITSQASSDDataMakerSim::InitSDigits() {
154 // Initialization for SDIGIT data - SSD -
7d297381 155 const Bool_t expert = kTRUE ;
156 const Bool_t image = kTRUE ;
157
57acd2d2 158 fGenOffsetS = (fAliITSQADataMakerSim->fSDigitsQAList[AliRecoParam::kDefault])->GetEntries();
7a0e5776 159
160 // custom code here
161 TH1F *fHistSSDModule = new TH1F("fHistSSDSDigitsModule",
162 ";SSD Module Number;N_{SDIGITS}",
163 1698,499.5,2197.5);
164 fAliITSQADataMakerSim->Add2SDigitsList(fHistSSDModule,
7d297381 165 fGenOffsetS + 0, !expert, image);
7a0e5776 166 fSSDhSTask += 1;
167
5379c4a3 168 AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SSD SDigits histograms booked\n",fSSDhSTask));
7a0e5776 169}
170
171//____________________________________________________________________________
172void AliITSQASSDDataMakerSim::MakeSDigits(TTree *sdigits) {
173 // Fill QA for SDIGIT - SSD -
174 static TClonesArray iSSDEmpty("AliITSpListItem",10000);
175 iSSDEmpty.Clear();
176 TClonesArray *iSSDsdigits = &iSSDEmpty;
177
5379c4a3 178 AliDebug(AliQAv1::GetQADebugLevel(), Form("Trying to access the sdigits histogram: %d\n",fGenOffsetS));
7a0e5776 179
180 TBranch *brchSDigits = sdigits->GetBranch("ITS");
181 brchSDigits->SetAddress(&iSSDsdigits);
182 for(Int_t iModule = 500; iModule < 2198; iModule++) {
183 iSSDsdigits->Clear();
184 sdigits->GetEvent(iModule);
185 Int_t ndigits = iSSDsdigits->GetEntries();
186 fAliITSQADataMakerSim->GetSDigitsData(fGenOffsetS + 0)->Fill(iModule,ndigits);
187 if(ndigits != 0)
5379c4a3 188 AliDebug(AliQAv1::GetQADebugLevel(),Form("Module: %d - Digits: %d",iModule,ndigits));
7a0e5776 189
190 for (Int_t iDigit = 0; iDigit < ndigits; iDigit++) {
191 AliITSpListItem *dig=(AliITSpListItem*)iSSDsdigits->At(iDigit);
192 dig=0;
193 }//digit loop
194 }//module loop
195}
196
197//____________________________________________________________________________
198void AliITSQASSDDataMakerSim::InitHits() {
199 // Initialization for HITS data - SSD -
7d297381 200 const Bool_t expert = kTRUE ;
201 const Bool_t image = kTRUE ;
202
57acd2d2 203 fGenOffsetH = (fAliITSQADataMakerSim->fHitsQAList[AliRecoParam::kDefault])->GetEntries();
7a0e5776 204
205 // custom code here
206 TH1F *fHistSSDModule = new TH1F("fHistSSDHitsModule",
207 ";SDD Module Number;N_{HITS}",
208 1698,499.5,2197.5);
209 fAliITSQADataMakerSim->Add2HitsList(fHistSSDModule,
7d297381 210 fGenOffsetH + 0, !expert, image);
7a0e5776 211 fSSDhHTask += 1;
212 TH1F *fHistSSDGlobalX = new TH1F("fHistSSDHitsGlobalX",
213 ";x [cm];Entries",
214 1000,-50.,50.);
215 fAliITSQADataMakerSim->Add2HitsList(fHistSSDGlobalX,
7d297381 216 fGenOffsetH + 1, !expert, image);
7a0e5776 217 fSSDhHTask += 1;
218 TH1F *fHistSSDGlobalY = new TH1F("fHistSSDHitsGlobalY",
219 ";y [cm];Entries",
220 1000,-50.,50.);
221 fAliITSQADataMakerSim->Add2HitsList(fHistSSDGlobalY,
7d297381 222 fGenOffsetH + 2, !expert, image);
7a0e5776 223 fSSDhHTask += 1;
224 TH1F *fHistSSDGlobalZ = new TH1F("fHistSSDHitsGlobalZ",
225 ";z [cm];Entries",
226 1000,-60.,60.);
227 fAliITSQADataMakerSim->Add2HitsList(fHistSSDGlobalZ,
7d297381 228 fGenOffsetH + 3, !expert, image);
7a0e5776 229 fSSDhHTask += 1;
230 TH1F *fHistSSDLocalX = new TH1F("fHistSSDHitsLocalX",
231 ";x [cm];Entries",
232 1000,-4.,4.);
233 fAliITSQADataMakerSim->Add2HitsList(fHistSSDLocalX,
7d297381 234 fGenOffsetH + 4, !expert, image);
7a0e5776 235 fSSDhHTask += 1;
236 TH1F *fHistSSDLocalY = new TH1F("fHistSSDHitsLocalY",
237 ";y [cm];Entries",
238 1000,-0.1,0.1);
239 fAliITSQADataMakerSim->Add2HitsList(fHistSSDLocalY,
7d297381 240 fGenOffsetH + 5, !expert, image);
7a0e5776 241 fSSDhHTask += 1;
242 TH1F *fHistSSDLocalZ = new TH1F("fHistSSDHitsLocalZ",
243 ";z [cm];Entries",
244 1000,-4.,4.);
245 fAliITSQADataMakerSim->Add2HitsList(fHistSSDLocalZ,
7d297381 246 fGenOffsetH + 6, !expert, image);
7a0e5776 247 fSSDhHTask += 1;
248 TH1F *fHistSSDIonization = new TH1F("fHistSSDHitsIonization",
249 ";log(dE/dx) [KeV];N_{Hits}",
250 100,-7,-2);
251 fAliITSQADataMakerSim->Add2HitsList(fHistSSDIonization,
7d297381 252 fGenOffsetH + 7, !expert, image);
7a0e5776 253 fSSDhHTask += 1;
254 TH2F *fHistSSDGlobalXY = new TH2F("fHistSSDHitsGlobalXY",
255 ";x [cm];y [cm]",
256 1000,-50.,50.,
257 1000,-50.,50.);
258 fAliITSQADataMakerSim->Add2HitsList(fHistSSDGlobalXY,
7d297381 259 fGenOffsetH + 8, !expert, image);
7a0e5776 260 fSSDhHTask += 1;
261
5379c4a3 262 AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SSD Hits histograms booked\n",fSSDhHTask));
7a0e5776 263}
264
265
266//____________________________________________________________________________
267void AliITSQASSDDataMakerSim::MakeHits(TTree *hits) {
268 // Fill QA for HITS - SSD -
269 AliITS *fITS = (AliITS*)gAlice->GetModule("ITS");
270 fITS->SetTreeAddress();
271 Int_t nmodules;
272 fITS->InitModules(-1,nmodules);
273 fITS->FillModules(hits,0);
274 for(Int_t iModule = 500; iModule < 2198; iModule++) {
275 AliITSmodule *module = fITS->GetModule(iModule);
276 TObjArray *arrHits = module->GetHits();
277 Int_t nhits = arrHits->GetEntriesFast();
278 if(nhits != 0)
5379c4a3 279 AliDebug(AliQAv1::GetQADebugLevel(),Form("Module: %d - Hits: %d",iModule,nhits));
7a0e5776 280 for (Int_t iHit = 0; iHit < nhits; iHit++) {
281 AliITShit *hit = (AliITShit*) arrHits->At(iHit);
282
283 fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 0)->Fill(iModule);
284 fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 1)->Fill(hit->GetXG());
285 fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 2)->Fill(hit->GetYG());
286 fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 3)->Fill(hit->GetZG());
287 fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 4)->Fill(hit->GetXL());
288 fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 5)->Fill(hit->GetYL());
289 fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 6)->Fill(hit->GetZL());
290 if(hit->GetIonization())
291 fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 7)->Fill(TMath::Log10(hit->GetIonization()));
292 fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 8)->Fill(hit->GetXG(),hit->GetYG());
293 }//hit loop
294 }//module loop
295}
296
297
298
299
300//____________________________________________________________________________
4e25ac79 301Int_t AliITSQASSDDataMakerSim::GetOffset(AliQAv1::TASKINDEX_t task){
7a0e5776 302 // Returns histogram offset according to the specified task
303 Int_t offset=0;
4e25ac79 304 if( task == AliQAv1::kHITS){
7a0e5776 305 offset=fGenOffsetH;
306 }
4e25ac79 307 else if( task == AliQAv1::kSDIGITS) {
7a0e5776 308 offset=fGenOffsetS;
309 }
4e25ac79 310 else if( task == AliQAv1::kDIGITS) {
7a0e5776 311 offset=fGenOffsetD;
312 }
313 else {
314 AliInfo("No task has been selected. TaskHisto set to zero.\n");
315 }
316
317 return offset;
318}
319
320
321//____________________________________________________________________________
4e25ac79 322Int_t AliITSQASSDDataMakerSim::GetTaskHisto(AliQAv1::TASKINDEX_t task) {
7a0e5776 323 // Returns the number of booked histograms for the selected task
324 Int_t histotot=0;
4e25ac79 325 if( task == AliQAv1::kHITS) {
7a0e5776 326 histotot=fSSDhHTask ;
327 }
4e25ac79 328 else if( task == AliQAv1::kSDIGITS) {
7a0e5776 329 histotot=fSSDhSTask;
330 }
4e25ac79 331 else if( task == AliQAv1::kDIGITS) {
7a0e5776 332 histotot=fSSDhDTask ;
333 }
334 else {
335 AliInfo("No task has been selected. TaskHisto set to zero.\n");
336 }
337 return histotot;
338
339}