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