1.The QA data created on demand according to the event species at filling time. 2...
[u/mrichter/AliRoot.git] / ITS / AliITSQASDDDataMakerRec.cxx
CommitLineData
ebdd0606 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
e41192d7 24// M.Siciliano Aug 2008 QA RecPoints and HLT mode
ebdd0606 25// INFN Torino
26
27// --- ROOT system ---
ad300de9 28
ebdd0606 29#include <TProfile2D.h>
30#include <TH2D.h>
31#include <TBranch.h>
32#include <TTree.h>
33#include <TGaxis.h>
34#include <TMath.h>
35#include <TDirectory.h>
e41192d7 36#include <TSystem.h>
ebdd0606 37// --- Standard library ---
38
39// --- AliRoot header files ---
40#include "AliITSQASDDDataMakerRec.h"
41#include "AliLog.h"
4e25ac79 42#include "AliQAv1.h"
ebdd0606 43#include "AliQAChecker.h"
44#include "AliRawReader.h"
e41192d7 45#include "AliITSRawStream.h"
ebdd0606 46#include "AliITSRawStreamSDD.h"
e41192d7 47#include "AliITSRawStreamSDDCompressed.h"
48#include "AliITSDetTypeRec.h"
5192f264 49#include "AliITSdigit.h"
ebdd0606 50#include "AliITSRecPoint.h"
51#include "AliITSgeomTGeo.h"
e41192d7 52#include "AliITSHLTforSDD.h"
ebdd0606 53#include "AliCDBManager.h"
54#include "AliCDBStorage.h"
55#include "AliCDBEntry.h"
ad300de9 56#include "Riostream.h"
fc89f88c 57#include "AliITSdigitSDD.h"
58#include "AliITS.h"
59#include "AliRunLoader.h"
60#include "AliITSLoader.h"
61#include "AliITSDetTypeRec.h"
62
63
ebdd0606 64
65ClassImp(AliITSQASDDDataMakerRec)
66
67//____________________________________________________________________________
68AliITSQASDDDataMakerRec::AliITSQASDDDataMakerRec(AliITSQADataMakerRec *aliITSQADataMakerRec, Bool_t kMode, Short_t ldc) :
69TObject(),
70fAliITSQADataMakerRec(aliITSQADataMakerRec),
71fkOnline(kMode),
72fLDC(ldc),
ad300de9 73fSDDhRawsTask(0),
44ed7a66 74fSDDhDigitsTask(0),
ad300de9 75fSDDhRecPointsTask(0),
ad300de9 76fGenRawsOffset(0),
44ed7a66 77fGenDigitsOffset(0),
ad300de9 78fGenRecPointsOffset(0),
ebdd0606 79fTimeBinSize(1),
e41192d7 80fDDLModuleMap(0),
81fHLTMode(0),
82fHLTSDD(0)
ebdd0606 83{
84 //ctor used to discriminate OnLine-Offline analysis
85 if(fLDC < 0 || fLDC > 4) {
86 AliError("Error: LDC number out of range; return\n");
87 }
e41192d7 88 if(!fkOnline){AliInfo("Offline mode: HLT set from AliITSDetTypeRec for SDD\n");}
89 else
90 if(fkOnline){
91 AliInfo("Online mode: HLT set from environment for SDD\n");
92 SetHLTModeFromEnvironment();
93 }
ebdd0606 94 //fDDLModuleMap=NULL;
95}
96
97//____________________________________________________________________________
98AliITSQASDDDataMakerRec::AliITSQASDDDataMakerRec(const AliITSQASDDDataMakerRec& qadm) :
99TObject(),
100fAliITSQADataMakerRec(qadm.fAliITSQADataMakerRec),
101fkOnline(qadm.fkOnline),
102fLDC(qadm.fLDC),
ad300de9 103fSDDhRawsTask(qadm.fSDDhRawsTask),
44ed7a66 104fSDDhDigitsTask(qadm.fSDDhDigitsTask),
ad300de9 105fSDDhRecPointsTask(qadm.fSDDhRecPointsTask),
ad300de9 106fGenRawsOffset(qadm.fGenRawsOffset),
44ed7a66 107fGenDigitsOffset(qadm.fGenDigitsOffset),
ad300de9 108fGenRecPointsOffset(qadm.fGenRecPointsOffset),
ebdd0606 109fTimeBinSize(1),
e41192d7 110fDDLModuleMap(0),
111fHLTMode(qadm.fHLTMode),
112fHLTSDD( qadm.fHLTSDD)
ebdd0606 113{
114 //copy ctor
115 fAliITSQADataMakerRec->SetName((const char*)qadm.fAliITSQADataMakerRec->GetName()) ;
116 fAliITSQADataMakerRec->SetTitle((const char*)qadm.fAliITSQADataMakerRec->GetTitle());
117 fDDLModuleMap=NULL;
118}
119
120//____________________________________________________________________________
121AliITSQASDDDataMakerRec::~AliITSQASDDDataMakerRec(){
122 // destructor
123 // if(fDDLModuleMap) delete fDDLModuleMap;
124}
125//__________________________________________________________________
126AliITSQASDDDataMakerRec& AliITSQASDDDataMakerRec::operator = (const AliITSQASDDDataMakerRec& qac )
127{
7a0e5776 128 // Equal operator.
ebdd0606 129 this->~AliITSQASDDDataMakerRec();
130 new(this) AliITSQASDDDataMakerRec(qac);
131 return *this;
132}
133
134//____________________________________________________________________________
135void AliITSQASDDDataMakerRec::StartOfDetectorCycle()
136{
137 //Detector specific actions at start of cycle
5379c4a3 138 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM::Start of SDD Cycle\n");
ebdd0606 139}
140
141//____________________________________________________________________________
4e25ac79 142void AliITSQASDDDataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t /*task*/, TObjArray* /*list*/)
ebdd0606 143{
144 // launch the QA checking
5379c4a3 145 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSDM instantiates checker with Run(AliQAv1::kITS, task, list)\n");
ebdd0606 146}
147
148//____________________________________________________________________________
eca4fa66 149Int_t AliITSQASDDDataMakerRec::InitRaws()
ebdd0606 150{
151 // Initialization for RAW data - SDD -
7d297381 152 const Bool_t expert = kTRUE ;
153 const Bool_t saveCorr = kTRUE ;
154 const Bool_t image = kTRUE ;
eca4fa66 155 Int_t rv = 0 ;
156 //fGenRawsOffset = (fAliITSQADataMakerRec->fRawsQAList[AliRecoParam::kDefault])->GetEntries();
ebdd0606 157 AliCDBEntry *ddlMapSDD = AliCDBManager::Instance()->Get("ITS/Calib/DDLMapSDD");
158 Bool_t cacheStatus = AliCDBManager::Instance()->GetCacheFlag();
e41192d7 159 if(!ddlMapSDD)
160 {
161 AliError("Calibration object retrieval failed! SDD will not be processed");
162 fDDLModuleMap = NULL;
eca4fa66 163 return rv;
e41192d7 164 }
ebdd0606 165 fDDLModuleMap = (AliITSDDLModuleMapSDD*)ddlMapSDD->GetObject();
166 if(!cacheStatus)ddlMapSDD->SetObject(NULL);
167 ddlMapSDD->SetOwner(kTRUE);
e41192d7 168 if(!cacheStatus)
169 {
170 delete ddlMapSDD;
171 }
7a0e5776 172
e41192d7 173 if(fkOnline==kFALSE){
174 AliInfo("Offline mode: HLTforSDDobject used \n");
175 AliCDBEntry *hltforSDD = AliCDBManager::Instance()->Get("ITS/Calib/HLTforSDD");
176 if(!hltforSDD){
177 AliError("Calibration object retrieval failed! SDD will not be processed");
178 fHLTSDD=NULL;
eca4fa66 179 return rv;
e41192d7 180 }
181 fHLTSDD = (AliITSHLTforSDD*)hltforSDD->GetObject();
182 if(!cacheStatus)hltforSDD->SetObject(NULL);
183 hltforSDD->SetOwner(kTRUE);
184 if(!cacheStatus)
185 {
186 delete hltforSDD;
187 }
188 }
ebdd0606 189 Int_t lay, lad, det;
ebdd0606 190 Int_t indexlast = 0;
191 Int_t index1 = 0;
192
7a0e5776 193 if(fkOnline)
194 {
195 AliInfo("Book Online Histograms for SDD\n");
196 }
197 else
198 {
199 AliInfo("Book Offline Histograms for SDD\n ");
200 }
201 TH1D *h0 = new TH1D("SDDModPattern","HW Modules pattern",fgknSDDmodules,239.5,499.5); //0
ebdd0606 202 h0->GetXaxis()->SetTitle("Module Number");
203 h0->GetYaxis()->SetTitle("Counts");
eca4fa66 204 rv = fAliITSQADataMakerRec->Add2RawsList((new TH1D(*h0)),0+fGenRawsOffset, expert, !image, !saveCorr);
ebdd0606 205 delete h0;
ad300de9 206 fSDDhRawsTask++;
7a0e5776 207
208 //zPhi distribution using ladder and modules numbers
209 TH2D *hphil3 = new TH2D("SDDphizL3","SDD #varphiz Layer3 ",6,0.5,6.5,14,0.5,14.5);
210 hphil3->GetXaxis()->SetTitle("z[#Module L3 ]");
211 hphil3->GetYaxis()->SetTitle("#varphi[#Ladder L3]");
eca4fa66 212 rv = fAliITSQADataMakerRec->Add2RawsList((new TH2D(*hphil3)),1+fGenRawsOffset, !expert, image, saveCorr);
7a0e5776 213 delete hphil3;
214 fSDDhRawsTask++;
215
216 TH2D *hphil4 = new TH2D("SDDphizL4","SDD #varphiz Layer4 ",8,0.5,8.5,22,0.5,22.5);
217 hphil4->GetXaxis()->SetTitle("z[#Module L4]");
218 hphil4->GetYaxis()->SetTitle("#varphi[#Ladder L4]");
eca4fa66 219 rv = fAliITSQADataMakerRec->Add2RawsList((new TH2D(*hphil4)),2+fGenRawsOffset, !expert, image, saveCorr);
7a0e5776 220 delete hphil4;
221 fSDDhRawsTask++;
222
ebdd0606 223
7a0e5776 224 if(fkOnline)
225 {
226
227 //DDL Pattern
228 TH2D *hddl = new TH2D("SDDDDLPattern","SDD DDL Pattern ",24,-0.5,23.5,24,-0.5,23.5);
ad300de9 229 hddl->GetXaxis()->SetTitle("Channel");
230 hddl->GetYaxis()->SetTitle("#DDL");
eca4fa66 231 rv = fAliITSQADataMakerRec->Add2RawsList((new TH2D(*hddl)),3+fGenRawsOffset, expert, !image, !saveCorr);
ad300de9 232 delete hddl;
233 fSDDhRawsTask++;
7a0e5776 234 Int_t indexlast1 = 0;
235
236 fTimeBinSize = 4;
237 indexlast = 0;
238 index1 = 0;
239 indexlast1 = fSDDhRawsTask;
240 char *hname[3];
241 for(Int_t i=0; i<3; i++) hname[i]= new char[50];
242 for(Int_t moduleSDD =0; moduleSDD<fgknSDDmodules; moduleSDD++){
243 for(Int_t iside=0;iside<fgknSide;iside++){
244 AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det);
245 sprintf(hname[0],"SDDchargeMapFSE_L%d_%d_%d_%d",lay,lad,det,iside);
246 sprintf(hname[1],"SDDChargeMapForSingleEvent_L%d_%d_%d_%d",lay,lad,det,iside);
fc89f88c 247 // sprintf(hname[2],"SDDhmonoDMap_L%d_%d_%d_%d",lay,lad,det,iside);
7a0e5776 248 TProfile2D *fModuleChargeMapFSE = new TProfile2D(hname[0],hname[1],256/fTimeBinSize,-0.5,255.5,256,-0.5,255.5);
249 fModuleChargeMapFSE->GetXaxis()->SetTitle("Time Bin");
250 fModuleChargeMapFSE->GetYaxis()->SetTitle("Anode");
eca4fa66 251 rv = fAliITSQADataMakerRec->Add2RawsList((new TProfile2D(*fModuleChargeMapFSE)),indexlast1 + index1 + fGenRawsOffset, expert, !image, !saveCorr);
7a0e5776 252 delete fModuleChargeMapFSE;
253
254 fSDDhRawsTask++;
255 index1++;
ebdd0606 256 }
7a0e5776 257 }
258
259 for(Int_t moduleSDD =0; moduleSDD<fgknSDDmodules; moduleSDD++){
260 for(Int_t iside=0;iside<fgknSide;iside++){
261 AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det);
262 sprintf(hname[0],"SDDchargeMap_L%d_%d_%d_%d",lay,lad,det,iside);
263 sprintf(hname[1],"SDDChargeMap_L%d_%d_%d_%d",lay,lad,det,iside);
264 TProfile2D *fModuleChargeMap = new TProfile2D(hname[0],hname[1],256/fTimeBinSize,-0.5,255.5,256,-0.5,255.5);
265 fModuleChargeMap->GetXaxis()->SetTitle("Time Bin");
266 fModuleChargeMap->GetYaxis()->SetTitle("Anode");
eca4fa66 267 rv = fAliITSQADataMakerRec->Add2RawsList((new TProfile2D(*fModuleChargeMap)),indexlast1 + index1 + fGenRawsOffset, expert, !image, !saveCorr);
7a0e5776 268 delete fModuleChargeMap;
269
270 fSDDhRawsTask++;
271 index1++;
ebdd0606 272 }
7a0e5776 273 }
274
275 } // kONLINE
ebdd0606 276
5379c4a3 277 AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SDD Raws histograms booked\n",fSDDhRawsTask));
eca4fa66 278 return rv ;
ebdd0606 279}
280
281
282//____________________________________________________________________________
eca4fa66 283Int_t AliITSQASDDDataMakerRec::MakeRaws(AliRawReader* rawReader)
ebdd0606 284{
285 // Fill QA for RAW - SDD -
7a0e5776 286
eca4fa66 287 Int_t rv = 0 ;
288
ebdd0606 289 if(!fDDLModuleMap){
290 AliError("SDD DDL module map not available - skipping SDD QA");
eca4fa66 291 return rv;
ebdd0606 292 }
eca4fa66 293 if(rawReader->GetType() != 7) return rv; // skips non physical triggers
5379c4a3 294 AliDebug(AliQAv1::GetQADebugLevel(),"entering MakeRaws\n");
7a0e5776 295
eca4fa66 296 // Check id histograms already created for this Event Specie
297 if ( ! fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset) )
298 rv = InitRaws () ;
299
e41192d7 300 rawReader->Reset();
301 AliITSRawStream *stream;
302
303 if(fkOnline==kTRUE)
304 {
305 if(GetHLTMode()==kTRUE)
306 {
ad300de9 307 //AliInfo("Online mode: HLT C compressed mode used for SDD\n");
e41192d7 308 stream = new AliITSRawStreamSDDCompressed(rawReader); }
309 else{
ad300de9 310 //AliInfo("Online mode: HLT A mode used for SDD\n");
e41192d7 311 stream = new AliITSRawStreamSDD(rawReader);}
312 }
313 else
314 {
315 if(fHLTSDD->IsHLTmodeC()==kTRUE){
ad300de9 316 //AliInfo("Offline mode: HLT C compressed mode used for SDD\n");
e41192d7 317 stream = new AliITSRawStreamSDDCompressed(rawReader);
318 }else
319 {
ad300de9 320 //AliInfo("Offline mode: HLT A mode used for SDD\n");
7a0e5776 321 stream = new AliITSRawStreamSDD(rawReader);
322 }
e41192d7 323 }
324
325 //ckeck on HLT mode
7a0e5776 326
e41192d7 327 // AliITSRawStreamSDD s(rawReader);
328 stream->SetDDLModuleMap(fDDLModuleMap);
329
ebdd0606 330 Int_t lay, lad, det;
7a0e5776 331
ebdd0606 332 Int_t index=0;
333 if(fkOnline) {
334 for(Int_t moduleSDD =0; moduleSDD<fgknSDDmodules; moduleSDD++){
7a0e5776 335 for(Int_t iside=0;iside<fgknSide;iside++) {
336 if(fSDDhRawsTask > 4 + index) fAliITSQADataMakerRec->GetRawsData(4 + index +fGenRawsOffset)->Reset();
337 // 4 because the 2D histos for single events start after the fourth position
338 index++;
339 }
ebdd0606 340 }
341 }
e41192d7 342
ebdd0606 343 Int_t cnt = 0;
344 Int_t ildcID = -1;
345 Int_t iddl = -1;
346 Int_t isddmod = -1;
7a0e5776 347 Int_t coord1, coord2, signal, moduleSDD, activeModule, index1;
e41192d7 348
349 while(stream->Next()) {
ebdd0606 350 ildcID = rawReader->GetLDCId();
351 iddl = rawReader->GetDDLID() - fgkDDLIDshift;
7a0e5776 352
e41192d7 353 isddmod = fDDLModuleMap->GetModuleNumber(iddl,stream->GetCarlosId());
ebdd0606 354 if(isddmod==-1){
5379c4a3 355 AliDebug(AliQAv1::GetQADebugLevel(),Form("Found module with iddl: %d, stream->GetCarlosId: %d \n",iddl,stream->GetCarlosId()));
ebdd0606 356 continue;
357 }
e41192d7 358 if(stream->IsCompletedModule()) {
5379c4a3 359 AliDebug(AliQAv1::GetQADebugLevel(),Form("IsCompletedModule == KTRUE\n"));
ebdd0606 360 continue;
361 }
de075dae 362 if(stream->IsCompletedDDL()) {
5379c4a3 363 AliDebug(AliQAv1::GetQADebugLevel(),Form("IsCompletedDDL == KTRUE\n"));
de075dae 364 continue;
365 }
ebdd0606 366
e41192d7 367 coord1 = stream->GetCoord1();
368 coord2 = stream->GetCoord2();
369 signal = stream->GetSignal();
ebdd0606 370
7a0e5776 371 moduleSDD = isddmod - fgkmodoffset;
372
b62d7123 373 if(isddmod <fgkmodoffset|| isddmod>fgknSDDmodules+fgkmodoffset-1) {
5379c4a3 374 AliDebug(AliQAv1::GetQADebugLevel(),Form( "Module SDD = %d, resetting it to 1 \n",isddmod));
b62d7123 375 isddmod = 1;
ebdd0606 376 }
7a0e5776 377
ebdd0606 378 AliITSgeomTGeo::GetModuleId(isddmod, lay, lad, det);
ad300de9 379
7a0e5776 380
ad300de9 381 fAliITSQADataMakerRec->GetRawsData( 0 + fGenRawsOffset )->Fill(isddmod);
7a0e5776 382
383 if(lay==3) fAliITSQADataMakerRec->GetRawsData(1+fGenRawsOffset)->Fill(det,lad);
ebdd0606 384 if(lay==4) {
7a0e5776 385 fAliITSQADataMakerRec->GetRawsData(2+fGenRawsOffset)->Fill(det,lad);}
386
e41192d7 387 Short_t iside = stream->GetChannel();
ebdd0606 388
fc89f88c 389
7a0e5776 390
ad300de9 391
ebdd0606 392 if(fkOnline) {
7a0e5776 393
fc89f88c 394 fAliITSQADataMakerRec->GetRawsData(3+fGenRawsOffset)->Fill(2*(stream->GetCarlosId())+iside,iddl);
395
7a0e5776 396 activeModule = moduleSDD;
397 index1 = activeModule * 2 + iside;
398
399 if(index1<0){
5379c4a3 400 AliDebug(AliQAv1::GetQADebugLevel(),Form("Wrong index number %d - patched to 0\n",index1));
7a0e5776 401 index1 = 0;
402 }
403 fAliITSQADataMakerRec->GetRawsData(3+fGenRawsOffset)->Fill(2*(stream->GetCarlosId())+iside,iddl);
404 if(fSDDhRawsTask > 4 + index1) {
405 ((TProfile2D *)(fAliITSQADataMakerRec->GetRawsData(4 + index1 +fGenRawsOffset)))->Fill(coord2, coord1, signal);
406 ((TProfile2D *)(fAliITSQADataMakerRec->GetRawsData(4 + index1 + 260*2 +fGenRawsOffset)))->Fill(coord2, coord1, signal);
ebdd0606 407 }
408 }
7a0e5776 409 cnt++;
5379c4a3 410 if(!(cnt%10000)) AliDebug(AliQAv1::GetQADebugLevel(),Form(" %d raw digits read",cnt));
ebdd0606 411 }
5379c4a3 412 AliDebug(AliQAv1::GetQADebugLevel(),Form("Event completed, %d raw digits read",cnt));
e41192d7 413 delete stream;
414 stream = NULL;
eca4fa66 415 return rv ;
7a0e5776 416}
ebdd0606 417
418//____________________________________________________________________________
eca4fa66 419Int_t AliITSQASDDDataMakerRec::InitDigits()
44ed7a66 420{
fc89f88c 421
422 //printf(" ======================================================> Init digits\n " );
44ed7a66 423 // Initialization for DIGIT data - SDD -
424 const Bool_t expert = kTRUE ;
425 const Bool_t image = kTRUE ;
eca4fa66 426 Int_t rv = 0 ;
427// fGenDigitsOffset = (fAliITSQADataMakerRec->fDigitsQAList[AliRecoParam::kDefault])->GetEntries();
44ed7a66 428 //fSDDhTask must be incremented by one unit every time a histogram is ADDED to the QA List
429 TH1F* h0=new TH1F("SDD DIGITS Module Pattern","SDD DIGITS Module Pattern",260,239.5,499.5); //hmod
430 h0->GetXaxis()->SetTitle("SDD Module Number");
431 h0->GetYaxis()->SetTitle("# DIGITS");
eca4fa66 432 rv = fAliITSQADataMakerRec->Add2DigitsList(h0,fGenDigitsOffset, !expert, image);
44ed7a66 433 fSDDhDigitsTask ++;
434 TH1F* h1=new TH1F("SDD Anode Distribution","DIGITS Anode Distribution",512,-0.5,511.5); //hanocc
435 h1->GetXaxis()->SetTitle("Anode Number");
436 h1->GetYaxis()->SetTitle("# DIGITS");
eca4fa66 437 rv = fAliITSQADataMakerRec->Add2DigitsList(h1,1+fGenDigitsOffset, !expert, image);
44ed7a66 438 fSDDhDigitsTask ++;
439 TH1F* h2=new TH1F("SDD Tbin Distribution","DIGITS Tbin Distribution",256,-0.5,255.5); //htbocc
440 h2->GetXaxis()->SetTitle("Tbin Number");
441 h2->GetYaxis()->SetTitle("# DIGITS");
eca4fa66 442 rv = fAliITSQADataMakerRec->Add2DigitsList(h2,2+fGenDigitsOffset, !expert, image);
44ed7a66 443 fSDDhDigitsTask ++;
444 TH1F* h3=new TH1F("SDD ADC Counts Distribution","DIGITS ADC Counts Distribution",200,0.,1024.); //hsig
445 h3->GetXaxis()->SetTitle("ADC Value");
446 h3->GetYaxis()->SetTitle("# DIGITS");
eca4fa66 447 rv = fAliITSQADataMakerRec->Add2DigitsList(h3,3+fGenDigitsOffset, !expert, image);
44ed7a66 448 fSDDhDigitsTask ++;
449 AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SDD Digits histograms booked\n",fSDDhDigitsTask));
eca4fa66 450 return rv ;
44ed7a66 451}
452
453//____________________________________________________________________________
eca4fa66 454Int_t AliITSQASDDDataMakerRec::MakeDigits(TTree * digits)
44ed7a66 455{
fc89f88c 456 //printf(" ======================================================> make digits\n " );
44ed7a66 457 // Fill QA for DIGIT - SDD -
fc89f88c 458 //AliITS *fITS = (AliITS*)gAlice->GetModule("ITS");
459 //fITS->SetTreeAddress();
460 //TClonesArray *iITSdigits = fITS->DigitsAddress(1);
461
462
eca4fa66 463 Int_t rv = 0 ;
464
fc89f88c 465 TBranch *branchD = digits->GetBranch("ITSDigitsSDD");
466
467 if (!branchD) {
468 AliError("can't get the branch with the ITS SDD digits !");
eca4fa66 469 return rv ;
44ed7a66 470 }
eca4fa66 471 // Check id histograms already created for this Event Specie
472 if ( ! fAliITSQADataMakerRec->GetDigitsData(fGenDigitsOffset) )
473 rv = InitDigits() ;
474
fc89f88c 475 static TClonesArray statDigits("AliITSdigitSDD");
44ed7a66 476 TClonesArray *iITSdigits = &statDigits;
477 branchD->SetAddress(&iITSdigits);
fc89f88c 478
44ed7a66 479 for(Int_t i=0; i<260; i++){
480 Int_t nmod=i+240;
481 digits->GetEvent(nmod);
482 Int_t ndigits = iITSdigits->GetEntries();
483 fAliITSQADataMakerRec->GetDigitsData(fGenDigitsOffset)->Fill(nmod,ndigits);
fc89f88c 484 //printf(" Filled: =======================================> %s \t %i \t %i \n",fAliITSQADataMakerRec->GetDigitsData(fGenDigitsOffset)->GetName(), nmod, ndigits );
44ed7a66 485 for (Int_t idig=0; idig<ndigits; idig++) {
486 AliITSdigit *dig=(AliITSdigit*)iITSdigits->UncheckedAt(idig);
487 Int_t iz=dig->GetCoord1(); // cell number z
488 Int_t ix=dig->GetCoord2(); // cell number x
489 Int_t sig=dig->GetSignal();
490 fAliITSQADataMakerRec->GetDigitsData(1+fGenDigitsOffset)->Fill(iz);
491 fAliITSQADataMakerRec->GetDigitsData(2+fGenDigitsOffset)->Fill(ix);
492 fAliITSQADataMakerRec->GetDigitsData(3+fGenDigitsOffset)->Fill(sig);
493 }
494 }
eca4fa66 495 return rv ;
44ed7a66 496}
497
498//____________________________________________________________________________
eca4fa66 499Int_t AliITSQASDDDataMakerRec::InitRecPoints()
ebdd0606 500{
501 // Initialization for RECPOINTS - SDD -
7d297381 502 const Bool_t expert = kTRUE ;
503 const Bool_t image = kTRUE ;
eca4fa66 504 Int_t rv = 0 ;
505// fGenRecPointsOffset = (fAliITSQADataMakerRec->fRecPointsQAList[AliRecoParam::kDefault])->GetEntries();
ad300de9 506
ebdd0606 507 Int_t nOnline=1;
508 Int_t nOnline2=1;
509 Int_t nOnline3=1;
510 Int_t nOnline4=1;
511 if(fkOnline)
512 {
ebdd0606 513 nOnline=4;
514 nOnline2=28;
515 nOnline3=64;
516 nOnline4=14;
517 }
518
519
520 TH1F *h0 = new TH1F("SDDLay3TotCh","Layer 3 total charge",1000/nOnline,-0.5, 499.5); //position number 0
521 h0->GetXaxis()->SetTitle("ADC value");
522 h0->GetYaxis()->SetTitle("Entries");
eca4fa66 523 rv = fAliITSQADataMakerRec->Add2RecPointsList((new TH1F(*h0)), 0 +fGenRecPointsOffset, !expert, image);
ebdd0606 524 delete h0;
ad300de9 525 fSDDhRecPointsTask++;
ebdd0606 526
527 TH1F *h1 = new TH1F("SDDLay4TotCh","Layer 4 total charge",1000/nOnline,-0.5, 499.5);//position number 1
528 h1->GetXaxis()->SetTitle("ADC value");
529 h1->GetYaxis()->SetTitle("Entries");
eca4fa66 530 rv = fAliITSQADataMakerRec->Add2RecPointsList((new TH1F(*h1)), 1 +fGenRecPointsOffset, !expert, image);
ebdd0606 531 delete h1;
ad300de9 532 fSDDhRecPointsTask++;
ebdd0606 533
534 char hisnam[50];
535 TH2F *h2 = new TH2F("SDDGlobalCoordDistribYX","YX Global Coord Distrib",5600/nOnline2,-28,28,5600/nOnline2,-28,28);//position number 2
536 h2->GetYaxis()->SetTitle("Y[cm]");
537 h2->GetXaxis()->SetTitle("X[cm]");
eca4fa66 538 rv = fAliITSQADataMakerRec->Add2RecPointsList((new TH2F(*h2)),2+fGenRecPointsOffset, expert, !image);
ebdd0606 539 delete h2;
ad300de9 540 fSDDhRecPointsTask++;
ebdd0606 541
542 TH2F *h3 = new TH2F("SDDGlobalCoordDistribRZ","RZ Global Coord Distrib",6400/nOnline3,-32,32,1400/nOnline4,12,26);//position number 3
543 h3->GetYaxis()->SetTitle("R[cm]");
544 h3->GetXaxis()->SetTitle("Z[cm]");
eca4fa66 545 rv = fAliITSQADataMakerRec->Add2RecPointsList((new TH2F(*h3)),3+fGenRecPointsOffset, expert, !image);
ebdd0606 546 delete h3;
ad300de9 547 fSDDhRecPointsTask++;
ebdd0606 548
549 TH2F *h4 = new TH2F("SDDGlobalCoordDistribL3PHIZ","#varphi Z Global Coord Distrib L3",6400/nOnline3,-32,32,360/nOnline,-TMath::Pi(),TMath::Pi());//position number 4
550 h4->GetYaxis()->SetTitle("#phi[rad]");
551 h4->GetXaxis()->SetTitle("Z[cm]");
eca4fa66 552 rv = fAliITSQADataMakerRec->Add2RecPointsList((new TH2F(*h4)),4+fGenRecPointsOffset, !expert, image);
ebdd0606 553 delete h4;
ad300de9 554 fSDDhRecPointsTask++;
ebdd0606 555
556 TH2F *h5 = new TH2F("SDDGlobalCoordDistribL4PHIZ","#varphi Z Global Coord Distrib L4",6400/nOnline3,-32,32,360/nOnline,-TMath::Pi(),TMath::Pi());//position number 5
557 h5->GetYaxis()->SetTitle("#phi[rad]");
558 h5->GetXaxis()->SetTitle("Z[cm]");
eca4fa66 559 rv = fAliITSQADataMakerRec->Add2RecPointsList((new TH2F(*h5)),5+fGenRecPointsOffset, !expert, image);
ebdd0606 560 delete h5;
ad300de9 561 fSDDhRecPointsTask++;
ebdd0606 562
563 TH1F *h6 = new TH1F("SDDModPatternRP","Modules pattern RP",fgknSDDmodules,239.5,499.5); //position number 6
564 h6->GetXaxis()->SetTitle("Module number"); //spd offset = 240
565 h6->GetYaxis()->SetTitle("Entries");
eca4fa66 566 rv = fAliITSQADataMakerRec->Add2RecPointsList((new TH1F(*h6)),6 +fGenRecPointsOffset, expert, !image);
ebdd0606 567 delete h6;
ad300de9 568 fSDDhRecPointsTask++;
ebdd0606 569 TH1F *h7 = new TH1F("SDDLadPatternL3RP","Ladder pattern L3 RP",14,0.5,14.5); //position number 7
570 h7->GetXaxis()->SetTitle("Ladder #, Layer 3");
571 h7->GetYaxis()->SetTitle("Entries");
eca4fa66 572 rv = fAliITSQADataMakerRec->Add2RecPointsList((new TH1F(*h7)),7 +fGenRecPointsOffset, expert, !image);
ebdd0606 573 delete h7;
ad300de9 574 fSDDhRecPointsTask++;
ebdd0606 575 TH1F *h8 = new TH1F("SDDLadPatternL4RP","Ladder pattern L4 RP",22,0.5,22.5); //position number 8
576 h8->GetXaxis()->SetTitle("Ladder #, Layer 4");
577 h8->GetYaxis()->SetTitle("Entries");
eca4fa66 578 rv = fAliITSQADataMakerRec->Add2RecPointsList((new TH1F(*h8)),8 +fGenRecPointsOffset, expert, !image);
ebdd0606 579 delete h8;
ad300de9 580 fSDDhRecPointsTask++;
ebdd0606 581 TH2F *h9 = new TH2F("SDDLocalCoordDistrib","Local Coord Distrib",1000/nOnline,-4,4,1000/nOnline,-4,4);//position number 9
582 h9->GetXaxis()->SetTitle("X local coord, drift, cm");
583 h9->GetYaxis()->SetTitle("Z local coord, anode, cm");
eca4fa66 584 rv = fAliITSQADataMakerRec->Add2RecPointsList((new TH2F(*h9)),9 +fGenRecPointsOffset, expert, !image);
ebdd0606 585 delete h9;
ad300de9 586 fSDDhRecPointsTask++;
ebdd0606 587
588
589 TH1F *h10 = new TH1F("SDDrdistrib_Layer3" ,"SDD r distribution Layer3" ,100,14.,18.);//position number 10 (L3)
590 h10->GetXaxis()->SetTitle("r[cm]");
591 h10->GetXaxis()->CenterTitle();
592 h10->GetYaxis()->SetTitle("Entries");
eca4fa66 593 rv = fAliITSQADataMakerRec->Add2RecPointsList((new TH1F(*h10)),10 +fGenRecPointsOffset, expert, !image);
ebdd0606 594 delete h10;
ad300de9 595 fSDDhRecPointsTask++;
ebdd0606 596
597 TH1F *h11 = new TH1F("SDDrdistrib_Layer4" ,"SDD r distribution Layer4" ,100,22.,26.);// and position number 11 (L4)
598 h11->GetXaxis()->SetTitle("r[cm]");
599 h11->GetXaxis()->CenterTitle();
600 h11->GetYaxis()->SetTitle("Entries");
eca4fa66 601 rv = fAliITSQADataMakerRec->Add2RecPointsList((new TH1F(*h11)),11 +fGenRecPointsOffset, expert, !image);
ebdd0606 602 delete h11;
ad300de9 603 fSDDhRecPointsTask++;
ebdd0606 604
605 for(Int_t iLay=0; iLay<=1; iLay++){
606 sprintf(hisnam,"SDDphidistrib_Layer%d",iLay+3);
607 TH1F *h12 = new TH1F(hisnam,hisnam,180,-TMath::Pi(),TMath::Pi());//position number 12 (L3) and position number 13 (L4)
608 h12->GetXaxis()->SetTitle("#varphi[rad]");
609 h12->GetXaxis()->CenterTitle();
610 h12->GetYaxis()->SetTitle("Entries");
eca4fa66 611 rv = fAliITSQADataMakerRec->Add2RecPointsList((new TH1F(*h12)),iLay+12+fGenRecPointsOffset, expert, !image);
ebdd0606 612 delete h12;
ad300de9 613 fSDDhRecPointsTask++;
ebdd0606 614 }
615
616 if(fkOnline)
617 {
618 TH2F *h14 = new TH2F("SDDGlobalCoordDistribYXFSE","YX Global Coord Distrib FSE",5600/nOnline2,-28,28,5600/nOnline2,-28,28);//position number 14
619 h14->GetYaxis()->SetTitle("Y[cm]");
620 h14->GetXaxis()->SetTitle("X[cm]");
eca4fa66 621 rv = fAliITSQADataMakerRec->Add2RecPointsList((new TH2F(*h14)),14+fGenRecPointsOffset, expert, !image);
ebdd0606 622 delete h14;
ad300de9 623 fSDDhRecPointsTask++;
ebdd0606 624
625 TH2F *h15 = new TH2F("SDDGlobalCoordDistribRZFSE","RZ Global Coord Distrib FSE",Int_t(6400/nOnline3),-32,32,1400/nOnline4,12,26);//position number 15
626 h15->GetYaxis()->SetTitle("R[cm]");
627 h15->GetXaxis()->SetTitle("Z[cm]");
eca4fa66 628 rv = fAliITSQADataMakerRec->Add2RecPointsList((new TH2F(*h15)),15+fGenRecPointsOffset, expert, !image);
ebdd0606 629 delete h15;
ad300de9 630 fSDDhRecPointsTask++;
ebdd0606 631
ebdd0606 632 }//online
633
ad300de9 634 //printf("%d SDD Recs histograms booked\n",fSDDhRecPointsTask);
ebdd0606 635
636
5379c4a3 637 AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SDD Recs histograms booked\n",fSDDhRecPointsTask));
ebdd0606 638
eca4fa66 639 return rv ;
ebdd0606 640}
641
642//____________________________________________________________________________
eca4fa66 643Int_t AliITSQASDDDataMakerRec::MakeRecPoints(TTree * clustersTree)
7a0e5776 644{
ebdd0606 645 // Fill QA for RecPoints - SDD -
eca4fa66 646 Int_t rv = 0 ;
ebdd0606 647 Int_t lay, lad, det;
648 TBranch *branchRecP = clustersTree->GetBranch("ITSRecPoints");
649 if (!branchRecP) {
650 AliError("can't get the branch with the ITS clusters !");
eca4fa66 651 return rv ;
ebdd0606 652 }
eca4fa66 653 // Check id histograms already created for this Event Specie
654 if ( ! fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset) )
655 rv = InitRecPoints() ;
ebdd0606 656
657 static TClonesArray statRecpoints("AliITSRecPoint") ;
658 TClonesArray *recpoints = &statRecpoints;
659 branchRecP->SetAddress(&recpoints);
660 Int_t npoints = 0;
661 Float_t cluglo[3]={0.,0.,0.};
662 if(fkOnline)
663 {
664 for(Int_t i=14;i<16;i++)
665 {
ad300de9 666 fAliITSQADataMakerRec->GetRecPointsData(i+fGenRecPointsOffset)->Reset();
ebdd0606 667 }
668 }
669 for(Int_t module=0; module<clustersTree->GetEntries();module++){
670 branchRecP->GetEvent(module);
671 npoints += recpoints->GetEntries();
672 AliITSgeomTGeo::GetModuleId(module, lay, lad, det);
673 //printf("modnumb %d, lay %d, lad %d, det %d \n",module, lay, lad, det);
674 for(Int_t j=0;j<recpoints->GetEntries();j++){
675 AliITSRecPoint *recp = (AliITSRecPoint*)recpoints->At(j);
ad300de9 676 fAliITSQADataMakerRec->GetRecPointsData(6 +fGenRecPointsOffset)->Fill(module);//modpatternrp
ebdd0606 677 recp->GetGlobalXYZ(cluglo);
678 Float_t rad=TMath::Sqrt(cluglo[0]*cluglo[0]+cluglo[1]*cluglo[1]);
679 Float_t phi=TMath::ATan2(cluglo[1],cluglo[0]);
ad300de9 680 fAliITSQADataMakerRec->GetRecPointsData(9 +fGenRecPointsOffset)->Fill(recp->GetDetLocalX(),recp->GetDetLocalZ());//local distribution
681 fAliITSQADataMakerRec->GetRecPointsData(2 +fGenRecPointsOffset)->Fill(cluglo[0],cluglo[1]);//global distribution YX
682 fAliITSQADataMakerRec->GetRecPointsData(3 +fGenRecPointsOffset)->Fill(cluglo[2],rad);//global distribution rz
ebdd0606 683 if(fkOnline)
684 {
ad300de9 685 fAliITSQADataMakerRec->GetRecPointsData(14 +fGenRecPointsOffset)->Fill(cluglo[0],cluglo[1]);//global distribution YX FSE
686 fAliITSQADataMakerRec->GetRecPointsData(15 +fGenRecPointsOffset)->Fill(cluglo[2],rad);//global distribution rz FSE
ebdd0606 687 }
688 if(recp->GetLayer() ==2) {
ad300de9 689 fAliITSQADataMakerRec->GetRecPointsData(0 +fGenRecPointsOffset)->Fill(recp->GetQ()) ;//total charge of layer 3
690 fAliITSQADataMakerRec->GetRecPointsData(7 +fGenRecPointsOffset)->Fill(lad);//lad pattern layer 3
691 fAliITSQADataMakerRec->GetRecPointsData(10 +fGenRecPointsOffset)->Fill(rad);//r distribution layer 3
692 fAliITSQADataMakerRec->GetRecPointsData(12 +fGenRecPointsOffset)->Fill(phi);// phi distribution layer 3
693 fAliITSQADataMakerRec->GetRecPointsData(4 +fGenRecPointsOffset)->Fill(cluglo[2],phi);// phi distribution layer 3
ebdd0606 694 }
695 else if(recp->GetLayer() ==3) {
ad300de9 696 fAliITSQADataMakerRec->GetRecPointsData(1 +fGenRecPointsOffset)->Fill(recp->GetQ()) ;//total charge layer 4
697 fAliITSQADataMakerRec->GetRecPointsData(8 +fGenRecPointsOffset)->Fill(lad);//ladpatternlayer4
698 fAliITSQADataMakerRec->GetRecPointsData(11 +fGenRecPointsOffset)->Fill(rad);//r distribution
699 fAliITSQADataMakerRec->GetRecPointsData(13 +fGenRecPointsOffset)->Fill(phi);//phi distribution
700 fAliITSQADataMakerRec->GetRecPointsData(5 +fGenRecPointsOffset)->Fill(cluglo[2],phi);// phi distribution layer 4
ebdd0606 701 }
702 }
703 }
704 statRecpoints.Clear();
eca4fa66 705 return rv ;
ebdd0606 706}
707
e41192d7 708//_______________________________________________________________
709
7a0e5776 710void AliITSQASDDDataMakerRec::SetHLTModeFromEnvironment()
711{
e41192d7 712
713 Int_t hltmode= ::atoi(gSystem->Getenv("HLT_MODE"));
714
7a0e5776 715 if(hltmode==1)
716 {
717 AliInfo("Online mode: HLT mode A selected from environment for SDD\n");
718 SetHLTMode(kFALSE);
719 }
720 else
721 if(hltmode==2)
722 {
723 AliInfo("Online mode: HLT mode C compressed selected from environment for SDD\n");
724 SetHLTMode(kTRUE);
725 }
ad300de9 726}
727
728
729//_______________________________________________________________
730
4e25ac79 731Int_t AliITSQASDDDataMakerRec::GetOffset(AliQAv1::TASKINDEX_t task)
7a0e5776 732{
ad300de9 733 Int_t offset=0;
4e25ac79 734 if( task == AliQAv1::kRAWS )
7a0e5776 735 {
736 offset=fGenRawsOffset;
737 }
eca4fa66 738 else if(task == AliQAv1::kDIGITSR )
739 {
740 offset=fGenDigitsOffset;
741 }
742 else if( task == AliQAv1::kRECPOINTS )
743 {
744 offset=fGenRecPointsOffset;
745 }
7a0e5776 746 else AliInfo("No task has been selected. Offset set to zero.\n");
ad300de9 747 return offset;
748}
749
750//_______________________________________________________________
751
eca4fa66 752void AliITSQASDDDataMakerRec::SetOffset(AliQAv1::TASKINDEX_t task, Int_t offset) {
753 // Returns offset number according to the specified task
754 if( task == AliQAv1::kRAWS ) {
755 fGenRawsOffset=offset;
756 }
757 else if( task == AliQAv1::kDIGITSR ) {
758 fGenDigitsOffset=offset;
759 }
760 else if( task == AliQAv1::kRECPOINTS ) {
761 fGenRecPointsOffset=offset;
762 }
763 else {
764 AliInfo("No task has been selected. Offset set to zero.\n");
765 }
766}
767
768//_______________________________________________________________
769
4e25ac79 770Int_t AliITSQASDDDataMakerRec::GetTaskHisto(AliQAv1::TASKINDEX_t task)
7a0e5776 771{
ad300de9 772
7a0e5776 773 Int_t histotot=0;
ad300de9 774
4e25ac79 775 if( task == AliQAv1::kRAWS )
7a0e5776 776 {
777 histotot=fSDDhRawsTask ;
778 }
eca4fa66 779 else if(task == AliQAv1::kDIGITSR)
780 {
781 histotot=fSDDhDigitsTask;
782 }
783 else if( task == AliQAv1::kRECPOINTS )
784 {
785 histotot=fSDDhRecPointsTask;
786 }
787 else AliInfo("No task has been selected. TaskHisto set to zero.\n");
ad300de9 788 return histotot;
e41192d7 789}