]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSQASDDDataMakerRec.cxx
Rename method Dump to DumpPayLoad to avoid compilation warning since mother class...
[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
8b7e858c 24// M.Siciliano Aug 2008 QA RecPoints
ebdd0606 25// INFN Torino
26
27// --- ROOT system ---
ad300de9 28
ebdd0606 29#include <TProfile2D.h>
30#include <TH2D.h>
58ceb8ca 31#include <TH1F.h>
ebdd0606 32#include <TBranch.h>
33#include <TTree.h>
34#include <TGaxis.h>
35#include <TMath.h>
8b7e858c 36#include <TF1.h>
ebdd0606 37#include <TDirectory.h>
e41192d7 38#include <TSystem.h>
3f90b3dc 39#include <TObjArray.h>
40
ebdd0606 41// --- Standard library ---
42
43// --- AliRoot header files ---
44#include "AliITSQASDDDataMakerRec.h"
45#include "AliLog.h"
4e25ac79 46#include "AliQAv1.h"
ebdd0606 47#include "AliQAChecker.h"
48#include "AliRawReader.h"
e41192d7 49#include "AliITSRawStream.h"
ebdd0606 50#include "AliITSRawStreamSDD.h"
e41192d7 51#include "AliITSRawStreamSDDCompressed.h"
52#include "AliITSDetTypeRec.h"
5192f264 53#include "AliITSdigit.h"
ebdd0606 54#include "AliITSRecPoint.h"
e62fe478 55#include "AliITSRecPointContainer.h"
ebdd0606 56#include "AliITSgeomTGeo.h"
ebdd0606 57#include "AliCDBManager.h"
58#include "AliCDBStorage.h"
59#include "AliCDBEntry.h"
ad300de9 60#include "Riostream.h"
fc89f88c 61#include "AliITSdigitSDD.h"
62#include "AliITS.h"
63#include "AliRunLoader.h"
64#include "AliITSLoader.h"
65#include "AliITSDetTypeRec.h"
3f90b3dc 66#include "AliITSCalibrationSDD.h"
fc89f88c 67
ebdd0606 68
69ClassImp(AliITSQASDDDataMakerRec)
70
71//____________________________________________________________________________
72AliITSQASDDDataMakerRec::AliITSQASDDDataMakerRec(AliITSQADataMakerRec *aliITSQADataMakerRec, Bool_t kMode, Short_t ldc) :
73TObject(),
74fAliITSQADataMakerRec(aliITSQADataMakerRec),
75fkOnline(kMode),
76fLDC(ldc),
ad300de9 77fSDDhRawsTask(0),
44ed7a66 78fSDDhDigitsTask(0),
ad300de9 79fSDDhRecPointsTask(0),
ad300de9 80fGenRawsOffset(0),
44ed7a66 81fGenDigitsOffset(0),
ad300de9 82fGenRecPointsOffset(0),
ebdd0606 83fTimeBinSize(1),
3f90b3dc 84fNEvent(0),
85fNEventRP(0),
86fDDLModuleMap(0),
87fCalibration(0),
88fHistoCalibration(0)
ebdd0606 89{
90 //ctor used to discriminate OnLine-Offline analysis
8b7e858c 91 if(fLDC < 0 || fLDC > 6) {
ebdd0606 92 AliError("Error: LDC number out of range; return\n");
93 }
8b7e858c 94 fGenRawsOffset = new Int_t[AliRecoParam::kNSpecies];
95 fGenRecPointsOffset = new Int_t[AliRecoParam::kNSpecies];
4a903927 96 fGenDigitsOffset = new Int_t[AliRecoParam::kNSpecies];
8b7e858c 97 for(Int_t i=0; i<AliRecoParam::kNSpecies; i++) {
98 fGenRawsOffset[i] = 0;
99 fGenRecPointsOffset[i] = 0;
4a903927 100 fGenDigitsOffset[i]=0;
8b7e858c 101 }
ebdd0606 102}
103
104//____________________________________________________________________________
105AliITSQASDDDataMakerRec::AliITSQASDDDataMakerRec(const AliITSQASDDDataMakerRec& qadm) :
106TObject(),
107fAliITSQADataMakerRec(qadm.fAliITSQADataMakerRec),
108fkOnline(qadm.fkOnline),
109fLDC(qadm.fLDC),
ad300de9 110fSDDhRawsTask(qadm.fSDDhRawsTask),
44ed7a66 111fSDDhDigitsTask(qadm.fSDDhDigitsTask),
ad300de9 112fSDDhRecPointsTask(qadm.fSDDhRecPointsTask),
ad300de9 113fGenRawsOffset(qadm.fGenRawsOffset),
44ed7a66 114fGenDigitsOffset(qadm.fGenDigitsOffset),
ad300de9 115fGenRecPointsOffset(qadm.fGenRecPointsOffset),
3f90b3dc 116fTimeBinSize(qadm.fTimeBinSize),
117fNEvent(qadm.fNEvent),
118fNEventRP(qadm.fNEventRP),
119fDDLModuleMap(qadm.fDDLModuleMap),
120fCalibration(qadm.fCalibration),
121fHistoCalibration(qadm.fHistoCalibration)
58ceb8ca 122{
ebdd0606 123 //copy ctor
124 fAliITSQADataMakerRec->SetName((const char*)qadm.fAliITSQADataMakerRec->GetName()) ;
125 fAliITSQADataMakerRec->SetTitle((const char*)qadm.fAliITSQADataMakerRec->GetTitle());
126 fDDLModuleMap=NULL;
127}
128
129//____________________________________________________________________________
130AliITSQASDDDataMakerRec::~AliITSQASDDDataMakerRec(){
131 // destructor
58ceb8ca 132 //if(fDDLModuleMap) delete fDDLModuleMap;
3f90b3dc 133 if(fHistoCalibration){delete fHistoCalibration; fHistoCalibration=NULL;}
ebdd0606 134}
135//__________________________________________________________________
136AliITSQASDDDataMakerRec& AliITSQASDDDataMakerRec::operator = (const AliITSQASDDDataMakerRec& qac )
137{
7a0e5776 138 // Equal operator.
ebdd0606 139 this->~AliITSQASDDDataMakerRec();
140 new(this) AliITSQASDDDataMakerRec(qac);
141 return *this;
142}
143
144//____________________________________________________________________________
145void AliITSQASDDDataMakerRec::StartOfDetectorCycle()
146{
147 //Detector specific actions at start of cycle
5379c4a3 148 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM::Start of SDD Cycle\n");
3f90b3dc 149 if(fAliITSQADataMakerRec->GetRawsData(0)!=NULL){
150 fAliITSQADataMakerRec->GetRawsData(3+ fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Reset();
151 fAliITSQADataMakerRec->GetRawsData(4+ fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Reset();
152 fAliITSQADataMakerRec->GetRawsData(5+ fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Reset();
153 }
154
155 if(fAliITSQADataMakerRec->GetRecPointsData(0)!=NULL){
156 fAliITSQADataMakerRec->GetRecPointsData(9+ fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Reset();
157 fAliITSQADataMakerRec->GetRecPointsData(10+ fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Reset();
158 fAliITSQADataMakerRec->GetRecPointsData(11+ fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Reset();
159 }
ebdd0606 160}
161
162//____________________________________________________________________________
3f90b3dc 163void AliITSQASDDDataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray* /*list*/)
ebdd0606 164{
8b7e858c 165 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSDM instantiates checker with Run(AliQAv1::kITS, task, list)\n");
3f90b3dc 166 if(task==AliQAv1::kRAWS){
167 printf("fNevent %d \n",fNEvent);
168 if(fNEvent!=0){
169 ((TH1D*)fAliITSQADataMakerRec->GetRawsData(3 + fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()]))->Divide((TH1D*)fAliITSQADataMakerRec->GetRawsData(0 + fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()]),((TH1D*) (fHistoCalibration->At(0))),1.,(Double_t)fNEvent);
170
171 ((TH2D*)fAliITSQADataMakerRec->GetRawsData(4 + fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()]))->Divide((TH2D*)fAliITSQADataMakerRec->GetRawsData(1 + fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()]),((TH2D*)(fHistoCalibration->At(1))),1.,(Double_t)fNEvent);
172
173 ((TH2D*)fAliITSQADataMakerRec->GetRawsData(5 + fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()]))->Divide((TH2D*)fAliITSQADataMakerRec->GetRawsData(2 + fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()]),((TH2D*)(fHistoCalibration->At(2))),1.,(Double_t)fNEvent);
174 }
175 }//end raws
176
177 if(task==AliQAv1::kRECPOINTS){
178 printf("fNeventRP %d \n",fNEventRP);
179 if(fNEventRP!=0){
180 ((TH1D*)fAliITSQADataMakerRec->GetRecPointsData(9 + fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()]))->Divide((TH1D*)fAliITSQADataMakerRec->GetRecPointsData(6 + fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()]),((TH1D*) (fHistoCalibration->At(0))),1.,(Double_t)fNEventRP);
181
182 ((TH2D*)fAliITSQADataMakerRec->GetRecPointsData(10+ fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()]))->Divide((TH2D*)fAliITSQADataMakerRec->GetRecPointsData(7 + fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()]),((TH2D*)(fHistoCalibration->At(1))),1.,(Double_t)fNEventRP);
183
184 ((TH2D*)fAliITSQADataMakerRec->GetRecPointsData(11+ fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()]))->Divide((TH2D*)fAliITSQADataMakerRec->GetRecPointsData(8 + fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()]),((TH2D*)(fHistoCalibration->At(2))),1.,(Double_t)fNEventRP);
185 }
186 }//end recpoints
187
ebdd0606 188}
189
190//____________________________________________________________________________
eca4fa66 191Int_t AliITSQASDDDataMakerRec::InitRaws()
ebdd0606 192{
193 // Initialization for RAW data - SDD -
7d297381 194 const Bool_t expert = kTRUE ;
195 const Bool_t saveCorr = kTRUE ;
196 const Bool_t image = kTRUE ;
58ceb8ca 197
eca4fa66 198 Int_t rv = 0 ;
ebdd0606 199 Int_t lay, lad, det;
ebdd0606 200 Int_t indexlast = 0;
201 Int_t index1 = 0;
202
3f90b3dc 203 if(fkOnline){AliInfo("Book Online Histograms for SDD\n");}
204 else {AliInfo("Book Offline Histograms for SDD\n ");}
7a0e5776 205 TH1D *h0 = new TH1D("SDDModPattern","HW Modules pattern",fgknSDDmodules,239.5,499.5); //0
ebdd0606 206 h0->GetXaxis()->SetTitle("Module Number");
207 h0->GetYaxis()->SetTitle("Counts");
ce8c37f2 208 rv = fAliITSQADataMakerRec->Add2RawsList(h0,0+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr);
ad300de9 209 fSDDhRawsTask++;
7a0e5776 210
211 //zPhi distribution using ladder and modules numbers
3f90b3dc 212 TH2D *hphil3 = new TH2D("SDDphizL3","SDD #varphiz Layer3 ",12,0.5,6.5,14,0.5,14.5);//1
5af1d436 213 hphil3->GetXaxis()->SetTitle("z[Module Number L3 ]");
214 hphil3->GetYaxis()->SetTitle("#varphi[ Ladder Number L3]");
ce8c37f2 215 rv = fAliITSQADataMakerRec->Add2RawsList(hphil3,1+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image, saveCorr);
7a0e5776 216 fSDDhRawsTask++;
217
3f90b3dc 218 TH2D *hphil4 = new TH2D("SDDphizL4","SDD #varphiz Layer4 ",16,0.5,8.5,22,0.5,22.5); //2
5af1d436 219 hphil4->GetXaxis()->SetTitle("z[Module Number L4]");
220 hphil4->GetYaxis()->SetTitle("#varphi[Ladder Number L4]");
ce8c37f2 221 rv = fAliITSQADataMakerRec->Add2RawsList(hphil4,2+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image, saveCorr);
7a0e5776 222 fSDDhRawsTask++;
223
3f90b3dc 224 //normalized histograms
225 TH1D *h0norm = new TH1D("SDDModPatternNORM","NORM HW Modules pattern",fgknSDDmodules,239.5,499.5); //3
226 h0norm->GetXaxis()->SetTitle("Module Number");
227 h0norm->GetYaxis()->SetTitle("Counts");
228 rv = fAliITSQADataMakerRec->Add2RawsList(h0norm,3+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr);
229 fSDDhRawsTask++;
230
231 //zPhi distribution using ladder and modules numbers
232 TH2D *hphil3norm = new TH2D("SDDphizL3NORM","NORM SDD #varphiz Layer3 ",12,0.5,6.5,14,0.5,14.5);//4
233 hphil3norm->GetXaxis()->SetTitle("z[Module Number L3 ]");
234 hphil3norm->GetYaxis()->SetTitle("#varphi[ Ladder Number L3]");
235 rv = fAliITSQADataMakerRec->Add2RawsList(hphil3norm,4+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr);
236 fSDDhRawsTask++;
237
238 TH2D *hphil4norm = new TH2D("SDDphizL4NORM","NORM SDD #varphiz Layer4 ",16,0.5,8.5,22,0.5,22.5); //5
239 hphil4norm->GetXaxis()->SetTitle("z[Module Number L4]");
240 hphil4norm->GetYaxis()->SetTitle("#varphi[Ladder Number L4]");
241 rv = fAliITSQADataMakerRec->Add2RawsList(hphil4norm,5+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr);
242 fSDDhRawsTask++;
ebdd0606 243
3f90b3dc 244 if(fkOnline){
7a0e5776 245 //DDL Pattern
3f90b3dc 246 TH2D *hddl = new TH2D("SDDDDLPattern","SDD DDL Pattern ",24,-0.5,11.5,24,-0.5,23.5); //6
ad300de9 247 hddl->GetXaxis()->SetTitle("Channel");
5af1d436 248 hddl->GetYaxis()->SetTitle("DDL Number");
3f90b3dc 249 rv = fAliITSQADataMakerRec->Add2RawsList(hddl,6+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr);
ad300de9 250 fSDDhRawsTask++;
7a0e5776 251 Int_t indexlast1 = 0;
252
253 fTimeBinSize = 4;
254 indexlast = 0;
255 index1 = 0;
256 indexlast1 = fSDDhRawsTask;
257 char *hname[3];
258 for(Int_t i=0; i<3; i++) hname[i]= new char[50];
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],"SDDchargeMapFSE_L%d_%d_%d_%d",lay,lad,det,iside);
263 sprintf(hname[1],"SDDChargeMapForSingleEvent_L%d_%d_%d_%d",lay,lad,det,iside);
fc89f88c 264 // sprintf(hname[2],"SDDhmonoDMap_L%d_%d_%d_%d",lay,lad,det,iside);
7a0e5776 265 TProfile2D *fModuleChargeMapFSE = new TProfile2D(hname[0],hname[1],256/fTimeBinSize,-0.5,255.5,256,-0.5,255.5);
266 fModuleChargeMapFSE->GetXaxis()->SetTitle("Time Bin");
267 fModuleChargeMapFSE->GetYaxis()->SetTitle("Anode");
80b9610c 268 rv = fAliITSQADataMakerRec->Add2RawsList(fModuleChargeMapFSE,indexlast1 + index1 + fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr);
7a0e5776 269 fSDDhRawsTask++;
270 index1++;
ebdd0606 271 }
7a0e5776 272 }
273
274 for(Int_t moduleSDD =0; moduleSDD<fgknSDDmodules; moduleSDD++){
275 for(Int_t iside=0;iside<fgknSide;iside++){
276 AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det);
277 sprintf(hname[0],"SDDchargeMap_L%d_%d_%d_%d",lay,lad,det,iside);
278 sprintf(hname[1],"SDDChargeMap_L%d_%d_%d_%d",lay,lad,det,iside);
279 TProfile2D *fModuleChargeMap = new TProfile2D(hname[0],hname[1],256/fTimeBinSize,-0.5,255.5,256,-0.5,255.5);
280 fModuleChargeMap->GetXaxis()->SetTitle("Time Bin");
5af1d436 281 fModuleChargeMap->GetYaxis()->SetTitle("Anode Number");
80b9610c 282 rv = fAliITSQADataMakerRec->Add2RawsList(fModuleChargeMap,indexlast1 + index1 + fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr);
7a0e5776 283 fSDDhRawsTask++;
284 index1++;
ebdd0606 285 }
7a0e5776 286 }
287
58ceb8ca 288 //Event Size
3f90b3dc 289 TH1F *hsize = new TH1F("SDDEventSize","SDD Event Size ",500,-0.5,199.5);
290 hsize->SetBit(TH1::kCanRebin);
58ceb8ca 291 hsize->GetXaxis()->SetTitle("Event Size [kB]");
292 hsize->GetYaxis()->SetTitle("Entries");
ce8c37f2 293 rv = fAliITSQADataMakerRec->Add2RawsList(hsize,indexlast1 + index1 + fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr);
58ceb8ca 294 fSDDhRawsTask++;
8b7e858c 295
7a0e5776 296 } // kONLINE
3f90b3dc 297 InitCalibrationArray();
5379c4a3 298 AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SDD Raws histograms booked\n",fSDDhRawsTask));
eca4fa66 299 return rv ;
ebdd0606 300}
301
302
303//____________________________________________________________________________
eca4fa66 304Int_t AliITSQASDDDataMakerRec::MakeRaws(AliRawReader* rawReader)
ebdd0606 305{
306 // Fill QA for RAW - SDD -
3f90b3dc 307 Int_t rv = 0;
7555afef 308 // Check id histograms already created for this Event Specie
3f90b3dc 309 fNEvent++;
310 if(!fDDLModuleMap){CreateTheMap();}
311 if(!fCalibration) {CreateTheCalibration();}
eca4fa66 312 if(rawReader->GetType() != 7) return rv; // skips non physical triggers
5379c4a3 313 AliDebug(AliQAv1::GetQADebugLevel(),"entering MakeRaws\n");
e41192d7 314 rawReader->Reset();
58ceb8ca 315 rawReader->Select("ITSSDD");
8b7e858c 316 AliITSRawStream *stream=AliITSRawStreamSDD::CreateRawStreamSDD(rawReader);
317 stream->SetDDLModuleMap(fDDLModuleMap);
e41192d7 318
ebdd0606 319 Int_t lay, lad, det;
7a0e5776 320
ebdd0606 321 Int_t index=0;
322 if(fkOnline) {
323 for(Int_t moduleSDD =0; moduleSDD<fgknSDDmodules; moduleSDD++){
7a0e5776 324 for(Int_t iside=0;iside<fgknSide;iside++) {
3f90b3dc 325 if(fSDDhRawsTask > 7 + index) fAliITSQADataMakerRec->GetRawsData(7 + index +fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Reset();
7a0e5776 326 // 4 because the 2D histos for single events start after the fourth position
327 index++;
328 }
ebdd0606 329 }
330 }
e41192d7 331
ebdd0606 332 Int_t cnt = 0;
333 Int_t ildcID = -1;
334 Int_t iddl = -1;
335 Int_t isddmod = -1;
7a0e5776 336 Int_t coord1, coord2, signal, moduleSDD, activeModule, index1;
58ceb8ca 337 //if(fkOnline)
338 //{
339 Int_t prevDDLID = -1;
340 UInt_t size = 0;
341 int totalddl=static_cast<int>(fDDLModuleMap->GetNDDLs());
342 Bool_t *ddldata=new Bool_t[totalddl];
343 for(Int_t jddl=0;jddl<totalddl;jddl++){ddldata[jddl]=kFALSE;}
344 //}
e41192d7 345 while(stream->Next()) {
ebdd0606 346 ildcID = rawReader->GetLDCId();
58ceb8ca 347 iddl = rawReader->GetDDLID();// - fgkDDLIDshift;
3f90b3dc 348 //printf("----------------------iddl %i\n",iddl);
58ceb8ca 349
e41192d7 350 isddmod = fDDLModuleMap->GetModuleNumber(iddl,stream->GetCarlosId());
ebdd0606 351 if(isddmod==-1){
5379c4a3 352 AliDebug(AliQAv1::GetQADebugLevel(),Form("Found module with iddl: %d, stream->GetCarlosId: %d \n",iddl,stream->GetCarlosId()));
ebdd0606 353 continue;
354 }
e41192d7 355 if(stream->IsCompletedModule()) {
5379c4a3 356 AliDebug(AliQAv1::GetQADebugLevel(),Form("IsCompletedModule == KTRUE\n"));
ebdd0606 357 continue;
358 }
de075dae 359 if(stream->IsCompletedDDL()) {
58ceb8ca 360 if(fkOnline){
361 if ((rawReader->GetDDLID() != prevDDLID)&&(ddldata[iddl])==kFALSE){
362 size += rawReader->GetDataSize();//in bytes
363 prevDDLID = rawReader->GetDDLID();
364 ddldata[iddl]=kTRUE;
365 }
366 }
5379c4a3 367 AliDebug(AliQAv1::GetQADebugLevel(),Form("IsCompletedDDL == KTRUE\n"));
de075dae 368 continue;
369 }
ebdd0606 370
e41192d7 371 coord1 = stream->GetCoord1();
372 coord2 = stream->GetCoord2();
373 signal = stream->GetSignal();
ebdd0606 374
7a0e5776 375 moduleSDD = isddmod - fgkmodoffset;
376
b62d7123 377 if(isddmod <fgkmodoffset|| isddmod>fgknSDDmodules+fgkmodoffset-1) {
5379c4a3 378 AliDebug(AliQAv1::GetQADebugLevel(),Form( "Module SDD = %d, resetting it to 1 \n",isddmod));
b62d7123 379 isddmod = 1;
ebdd0606 380 }
7a0e5776 381
ebdd0606 382 AliITSgeomTGeo::GetModuleId(isddmod, lay, lad, det);
e41192d7 383 Short_t iside = stream->GetChannel();
ad300de9 384
58ceb8ca 385 //printf(" \n%i %i %i %i \n ",lay, lad, det,iside );
386 fAliITSQADataMakerRec->GetRawsData( 0 + fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()] )->Fill(isddmod);
387 if(lay==3) fAliITSQADataMakerRec->GetRawsData(1+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(det+0.5*iside-0.5,lad);
3f90b3dc 388 if(lay==4) {fAliITSQADataMakerRec->GetRawsData(2+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(det+0.5*iside-0.5,lad);}
58ceb8ca 389
ebdd0606 390 if(fkOnline) {
fc89f88c 391
3f90b3dc 392 fAliITSQADataMakerRec->GetRawsData(6+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill((stream->GetCarlosId())+0.5*iside -0.5,iddl);
393 // printf("content ddlmap %d, %d = %f \n",(stream->GetCarlosId()+0.5*iside -0.5),iddl,fAliITSQADataMakerRec->GetRawsData(3+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->GetBinContent(1+(det-1)*2;lad));
394 //printf("content ddlmap %d, %d = %f \n",(stream->GetCarlosId())+0.5*iside -0.5,iddl,fAliITSQADataMakerRec->GetRawsData(3+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->GetBinContent(1+(stream->GetCarlosId()-1)*2,iddl));
7a0e5776 395 activeModule = moduleSDD;
396 index1 = activeModule * 2 + iside;
397
398 if(index1<0){
5379c4a3 399 AliDebug(AliQAv1::GetQADebugLevel(),Form("Wrong index number %d - patched to 0\n",index1));
7a0e5776 400 index1 = 0;
401 }
78f8430c 402
3f90b3dc 403 if(fSDDhRawsTask > 7 + index1) {
404 ((TProfile2D *)(fAliITSQADataMakerRec->GetRawsData(7 + index1 +fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])))->Fill(coord2, coord1, signal);
405 ((TProfile2D *)(fAliITSQADataMakerRec->GetRawsData(7 + index1 + 260*2 +fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])))->Fill(coord2, coord1, signal);
ebdd0606 406 }
58ceb8ca 407 }//online
7a0e5776 408 cnt++;
5379c4a3 409 if(!(cnt%10000)) AliDebug(AliQAv1::GetQADebugLevel(),Form(" %d raw digits read",cnt));
58ceb8ca 410 }//end next()
3f90b3dc 411 if(fkOnline){((TH1F*)(fAliITSQADataMakerRec->GetRawsData(7 + 260*4 +fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])))->Fill(size/1024.);//KB
412 }
5379c4a3 413 AliDebug(AliQAv1::GetQADebugLevel(),Form("Event completed, %d raw digits read",cnt));
e41192d7 414 delete stream;
415 stream = NULL;
8b7e858c 416
417// if(fkOnline) {
418// AnalyseBNG(); // Analyse Baseline, Noise, Gain
419// AnalyseINJ(); // Analyse Injectors
420// }
421
58ceb8ca 422 delete []ddldata;
423 ddldata=NULL;
eca4fa66 424 return rv ;
7a0e5776 425}
ebdd0606 426
44ed7a66 427//____________________________________________________________________________
eca4fa66 428Int_t AliITSQASDDDataMakerRec::InitDigits()
44ed7a66 429{
430 // Initialization for DIGIT data - SDD -
431 const Bool_t expert = kTRUE ;
432 const Bool_t image = kTRUE ;
eca4fa66 433 Int_t rv = 0 ;
434// fGenDigitsOffset = (fAliITSQADataMakerRec->fDigitsQAList[AliRecoParam::kDefault])->GetEntries();
44ed7a66 435 //fSDDhTask must be incremented by one unit every time a histogram is ADDED to the QA List
436 TH1F* h0=new TH1F("SDD DIGITS Module Pattern","SDD DIGITS Module Pattern",260,239.5,499.5); //hmod
437 h0->GetXaxis()->SetTitle("SDD Module Number");
438 h0->GetYaxis()->SetTitle("# DIGITS");
4a903927 439 rv = fAliITSQADataMakerRec->Add2DigitsList(h0,fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);
44ed7a66 440 fSDDhDigitsTask ++;
4a903927 441 // printf("Add %s \t the task offset is %i\n",fAliITSQADataMakerRec->GetDigitsData(fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->GetName() , fSDDhDigitsTask );
44ed7a66 442 TH1F* h1=new TH1F("SDD Anode Distribution","DIGITS Anode Distribution",512,-0.5,511.5); //hanocc
443 h1->GetXaxis()->SetTitle("Anode Number");
444 h1->GetYaxis()->SetTitle("# DIGITS");
4a903927 445 rv = fAliITSQADataMakerRec->Add2DigitsList(h1,1+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);
44ed7a66 446 fSDDhDigitsTask ++;
4a903927 447 //printf("Add %s \t the task offset is %i\n",fAliITSQADataMakerRec->GetDigitsData(1+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->GetName() , fSDDhDigitsTask );
44ed7a66 448 TH1F* h2=new TH1F("SDD Tbin Distribution","DIGITS Tbin Distribution",256,-0.5,255.5); //htbocc
449 h2->GetXaxis()->SetTitle("Tbin Number");
450 h2->GetYaxis()->SetTitle("# DIGITS");
4a903927 451 rv = fAliITSQADataMakerRec->Add2DigitsList(h2,2+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);
44ed7a66 452 fSDDhDigitsTask ++;
4a903927 453 //printf("Add %s \t the task offset is %i\n",fAliITSQADataMakerRec->GetDigitsData(2+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->GetName() , fSDDhDigitsTask );
44ed7a66 454 TH1F* h3=new TH1F("SDD ADC Counts Distribution","DIGITS ADC Counts Distribution",200,0.,1024.); //hsig
455 h3->GetXaxis()->SetTitle("ADC Value");
456 h3->GetYaxis()->SetTitle("# DIGITS");
4a903927 457 rv = fAliITSQADataMakerRec->Add2DigitsList(h3,3+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);
44ed7a66 458 fSDDhDigitsTask ++;
4a903927 459 //printf("Add %s \t the task offset is %i\n",fAliITSQADataMakerRec->GetDigitsData(3+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->GetName() , fSDDhDigitsTask );
44ed7a66 460 AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SDD Digits histograms booked\n",fSDDhDigitsTask));
eca4fa66 461 return rv ;
44ed7a66 462}
463
464//____________________________________________________________________________
eca4fa66 465Int_t AliITSQASDDDataMakerRec::MakeDigits(TTree * digits)
44ed7a66 466{
7555afef 467
44ed7a66 468 // Fill QA for DIGIT - SDD -
fc89f88c 469 //AliITS *fITS = (AliITS*)gAlice->GetModule("ITS");
470 //fITS->SetTreeAddress();
471 //TClonesArray *iITSdigits = fITS->DigitsAddress(1);
472
473
eca4fa66 474 Int_t rv = 0 ;
475
fc89f88c 476 TBranch *branchD = digits->GetBranch("ITSDigitsSDD");
477
478 if (!branchD) {
479 AliError("can't get the branch with the ITS SDD digits !");
eca4fa66 480 return rv ;
44ed7a66 481 }
eca4fa66 482 // Check id histograms already created for this Event Specie
8b7e858c 483// if ( ! fAliITSQADataMakerRec->GetDigitsData(fGenDigitsOffset) )
484// rv = InitDigits() ;
eca4fa66 485
fc89f88c 486 static TClonesArray statDigits("AliITSdigitSDD");
44ed7a66 487 TClonesArray *iITSdigits = &statDigits;
488 branchD->SetAddress(&iITSdigits);
fc89f88c 489
44ed7a66 490 for(Int_t i=0; i<260; i++){
491 Int_t nmod=i+240;
492 digits->GetEvent(nmod);
493 Int_t ndigits = iITSdigits->GetEntries();
4a903927 494 fAliITSQADataMakerRec->GetDigitsData(fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(nmod,ndigits);
7555afef 495
44ed7a66 496 for (Int_t idig=0; idig<ndigits; idig++) {
497 AliITSdigit *dig=(AliITSdigit*)iITSdigits->UncheckedAt(idig);
498 Int_t iz=dig->GetCoord1(); // cell number z
499 Int_t ix=dig->GetCoord2(); // cell number x
500 Int_t sig=dig->GetSignal();
4a903927 501 fAliITSQADataMakerRec->GetDigitsData(1+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(iz);
502 fAliITSQADataMakerRec->GetDigitsData(2+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(ix);
503 fAliITSQADataMakerRec->GetDigitsData(3+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(sig);
44ed7a66 504 }
505 }
eca4fa66 506 return rv ;
44ed7a66 507}
508
ebdd0606 509//____________________________________________________________________________
eca4fa66 510Int_t AliITSQASDDDataMakerRec::InitRecPoints()
ebdd0606 511{
7555afef 512
8b7e858c 513 //AliInfo("Initialize SDD recpoints histos\n");
ebdd0606 514 // Initialization for RECPOINTS - SDD -
7d297381 515 const Bool_t expert = kTRUE ;
516 const Bool_t image = kTRUE ;
eca4fa66 517 Int_t rv = 0 ;
518// fGenRecPointsOffset = (fAliITSQADataMakerRec->fRecPointsQAList[AliRecoParam::kDefault])->GetEntries();
ad300de9 519
80b9610c 520 Int_t nOnline=1;
ebdd0606 521 Int_t nOnline2=1;
522 Int_t nOnline3=1;
523 Int_t nOnline4=1;
3f90b3dc 524 Int_t nOnline5=1;
525 Int_t nOnline6=1;
526 if(fkOnline){
ebdd0606 527 nOnline=4;
528 nOnline2=28;
3f90b3dc 529 nOnline3=46;
ebdd0606 530 nOnline4=14;
3f90b3dc 531 nOnline5=2;
532 nOnline6=62;
ebdd0606 533 }
534
8b7e858c 535 //AliInfo(Form("fAliITSQADataMakerRec->GetEventSpecie() %d\n",fAliITSQADataMakerRec->GetEventSpecie()));
536 //AliInfo(Form("fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()] %d\n",fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()]));
ebdd0606 537 TH1F *h0 = new TH1F("SDDLay3TotCh","Layer 3 total charge",1000/nOnline,-0.5, 499.5); //position number 0
3f90b3dc 538 //h0->SetBit(TH1::kCanRebin);
ebdd0606 539 h0->GetXaxis()->SetTitle("ADC value");
540 h0->GetYaxis()->SetTitle("Entries");
80b9610c 541 rv = fAliITSQADataMakerRec->Add2RecPointsList(h0, 0 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);//NON expert image
ad300de9 542 fSDDhRecPointsTask++;
ebdd0606 543
544 TH1F *h1 = new TH1F("SDDLay4TotCh","Layer 4 total charge",1000/nOnline,-0.5, 499.5);//position number 1
3f90b3dc 545 //h1->SetBit(TH1::kCanRebin);
ebdd0606 546 h1->GetXaxis()->SetTitle("ADC value");
547 h1->GetYaxis()->SetTitle("Entries");
80b9610c 548 rv = fAliITSQADataMakerRec->Add2RecPointsList(h1, 1 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);//NON expert image
ad300de9 549 fSDDhRecPointsTask++;
ebdd0606 550
551 char hisnam[50];
552 TH2F *h2 = new TH2F("SDDGlobalCoordDistribYX","YX Global Coord Distrib",5600/nOnline2,-28,28,5600/nOnline2,-28,28);//position number 2
553 h2->GetYaxis()->SetTitle("Y[cm]");
554 h2->GetXaxis()->SetTitle("X[cm]");
80b9610c 555 rv = fAliITSQADataMakerRec->Add2RecPointsList(h2,2+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);// NON expert image
ad300de9 556 fSDDhRecPointsTask++;
ebdd0606 557
558 TH2F *h3 = new TH2F("SDDGlobalCoordDistribRZ","RZ Global Coord Distrib",6400/nOnline3,-32,32,1400/nOnline4,12,26);//position number 3
559 h3->GetYaxis()->SetTitle("R[cm]");
560 h3->GetXaxis()->SetTitle("Z[cm]");
80b9610c 561 rv = fAliITSQADataMakerRec->Add2RecPointsList(h3,3+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);// NON expert image
ad300de9 562 fSDDhRecPointsTask++;
ebdd0606 563
3f90b3dc 564 TH2F *h4 = new TH2F("SDDGlobalCoordDistribL3PHIZ","#varphi Z Global Coord Distrib L3",4600/nOnline3,-23,23,360/nOnline,-TMath::Pi(),TMath::Pi());//position number 4
ebdd0606 565 h4->GetYaxis()->SetTitle("#phi[rad]");
566 h4->GetXaxis()->SetTitle("Z[cm]");
80b9610c 567 rv = fAliITSQADataMakerRec->Add2RecPointsList(h4,4+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);//NON expert image
ad300de9 568 fSDDhRecPointsTask++;
ebdd0606 569
3f90b3dc 570 TH2F *h5 = new TH2F("SDDGlobalCoordDistribL4PHIZ","#varphi Z Global Coord Distrib L4",6200/nOnline6,-31,31,360/nOnline,-TMath::Pi(),TMath::Pi());//position number 5
ebdd0606 571 h5->GetYaxis()->SetTitle("#phi[rad]");
572 h5->GetXaxis()->SetTitle("Z[cm]");
80b9610c 573 rv = fAliITSQADataMakerRec->Add2RecPointsList(h5,5+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);//NON expert image
ad300de9 574 fSDDhRecPointsTask++;
ebdd0606 575
3f90b3dc 576 TH1D *h6 = new TH1D("SDDModPatternRP","Modules pattern RP",fgknSDDmodules,239.5,499.5); //position number 6
ebdd0606 577 h6->GetXaxis()->SetTitle("Module number"); //spd offset = 240
578 h6->GetYaxis()->SetTitle("Entries");
80b9610c 579 rv = fAliITSQADataMakerRec->Add2RecPointsList(h6,6 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);// expert NO image
ad300de9 580 fSDDhRecPointsTask++;
58ceb8ca 581
3f90b3dc 582
583 TH2D *h7 = new TH2D("SDDModPatternL3RP","Modules pattern L3 RP",12,0.5,6.5,14,0.5,14.5); //position number 7
5af1d436 584 h7->GetXaxis()->SetTitle("z[#Module L3 ]");
585 h7->GetYaxis()->SetTitle("#varphi[#Ladder L3]");
3f90b3dc 586 rv = fAliITSQADataMakerRec->Add2RecPointsList(h7,7 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);// expert NO image
ad300de9 587 fSDDhRecPointsTask++;
58ceb8ca 588
3f90b3dc 589 TH2D *h8 = new TH2D("SDDModPatternL4RP","Modules pattern L4 RP",16,0.5,8.5,22,0.5,22.5); //position number 8
5af1d436 590 h8->GetXaxis()->SetTitle("[#Module L3 ]");
591 h8->GetYaxis()->SetTitle("#varphi[#Ladder L4]");
3f90b3dc 592 rv = fAliITSQADataMakerRec->Add2RecPointsList(h8,8 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);// expert NO image
593 fSDDhRecPointsTask++;
594
595 //------------------------norm--------------------------//
596
597
598 TH1D *h9 = new TH1D("SDDModPatternRPNORM","Modules pattern RP NORM",fgknSDDmodules,239.5,499.5); //position number 9
599 h9->GetXaxis()->SetTitle("Module number"); //spd offset = 240
600 h9->GetYaxis()->SetTitle("Entries");
601 rv = fAliITSQADataMakerRec->Add2RecPointsList(h9,9 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);// expert NO image
ad300de9 602 fSDDhRecPointsTask++;
58ceb8ca 603
3f90b3dc 604
605 TH2D *h10 = new TH2D("SDDModPatternL3RPNORM","Modules pattern L3 RP NORM",12,0.5,6.5,14,0.5,14.5); //position number 10
606 h10->GetXaxis()->SetTitle("z[#Module L3 ]");
607 h10->GetYaxis()->SetTitle("#varphi[#Ladder L3]");
608 rv = fAliITSQADataMakerRec->Add2RecPointsList(h10,10 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);// expert NO image
609 fSDDhRecPointsTask++;
610
611 TH2D *h11 = new TH2D("SDDModPatternL4RPNORM","Modules pattern L4 RP NORM",16,0.5,8.5,22,0.5,22.5); //position number 11
612 h11->GetXaxis()->SetTitle("[#Module L3 ]");
613 h10->GetYaxis()->SetTitle("#varphi[#Ladder L4]");
614 rv = fAliITSQADataMakerRec->Add2RecPointsList(h11,11 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);// expert NO image
615 fSDDhRecPointsTask++;
616
617 //--------------------------------------------------------//
618
619 TH2F *h12 = new TH2F("SDDLocalCoordDistrib","Local Coord Distrib",1000/nOnline,-4,4,1000/nOnline,-4,4);//position number 12
620 h12->GetXaxis()->SetTitle("X local coord, drift, cm");
621 h12->GetYaxis()->SetTitle("Z local coord, anode, cm");
622 rv = fAliITSQADataMakerRec->Add2RecPointsList(h12,12 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);// expert NO image
ad300de9 623 fSDDhRecPointsTask++;
58ceb8ca 624
625 //AliInfo("Create SDD recpoints histos\n");
626
3f90b3dc 627 TH1F *h13 = new TH1F("SDDrdistrib_Layer3" ,"SDD r distribution Layer3" ,100,14.,16.5);//position number 13 (L3)
628 h13->SetBit(TH1::kCanRebin);
629 h13->GetXaxis()->SetTitle("r[cm]");
630 h13->GetXaxis()->CenterTitle();
631 h13->GetYaxis()->SetTitle("Entries");
632 rv = fAliITSQADataMakerRec->Add2RecPointsList(h13,13 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);// expert NO image
58ceb8ca 633 fSDDhRecPointsTask++;
634
3f90b3dc 635 TH1F *h14 = new TH1F("SDDrdistrib_Layer4" ,"SDD r distribution Layer4" ,100,23.,25.);// and position number 14 (L4)
636 h14->SetBit(TH1::kCanRebin);
637 h14->GetXaxis()->SetTitle("r[cm]");
638 h14->GetXaxis()->CenterTitle();
639 h14->GetYaxis()->SetTitle("Entries");
640 rv = fAliITSQADataMakerRec->Add2RecPointsList(h14,14 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);// expert NO image
58ceb8ca 641 fSDDhRecPointsTask++;
642
ebdd0606 643 for(Int_t iLay=0; iLay<=1; iLay++){
644 sprintf(hisnam,"SDDphidistrib_Layer%d",iLay+3);
3f90b3dc 645 TH1F *h15 = new TH1F(hisnam,hisnam,180,-TMath::Pi(),TMath::Pi());//position number 15 (L3) and position number 16 (L4)
646 h15->GetXaxis()->SetTitle("#varphi[rad]");
647 h15->GetXaxis()->CenterTitle();
648 h15->GetYaxis()->SetTitle("Entries");
649 rv = fAliITSQADataMakerRec->Add2RecPointsList(h15,iLay+15+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);// expert NO image
ad300de9 650 fSDDhRecPointsTask++;
ebdd0606 651 }
58ceb8ca 652
653 for(Int_t iLay=0; iLay<=1; iLay++){
654 sprintf(hisnam,"SDDdrifttime_Layer%d",iLay+3);
3f90b3dc 655 TH1F *h17 = new TH1F(hisnam,hisnam,90/nOnline5,-0.5,4499.5);//position number 17 (L3) and position number 18 (L4)
656 h17->SetBit(TH1::kCanRebin);
657 h17->GetXaxis()->SetTitle("drift time[#mus]");
658 h17->GetXaxis()->CenterTitle();
659 h17->GetYaxis()->SetTitle("Entries");
660 rv = fAliITSQADataMakerRec->Add2RecPointsList(h17,iLay+17+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);// NON expert image
58ceb8ca 661 fSDDhRecPointsTask++;
662 }
663
3f90b3dc 664 if(fkOnline){
665 TH2F *h19 = new TH2F("SDDGlobalCoordDistribYXFSE","YX Global Coord Distrib FSE",5600/nOnline2,-28,28,5600/nOnline2,-28,28);//position number 19
666 h19->GetYaxis()->SetTitle("Y[cm]");
667 h19->GetXaxis()->SetTitle("X[cm]");
668 rv = fAliITSQADataMakerRec->Add2RecPointsList(h19,19+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);// expert NO image
ad300de9 669 fSDDhRecPointsTask++;
ebdd0606 670
3f90b3dc 671 TH2F *h20 = new TH2F("SDDGlobalCoordDistribRZFSE","RZ Global Coord Distrib FSE",Int_t(6400/nOnline3),-32,32,1400/nOnline4,12,26);//position number 20
672 h20->GetYaxis()->SetTitle("R[cm]");
673 h20->GetXaxis()->SetTitle("Z[cm]");
674 rv = fAliITSQADataMakerRec->Add2RecPointsList(h20,20+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);// expert NO image
675 fSDDhRecPointsTask++;
ebdd0606 676 }//online
58ceb8ca 677
5379c4a3 678 AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SDD Recs histograms booked\n",fSDDhRecPointsTask));
58ceb8ca 679
eca4fa66 680 return rv ;
ebdd0606 681}
682
683//____________________________________________________________________________
eca4fa66 684Int_t AliITSQASDDDataMakerRec::MakeRecPoints(TTree * clustersTree)
7a0e5776 685{
ebdd0606 686 // Fill QA for RecPoints - SDD -
3f90b3dc 687 Int_t rv = 0 ;
688 fNEventRP++;
ebdd0606 689 Int_t lay, lad, det;
8b7e858c 690 //AliInfo("get the branch with the ITS clusters !\n");
e62fe478 691 AliITSRecPointContainer* rpcont=AliITSRecPointContainer::Instance();
aa444532 692 TClonesArray *recpoints=NULL;
3f90b3dc 693 if(fkOnline){recpoints = rpcont->FetchClusters(0,clustersTree,fAliITSQADataMakerRec->GetEventNumber());}
694 else{recpoints = rpcont->FetchClusters(0,clustersTree);}
e62fe478 695 if(!rpcont->GetStatusOK() || !rpcont->IsSDDActive()){
696 AliError("can't get SDD clusters !");
697 return rv;
ebdd0606 698 }
699
ebdd0606 700 Int_t npoints = 0;
701 Float_t cluglo[3]={0.,0.,0.};
3f90b3dc 702 if(fkOnline){
703 for(Int_t i=19;i<21;i++){
8b7e858c 704 fAliITSQADataMakerRec->GetRecPointsData(i+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Reset();
ebdd0606 705 }
706 }
e62fe478 707 Int_t firMod=AliITSgeomTGeo::GetModuleIndex(3,1,1);
708 Int_t lasMod=AliITSgeomTGeo::GetModuleIndex(5,1,1);
709 for(Int_t module=firMod; module<lasMod;module++){
58ceb8ca 710 //AliInfo(Form("Module %d\n",module));
e62fe478 711 recpoints = rpcont->UncheckedGetClusters(module);
58ceb8ca 712 npoints += recpoints->GetEntries();
713 //AliInfo(Form("modnumb %d, npoints %d, total points %d\n",module, recpoints->GetEntries(),npoints));
80b9610c 714 //AliITSgeomTGeo::GetModuleId(module, lay, lad, det);
58ceb8ca 715 //AliInfo(Form("modnumb %d, lay %d, lad %d, det %d \n",module, lay, lad, det));
716
717 //AliInfo(Form("modnumb %d, entries %d\n",module, recpoints->GetEntries()));
718 for(Int_t j=0;j<recpoints->GetEntries();j++){
719 //AliInfo(Form("modnumb %d, entry %d \n",module, j));
80b9610c 720 AliITSRecPoint *recp = (AliITSRecPoint*)recpoints->At(j);
721 Int_t index = recp->GetDetectorIndex();
722 lay=recp->GetLayer();
723 Int_t modnumb=index+AliITSgeomTGeo::GetModuleIndex(lay+1,1,1);
724 //printf("modnumb %i\n",modnumb);
725 AliITSgeomTGeo::GetModuleId(modnumb, lay, lad, det);
726 fAliITSQADataMakerRec->GetRecPointsData(6 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(modnumb);//modpatternrp
58ceb8ca 727 recp->GetGlobalXYZ(cluglo);
728 Float_t rad=TMath::Sqrt(cluglo[0]*cluglo[0]+cluglo[1]*cluglo[1]);
729 Float_t phi=TMath::ATan2(cluglo[1],cluglo[0]);
730 Float_t drifttime=recp->GetDriftTime();
3f90b3dc 731 fAliITSQADataMakerRec->GetRecPointsData(12 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(recp->GetDetLocalX(),recp->GetDetLocalZ());//local distribution
80b9610c 732 if(lay==3||lay==4)fAliITSQADataMakerRec->GetRecPointsData(2 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluglo[0],cluglo[1]);//global distribution YX
58ceb8ca 733 fAliITSQADataMakerRec->GetRecPointsData(3 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluglo[2],rad);//global distribution rz
734 if(fkOnline) {
3f90b3dc 735 fAliITSQADataMakerRec->GetRecPointsData(19 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluglo[0],cluglo[1]);//global distribution YX FSE
736 fAliITSQADataMakerRec->GetRecPointsData(20 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluglo[2],rad);//global distribution rz FSE
58ceb8ca 737 }
738 if(recp->GetLayer() == 2) {
739 fAliITSQADataMakerRec->GetRecPointsData(0 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(recp->GetQ()) ;//total charge of layer 3
5af1d436 740 //fAliITSQADataMakerRec->GetRecPointsData(7 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(lad);//lad pattern layer 3
3f90b3dc 741 Int_t iside=recp->GetDriftSide();
742 //printf("iside =%d\n",iside);
743 fAliITSQADataMakerRec->GetRecPointsData(7 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(det+0.5*iside-0.5,lad);//mod pattern layer 3
744 fAliITSQADataMakerRec->GetRecPointsData(13 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(rad);//r distribution layer 3
745 fAliITSQADataMakerRec->GetRecPointsData(15 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(phi);// phi distribution layer 3
58ceb8ca 746 fAliITSQADataMakerRec->GetRecPointsData(4 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluglo[2],phi);// zphi distribution layer
3f90b3dc 747 fAliITSQADataMakerRec->GetRecPointsData(17 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(drifttime);// time distribution layer 3
58ceb8ca 748 } else if(recp->GetLayer() == 3) {
749 fAliITSQADataMakerRec->GetRecPointsData(1 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(recp->GetQ()) ;//total charge layer 4
5af1d436 750 //fAliITSQADataMakerRec->GetRecPointsData(8 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(lad);//ladpatternlayer4
3f90b3dc 751 Int_t iside=recp->GetDriftSide();
752 //printf("iside =%d\n",iside);
753 fAliITSQADataMakerRec->GetRecPointsData(8 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(det+0.5*iside-0.5,lad);//mod pattern layer 4
754 fAliITSQADataMakerRec->GetRecPointsData(14 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(rad);//r distribution
755 fAliITSQADataMakerRec->GetRecPointsData(16 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(phi);//phi distribution
58ceb8ca 756 fAliITSQADataMakerRec->GetRecPointsData(5 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluglo[2],phi);// zphi distribution layer 4
3f90b3dc 757 fAliITSQADataMakerRec->GetRecPointsData(18 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(drifttime);// time distribution layer 4
58ceb8ca 758 }
759 }
760 }
58ceb8ca 761 return rv ;
ebdd0606 762}
763
ad300de9 764//_______________________________________________________________
765
80b9610c 766Int_t AliITSQASDDDataMakerRec::GetOffset(AliQAv1::TASKINDEX_t task, Int_t specie)
7a0e5776 767{
ad300de9 768 Int_t offset=0;
3f90b3dc 769 if( task == AliQAv1::kRAWS ){offset=fGenRawsOffset[specie];}
770 else if(task == AliQAv1::kDIGITSR ){offset=fGenDigitsOffset[specie];}
771 else if( task == AliQAv1::kRECPOINTS ){offset=fGenRecPointsOffset[specie];}
ad300de9 772 return offset;
773}
774
775//_______________________________________________________________
776
8b7e858c 777void AliITSQASDDDataMakerRec::SetOffset(AliQAv1::TASKINDEX_t task, Int_t offset, Int_t specie) {
eca4fa66 778 // Returns offset number according to the specified task
3f90b3dc 779 if( task == AliQAv1::kRAWS ) {fGenRawsOffset[specie]=offset;}
780 else if( task == AliQAv1::kDIGITSR ) {fGenDigitsOffset[specie]=offset;}
781 else if( task == AliQAv1::kRECPOINTS ) {fGenRecPointsOffset[specie]=offset;}
eca4fa66 782}
783
784//_______________________________________________________________
785
4e25ac79 786Int_t AliITSQASDDDataMakerRec::GetTaskHisto(AliQAv1::TASKINDEX_t task)
7a0e5776 787{
7a0e5776 788 Int_t histotot=0;
3f90b3dc 789 if( task == AliQAv1::kRAWS ){ histotot=fSDDhRawsTask ;}
790 else if(task == AliQAv1::kDIGITSR) { histotot=fSDDhDigitsTask;}
791 else if( task == AliQAv1::kRECPOINTS ){ histotot=fSDDhRecPointsTask;}
792 else {AliInfo("No task has been selected. TaskHisto set to zero.\n");}
ad300de9 793 return histotot;
e41192d7 794}
8b7e858c 795
58ceb8ca 796
797//_______________________________________________________________
798
799
800void AliITSQASDDDataMakerRec::CreateTheMap()
801{
8b7e858c 802
58ceb8ca 803 AliCDBEntry *ddlMapSDD = AliCDBManager::Instance()->Get("ITS/Calib/DDLMapSDD");
804 Bool_t cacheStatus = AliCDBManager::Instance()->GetCacheFlag();
3f90b3dc 805 if(!ddlMapSDD){
58ceb8ca 806 AliError("Calibration object retrieval failed! SDD will not be processed");
807 fDDLModuleMap = NULL;
808 //return rv;
809 }
810 fDDLModuleMap = (AliITSDDLModuleMapSDD*)ddlMapSDD->GetObject();
811 if(!cacheStatus)ddlMapSDD->SetObject(NULL);
812 ddlMapSDD->SetOwner(kTRUE);
3f90b3dc 813 if(!cacheStatus){ delete ddlMapSDD;}
58ceb8ca 814 AliInfo("DDL Map Created\n ");
815}
5af1d436 816
3f90b3dc 817//_______________________________________________________________
818
819
820void AliITSQASDDDataMakerRec::CreateTheCalibration()
821{
822
823 AliCDBEntry *calibSDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD");
824 Bool_t cacheStatus = AliCDBManager::Instance()->GetCacheFlag();
825 if(!calibSDD)
826 {
827 AliError("Calibration object retrieval failed! SDD will not be processed");
828 fCalibration = NULL;;
829 }
830 fCalibration = (TObjArray *)calibSDD->GetObject();
831
832 if(!cacheStatus)calibSDD->SetObject(NULL);
833 calibSDD->SetOwner(kTRUE);
834 if(!cacheStatus){delete calibSDD;}
835
836 AliITSCalibrationSDD * cal=NULL;
837 for(Int_t imod=0;imod<fgknSDDmodules;imod++)
838 {
839 //cal=NULL;
840 Int_t fillmodhisto1=fgkTotalNumberSDDAnodes;
841 Int_t fillmodhisto2side0=fgkNumberOfSDDAnodesperSide;
842 Int_t fillmodhisto2side1=fgkNumberOfSDDAnodesperSide;
843 Int_t fillmodhisto3side0=fgkNumberOfSDDAnodesperSide;
844 Int_t fillmodhisto3side1=fgkNumberOfSDDAnodesperSide;
845
846 Int_t badmodhisto1=0;
847 Int_t badmodhisto2side0=0;
848 Int_t badmodhisto2side1=0;
849 Int_t badmodhisto3side0=0;
850 Int_t badmodhisto3side1=0;
851 //printf("imod %i\t ==== \t",imod);
852 Int_t module=imod + 240;
853 //printf("module %i\t ==== \t",module);
854 cal=(AliITSCalibrationSDD*)fCalibration->At(imod);
855 Int_t lay,lad,det;
856 AliITSgeomTGeo::GetModuleId(module,lay,lad,det);
857 Int_t index=1+(det-1)*2;
858 if(cal==0){continue;}
859 if (cal->IsBad()){continue;}//bad module check
860 else{
861 for(Int_t i=0;i<8;i++) //check on bad chips in good modules
862 {
863 if(lay==3){
864 if(cal->IsChipBad(i)){
865 if(i<4){badmodhisto2side0+=64;}
866 if(i>=4){badmodhisto2side1+=64;}
867 }//end if chip
868 }//end if layer3
869 else if(lay==4){
870 if(cal->IsChipBad(i)){
871 if(i<4){badmodhisto3side0+=64;}
872 if(i>=4){badmodhisto3side1+=64;}
873 }//end if chip
874 }//ens if layer4
875 }//end for chip
876 for(Int_t iAn=0; iAn<512; iAn++){//anodes loop
877 Int_t ic=cal->GetChip(iAn);//chip with this anode number
878 if(!cal->IsChipBad(ic) && !cal->IsBad() && cal->IsBadChannel(iAn)){// good chip good module bad channel
879 if(lay==3){
880 if(ic<4) badmodhisto2side0++;
881 else if(ic>=4)badmodhisto2side1++;
882 }//end if layer 3
883 else if(lay==4){
884 if(ic<4) badmodhisto3side0++;
885 else if(ic>=4)badmodhisto3side1++;
886 }//end if layer 4
887 }//end if chip module channel
888 }//end for anodes
889 if(lay==3){
890 badmodhisto1=badmodhisto2side0+badmodhisto2side1;
891 fillmodhisto1-=badmodhisto1;
892 fillmodhisto2side0-=badmodhisto2side0;
893 fillmodhisto2side1-=badmodhisto2side1;
894 ((TH1D*)(fHistoCalibration->At(0)))->SetBinContent(imod+1,fillmodhisto1);
895 ((TH2D*)(fHistoCalibration->At(1)))->SetBinContent(index,lad,fillmodhisto2side0);
896 ((TH2D*)(fHistoCalibration->At(1)))->SetBinContent(index+1,lad,fillmodhisto2side1);
897 }//end layer 3
898 else if(lay==4){
899 badmodhisto1=badmodhisto3side0+badmodhisto3side1;
900 fillmodhisto1-=badmodhisto1;
901 fillmodhisto3side0-=badmodhisto3side0;
902 fillmodhisto3side1-=badmodhisto3side1;
903 ((TH1D*)(fHistoCalibration->At(0)))->SetBinContent(imod+1,fillmodhisto1);
904 ((TH2D*)(fHistoCalibration->At(2)))->SetBinContent(index,lad,fillmodhisto3side0);
905 ((TH2D*)(fHistoCalibration->At(2)))->SetBinContent(index+1,lad,fillmodhisto2side1);
906 }//end layer 4
907 }//end else bad module
908 }//end module for
909
910}
911
912//____________________________________________________________________
913
914void AliITSQASDDDataMakerRec::InitCalibrationArray()
915{
916
917 TH1D *pattern1 = new TH1D("CALSDDModPattern","Calibration HW Modules pattern",fgknSDDmodules,239.5,499.5);
918 TH2D *patternl3 = new TH2D("CALSDDphizL3","Calibration SDD #varphiz Layer3 ",12,0.5,6.5,14,0.5,14.5);
919 TH2D *patternl4 = new TH2D("CALSDDphizL4"," Calibration SDD #varphiz Layer4 ",16,0.5,8.5,22,0.5,22.5);
920
921 fHistoCalibration = new TObjArray(3);
922 fHistoCalibration->AddAtAndExpand(pattern1,0);
923 fHistoCalibration->AddAtAndExpand(patternl3,1);
924 fHistoCalibration->AddAtAndExpand(patternl4,2);
925
926 printf("Calibration Histograms created!\n");
927}
5af1d436 928
929//____________________________________________________________________
930
931void AliITSQASDDDataMakerRec::ResetDetector(AliQAv1::TASKINDEX_t task)
932{
933
934 AliInfo(Form("Reset detector in SDD called for task index %i", task));
935 if(task== AliQAv1::kRAWS ){
5af1d436 936 fDDLModuleMap=NULL;
3f90b3dc 937 fCalibration=NULL;
938 ((TH1D*)(fHistoCalibration->At(0)))->Reset();
939 ((TH2D*)(fHistoCalibration->At(1)))->Reset();
940 ((TH2D*)(fHistoCalibration->At(2)))->Reset();
5af1d436 941 }
5af1d436 942}