store also difference in local Y
[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>
92664bc8 30#include <TH2F.h>
58ceb8ca 31#include <TH1F.h>
ebdd0606 32#include <TBranch.h>
33#include <TTree.h>
ebdd0606 34#include <TMath.h>
f81e865d 35#include <TPaveText.h>
ed340566 36//#include <TObjArray.h>
3f90b3dc 37
ebdd0606 38// --- Standard library ---
39
40// --- AliRoot header files ---
41#include "AliITSQASDDDataMakerRec.h"
4e25ac79 42#include "AliQAv1.h"
ebdd0606 43#include "AliRawReader.h"
e41192d7 44#include "AliITSRawStream.h"
ebdd0606 45#include "AliITSRawStreamSDD.h"
5192f264 46#include "AliITSdigit.h"
ebdd0606 47#include "AliITSRecPoint.h"
e62fe478 48#include "AliITSRecPointContainer.h"
ebdd0606 49#include "AliITSgeomTGeo.h"
ebdd0606 50#include "AliCDBManager.h"
ebdd0606 51#include "AliCDBEntry.h"
3f90b3dc 52#include "AliITSCalibrationSDD.h"
f1b15b8d 53#include "AliITSQADataMakerRec.h"
fc89f88c 54
cfb59c70 55class TGaxis;
56class TF1;
57class TSystem;
58class AliLog;
59class AliQAChecker;
60class AliITSRawStreamSDDCompressed;
61class AliCDBStorage;
62class Riostream;
63class AliITSdigitSDD;
64class AliITS;
65class AliRunLoader;
66class AliITSLoader;
67class AliITSDetTypeRec;
68
fe7d86eb 69using std::endl;
70using std::cout;
ebdd0606 71ClassImp(AliITSQASDDDataMakerRec)
72
73//____________________________________________________________________________
74AliITSQASDDDataMakerRec::AliITSQASDDDataMakerRec(AliITSQADataMakerRec *aliITSQADataMakerRec, Bool_t kMode, Short_t ldc) :
75TObject(),
76fAliITSQADataMakerRec(aliITSQADataMakerRec),
77fkOnline(kMode),
78fLDC(ldc),
ad300de9 79fSDDhRawsTask(0),
44ed7a66 80fSDDhDigitsTask(0),
ad300de9 81fSDDhRecPointsTask(0),
78fb0b3d 82fOnlineOffsetRaws(0),
83fOnlineOffsetRecPoints(0),
ad300de9 84fGenRawsOffset(0),
44ed7a66 85fGenDigitsOffset(0),
ad300de9 86fGenRecPointsOffset(0),
ebdd0606 87fTimeBinSize(1),
3f90b3dc 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),
3f90b3dc 123fDDLModuleMap(qadm.fDDLModuleMap),
124fCalibration(qadm.fCalibration),
125fHistoCalibration(qadm.fHistoCalibration)
58ceb8ca 126{
ebdd0606 127 //copy ctor
128 fAliITSQADataMakerRec->SetName((const char*)qadm.fAliITSQADataMakerRec->GetName()) ;
129 fAliITSQADataMakerRec->SetTitle((const char*)qadm.fAliITSQADataMakerRec->GetTitle());
3d0c40f9 130 //fDDLModuleMap=NULL;
ebdd0606 131}
132
133//____________________________________________________________________________
134AliITSQASDDDataMakerRec::~AliITSQASDDDataMakerRec(){
135 // destructor
58ceb8ca 136 //if(fDDLModuleMap) delete fDDLModuleMap;
3f90b3dc 137 if(fHistoCalibration){delete fHistoCalibration; fHistoCalibration=NULL;}
ebdd0606 138}
139//__________________________________________________________________
140AliITSQASDDDataMakerRec& AliITSQASDDDataMakerRec::operator = (const AliITSQASDDDataMakerRec& qac )
141{
7a0e5776 142 // Equal operator.
ebdd0606 143 this->~AliITSQASDDDataMakerRec();
144 new(this) AliITSQASDDDataMakerRec(qac);
145 return *this;
146}
147
148//____________________________________________________________________________
149void AliITSQASDDDataMakerRec::StartOfDetectorCycle()
150{
cfb59c70 151
152 //Start of a QA cycle
92664bc8 153 //
1e7991d8 154 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()));
92664bc8 155 if(!fCalibration) {
156 //fAliITSQADataMakerRec->GetRawsData(9+ fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Reset();
157 CreateTheCalibration();
8a55554e 158 }
3d0c40f9 159
1e7991d8 160 if(fAliITSQADataMakerRec->GetEventSpecie()==0) return;//not the kDefault EventSpecie
92664bc8 161 //Detector specific actions at start of cycle
162 if(fAliITSQADataMakerRec->GetTaskIndexSelected()==AliQAv1::kRAWS){
163 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM::Start of SDD Cycle\n");
164 if(fAliITSQADataMakerRec->ListExists(AliQAv1::kRAWS)==kFALSE)return;
165 //
166 int offsRW = fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()];
167 AliDebug(AliQAv1::GetQADebugLevel(),Form("Reset of Raw Data normalized histograms with eventspecie %s ",AliRecoParam::GetEventSpecieName(fAliITSQADataMakerRec->GetEventSpecie())));
168 fAliITSQADataMakerRec->ResetRawsData(10+offsRW );
169 fAliITSQADataMakerRec->ResetRawsData(3+ offsRW);
170 fAliITSQADataMakerRec->ResetRawsData(4+ offsRW);
171 fAliITSQADataMakerRec->ResetRawsData(5+ offsRW);
172 //
173 }
174 if(fAliITSQADataMakerRec->GetTaskIndexSelected()==AliQAv1::kRECPOINTS){
175 if(fAliITSQADataMakerRec->ListExists(AliQAv1::kRECPOINTS)==kFALSE)return;
176
177 AliDebug(AliQAv1::GetQADebugLevel(),Form("Reset of RecPoints normalized histograms with eventspecie %s ",AliRecoParam::GetEventSpecieName(fAliITSQADataMakerRec->GetEventSpecie())));
178 int offsRP = fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()];
179 fAliITSQADataMakerRec->ResetRecPointsData(9+ offsRP);
180 fAliITSQADataMakerRec->ResetRecPointsData(10+ offsRP);
181 fAliITSQADataMakerRec->ResetRecPointsData(11+ offsRP);
182 fAliITSQADataMakerRec->ResetRecPointsData(27+ offsRP);
183
184 }
ebdd0606 185}
186
187//____________________________________________________________________________
92664bc8 188void AliITSQASDDDataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray** /*list*/)
ebdd0606 189{
cfb59c70 190 //end of a QA cycle
92664bc8 191
6649909b 192 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSDM instantiates checker with Run(AliQAv1::kITS, task, list)\n");
193
194 Double_t entriescalibration1= 0.;
195 Double_t entriescalibrationL3=0.;
196 Double_t entriescalibrationL4=0.;
92664bc8 197 int offsRW = fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()];
198 int offsRP = fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()];
199 //
6649909b 200 if(fHistoCalibration){
92664bc8 201 entriescalibration1= ((TH1F*)(fHistoCalibration->At(0)))->GetEntries();
202 entriescalibrationL3=((TH2F*)(fHistoCalibration->At(1)))->GetEntries();
203 entriescalibrationL4=((TH2F*)(fHistoCalibration->At(2)))->GetEntries();
6649909b 204 }
205 else{ AliWarning("Calibration TObjArray is NULL! No Normalization and calibtaion plot will be filled\n");}
92664bc8 206 //
207 for (int trCl=-1;trCl<fAliITSQADataMakerRec->GetNTrigClasses();trCl++) { // RS Loop over all trigger classes (+ global counter, -1)
208 //
209 if(task==AliQAv1::kRAWS) {
210 TObjArray &harr = *fAliITSQADataMakerRec->GetRawsDataOfTrigClass(trCl);
211 int nEvent = GetNumberOfEvents(AliQAv1::kRAWS,trCl);
212 // printf("fNevent %d \n",nEvent);
213 TH1* h10 = (TH1*)harr[10+offsRW];
56147eda 214 if(nEvent==0) if(h10) nEvent=h10->GetBinContent(1);
92664bc8 215 if (h10) h10->SetBinContent(1,nEvent);
216 //
217 if(nEvent!=0) {
218 if (h10 && harr[0+offsRW] && harr[1+offsRW] && harr[2]) { // were they all cloned?
219 //
220 Double_t entriesmodpattern = ((TH1*)harr[0+offsRW])->GetEntries();
221 Double_t entriesL3 = ((TH1*)harr[1+offsRW])->GetEntries();
222 Double_t entriesL4 = ((TH1*)harr[2+offsRW])->GetEntries();
223 //
224 Double_t normentriesmodpattern=0.;
225 Double_t normentriesL3= 0.;
226 Double_t normentriesL4= 0.;
227
228 if(entriescalibration1!=0.)normentriesmodpattern=entriesmodpattern/(entriescalibration1*nEvent);
229 if(entriesL3!=0.) normentriesL3= entriesL3/(entriescalibrationL3*nEvent);
230 if(entriesL4!=0.) normentriesL4= entriesL4/(entriescalibrationL4*nEvent);
231 //
232 h10->SetBinContent(2,normentriesmodpattern);
233 h10->SetBinContent(3,normentriesL3);
234 h10->SetBinContent(4,normentriesL4);
235 //
236 if(fHistoCalibration){
237 if (harr[3+offsRW] && harr[0+offsRW]) ((TH1*)harr[3+offsRW])->Divide( (TH1*)harr[0+offsRW],((TH1F*)(fHistoCalibration->At(0))),1.,nEvent);
238 if (harr[4+offsRW] && harr[1+offsRW]) ((TH1*)harr[4+offsRW])->Divide( (TH1*)harr[1+offsRW],((TH1F*)(fHistoCalibration->At(1))),1.,nEvent);
239 if (harr[5+offsRW] && harr[2+offsRW]) ((TH1*)harr[5+offsRW])->Divide( (TH1*)harr[2+offsRW],((TH1F*)(fHistoCalibration->At(2))),1.,nEvent);
240 }
241 }
6649909b 242 }
92664bc8 243 //
244 TH1* htmp4 = (TH1*)harr[4+offsRW];
245 Int_t xbin3 = htmp4 ? ((TH1*)harr[4+offsRW])->GetNbinsX() : 0;
246 Int_t ybin3 = htmp4 ? ((TH1*)harr[4+offsRW])->GetNbinsY() : 0;
247 //
248 TH1* htmp6 = ((TH1*)harr[6+offsRW]);
249 if (htmp6 && htmp4) for(Int_t i=0; i<xbin3; i++) for(Int_t j=0; j<ybin3; j++) htmp6->Fill(htmp4->GetBinContent(i,j));
250 //
251 TH1* htmp5 = (TH1*)harr[5+offsRW];
252 Int_t xbin4 = htmp5 ? htmp5->GetNbinsX() : 0;
253 Int_t ybin4 = htmp5 ? htmp5->GetNbinsY() : 0;
254 //
255 TH1* htmp7 = (TH1*)harr[7+offsRW];
256 if (htmp7 && htmp5) for(Int_t i=0; i<xbin4; i++) for(Int_t j=0; j<ybin4; j++) htmp7->Fill(htmp5->GetBinContent(i,j));
257 //
258 if(fHistoCalibration){
259 for(Int_t inumb=8;inumb<10;inumb++) {
260 TH1* htmp = (TH1*)harr[inumb + offsRW];
261 if (!htmp) continue;
262 TH1* hcal = (TH1*)fHistoCalibration->At(inumb-7);
263 for(Int_t ii=1; ii<htmp->GetNbinsX()+1;ii++) {
264 for(Int_t jj=1; jj<htmp->GetNbinsY()+1;jj++) {
265 if( hcal->GetBinContent(ii,jj) != 0. ) htmp->SetBinContent(ii,jj,1);
266 else if( hcal->GetBinContent(ii,jj) == 0. ) htmp->SetBinContent(ii,jj,0);
56147eda 267 //MM printf("x=%i \t y=%i => \t %f \n",ii,jj,hcal->GetBinContent(ii,jj));
92664bc8 268 }//end x axis
269 }//end y axis
6649909b 270 }//end for inumb
92664bc8 271 }
272 //
273 }//end raws
274 //
275 //
276 if(task==AliQAv1::kRECPOINTS) {
277 //
278 TObjArray &harr = *fAliITSQADataMakerRec->GetRecPointsDataOfTrigClass(trCl);
279 //
280 TH1* htmp0 = (TH1*)harr[0+offsRP];
281 TH1* htmp1 = (TH1*)harr[1+offsRP];
282 TH1* htmp13 = (TH1*)harr[13+offsRP];
283 TH1* htmp14 = (TH1*)harr[14+offsRP];
284 //
285 int nEventRP = GetNumberOfEvents(AliQAv1::kRECPOINTS,trCl);
286 if (htmp0 && htmp1 && htmp13 && htmp14) {
287 Double_t chargeL3 = htmp0->GetMean();
288 Double_t errchargeL3 = htmp0->GetMeanError();
289 //
290 Double_t chargeL4 = htmp1->GetMean();
291 Double_t errchargeL4 = htmp1->GetMeanError();
292 //
293 Double_t radiusL3 = htmp13->GetMean();
294 Double_t errradiusL3 = htmp13->GetMeanError();
295
296 Double_t radiusL4= htmp14->GetMean();
297 Double_t errradiusL4= htmp14->GetMeanError();
298 //
299 // printf("fNeventRP %d \n",nEventRP);
300 TH1* htmp27 = (TH1*)harr[27+offsRP];
56147eda 301 if(nEventRP==0) if(htmp27) nEventRP=htmp27->GetBinContent(1);
302
92664bc8 303 if (htmp27) {
304 htmp27->SetBinContent(1,nEventRP);
305
306 htmp27->SetBinContent(31,chargeL3);
307 htmp27->SetBinError(31,errchargeL3);
308
309 htmp27->SetBinContent(47,chargeL4);
310 htmp27->SetBinError(47,errchargeL4);
311
312 htmp27->SetBinContent(32,radiusL3);
313 htmp27->SetBinError(32,errradiusL3);
314
315 htmp27->SetBinContent(48,radiusL4);
316 htmp27->SetBinError(48,errradiusL4);
317 }
318 //
319 TH1 *htmp6=(TH1*)harr[6+offsRP],*htmp7=(TH1*)harr[7+offsRP],*htmp8=(TH1*)harr[8+offsRP];
320 Double_t entriesmodpattern = htmp6 ? htmp6->GetEntries() : 0;
321 Double_t entriesL3 = htmp7 ? htmp7->GetEntries() : 0;
322 Double_t entriesL4 = htmp8 ? htmp8->GetEntries() : 0;
6649909b 323
92664bc8 324 //printf("entries modpatternrp = %02f \t L3= %02f \t L4 =%02f \n",entriesmodpattern,entriesL3,entriesL4 );
6649909b 325
92664bc8 326 if(nEventRP!=0) {
327 Double_t normentriesmodpattern=0.;
328 Double_t normentriesL3= 0.;
329 Double_t normentriesL4= 0.;
330
331 if(entriescalibration1!=0.) normentriesmodpattern=entriesmodpattern/(entriescalibration1*nEventRP);
332 if(entriesL3!=0.) normentriesL3= entriesL3/(entriescalibrationL3*nEventRP);
333 if(entriesL4!=0.) normentriesL4= entriesL4/(entriescalibrationL4*nEventRP);
6649909b 334
92664bc8 335 if (htmp27) {
336 htmp27->SetBinContent(2,normentriesmodpattern);
337 htmp27->SetBinContent(3,normentriesL3);
338 htmp27->SetBinContent(4,normentriesL4);
339 }
340 // printf("NORM entries modpatternrp = %02f \t L3= %02f \t L4 =%02f \n",normentriesmodpattern,normentriesL3,normentriesL4 );
6649909b 341
92664bc8 342 if(fHistoCalibration) {
343 if (harr[9 +offsRP] && htmp6) ((TH1*)harr[9 +offsRP])->Divide(htmp6, (TH1*)fHistoCalibration->At(0),nEventRP);
344 if (harr[10+offsRP] && htmp7) ((TH1*)harr[10+offsRP])->Divide(htmp7, (TH1*)fHistoCalibration->At(1),nEventRP);
345 if (harr[11+offsRP] && htmp8) ((TH1*)harr[11+offsRP])->Divide(htmp8, (TH1*)fHistoCalibration->At(2),nEventRP);
346 //if (harr[21+offsRP] && htmp7) ((TH1*)harr[21+offsRP])->Divide(htmp7, (TH1*)fHistoCalibration->At(1),nEventRP);
347 //if (harr[22+offsRP] && htmp8) ((TH1*)harr[22+offsRP])->Divide(htmp8, (TH1*)fHistoCalibration->At(2),nEventRP);
3f90b3dc 348 }
92664bc8 349 }
350 TH1* htmp10 = (TH1*)harr[10+offsRP];
351 Int_t xbin3 = htmp10 ? htmp10->GetNbinsX() : 0;
352 Int_t ybin3 = htmp10 ? htmp10->GetNbinsY() : 0;
353 //
354 TH1* htmp19 = (TH1*)harr[19+offsRP];
355 if (htmp19&&htmp10) for(Int_t i=0; i<xbin3; i++) for(Int_t j=0; j<ybin3; j++) htmp19->Fill(htmp10->GetBinContent(i,j));
356 //
357 TH1* htmp11 = (TH1*)harr[11+offsRP];
358 Int_t xbin4 = htmp11 ? htmp11->GetNbinsX() : 0;
359 Int_t ybin4 = htmp11 ? htmp11->GetNbinsY() : 0;
360 //
361 TH1* htmp20 = (TH1*)harr[20+offsRP];
362 if (htmp11&&htmp20) for(Int_t i=0; i<xbin4; i++) for(Int_t j=0; j<ybin4; j++) htmp20->Fill(htmp11->GetBinContent(i,j));
363 }
364 //
365
366 // RecPoints 2 Raws Ratio
367 if(fAliITSQADataMakerRec->ListExists(AliQAv1::kRAWS)==kTRUE) {
368 //
369 TH1* htmp21 = (TH1*)harr[21+offsRP];
370 TH1* htmp23 = (TH1*)harr[23+offsRP];
371 TH1* htmp10 = (TH1*)harr[10+offsRP];
372 TH1* htmp4rw = fAliITSQADataMakerRec->GetRawsData(4 + offsRW,trCl);
373 if (htmp21 && htmp23 && htmp10 && htmp4rw) {
374 Int_t xbin3RP = htmp21->GetNbinsX();
375 Int_t ybin3RP = htmp21->GetNbinsY();
376 Int_t xbin3R = htmp4rw->GetNbinsX();
377 Int_t ybin3R = htmp4rw->GetNbinsY();
378 if((xbin3RP == xbin3R) && (ybin3RP == ybin3R)) {
379 htmp21->Divide(htmp10,htmp4rw);
380 for(Int_t i=0; i<xbin3R; i++) for(Int_t j=0; j<ybin3R; j++) htmp23->Fill(htmp21->GetBinContent(i,j));
6649909b 381 }
92664bc8 382 else AliWarning("Number of bins for Raws and RecPoints (Layer 3) do not match\n");
383 }
384 //
385 TH1* htmp22 = (TH1*)harr[22+offsRP];
386 TH1* htmp24 = (TH1*)harr[24+offsRP];
387 TH1* htmp11 = (TH1*)harr[11+offsRP];
388 TH1* htmp5rw = fAliITSQADataMakerRec->GetRawsData(5 + offsRW,trCl);
389 if (htmp22 && htmp24 && htmp11 && htmp5rw) {
390 Int_t xbin4RP = htmp22->GetNbinsX();
391 Int_t ybin4RP = htmp22->GetNbinsY();
392 Int_t xbin4R = htmp5rw->GetNbinsX();
393 Int_t ybin4R = htmp5rw->GetNbinsY();
394 if((xbin4RP == xbin4R) && (ybin4RP == ybin4R)) {
395 htmp22->Divide(htmp11,htmp5rw);
396 for(Int_t i=0; i<xbin4R; i++) for(Int_t j=0; j<ybin4R; j++) htmp24->Fill(htmp22->GetBinContent(i,j));
397 }
398 else AliWarning("Number of bins for Raws and RecPoints (Layer 4) do not match\n");
399 }
6649909b 400 }
92664bc8 401 else{AliWarning("Ratio between RecPoints and Raws not executed because the raw list has not been created\n");}
402 }//end recpoints
403 //
404 } // RS Loop over all trigger classes (+ global counter, -1)
405 //
ebdd0606 406}
407
408//____________________________________________________________________________
eca4fa66 409Int_t AliITSQASDDDataMakerRec::InitRaws()
ebdd0606 410{
3d0c40f9 411
ebdd0606 412 // Initialization for RAW data - SDD -
7d297381 413 const Bool_t expert = kTRUE ;
414 const Bool_t saveCorr = kTRUE ;
415 const Bool_t image = kTRUE ;
58ceb8ca 416
eca4fa66 417 Int_t rv = 0 ;
ebdd0606 418 Int_t lay, lad, det;
ebdd0606 419 Int_t indexlast = 0;
420 Int_t index1 = 0;
92664bc8 421 int offsRW = fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()];
422 fSDDhRawsTask = 0;
423 if(fkOnline){AliInfo("Book Online Histograms for SDD\n");}
3f90b3dc 424 else {AliInfo("Book Offline Histograms for SDD\n ");}
f81e865d 425
426 TPaveText *PaveText0=new TPaveText(0.3,0.88,0.9,0.99,"NDC");
427 PaveText0->AddText("");
428 PaveText0->SetFillColor(kMagenta+2);
429 PaveText0->SetTextColor(kWhite);
430 PaveText0->SetBorderSize(1);
431 PaveText0->SetLineWidth(1);
432
433 TH1F *h0 = new TH1F("SDDModPattern","HW Modules pattern",fgknSDDmodules,239.5,499.5); //0
ebdd0606 434 h0->GetXaxis()->SetTitle("Module Number");
435 h0->GetYaxis()->SetTitle("Counts");
8a55554e 436 h0->SetOption("bar1");
437 h0->SetBarOffset(0.01);
438 h0->SetBarWidth(0.95);
439 h0->SetFillColor(45);
f81e865d 440 h0->GetListOfFunctions()->Add(PaveText0);
441
92664bc8 442 rv = fAliITSQADataMakerRec->Add2RawsList(h0,0+offsRW, expert, !image, !saveCorr);
ad300de9 443 fSDDhRawsTask++;
f81e865d 444
445 TPaveText *PaveText1=new TPaveText(0.3,0.88,0.9,0.99,"NDC");
446 PaveText1->AddText("");
447 PaveText1->SetFillColor(kMagenta+2);
448 PaveText1->SetTextColor(kWhite);
449 PaveText1->SetBorderSize(1);
450 PaveText1->SetLineWidth(1);
451
7a0e5776 452 //zPhi distribution using ladder and modules numbers
92664bc8 453 TH2F *hphil3 = new TH2F("SDDphizL3","SDD #varphiz Layer3 ",12,0.5,6.5,14,0.5,14.5);//1
5af1d436 454 hphil3->GetXaxis()->SetTitle("z[Module Number L3 ]");
455 hphil3->GetYaxis()->SetTitle("#varphi[ Ladder Number L3]");
8a55554e 456 hphil3->SetStats(0);
f81e865d 457 hphil3->GetListOfFunctions()->Add(PaveText1);
92664bc8 458 rv = fAliITSQADataMakerRec->Add2RawsList(hphil3,1+offsRW, !expert, image, !saveCorr);
7a0e5776 459 fSDDhRawsTask++;
f81e865d 460
461 TPaveText *PaveText2=new TPaveText(0.3,0.88,0.9,0.99,"NDC");
462 PaveText2->AddText("");
463 PaveText2->SetFillColor(kMagenta+2);
464 PaveText2->SetTextColor(kWhite);
465 PaveText2->SetBorderSize(1);
466 PaveText2->SetLineWidth(1);
467
92664bc8 468 TH2F *hphil4 = new TH2F("SDDphizL4","SDD #varphiz Layer4 ",16,0.5,8.5,22,0.5,22.5); //2
5af1d436 469 hphil4->GetXaxis()->SetTitle("z[Module Number L4]");
470 hphil4->GetYaxis()->SetTitle("#varphi[Ladder Number L4]");
8a55554e 471 hphil4->SetStats(0);
f81e865d 472 hphil4->GetListOfFunctions()->Add(PaveText2);
92664bc8 473 rv = fAliITSQADataMakerRec->Add2RawsList(hphil4,2+offsRW, !expert, image, !saveCorr);
7a0e5776 474 fSDDhRawsTask++;
f81e865d 475
476 //normalized histograms
92664bc8 477 TH1F *h0norm = new TH1F("SDDModPatternNORM","NORM HW Modules pattern",fgknSDDmodules,239.5,499.5); //3
3f90b3dc 478 h0norm->GetXaxis()->SetTitle("Module Number");
479 h0norm->GetYaxis()->SetTitle("Counts");
8a55554e 480 h0norm->SetOption("bar1");
481 h0norm->SetBarOffset(0.01);
482 h0norm->SetBarWidth(0.95);
483 h0norm->SetFillColor(46);
484 //h0norm->SetStats(0);
92664bc8 485 rv = fAliITSQADataMakerRec->Add2RawsList(h0norm,3+offsRW, expert, !image, !saveCorr);
3f90b3dc 486 fSDDhRawsTask++;
487
488 //zPhi distribution using ladder and modules numbers
92664bc8 489 TH2F *hphil3norm = new TH2F("SDDphizL3NORM","NORM SDD #varphiz Layer3 ",12,0.5,6.5,14,0.5,14.5);//4
3f90b3dc 490 hphil3norm->GetXaxis()->SetTitle("z[Module Number L3 ]");
491 hphil3norm->GetYaxis()->SetTitle("#varphi[ Ladder Number L3]");
8a55554e 492 hphil3norm->SetStats(0);
92664bc8 493 rv = fAliITSQADataMakerRec->Add2RawsList(hphil3norm,4+offsRW, expert, !image, !saveCorr);
3f90b3dc 494 fSDDhRawsTask++;
495
92664bc8 496 TH2F *hphil4norm = new TH2F("SDDphizL4NORM","NORM SDD #varphiz Layer4 ",16,0.5,8.5,22,0.5,22.5); //5
3f90b3dc 497 hphil4norm->GetXaxis()->SetTitle("z[Module Number L4]");
498 hphil4norm->GetYaxis()->SetTitle("#varphi[Ladder Number L4]");
8a55554e 499 hphil4norm->SetStats(0);
92664bc8 500 rv = fAliITSQADataMakerRec->Add2RawsList(hphil4norm,5+offsRW, expert, !image, !saveCorr);
3f90b3dc 501 fSDDhRawsTask++;
ebdd0606 502
78fb0b3d 503
8a55554e 504 Float_t hMax = 0.2;
7a0e5776 505
8a55554e 506 TH1F *oL3 = new TH1F("SDDL3_RelativeOccupancy","Layer 3 Relative Occupancy",200,0.,hMax);
92664bc8 507 rv = fAliITSQADataMakerRec->Add2RawsList(oL3,6+offsRW, expert, !image, !saveCorr); //6
8a55554e 508 fSDDhRawsTask++;
509
510 TH1F *oL4 = new TH1F("SDDL4_RelativeOccupancy","Layer 4 Relative Occupancy",200,0.,hMax);
92664bc8 511 rv = fAliITSQADataMakerRec->Add2RawsList(oL4,7+offsRW, expert, !image, !saveCorr); //7
8a55554e 512 fSDDhRawsTask++;
513
514 //zPhi distribution using ladder and modules numbers
92664bc8 515 TH2F *hcalibl3 = new TH2F("SDDphizCalibL3","SDDCalibL3 ",12,0.5,6.5,14,0.5,14.5);//8
8a55554e 516 hcalibl3->GetXaxis()->SetTitle("z[Module Number L3]");
517 hcalibl3->GetYaxis()->SetTitle("#varphi[ Ladder Number L3]");
518 hcalibl3->SetStats(0);
519 hcalibl3->SetMaximum(2);
92664bc8 520 rv = fAliITSQADataMakerRec->Add2RawsList(hcalibl3,8+offsRW, !expert, image, !saveCorr);
8a55554e 521 fSDDhRawsTask++;
522
92664bc8 523 TH2F *hcalibl4 = new TH2F("SDDphizCalibL4","SDDCalibL4 ",16,0.5,8.5,22,0.5,22.5); //9
8a55554e 524 hcalibl4->GetXaxis()->SetTitle("z[Module Number L4]");
525 hcalibl4->GetYaxis()->SetTitle("#varphi[Ladder Number L4]");
526 hcalibl4->SetStats(0);
527 hcalibl4->SetMaximum(2);
92664bc8 528 rv = fAliITSQADataMakerRec->Add2RawsList(hcalibl4,9+offsRW, !expert, image, !saveCorr);
8a55554e 529 fSDDhRawsTask++;
530
56147eda 531 TH1F *hsummarydata = new TH1F("SDDRawDataCheck","SDDRawDataCheck",46,-0.5,45.5);//10 summary of raw data checks Non expert and image
8a55554e 532 hsummarydata->GetXaxis()->SetLabelSize(0.02);
533 hsummarydata->GetXaxis()->SetTickLength(0.01);
534 hsummarydata->GetXaxis()->SetNdivisions(110);
535 hsummarydata->GetXaxis()->SetTicks("-");
536 hsummarydata->GetYaxis()->SetLabelSize(0.02);
537 hsummarydata->GetYaxis()->SetTitleSize(0.02);
538 hsummarydata->GetYaxis()->SetTitleOffset(1.5);
539 hsummarydata->GetYaxis()->SetTitle("#events(norm) or #modules (m) or #drift regions (dr)");
540 hsummarydata->SetStats(0);
541 hsummarydata->SetMaximum(272);
542 hsummarydata->SetMinimum(0.);
543
544 hsummarydata->SetOption("textbar1");
545 hsummarydata->SetBarOffset(0.01);
546 hsummarydata->SetBarWidth(0.95);
547 hsummarydata->SetFillColor(8);
548
549 //information about the events
550 hsummarydata->GetXaxis()->SetBinLabel(1,"Events");
551 hsummarydata->GetXaxis()->SetBinLabel(2,"Ent_NORM");
552 hsummarydata->GetXaxis()->SetBinLabel(3,"Ent_NORML3");
553 hsummarydata->GetXaxis()->SetBinLabel(4,"Ent_NORML4");
554 //all
555
556 hsummarydata->GetXaxis()->SetBinLabel(5,"m_act");
557 hsummarydata->GetXaxis()->SetBinLabel(6,"m_fil");
558 hsummarydata->GetXaxis()->SetBinLabel(7,"dr_act");
559 hsummarydata->GetXaxis()->SetBinLabel(8,"dr_fil");
560 hsummarydata->GetXaxis()->SetBinLabel(9,"m_exc");
561 hsummarydata->GetXaxis()->SetBinLabel(10,"m_emp");
562 hsummarydata->GetXaxis()->SetBinLabel(11,"dr_exc");
563 hsummarydata->GetXaxis()->SetBinLabel(12,"dr_emp");
564 hsummarydata->GetXaxis()->SetBinLabel(13,"m_exc-act");
565 hsummarydata->GetXaxis()->SetBinLabel(14,"m_act-emp");
566 hsummarydata->GetXaxis()->SetBinLabel(15,"dr_exc-act");
567 hsummarydata->GetXaxis()->SetBinLabel(16,"dr_act-emp");
568 hsummarydata->GetXaxis()->SetBinLabel(17,"m_overth");
569 hsummarydata->GetXaxis()->SetBinLabel(18,"dr_overth");
570
571 //l3
572
573 hsummarydata->GetXaxis()->SetBinLabel(19,"m_actl3");
574 hsummarydata->GetXaxis()->SetBinLabel(20,"m_fill3");
575 hsummarydata->GetXaxis()->SetBinLabel(21,"dr_actl3");
576 hsummarydata->GetXaxis()->SetBinLabel(22,"dr_fill3");
577 hsummarydata->GetXaxis()->SetBinLabel(23,"m_excl3");
578 hsummarydata->GetXaxis()->SetBinLabel(24,"m_empl3");
579 hsummarydata->GetXaxis()->SetBinLabel(25,"dr_excl3");
580 hsummarydata->GetXaxis()->SetBinLabel(26,"dr_empl3");
581 hsummarydata->GetXaxis()->SetBinLabel(27,"m_exc-actl3");
582 hsummarydata->GetXaxis()->SetBinLabel(28,"m_act-empl3");
583 hsummarydata->GetXaxis()->SetBinLabel(29,"dr_exc-actl3");
584 hsummarydata->GetXaxis()->SetBinLabel(30,"dr_act-empl3");
585 hsummarydata->GetXaxis()->SetBinLabel(31,"m_overthl3");
586 hsummarydata->GetXaxis()->SetBinLabel(32,"dr_overthl3");
587
588 //l4
589
590 hsummarydata->GetXaxis()->SetBinLabel(33,"m_actl4");
591 hsummarydata->GetXaxis()->SetBinLabel(34,"m_fill4");
592 hsummarydata->GetXaxis()->SetBinLabel(35,"dr_actl4");
593 hsummarydata->GetXaxis()->SetBinLabel(36,"dr_fill4");
594 hsummarydata->GetXaxis()->SetBinLabel(37,"m_excl4");
595 hsummarydata->GetXaxis()->SetBinLabel(38,"m_empl4");
596 hsummarydata->GetXaxis()->SetBinLabel(39,"dr_excl4");
597 hsummarydata->GetXaxis()->SetBinLabel(40,"dr_empl4");
598 hsummarydata->GetXaxis()->SetBinLabel(41,"m_exc-actl4");
599 hsummarydata->GetXaxis()->SetBinLabel(42,"m_act-empl4");
600 hsummarydata->GetXaxis()->SetBinLabel(43,"dr_exc-actl4");
601 hsummarydata->GetXaxis()->SetBinLabel(44,"dr_act-empl4");
602 hsummarydata->GetXaxis()->SetBinLabel(45,"m_overthl4");
603 hsummarydata->GetXaxis()->SetBinLabel(46,"dr_overthl4");
604 hsummarydata->GetXaxis()->LabelsOption("v");
605
56147eda 606 rv = fAliITSQADataMakerRec->Add2RawsList(hsummarydata,10+offsRW, !expert, image, !saveCorr);
8a55554e 607 fSDDhRawsTask++;
608 fOnlineOffsetRaws = fSDDhRawsTask;
609
610 //online part
611 if(fkOnline){
612 //DDL Pattern
92664bc8 613 TH2F *hddl = new TH2F("SDDDDLPattern","SDD DDL Pattern ",24,-0.5,11.5,24,-0.5,23.5); //11
8a55554e 614 hddl->GetXaxis()->SetTitle("Channel");
615 hddl->GetYaxis()->SetTitle("DDL Number");
92664bc8 616 rv = fAliITSQADataMakerRec->Add2RawsList(hddl,fOnlineOffsetRaws+offsRW, expert, !image, !saveCorr);
8a55554e 617 fSDDhRawsTask++;
618 Int_t indexlast1 = 0;
619
620 fTimeBinSize = 4;
621 indexlast = 0;
622 index1 = 0;
623 indexlast1 = fSDDhRawsTask;
624 for(Int_t moduleSDD =0; moduleSDD<fgknSDDmodules; moduleSDD++){
625 for(Int_t iside=0;iside<fgknSide;iside++){
626 AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det);
627 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);
628 fModuleChargeMapFSE->GetXaxis()->SetTitle("Time Bin");
629 fModuleChargeMapFSE->GetYaxis()->SetTitle("Anode");
92664bc8 630 rv = fAliITSQADataMakerRec->Add2RawsList(fModuleChargeMapFSE,indexlast1 + index1 + offsRW, expert, !image, !saveCorr);
8a55554e 631 fSDDhRawsTask++;
632 index1++;
7a0e5776 633 }
8a55554e 634 }
7a0e5776 635
8a55554e 636 for(Int_t moduleSDD =0; moduleSDD<fgknSDDmodules; moduleSDD++){
637 for(Int_t iside=0;iside<fgknSide;iside++){
638 AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det);
639 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);
640 fModuleChargeMap->GetXaxis()->SetTitle("Time Bin");
641 fModuleChargeMap->GetYaxis()->SetTitle("Anode Number");
92664bc8 642 rv = fAliITSQADataMakerRec->Add2RawsList(fModuleChargeMap,indexlast1 + index1 + offsRW, expert, !image, !saveCorr);
8a55554e 643 fSDDhRawsTask++;
644 index1++;
7a0e5776 645 }
8a55554e 646 }
647
648 //Event Size
649 TH1F *hsize = new TH1F("SDDEventSize","SDD Event Size ",500,-0.5,199.5);
650 hsize->SetBit(TH1::kCanRebin);
651 hsize->GetXaxis()->SetTitle("Event Size [kB]");
652 hsize->GetYaxis()->SetTitle("Entries");
92664bc8 653 rv = fAliITSQADataMakerRec->Add2RawsList(hsize,indexlast1 + index1 + offsRW, expert, !image, !saveCorr);
8a55554e 654 fSDDhRawsTask++;
655
656 } // kONLINE
657
658 cout << fSDDhRawsTask << " SDD Raws histograms booked" << endl;
659
660 AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SDD Raws histograms booked\n",fSDDhRawsTask));
92664bc8 661 //
8a55554e 662 return rv ;
ebdd0606 663}
664
665
666//____________________________________________________________________________
eca4fa66 667Int_t AliITSQASDDDataMakerRec::MakeRaws(AliRawReader* rawReader)
ebdd0606 668{
669 // Fill QA for RAW - SDD -
3f90b3dc 670 Int_t rv = 0;
92664bc8 671 int offsRW = fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()];
7555afef 672 // Check id histograms already created for this Event Specie
3f90b3dc 673 if(!fDDLModuleMap){CreateTheMap();}
eca4fa66 674 if(rawReader->GetType() != 7) return rv; // skips non physical triggers
5379c4a3 675 AliDebug(AliQAv1::GetQADebugLevel(),"entering MakeRaws\n");
e41192d7 676 rawReader->Reset();
58ceb8ca 677 rawReader->Select("ITSSDD");
8b7e858c 678 AliITSRawStream *stream=AliITSRawStreamSDD::CreateRawStreamSDD(rawReader);
679 stream->SetDDLModuleMap(fDDLModuleMap);
e41192d7 680
ebdd0606 681 Int_t lay, lad, det;
7a0e5776 682
ebdd0606 683 Int_t index=0;
684 if(fkOnline) {
685 for(Int_t moduleSDD =0; moduleSDD<fgknSDDmodules; moduleSDD++){
7a0e5776 686 for(Int_t iside=0;iside<fgknSide;iside++) {
92664bc8 687 if(fSDDhRawsTask > fOnlineOffsetRaws + 1 + index) fAliITSQADataMakerRec->ResetRawsData(fOnlineOffsetRaws + 1 + index +offsRW);
7a0e5776 688 // 4 because the 2D histos for single events start after the fourth position
689 index++;
690 }
ebdd0606 691 }
692 }
e41192d7 693
ebdd0606 694 Int_t cnt = 0;
695 Int_t ildcID = -1;
696 Int_t iddl = -1;
697 Int_t isddmod = -1;
7a0e5776 698 Int_t coord1, coord2, signal, moduleSDD, activeModule, index1;
58ceb8ca 699 //if(fkOnline)
700 //{
701 Int_t prevDDLID = -1;
702 UInt_t size = 0;
703 int totalddl=static_cast<int>(fDDLModuleMap->GetNDDLs());
704 Bool_t *ddldata=new Bool_t[totalddl];
705 for(Int_t jddl=0;jddl<totalddl;jddl++){ddldata[jddl]=kFALSE;}
706 //}
e41192d7 707 while(stream->Next()) {
ebdd0606 708 ildcID = rawReader->GetLDCId();
58ceb8ca 709 iddl = rawReader->GetDDLID();// - fgkDDLIDshift;
d2f99642 710 if(iddl<0)isddmod=-1;
3f90b3dc 711 //printf("----------------------iddl %i\n",iddl);
d2f99642 712 else isddmod = fDDLModuleMap->GetModuleNumber(iddl,stream->GetCarlosId());
58ceb8ca 713
ebdd0606 714 if(isddmod==-1){
5379c4a3 715 AliDebug(AliQAv1::GetQADebugLevel(),Form("Found module with iddl: %d, stream->GetCarlosId: %d \n",iddl,stream->GetCarlosId()));
ebdd0606 716 continue;
717 }
e41192d7 718 if(stream->IsCompletedModule()) {
5379c4a3 719 AliDebug(AliQAv1::GetQADebugLevel(),Form("IsCompletedModule == KTRUE\n"));
ebdd0606 720 continue;
721 }
de075dae 722 if(stream->IsCompletedDDL()) {
58ceb8ca 723 if(fkOnline){
724 if ((rawReader->GetDDLID() != prevDDLID)&&(ddldata[iddl])==kFALSE){
725 size += rawReader->GetDataSize();//in bytes
726 prevDDLID = rawReader->GetDDLID();
727 ddldata[iddl]=kTRUE;
728 }
729 }
5379c4a3 730 AliDebug(AliQAv1::GetQADebugLevel(),Form("IsCompletedDDL == KTRUE\n"));
de075dae 731 continue;
732 }
ebdd0606 733
e41192d7 734 coord1 = stream->GetCoord1();
735 coord2 = stream->GetCoord2();
736 signal = stream->GetSignal();
ebdd0606 737
7a0e5776 738 moduleSDD = isddmod - fgkmodoffset;
739
b62d7123 740 if(isddmod <fgkmodoffset|| isddmod>fgknSDDmodules+fgkmodoffset-1) {
5379c4a3 741 AliDebug(AliQAv1::GetQADebugLevel(),Form( "Module SDD = %d, resetting it to 1 \n",isddmod));
b62d7123 742 isddmod = 1;
ebdd0606 743 }
7a0e5776 744
ebdd0606 745 AliITSgeomTGeo::GetModuleId(isddmod, lay, lad, det);
e41192d7 746 Short_t iside = stream->GetChannel();
ad300de9 747
58ceb8ca 748 //printf(" \n%i %i %i %i \n ",lay, lad, det,iside );
92664bc8 749 fAliITSQADataMakerRec->FillRawsData( 0 + offsRW,isddmod);
750 if(lay==3) fAliITSQADataMakerRec->FillRawsData(1+offsRW,det+0.5*iside-0.25,lad); //phiz l3 not norm
751 if(lay==4) fAliITSQADataMakerRec->FillRawsData(2+offsRW,det+0.5*iside-0.25,lad); //phiz l4 not norm
58ceb8ca 752
ebdd0606 753 if(fkOnline) {
fc89f88c 754
92664bc8 755 fAliITSQADataMakerRec->FillRawsData(fOnlineOffsetRaws+offsRW, (stream->GetCarlosId())+0.5*iside -0.5,iddl);
756 // printf("content ddlmap %d, %d = %f \n",(stream->GetCarlosId()+0.5*iside -0.5),iddl,fAliITSQADataMakerRec->GetRawsData(3+offsRW)->GetBinContent(1+(det-1)*2;lad));
757 //printf("content ddlmap %d, %d = %f \n",(stream->GetCarlosId())+0.5*iside -0.5,iddl,fAliITSQADataMakerRec->GetRawsData(3+offsRW)->GetBinContent(1+(stream->GetCarlosId()-1)*2,iddl));
7a0e5776 758 activeModule = moduleSDD;
759 index1 = activeModule * 2 + iside;
760
761 if(index1<0){
5379c4a3 762 AliDebug(AliQAv1::GetQADebugLevel(),Form("Wrong index number %d - patched to 0\n",index1));
78fb0b3d 763 index1 = 0;
7a0e5776 764 }
78f8430c 765
78fb0b3d 766 if(fSDDhRawsTask > fOnlineOffsetRaws +1 + index1) {
92664bc8 767 fAliITSQADataMakerRec->FillRawsData(fOnlineOffsetRaws +1 + index1 +offsRW , coord2, coord1, signal);
768 fAliITSQADataMakerRec->FillRawsData(fOnlineOffsetRaws +1 + index1 + 260*2 +offsRW, coord2, coord1, signal);
ebdd0606 769 }
58ceb8ca 770 }//online
7a0e5776 771 cnt++;
5379c4a3 772 if(!(cnt%10000)) AliDebug(AliQAv1::GetQADebugLevel(),Form(" %d raw digits read",cnt));
58ceb8ca 773 }//end next()
92664bc8 774 if(fkOnline){
775 fAliITSQADataMakerRec->FillRawsData(fOnlineOffsetRaws +1 + 260*4 +offsRW,size/1024.);//KB
3f90b3dc 776 }
78fb0b3d 777
5379c4a3 778 AliDebug(AliQAv1::GetQADebugLevel(),Form("Event completed, %d raw digits read",cnt));
e41192d7 779 delete stream;
780 stream = NULL;
8b7e858c 781
782// if(fkOnline) {
783// AnalyseBNG(); // Analyse Baseline, Noise, Gain
784// AnalyseINJ(); // Analyse Injectors
785// }
786
58ceb8ca 787 delete []ddldata;
788 ddldata=NULL;
92664bc8 789 //
eca4fa66 790 return rv ;
7a0e5776 791}
ebdd0606 792
793//____________________________________________________________________________
eca4fa66 794Int_t AliITSQASDDDataMakerRec::InitDigits()
44ed7a66 795{
3d0c40f9 796 // if(!fHistoCalibration)InitCalibrationArray();
44ed7a66 797 // Initialization for DIGIT data - SDD -
798 const Bool_t expert = kTRUE ;
799 const Bool_t image = kTRUE ;
eca4fa66 800 Int_t rv = 0 ;
92664bc8 801 int offsD = fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()];
eca4fa66 802// fGenDigitsOffset = (fAliITSQADataMakerRec->fDigitsQAList[AliRecoParam::kDefault])->GetEntries();
44ed7a66 803 //fSDDhTask must be incremented by one unit every time a histogram is ADDED to the QA List
804 TH1F* h0=new TH1F("SDD DIGITS Module Pattern","SDD DIGITS Module Pattern",260,239.5,499.5); //hmod
805 h0->GetXaxis()->SetTitle("SDD Module Number");
806 h0->GetYaxis()->SetTitle("# DIGITS");
92664bc8 807 rv = fAliITSQADataMakerRec->Add2DigitsList(h0,offsD, !expert, image);
44ed7a66 808 fSDDhDigitsTask ++;
92664bc8 809 // printf("Add %s \t the task offset is %i\n",fAliITSQADataMakerRec->GetDigitsData(offsD)->GetName() , fSDDhDigitsTask );
44ed7a66 810 TH1F* h1=new TH1F("SDD Anode Distribution","DIGITS Anode Distribution",512,-0.5,511.5); //hanocc
811 h1->GetXaxis()->SetTitle("Anode Number");
812 h1->GetYaxis()->SetTitle("# DIGITS");
92664bc8 813 rv = fAliITSQADataMakerRec->Add2DigitsList(h1,1+offsD, !expert, image);
44ed7a66 814 fSDDhDigitsTask ++;
92664bc8 815 //printf("Add %s \t the task offset is %i\n",fAliITSQADataMakerRec->GetDigitsData(1+offsD)->GetName() , fSDDhDigitsTask );
44ed7a66 816 TH1F* h2=new TH1F("SDD Tbin Distribution","DIGITS Tbin Distribution",256,-0.5,255.5); //htbocc
817 h2->GetXaxis()->SetTitle("Tbin Number");
818 h2->GetYaxis()->SetTitle("# DIGITS");
92664bc8 819 rv = fAliITSQADataMakerRec->Add2DigitsList(h2,2+offsD, !expert, image);
44ed7a66 820 fSDDhDigitsTask ++;
92664bc8 821 //printf("Add %s \t the task offset is %i\n",fAliITSQADataMakerRec->GetDigitsData(2+offsD)->GetName() , fSDDhDigitsTask );
44ed7a66 822 TH1F* h3=new TH1F("SDD ADC Counts Distribution","DIGITS ADC Counts Distribution",200,0.,1024.); //hsig
823 h3->GetXaxis()->SetTitle("ADC Value");
824 h3->GetYaxis()->SetTitle("# DIGITS");
92664bc8 825 rv = fAliITSQADataMakerRec->Add2DigitsList(h3,3+offsD, !expert, image);
44ed7a66 826 fSDDhDigitsTask ++;
92664bc8 827 //printf("Add %s \t the task offset is %i\n",fAliITSQADataMakerRec->GetDigitsData(3+offsD)->GetName() , fSDDhDigitsTask );
44ed7a66 828 AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SDD Digits histograms booked\n",fSDDhDigitsTask));
92664bc8 829 //
eca4fa66 830 return rv ;
44ed7a66 831}
832
833//____________________________________________________________________________
eca4fa66 834Int_t AliITSQASDDDataMakerRec::MakeDigits(TTree * digits)
44ed7a66 835{
7555afef 836
44ed7a66 837 // Fill QA for DIGIT - SDD -
fc89f88c 838 //AliITS *fITS = (AliITS*)gAlice->GetModule("ITS");
839 //fITS->SetTreeAddress();
840 //TClonesArray *iITSdigits = fITS->DigitsAddress(1);
841
eca4fa66 842 Int_t rv = 0 ;
92664bc8 843 int offsD = fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()];
fc89f88c 844 TBranch *branchD = digits->GetBranch("ITSDigitsSDD");
845
846 if (!branchD) {
847 AliError("can't get the branch with the ITS SDD digits !");
eca4fa66 848 return rv ;
44ed7a66 849 }
eca4fa66 850 // Check id histograms already created for this Event Specie
8b7e858c 851// if ( ! fAliITSQADataMakerRec->GetDigitsData(fGenDigitsOffset) )
852// rv = InitDigits() ;
eca4fa66 853
fc89f88c 854 static TClonesArray statDigits("AliITSdigitSDD");
44ed7a66 855 TClonesArray *iITSdigits = &statDigits;
856 branchD->SetAddress(&iITSdigits);
fc89f88c 857
44ed7a66 858 for(Int_t i=0; i<260; i++){
859 Int_t nmod=i+240;
860 digits->GetEvent(nmod);
861 Int_t ndigits = iITSdigits->GetEntries();
92664bc8 862 fAliITSQADataMakerRec->FillDigitsData(offsD,nmod,ndigits);
7555afef 863
44ed7a66 864 for (Int_t idig=0; idig<ndigits; idig++) {
865 AliITSdigit *dig=(AliITSdigit*)iITSdigits->UncheckedAt(idig);
866 Int_t iz=dig->GetCoord1(); // cell number z
867 Int_t ix=dig->GetCoord2(); // cell number x
868 Int_t sig=dig->GetSignal();
92664bc8 869 fAliITSQADataMakerRec->FillDigitsData(1+offsD,iz);
870 fAliITSQADataMakerRec->FillDigitsData(2+offsD,ix);
871 fAliITSQADataMakerRec->FillDigitsData(3+offsD,sig);
44ed7a66 872 }
873 }
92664bc8 874 //
eca4fa66 875 return rv ;
44ed7a66 876}
877
878//____________________________________________________________________________
eca4fa66 879Int_t AliITSQASDDDataMakerRec::InitRecPoints()
ebdd0606 880{
3d0c40f9 881 //if(!fHistoCalibration)InitCalibrationArray();
8b7e858c 882 //AliInfo("Initialize SDD recpoints histos\n");
ebdd0606 883 // Initialization for RECPOINTS - SDD -
7d297381 884 const Bool_t expert = kTRUE ;
885 const Bool_t image = kTRUE ;
eca4fa66 886 Int_t rv = 0 ;
92664bc8 887 int offsRP = fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()];
eca4fa66 888// fGenRecPointsOffset = (fAliITSQADataMakerRec->fRecPointsQAList[AliRecoParam::kDefault])->GetEntries();
ad300de9 889
8b7e858c 890 //AliInfo(Form("fAliITSQADataMakerRec->GetEventSpecie() %d\n",fAliITSQADataMakerRec->GetEventSpecie()));
92664bc8 891 //AliInfo(Form("offsRP %d\n",offsRP));
be2d913a 892 TH1F *h0 = new TH1F("SDDLay3TotCh","Layer 3 total charge",250,-0.5, 499.5); //position number 0
3f90b3dc 893 //h0->SetBit(TH1::kCanRebin);
cfb59c70 894 h0->GetXaxis()->SetTitle("KeV");
ebdd0606 895 h0->GetYaxis()->SetTitle("Entries");
92664bc8 896 rv = fAliITSQADataMakerRec->Add2RecPointsList(h0, 0 +offsRP, !expert, image);//NON expert image
ad300de9 897 fSDDhRecPointsTask++;
ebdd0606 898
be2d913a 899 TH1F *h1 = new TH1F("SDDLay4TotCh","Layer 4 total charge",250,-0.5, 499.5);//position number 1
3f90b3dc 900 //h1->SetBit(TH1::kCanRebin);
cfb59c70 901 h1->GetXaxis()->SetTitle("Kev");
ebdd0606 902 h1->GetYaxis()->SetTitle("Entries");
92664bc8 903 rv = fAliITSQADataMakerRec->Add2RecPointsList(h1, 1 +offsRP, !expert, image);//NON expert image
ad300de9 904 fSDDhRecPointsTask++;
ebdd0606 905
be2d913a 906 TH2F *h2 = new TH2F("SDDGlobalCoordDistribYX","YX Global Coord Distrib",56,-28,28,56,-28,28);//position number 2
ebdd0606 907 h2->GetYaxis()->SetTitle("Y[cm]");
908 h2->GetXaxis()->SetTitle("X[cm]");
56147eda 909 rv = fAliITSQADataMakerRec->Add2RecPointsList(h2,2+offsRP, expert, image);// NON expert image
ad300de9 910 fSDDhRecPointsTask++;
ebdd0606 911
be2d913a 912 TH2F *h3 = new TH2F("SDDGlobalCoordDistribRZ","RZ Global Coord Distrib",128,-32,32,56,12,26);//position number 3
ebdd0606 913 h3->GetYaxis()->SetTitle("R[cm]");
914 h3->GetXaxis()->SetTitle("Z[cm]");
56147eda 915 rv = fAliITSQADataMakerRec->Add2RecPointsList(h3,3+offsRP, expert, image);// NON expert image
ad300de9 916 fSDDhRecPointsTask++;
ebdd0606 917
78fb0b3d 918 TH2F *h4 = new TH2F("SDDGlobalCoordDistribL3PHIZ","#varphi Z Global Coord Distrib L3",96,-23,23,112,-TMath::Pi(),TMath::Pi());//position number 4
ebdd0606 919 h4->GetYaxis()->SetTitle("#phi[rad]");
920 h4->GetXaxis()->SetTitle("Z[cm]");
56147eda 921 rv = fAliITSQADataMakerRec->Add2RecPointsList(h4,4+offsRP, expert, image);//NON expert image
ad300de9 922 fSDDhRecPointsTask++;
ebdd0606 923
78fb0b3d 924 TH2F *h5 = new TH2F("SDDGlobalCoordDistribL4PHIZ","#varphi Z Global Coord Distrib L4",128,-31,31,176,-TMath::Pi(),TMath::Pi());//position number 5
ebdd0606 925 h5->GetYaxis()->SetTitle("#phi[rad]");
926 h5->GetXaxis()->SetTitle("Z[cm]");
56147eda 927 rv = fAliITSQADataMakerRec->Add2RecPointsList(h5,5+offsRP, expert, image);//NON expert image
ad300de9 928 fSDDhRecPointsTask++;
ebdd0606 929
92664bc8 930 TH1F *h6 = new TH1F("SDDModPatternRP","Modules pattern RP",fgknSDDmodules,239.5,499.5); //position number 6
ebdd0606 931 h6->GetXaxis()->SetTitle("Module number"); //spd offset = 240
932 h6->GetYaxis()->SetTitle("Entries");
8a55554e 933 h6->SetOption("bar1");
934 h6->SetBarOffset(0.01);
935 h6->SetBarWidth(0.95);
936 h6->SetFillColor(39);
92664bc8 937 rv = fAliITSQADataMakerRec->Add2RecPointsList(h6,6 +offsRP, expert, !image);// expert NO image
ad300de9 938 fSDDhRecPointsTask++;
58ceb8ca 939
f81e865d 940 TPaveText *PaveText7=new TPaveText(0.3,0.88,0.9,0.99,"NDC");
941 PaveText7->AddText("");
942 PaveText7->SetFillColor(kMagenta+2);
943 PaveText7->SetTextColor(kWhite);
944 PaveText7->SetBorderSize(1);
945 PaveText7->SetLineWidth(1);
946
947
92664bc8 948 TH2F *h7 = new TH2F("SDDModPatternL3RP","Modules pattern L3 RP",12,0.5,6.5,14,0.5,14.5); //position number 7
5af1d436 949 h7->GetXaxis()->SetTitle("z[#Module L3 ]");
950 h7->GetYaxis()->SetTitle("#varphi[#Ladder L3]");
f81e865d 951 h7->GetListOfFunctions()->Add(PaveText7);
56147eda 952 rv = fAliITSQADataMakerRec->Add2RecPointsList(h7,7 +offsRP, !expert, image);// expert NO image
ad300de9 953 fSDDhRecPointsTask++;
58ceb8ca 954
f81e865d 955 TPaveText *PaveText8=new TPaveText(0.3,0.88,0.9,0.99,"NDC");
956 PaveText8->AddText("");
957 PaveText8->SetFillColor(kMagenta+2);
958 PaveText8->SetTextColor(kWhite);
959 PaveText8->SetBorderSize(1);
960 PaveText8->SetLineWidth(1);
961
962 TH2F *h8 = new TH2F("SDDModPatternL4RP","Modules pattern L4 RP",16,0.5,8.5,22,0.5,22.5); //position number 8
5af1d436 963 h8->GetXaxis()->SetTitle("[#Module L3 ]");
964 h8->GetYaxis()->SetTitle("#varphi[#Ladder L4]");
f81e865d 965 h8->GetListOfFunctions()->Add(PaveText8);
56147eda 966 rv = fAliITSQADataMakerRec->Add2RecPointsList(h8,8 +offsRP, !expert, image);// expert NO image
3f90b3dc 967 fSDDhRecPointsTask++;
968
969 //------------------------norm--------------------------//
970
971
92664bc8 972 TH1F *h9 = new TH1F("SDDModPatternRPNORM","Modules pattern RP NORM",fgknSDDmodules,239.5,499.5); //position number 9
3f90b3dc 973 h9->GetXaxis()->SetTitle("Module number"); //spd offset = 240
974 h9->GetYaxis()->SetTitle("Entries");
8a55554e 975 h9->SetOption("bar1");
976 h9->SetBarOffset(0.01);
977 h9->SetBarWidth(0.95);
978 h9->SetFillColor(49);
92664bc8 979 rv = fAliITSQADataMakerRec->Add2RecPointsList(h9,9 +offsRP, expert, !image);// expert NO image
ad300de9 980 fSDDhRecPointsTask++;
58ceb8ca 981
3f90b3dc 982
92664bc8 983 TH2F *h10 = new TH2F("SDDModPatternL3RPNORM","Modules pattern L3 RP NORM",12,0.5,6.5,14,0.5,14.5); //position number 10
3f90b3dc 984 h10->GetXaxis()->SetTitle("z[#Module L3 ]");
985 h10->GetYaxis()->SetTitle("#varphi[#Ladder L3]");
92664bc8 986 rv = fAliITSQADataMakerRec->Add2RecPointsList(h10,10 +offsRP, expert, !image);// expert NO image
3f90b3dc 987 fSDDhRecPointsTask++;
988
92664bc8 989 TH2F *h11 = new TH2F("SDDModPatternL4RPNORM","Modules pattern L4 RP NORM",16,0.5,8.5,22,0.5,22.5); //position number 11
78fb0b3d 990 h11->GetXaxis()->SetTitle("[#Module L4 ]");
3f90b3dc 991 h10->GetYaxis()->SetTitle("#varphi[#Ladder L4]");
92664bc8 992 rv = fAliITSQADataMakerRec->Add2RecPointsList(h11,11 +offsRP, expert, !image);// expert NO image
3f90b3dc 993 fSDDhRecPointsTask++;
994
995 //--------------------------------------------------------//
996
be2d913a 997 TH2F *h12 = new TH2F("SDDLocalCoordDistrib","Local Coord Distrib",160,-4,4,160,-4,4);//position number 12
3f90b3dc 998 h12->GetXaxis()->SetTitle("X local coord, drift, cm");
999 h12->GetYaxis()->SetTitle("Z local coord, anode, cm");
92664bc8 1000 rv = fAliITSQADataMakerRec->Add2RecPointsList(h12,12 +offsRP, expert, !image);// expert NO image
ad300de9 1001 fSDDhRecPointsTask++;
58ceb8ca 1002
1003 //AliInfo("Create SDD recpoints histos\n");
1004
3f90b3dc 1005 TH1F *h13 = new TH1F("SDDrdistrib_Layer3" ,"SDD r distribution Layer3" ,100,14.,16.5);//position number 13 (L3)
1006 h13->SetBit(TH1::kCanRebin);
1007 h13->GetXaxis()->SetTitle("r[cm]");
1008 h13->GetXaxis()->CenterTitle();
1009 h13->GetYaxis()->SetTitle("Entries");
92664bc8 1010 rv = fAliITSQADataMakerRec->Add2RecPointsList(h13,13 +offsRP, expert, !image);// expert NO image
58ceb8ca 1011 fSDDhRecPointsTask++;
1012
3f90b3dc 1013 TH1F *h14 = new TH1F("SDDrdistrib_Layer4" ,"SDD r distribution Layer4" ,100,23.,25.);// and position number 14 (L4)
1014 h14->SetBit(TH1::kCanRebin);
1015 h14->GetXaxis()->SetTitle("r[cm]");
1016 h14->GetXaxis()->CenterTitle();
1017 h14->GetYaxis()->SetTitle("Entries");
92664bc8 1018 rv = fAliITSQADataMakerRec->Add2RecPointsList(h14,14 +offsRP, expert, !image);// expert NO image
58ceb8ca 1019 fSDDhRecPointsTask++;
1020
ebdd0606 1021 for(Int_t iLay=0; iLay<=1; iLay++){
d2f99642 1022 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 1023 h15->GetXaxis()->SetTitle("#varphi[rad]");
1024 h15->GetXaxis()->CenterTitle();
1025 h15->GetYaxis()->SetTitle("Entries");
92664bc8 1026 rv = fAliITSQADataMakerRec->Add2RecPointsList(h15,iLay+15+offsRP, expert, !image);// expert NO image
ad300de9 1027 fSDDhRecPointsTask++;
ebdd0606 1028 }
58ceb8ca 1029
1030 for(Int_t iLay=0; iLay<=1; iLay++){
d2f99642 1031 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 1032 h17->SetBit(TH1::kCanRebin);
1e7991d8 1033 h17->GetXaxis()->SetTitle("drift time[ns]");
3f90b3dc 1034 h17->GetXaxis()->CenterTitle();
1035 h17->GetYaxis()->SetTitle("Entries");
92664bc8 1036 rv = fAliITSQADataMakerRec->Add2RecPointsList(h17,iLay+17+offsRP, !expert, image);// NON expert image
58ceb8ca 1037 fSDDhRecPointsTask++;
1038 }
1039
78fb0b3d 1040 Float_t hMax = 0.2;
1041
1042 TH1F *oL3 = new TH1F("SDDL3_RelativeOccupancy","Layer 3 Relative Occupancy (RecPoints)",200,0.,hMax);
92664bc8 1043 rv = fAliITSQADataMakerRec->Add2RecPointsList(oL3,fSDDhRecPointsTask+offsRP, expert, !image); // 19
78fb0b3d 1044 fSDDhRecPointsTask++;
1045
1046 TH1F *oL4 = new TH1F("SDDL4_RelativeOccupancy","Layer 4 Relative Occupancy (RecPoints)",200,0.,hMax);
92664bc8 1047 rv = fAliITSQADataMakerRec->Add2RecPointsList(oL4,fSDDhRecPointsTask+offsRP, expert, !image); // 20
78fb0b3d 1048 fSDDhRecPointsTask++;
1049
1050
92664bc8 1051 TH2F *h21 = new TH2F("SDDL3_Rec2Raw_2D","L3 RecPoints to Raws 2D",12,0.5,6.5,14,0.5,14.5); //position number 21
78fb0b3d 1052 h21->GetXaxis()->SetTitle("z[#Module L3 ]");
1053 h21->GetYaxis()->SetTitle("#varphi[#Ladder L3]");
92664bc8 1054 rv = fAliITSQADataMakerRec->Add2RecPointsList(h21,21 +offsRP, expert, !image);// expert NO image
78fb0b3d 1055 fSDDhRecPointsTask++;
1056
92664bc8 1057 TH2F *h22 = new TH2F("SDDL4_Rec2Raw_2D","L4 RecPoints to Raws 2D",16,0.5,8.5,22,0.5,22.5); //position number 22
78fb0b3d 1058 h22->GetXaxis()->SetTitle("[#Module L4 ]");
1059 h22->GetYaxis()->SetTitle("#varphi[#Ladder L4]");
92664bc8 1060 rv = fAliITSQADataMakerRec->Add2RecPointsList(h22,22 +offsRP, expert, !image);// expert NO image
78fb0b3d 1061 fSDDhRecPointsTask++;
1062
1063 hMax = 0.3;
f1b15b8d 1064 TH1F *r2RL3 = new TH1F("SDDL3_Rec2Raw","L3 RecPoints to Raws ratio",150,0.,hMax);
1065 rv = fAliITSQADataMakerRec->Add2RecPointsList(r2RL3,fSDDhRecPointsTask+offsRP, expert, !image); // 23
78fb0b3d 1066 fSDDhRecPointsTask++;
1067
f1b15b8d 1068 TH1F *r2RL4 = new TH1F("SDDL4_Rec2Raw","L4 RecPoints to Raws ratio",150,0.,hMax);
1069 rv = fAliITSQADataMakerRec->Add2RecPointsList(r2RL4,fSDDhRecPointsTask+offsRP, expert, !image); // 24
78fb0b3d 1070 fSDDhRecPointsTask++;
1071
1072 TH1F *dedxL3 = new TH1F("SDDL3_dedx","L3 dE/dX",100,0.,1.);
92664bc8 1073 rv = fAliITSQADataMakerRec->Add2RecPointsList(dedxL3,fSDDhRecPointsTask+offsRP, expert, !image); // 25
78fb0b3d 1074 fSDDhRecPointsTask++;
1075
1076 TH1F *dedxL4 = new TH1F("SDDL4_dedx","L4 dE/dX",100,0.,1.);
92664bc8 1077 rv = fAliITSQADataMakerRec->Add2RecPointsList(dedxL4,fSDDhRecPointsTask+offsRP, expert, !image); // 26
78fb0b3d 1078 fSDDhRecPointsTask++;
1079
8a55554e 1080
1081 TH1F *hsummarydatarp = new TH1F("SDDRecPointCheck","SDDRecPointCheck",50,-0.5,49.5);//27 summary of recpoint checks
1082 hsummarydatarp->GetXaxis()->SetLabelSize(0.02);
1083 hsummarydatarp->GetXaxis()->SetTickLength(0.01);
1084 hsummarydatarp->GetXaxis()->SetNdivisions(110);
1085 hsummarydatarp->GetXaxis()->SetTicks("-");
1086 hsummarydatarp->GetYaxis()->SetLabelSize(0.02);
1087 hsummarydatarp->GetYaxis()->SetTitleSize(0.02);
1088 hsummarydatarp->GetYaxis()->SetTitleOffset(1.5);
1089 hsummarydatarp->GetYaxis()->SetTitle("#events(norm) or #modules (m) or #drift regions (dr)");
1090 hsummarydatarp->SetStats(0);
1091 hsummarydatarp->SetMaximum(272);
1092
56147eda 1093 hsummarydatarp->SetOption("text bar1");
8a55554e 1094 hsummarydatarp->SetBarOffset(0.05);
1095 hsummarydatarp->SetBarWidth(0.95);
1096 hsummarydatarp->SetFillColor(32);
1097 hsummarydatarp->SetMinimum(0.);
1098
1099 //information about the events
1100 hsummarydatarp->GetXaxis()->SetBinLabel(1,"Events");
1101 hsummarydatarp->GetXaxis()->SetBinLabel(2,"Ent_NORM");
1102 hsummarydatarp->GetXaxis()->SetBinLabel(3,"Ent_NORML3");
1103 hsummarydatarp->GetXaxis()->SetBinLabel(4,"Ent_NORML4");
1104 //all
1105
1106 hsummarydatarp->GetXaxis()->SetBinLabel(5, "m_act");
1107 hsummarydatarp->GetXaxis()->SetBinLabel(6, "m_fil");
1108 hsummarydatarp->GetXaxis()->SetBinLabel(7, "dr_act");
1109 hsummarydatarp->GetXaxis()->SetBinLabel(8, "dr_fil");
1110 hsummarydatarp->GetXaxis()->SetBinLabel(9, "m_exc");
1111 hsummarydatarp->GetXaxis()->SetBinLabel(10,"m_emp");
1112 hsummarydatarp->GetXaxis()->SetBinLabel(11,"dr_exc");
1113 hsummarydatarp->GetXaxis()->SetBinLabel(12,"dr_emp");
1114 hsummarydatarp->GetXaxis()->SetBinLabel(13,"m_exc-act");
1115 hsummarydatarp->GetXaxis()->SetBinLabel(14,"m_act-emp");
1116 hsummarydatarp->GetXaxis()->SetBinLabel(15,"dr_exc-act");
1117 hsummarydatarp->GetXaxis()->SetBinLabel(16,"dr_act-emp");
1118 hsummarydatarp->GetXaxis()->SetBinLabel(17,"m_overth");
1119 hsummarydatarp->GetXaxis()->SetBinLabel(18,"dr_overth");
1120
1121 //l3
1122
1123 hsummarydatarp->GetXaxis()->SetBinLabel(19,"m_actl3");
1124 hsummarydatarp->GetXaxis()->SetBinLabel(20,"m_fill3");
1125 hsummarydatarp->GetXaxis()->SetBinLabel(21,"dr_actl3");
1126 hsummarydatarp->GetXaxis()->SetBinLabel(22,"dr_fill3");
1127 hsummarydatarp->GetXaxis()->SetBinLabel(23,"m_excl3");
1128 hsummarydatarp->GetXaxis()->SetBinLabel(24,"m_empl3");
1129 hsummarydatarp->GetXaxis()->SetBinLabel(25,"dr_excl3");
1130 hsummarydatarp->GetXaxis()->SetBinLabel(26,"dr_empl3");
1131 hsummarydatarp->GetXaxis()->SetBinLabel(27,"m_exc-actl3");
1132 hsummarydatarp->GetXaxis()->SetBinLabel(28,"m_act-empl3");
1133 hsummarydatarp->GetXaxis()->SetBinLabel(29,"dr_exc-actl3");
1134 hsummarydatarp->GetXaxis()->SetBinLabel(30,"dr_act-empl3");
1135 hsummarydatarp->GetXaxis()->SetBinLabel(31,"meanch_l3");
1136 hsummarydatarp->GetXaxis()->SetBinLabel(32,"meanrad_l3");
1137 hsummarydatarp->GetXaxis()->SetBinLabel(33,"m_overthl3");
1138 hsummarydatarp->GetXaxis()->SetBinLabel(34,"dr_overthl3");
1139
1140 //l4
1141
1142 hsummarydatarp->GetXaxis()->SetBinLabel(35,"m_actl4");
1143 hsummarydatarp->GetXaxis()->SetBinLabel(36,"m_fill4");
1144 hsummarydatarp->GetXaxis()->SetBinLabel(37,"dr_actl4");
1145 hsummarydatarp->GetXaxis()->SetBinLabel(38,"dr_fill4");
1146 hsummarydatarp->GetXaxis()->SetBinLabel(39,"m_excl4");
1147 hsummarydatarp->GetXaxis()->SetBinLabel(40,"m_empl4");
1148 hsummarydatarp->GetXaxis()->SetBinLabel(41,"dr_excl4");
1149 hsummarydatarp->GetXaxis()->SetBinLabel(42,"dr_empl4");
1150 hsummarydatarp->GetXaxis()->SetBinLabel(43,"m_exc-actl4");
1151 hsummarydatarp->GetXaxis()->SetBinLabel(44,"m_act-empl4");
1152 hsummarydatarp->GetXaxis()->SetBinLabel(45,"dr_exc-actl4");
1153 hsummarydatarp->GetXaxis()->SetBinLabel(46,"dr_act-empl4");
1154 hsummarydatarp->GetXaxis()->SetBinLabel(47,"meanch_l4");
1155 hsummarydatarp->GetXaxis()->SetBinLabel(48,"meanrad_l4");
1156 hsummarydatarp->GetXaxis()->SetBinLabel(49,"m_overthl4");
1157 hsummarydatarp->GetXaxis()->SetBinLabel(50,"dr_overthl4");
1158
1159 hsummarydatarp->GetXaxis()->LabelsOption("v");
1160
56147eda 1161 rv = fAliITSQADataMakerRec->Add2RecPointsList(hsummarydatarp,fSDDhRecPointsTask+offsRP, !expert, image);// No expert image
8a55554e 1162
1163
1164
1165 fSDDhRecPointsTask++;
1166
92664bc8 1167 fOnlineOffsetRecPoints = fSDDhRecPointsTask;
1168 if(fkOnline){
1169 TH2F *h19 = new TH2F("SDDGlobalCoordDistribYXFSE","YX Global Coord Distrib FSE",112,-28,28,112,-28,28);//position number 27
1170 h19->GetYaxis()->SetTitle("Y[cm]");
1171 h19->GetXaxis()->SetTitle("X[cm]");
1172 rv = fAliITSQADataMakerRec->Add2RecPointsList(h19,fSDDhRecPointsTask+offsRP, expert, !image);// expert NO image
1173 fSDDhRecPointsTask++;
1174
1175 TH2F *h20 = new TH2F("SDDGlobalCoordDistribRZFSE","RZ Global Coord Distrib FSE",128,-32,32,56,12,26);//position number 28
1176 h20->GetYaxis()->SetTitle("R[cm]");
1177 h20->GetXaxis()->SetTitle("Z[cm]");
1178 rv = fAliITSQADataMakerRec->Add2RecPointsList(h20,fSDDhRecPointsTask+offsRP, expert, !image);// expert NO image
1179 fSDDhRecPointsTask++;
1180 }//online
58ceb8ca 1181
5379c4a3 1182 AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SDD Recs histograms booked\n",fSDDhRecPointsTask));
92664bc8 1183 //
eca4fa66 1184 return rv ;
ebdd0606 1185}
1186
1187//____________________________________________________________________________
eca4fa66 1188Int_t AliITSQASDDDataMakerRec::MakeRecPoints(TTree * clustersTree)
7a0e5776 1189{
ebdd0606 1190 // Fill QA for RecPoints - SDD -
3f90b3dc 1191 Int_t rv = 0 ;
ebdd0606 1192 Int_t lay, lad, det;
8b7e858c 1193 //AliInfo("get the branch with the ITS clusters !\n");
e62fe478 1194 AliITSRecPointContainer* rpcont=AliITSRecPointContainer::Instance();
aa444532 1195 TClonesArray *recpoints=NULL;
3f90b3dc 1196 if(fkOnline){recpoints = rpcont->FetchClusters(0,clustersTree,fAliITSQADataMakerRec->GetEventNumber());}
1197 else{recpoints = rpcont->FetchClusters(0,clustersTree);}
7fa9b948 1198 AliDebug(10,Form("Fetched RecPoints for %d SDD modules",recpoints->GetEntriesFast()));
e62fe478 1199 if(!rpcont->GetStatusOK() || !rpcont->IsSDDActive()){
1200 AliError("can't get SDD clusters !");
1201 return rv;
ebdd0606 1202 }
92664bc8 1203 int offsRP = fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()];
ebdd0606 1204 Int_t npoints = 0;
1205 Float_t cluglo[3]={0.,0.,0.};
3f90b3dc 1206 if(fkOnline){
92664bc8 1207 for(Int_t i=28;i<30;i++) fAliITSQADataMakerRec->ResetRecPointsData(i+offsRP);
1208 }
e917bef4 1209 // AliITSgeomTGeo::GetModuleIndex() issues an error in case the arguments
1210 // are illegal and returns -1
1211 Int_t firMod=TMath::Max(0,AliITSgeomTGeo::GetModuleIndex(3,1,1));
e62fe478 1212 Int_t lasMod=AliITSgeomTGeo::GetModuleIndex(5,1,1);
1213 for(Int_t module=firMod; module<lasMod;module++){
58ceb8ca 1214 //AliInfo(Form("Module %d\n",module));
e62fe478 1215 recpoints = rpcont->UncheckedGetClusters(module);
58ceb8ca 1216 npoints += recpoints->GetEntries();
58ceb8ca 1217 for(Int_t j=0;j<recpoints->GetEntries();j++){
80b9610c 1218 AliITSRecPoint *recp = (AliITSRecPoint*)recpoints->At(j);
1219 Int_t index = recp->GetDetectorIndex();
1220 lay=recp->GetLayer();
92664bc8 1221 if(lay < 2 || lay > 3) continue;
1222 Int_t modnumb=index+AliITSgeomTGeo::GetModuleIndex(lay+1,1,1);
1223 AliITSgeomTGeo::GetModuleId(modnumb, lay, lad, det);
1224 // AliInfo(Form("modnumb %d, lay %d, lad %d, det %d \n",module, lay, lad, det));
1225 fAliITSQADataMakerRec->FillRecPointsData(6 +offsRP,modnumb);//modpatternrp
58ceb8ca 1226 recp->GetGlobalXYZ(cluglo);
1227 Float_t rad=TMath::Sqrt(cluglo[0]*cluglo[0]+cluglo[1]*cluglo[1]);
1228 Float_t phi=TMath::ATan2(cluglo[1],cluglo[0]);
1229 Float_t drifttime=recp->GetDriftTime();
92664bc8 1230 fAliITSQADataMakerRec->FillRecPointsData(12 +offsRP,recp->GetDetLocalX(),recp->GetDetLocalZ());//local distribution
1231 fAliITSQADataMakerRec->FillRecPointsData(2 +offsRP,cluglo[0],cluglo[1]);//global distribution YX
1232 fAliITSQADataMakerRec->FillRecPointsData(3 +offsRP,cluglo[2],rad);//global distribution rz
1233 if(fkOnline) {
1234 fAliITSQADataMakerRec->FillRecPointsData(28 +offsRP,cluglo[0],cluglo[1]);//global distribution YX FSE
1235 fAliITSQADataMakerRec->FillRecPointsData(29 +offsRP,cluglo[2],rad);//global distribution rz FSE
1236 }
1237 Int_t iside=recp->GetDriftSide();
1238 lay=recp->GetLayer();
1239 if(lay == 2) {
1240 fAliITSQADataMakerRec->FillRecPointsData(0 +offsRP, recp->GetQ()) ;//total charge of layer 3
1241 fAliITSQADataMakerRec->FillRecPointsData(7 +offsRP, det+0.5*iside-0.5,lad);//mod pattern layer 3
1242 fAliITSQADataMakerRec->FillRecPointsData(13 +offsRP, rad);//r distribution layer 3
1243 fAliITSQADataMakerRec->FillRecPointsData(15 +offsRP, phi);// phi distribution layer 3
1244 fAliITSQADataMakerRec->FillRecPointsData(4 +offsRP, cluglo[2],phi);// zphi distribution layer
1245 fAliITSQADataMakerRec->FillRecPointsData(17 +offsRP, drifttime);// time distribution layer 3
1246 fAliITSQADataMakerRec->FillRecPointsData(25 +offsRP, recp->GetdEdX());// charge distribution layer 3
1247 } else if(lay == 3) {
1248 fAliITSQADataMakerRec->FillRecPointsData(1 +offsRP, recp->GetQ()) ;//total charge layer 4
1249 fAliITSQADataMakerRec->FillRecPointsData(8 +offsRP, det+0.5*iside-0.5,lad);//mod pattern layer 4
1250 fAliITSQADataMakerRec->FillRecPointsData(14 +offsRP, rad);//r distribution
1251 fAliITSQADataMakerRec->FillRecPointsData(16 +offsRP, phi);//phi distribution
1252 fAliITSQADataMakerRec->FillRecPointsData(5 +offsRP, cluglo[2],phi);// zphi distribution layer 4
1253 fAliITSQADataMakerRec->FillRecPointsData(18 +offsRP, drifttime);// time distribution layer 4
1254 fAliITSQADataMakerRec->FillRecPointsData(26 +offsRP, recp->GetdEdX());// charge distribution layer 4
58ceb8ca 1255 }
1256 }
1257 }
92664bc8 1258 //
58ceb8ca 1259 return rv ;
ebdd0606 1260}
1261
e41192d7 1262//_______________________________________________________________
92664bc8 1263Int_t AliITSQASDDDataMakerRec::GetOffset(AliQAv1::TASKINDEX_t task, Int_t specie) const
7a0e5776 1264{
cfb59c70 1265 // Returns offset number according to the specified task
ad300de9 1266 Int_t offset=0;
3f90b3dc 1267 if( task == AliQAv1::kRAWS ){offset=fGenRawsOffset[specie];}
1268 else if(task == AliQAv1::kDIGITSR ){offset=fGenDigitsOffset[specie];}
1269 else if( task == AliQAv1::kRECPOINTS ){offset=fGenRecPointsOffset[specie];}
ad300de9 1270 return offset;
1271}
1272
1273//_______________________________________________________________
8b7e858c 1274void AliITSQASDDDataMakerRec::SetOffset(AliQAv1::TASKINDEX_t task, Int_t offset, Int_t specie) {
cfb59c70 1275 // Set offset number according to the specified task
3f90b3dc 1276 if( task == AliQAv1::kRAWS ) {fGenRawsOffset[specie]=offset;}
1277 else if( task == AliQAv1::kDIGITSR ) {fGenDigitsOffset[specie]=offset;}
1278 else if( task == AliQAv1::kRECPOINTS ) {fGenRecPointsOffset[specie]=offset;}
eca4fa66 1279}
1280
1281//_______________________________________________________________
4e25ac79 1282Int_t AliITSQASDDDataMakerRec::GetTaskHisto(AliQAv1::TASKINDEX_t task)
7a0e5776 1283{
cfb59c70 1284 //return the number of histo booked for a given Task
7a0e5776 1285 Int_t histotot=0;
3f90b3dc 1286 if( task == AliQAv1::kRAWS ){ histotot=fSDDhRawsTask ;}
1287 else if(task == AliQAv1::kDIGITSR) { histotot=fSDDhDigitsTask;}
1288 else if( task == AliQAv1::kRECPOINTS ){ histotot=fSDDhRecPointsTask;}
1289 else {AliInfo("No task has been selected. TaskHisto set to zero.\n");}
ad300de9 1290 return histotot;
e41192d7 1291}
8b7e858c 1292
58ceb8ca 1293
1294//_______________________________________________________________
58ceb8ca 1295void AliITSQASDDDataMakerRec::CreateTheMap()
1296{
cfb59c70 1297 //Create the SDD DDL Module Map
58ceb8ca 1298 AliCDBEntry *ddlMapSDD = AliCDBManager::Instance()->Get("ITS/Calib/DDLMapSDD");
1299 Bool_t cacheStatus = AliCDBManager::Instance()->GetCacheFlag();
3f90b3dc 1300 if(!ddlMapSDD){
58ceb8ca 1301 AliError("Calibration object retrieval failed! SDD will not be processed");
1302 fDDLModuleMap = NULL;
1303 //return rv;
1304 }
d2f99642 1305 else{
1306 fDDLModuleMap = (AliITSDDLModuleMapSDD*)ddlMapSDD->GetObject();
1307 if(!cacheStatus)ddlMapSDD->SetObject(NULL);
1308 ddlMapSDD->SetOwner(kTRUE);
1309 if(!cacheStatus){ delete ddlMapSDD;}
1310 AliInfo("DDL Map Created\n ");
1311 }
58ceb8ca 1312}
5af1d436 1313
3f90b3dc 1314//_______________________________________________________________
3f90b3dc 1315void AliITSQASDDDataMakerRec::CreateTheCalibration()
1316{
cfb59c70 1317 //Take from the OCDB the calibration information for the SDD
3f90b3dc 1318 AliCDBEntry *calibSDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD");
1319 Bool_t cacheStatus = AliCDBManager::Instance()->GetCacheFlag();
1320 if(!calibSDD)
1321 {
1322 AliError("Calibration object retrieval failed! SDD will not be processed");
d2f99642 1323 fCalibration = NULL;
3f90b3dc 1324 }
d2f99642 1325 else{
1326 fCalibration = (TObjArray *)calibSDD->GetObject();
1327
1328 if(!cacheStatus)calibSDD->SetObject(NULL);
1329 calibSDD->SetOwner(kTRUE);
1330 if(!cacheStatus){delete calibSDD;}
1331
1332 AliITSCalibrationSDD * cal=NULL;
1333 for(Int_t imod=0;imod<fgknSDDmodules;imod++)
1334 {
1335 //cal=NULL;
1336 Int_t fillmodhisto1=fgkTotalNumberSDDAnodes;
1337 Int_t fillmodhisto2side0=fgkNumberOfSDDAnodesperSide;
1338 Int_t fillmodhisto2side1=fgkNumberOfSDDAnodesperSide;
1339 Int_t fillmodhisto3side0=fgkNumberOfSDDAnodesperSide;
1340 Int_t fillmodhisto3side1=fgkNumberOfSDDAnodesperSide;
1341
1342 Int_t badmodhisto1=0;
1343 Int_t badmodhisto2side0=0;
1344 Int_t badmodhisto2side1=0;
1345 Int_t badmodhisto3side0=0;
1346 Int_t badmodhisto3side1=0;
1347 //printf("imod %i\t ==== \t",imod);
1348 Int_t module=imod + 240;
1349 //printf("module %i\t ==== \t",module);
1350 cal=(AliITSCalibrationSDD*)fCalibration->At(imod);
1351 Int_t lay,lad,det;
1352 AliITSgeomTGeo::GetModuleId(module,lay,lad,det);
1353 Int_t index=1+(det-1)*2;
1354 if(cal==0){continue;}
1355 if (cal->IsBad()){continue;}//bad module check
1356 else{
1357 for(Int_t i=0;i<8;i++) //check on bad chips in good modules
1358 {
1359 if(lay==3){
1360 if(cal->IsChipBad(i)){
1361 if(i<4){badmodhisto2side0+=64;}
1362 if(i>=4){badmodhisto2side1+=64;}
1363 }//end if chip
1364 }//end if layer3
1365 else if(lay==4){
1366 if(cal->IsChipBad(i)){
1367 if(i<4){badmodhisto3side0+=64;}
1368 if(i>=4){badmodhisto3side1+=64;}
1369 }//end if chip
1370 }//ens if layer4
1371 }//end for chip
1372 for(Int_t iAn=0; iAn<512; iAn++){//anodes loop
1373 Int_t ic=cal->GetChip(iAn);//chip with this anode number
1374 if(!cal->IsChipBad(ic) && !cal->IsBad() && cal->IsBadChannel(iAn)){// good chip good module bad channel
1375 if(lay==3){
3f90b3dc 1376 if(ic<4) badmodhisto2side0++;
1377 else if(ic>=4)badmodhisto2side1++;
1378 }//end if layer 3
d2f99642 1379 else if(lay==4){
3f90b3dc 1380 if(ic<4) badmodhisto3side0++;
1381 else if(ic>=4)badmodhisto3side1++;
1382 }//end if layer 4
d2f99642 1383 }//end if chip module channel
1384 }//end for anodes
1385 if(lay==3){
1386 badmodhisto1=badmodhisto2side0+badmodhisto2side1;
1387 fillmodhisto1-=badmodhisto1;
1388 fillmodhisto2side0-=badmodhisto2side0;
1389 fillmodhisto2side1-=badmodhisto2side1;
92664bc8 1390 ((TH1F*)(fHistoCalibration->At(0)))->SetBinContent(imod+1,fillmodhisto1);
1391 ((TH2F*)(fHistoCalibration->At(1)))->SetBinContent(index,lad,fillmodhisto2side0);
1392 ((TH2F*)(fHistoCalibration->At(1)))->SetBinContent(index+1,lad,fillmodhisto2side1);
56147eda 1393 /*
1394 printf("cal 0 x=%i \t y=%i => \t %i bad= %d \n",index,lad,fillmodhisto2side0,badmodhisto2side0);
1395 printf("cal 1 x=%i \t y=%i => \t %i bad= %d \n",index+1,lad,fillmodhisto2side1,badmodhisto2side1);
1396 */
d2f99642 1397 }//end layer 3
1398 else if(lay==4){
1399 badmodhisto1=badmodhisto3side0+badmodhisto3side1;
1400 fillmodhisto1-=badmodhisto1;
1401 fillmodhisto3side0-=badmodhisto3side0;
1402 fillmodhisto3side1-=badmodhisto3side1;
92664bc8 1403 ((TH1F*)(fHistoCalibration->At(0)))->SetBinContent(imod+1,fillmodhisto1);
1404 ((TH2F*)(fHistoCalibration->At(2)))->SetBinContent(index,lad,fillmodhisto3side0);
1405 ((TH2F*)(fHistoCalibration->At(2)))->SetBinContent(index+1,lad,fillmodhisto3side1);
d2f99642 1406 }//end layer 4
1407 }//end else bad module
1408 }//end module for
1409 }
8a55554e 1410
3f90b3dc 1411}
1412
1413//____________________________________________________________________
3f90b3dc 1414void AliITSQASDDDataMakerRec::InitCalibrationArray()
1415{
cfb59c70 1416 //create the histograms with the calibration informations. The histograms are stored in a TObjArray
92664bc8 1417 TH1F *pattern1 = new TH1F("CALSDDModPattern","Calibration HW Modules pattern",fgknSDDmodules,239.5,499.5);
f2fafc64 1418 pattern1->SetDirectory(0) ;
92664bc8 1419 TH2F *patternl3 = new TH2F("CALSDDphizL3","Calibration SDD #varphiz Layer3 ",12,0.5,6.5,14,0.5,14.5);
f2fafc64 1420 patternl3->SetDirectory(0) ;
92664bc8 1421 TH2F *patternl4 = new TH2F("CALSDDphizL4"," Calibration SDD #varphiz Layer4 ",16,0.5,8.5,22,0.5,22.5);
f2fafc64 1422 patternl4->SetDirectory(0) ;
3f90b3dc 1423
f2fafc64 1424 if(!fHistoCalibration)fHistoCalibration = new TObjArray(3);
3f90b3dc 1425 fHistoCalibration->AddAtAndExpand(pattern1,0);
1426 fHistoCalibration->AddAtAndExpand(patternl3,1);
1427 fHistoCalibration->AddAtAndExpand(patternl4,2);
f2fafc64 1428 fHistoCalibration->SetOwner(kTRUE);
fad6e2fc 1429 // printf("Calibration Histograms created!\n");
3f90b3dc 1430}
5af1d436 1431
1432//____________________________________________________________________
5af1d436 1433void AliITSQASDDDataMakerRec::ResetDetector(AliQAv1::TASKINDEX_t task)
1434{
cfb59c70 1435 //reset the SDD calibration histograms
5af1d436 1436 AliInfo(Form("Reset detector in SDD called for task index %i", task));
1437 if(task== AliQAv1::kRAWS ){
d2f99642 1438 fDDLModuleMap=NULL;
3d0c40f9 1439 }
d2f99642 1440
3f90b3dc 1441 fCalibration=NULL;
3d0c40f9 1442
92664bc8 1443 ((TH1F*)(fHistoCalibration->At(0)))->Reset();
1444 ((TH2F*)(fHistoCalibration->At(1)))->Reset();
1445 ((TH2F*)(fHistoCalibration->At(2)))->Reset();
f2fafc64 1446 //delete fHistoCalibration;
1447 //fHistoCalibration=NULL;
3d0c40f9 1448
5af1d436 1449}
be2d913a 1450
8a55554e 1451//____________________________________________________________________
1452
92664bc8 1453Int_t AliITSQASDDDataMakerRec::GetNumberOfEvents(AliQAv1::TASKINDEX_t task, Int_t trigCl)
8a55554e 1454{
92664bc8 1455 //return the number of the processed events for a given task and trigger class (-1 for all)
a6a921e0 1456 return fAliITSQADataMakerRec->GetEvCountTotal(task, trigCl);
fe7d86eb 1457}