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