]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSQASDDDataMakerRec.cxx
Changed default values of cuts
[u/mrichter/AliRoot.git] / ITS / AliITSQASDDDataMakerRec.cxx
CommitLineData
ebdd0606 1/**************************************************************************
2 * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/* $Id$ */
17
18// *************************************************************
19// Checks the quality assurance
20// by comparing with reference data
21// contained in a DB
22// -------------------------------------------------------------
23// W. Ferrarese + P. Cerello Feb 2008
8b7e858c 24// M.Siciliano Aug 2008 QA RecPoints
ebdd0606 25// INFN Torino
26
27// --- ROOT system ---
ad300de9 28
ebdd0606 29#include <TProfile2D.h>
30#include <TH2D.h>
58ceb8ca 31#include <TH1F.h>
ebdd0606 32#include <TBranch.h>
33#include <TTree.h>
34#include <TGaxis.h>
35#include <TMath.h>
8b7e858c 36#include <TF1.h>
ebdd0606 37#include <TDirectory.h>
e41192d7 38#include <TSystem.h>
ebdd0606 39// --- Standard library ---
40
41// --- AliRoot header files ---
42#include "AliITSQASDDDataMakerRec.h"
43#include "AliLog.h"
4e25ac79 44#include "AliQAv1.h"
ebdd0606 45#include "AliQAChecker.h"
46#include "AliRawReader.h"
e41192d7 47#include "AliITSRawStream.h"
ebdd0606 48#include "AliITSRawStreamSDD.h"
e41192d7 49#include "AliITSRawStreamSDDCompressed.h"
50#include "AliITSDetTypeRec.h"
5192f264 51#include "AliITSdigit.h"
ebdd0606 52#include "AliITSRecPoint.h"
53#include "AliITSgeomTGeo.h"
ebdd0606 54#include "AliCDBManager.h"
55#include "AliCDBStorage.h"
56#include "AliCDBEntry.h"
ad300de9 57#include "Riostream.h"
fc89f88c 58#include "AliITSdigitSDD.h"
59#include "AliITS.h"
60#include "AliRunLoader.h"
61#include "AliITSLoader.h"
62#include "AliITSDetTypeRec.h"
63
64
ebdd0606 65
66ClassImp(AliITSQASDDDataMakerRec)
67
68//____________________________________________________________________________
69AliITSQASDDDataMakerRec::AliITSQASDDDataMakerRec(AliITSQADataMakerRec *aliITSQADataMakerRec, Bool_t kMode, Short_t ldc) :
70TObject(),
71fAliITSQADataMakerRec(aliITSQADataMakerRec),
72fkOnline(kMode),
73fLDC(ldc),
ad300de9 74fSDDhRawsTask(0),
44ed7a66 75fSDDhDigitsTask(0),
ad300de9 76fSDDhRecPointsTask(0),
ad300de9 77fGenRawsOffset(0),
44ed7a66 78fGenDigitsOffset(0),
ad300de9 79fGenRecPointsOffset(0),
ebdd0606 80fTimeBinSize(1),
e41192d7 81fDDLModuleMap(0),
8b7e858c 82fGoodAnodes(0),
83fBadAnodes(0),
84fGoodAnodesCurrent(0),
85fBadAnodesCurrent(0)
ebdd0606 86{
87 //ctor used to discriminate OnLine-Offline analysis
8b7e858c 88 if(fLDC < 0 || fLDC > 6) {
ebdd0606 89 AliError("Error: LDC number out of range; return\n");
90 }
8b7e858c 91 fGenRawsOffset = new Int_t[AliRecoParam::kNSpecies];
92 fGenRecPointsOffset = new Int_t[AliRecoParam::kNSpecies];
4a903927 93 fGenDigitsOffset = new Int_t[AliRecoParam::kNSpecies];
8b7e858c 94 for(Int_t i=0; i<AliRecoParam::kNSpecies; i++) {
95 fGenRawsOffset[i] = 0;
96 fGenRecPointsOffset[i] = 0;
4a903927 97 fGenDigitsOffset[i]=0;
8b7e858c 98 }
ebdd0606 99}
100
101//____________________________________________________________________________
102AliITSQASDDDataMakerRec::AliITSQASDDDataMakerRec(const AliITSQASDDDataMakerRec& qadm) :
103TObject(),
104fAliITSQADataMakerRec(qadm.fAliITSQADataMakerRec),
105fkOnline(qadm.fkOnline),
106fLDC(qadm.fLDC),
ad300de9 107fSDDhRawsTask(qadm.fSDDhRawsTask),
44ed7a66 108fSDDhDigitsTask(qadm.fSDDhDigitsTask),
ad300de9 109fSDDhRecPointsTask(qadm.fSDDhRecPointsTask),
ad300de9 110fGenRawsOffset(qadm.fGenRawsOffset),
44ed7a66 111fGenDigitsOffset(qadm.fGenDigitsOffset),
ad300de9 112fGenRecPointsOffset(qadm.fGenRecPointsOffset),
ebdd0606 113fTimeBinSize(1),
e41192d7 114fDDLModuleMap(0),
8b7e858c 115fGoodAnodes(qadm.fGoodAnodes),
116fBadAnodes(qadm.fBadAnodes),
117fGoodAnodesCurrent(qadm.fGoodAnodesCurrent),
58ceb8ca 118fBadAnodesCurrent(qadm.fBadAnodesCurrent)
119{
ebdd0606 120 //copy ctor
121 fAliITSQADataMakerRec->SetName((const char*)qadm.fAliITSQADataMakerRec->GetName()) ;
122 fAliITSQADataMakerRec->SetTitle((const char*)qadm.fAliITSQADataMakerRec->GetTitle());
123 fDDLModuleMap=NULL;
124}
125
126//____________________________________________________________________________
127AliITSQASDDDataMakerRec::~AliITSQASDDDataMakerRec(){
128 // destructor
58ceb8ca 129 //if(fDDLModuleMap) delete fDDLModuleMap;
ebdd0606 130}
131//__________________________________________________________________
132AliITSQASDDDataMakerRec& AliITSQASDDDataMakerRec::operator = (const AliITSQASDDDataMakerRec& qac )
133{
7a0e5776 134 // Equal operator.
ebdd0606 135 this->~AliITSQASDDDataMakerRec();
136 new(this) AliITSQASDDDataMakerRec(qac);
137 return *this;
138}
139
140//____________________________________________________________________________
141void AliITSQASDDDataMakerRec::StartOfDetectorCycle()
142{
143 //Detector specific actions at start of cycle
5379c4a3 144 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM::Start of SDD Cycle\n");
ebdd0606 145}
146
147//____________________________________________________________________________
4e25ac79 148void AliITSQASDDDataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t /*task*/, TObjArray* /*list*/)
ebdd0606 149{
f867e0d8 150
ebdd0606 151 // launch the QA checking
8b7e858c 152 if(fkOnline) {
153 AnalyseBNG(); // Analyse Baseline, Noise, Gain
154 AnalyseINJ(); // Analyse Injectors
155 }
f867e0d8 156
8b7e858c 157 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSDM instantiates checker with Run(AliQAv1::kITS, task, list)\n");
ebdd0606 158}
159
160//____________________________________________________________________________
eca4fa66 161Int_t AliITSQASDDDataMakerRec::InitRaws()
ebdd0606 162{
163 // Initialization for RAW data - SDD -
7d297381 164 const Bool_t expert = kTRUE ;
165 const Bool_t saveCorr = kTRUE ;
166 const Bool_t image = kTRUE ;
58ceb8ca 167
168
169
eca4fa66 170 Int_t rv = 0 ;
58ceb8ca 171 /*
ebdd0606 172 AliCDBEntry *ddlMapSDD = AliCDBManager::Instance()->Get("ITS/Calib/DDLMapSDD");
173 Bool_t cacheStatus = AliCDBManager::Instance()->GetCacheFlag();
e41192d7 174 if(!ddlMapSDD)
175 {
176 AliError("Calibration object retrieval failed! SDD will not be processed");
177 fDDLModuleMap = NULL;
eca4fa66 178 return rv;
e41192d7 179 }
ebdd0606 180 fDDLModuleMap = (AliITSDDLModuleMapSDD*)ddlMapSDD->GetObject();
181 if(!cacheStatus)ddlMapSDD->SetObject(NULL);
182 ddlMapSDD->SetOwner(kTRUE);
e41192d7 183 if(!cacheStatus)
184 {
185 delete ddlMapSDD;
186 }
58ceb8ca 187 */
ebdd0606 188 Int_t lay, lad, det;
ebdd0606 189 Int_t indexlast = 0;
190 Int_t index1 = 0;
191
7a0e5776 192 if(fkOnline)
193 {
194 AliInfo("Book Online Histograms for SDD\n");
195 }
196 else
197 {
198 AliInfo("Book Offline Histograms for SDD\n ");
199 }
200 TH1D *h0 = new TH1D("SDDModPattern","HW Modules pattern",fgknSDDmodules,239.5,499.5); //0
ebdd0606 201 h0->GetXaxis()->SetTitle("Module Number");
202 h0->GetYaxis()->SetTitle("Counts");
8b7e858c 203 rv = fAliITSQADataMakerRec->Add2RawsList((new TH1D(*h0)),0+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr);
ebdd0606 204 delete h0;
ad300de9 205 fSDDhRawsTask++;
7a0e5776 206
207 //zPhi distribution using ladder and modules numbers
58ceb8ca 208 TH2D *hphil3 = new TH2D("SDDphizL3","SDD #varphiz Layer3 ",12,0.5,6.5,14,0.5,14.5);
7a0e5776 209 hphil3->GetXaxis()->SetTitle("z[#Module L3 ]");
210 hphil3->GetYaxis()->SetTitle("#varphi[#Ladder L3]");
f867e0d8 211 rv = fAliITSQADataMakerRec->Add2RawsList((new TH2D(*hphil3)),1+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image, saveCorr);
7a0e5776 212 delete hphil3;
213 fSDDhRawsTask++;
214
58ceb8ca 215 TH2D *hphil4 = new TH2D("SDDphizL4","SDD #varphiz Layer4 ",16,0.5,8.5,22,0.5,22.5);
7a0e5776 216 hphil4->GetXaxis()->SetTitle("z[#Module L4]");
217 hphil4->GetYaxis()->SetTitle("#varphi[#Ladder L4]");
f867e0d8 218 rv = fAliITSQADataMakerRec->Add2RawsList((new TH2D(*hphil4)),2+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image, saveCorr);
7a0e5776 219 delete hphil4;
220 fSDDhRawsTask++;
221
ebdd0606 222
7a0e5776 223 if(fkOnline)
224 {
225
226 //DDL Pattern
58ceb8ca 227 TH2D *hddl = new TH2D("SDDDDLPattern","SDD DDL Pattern ",24,-0.5,11.5,24,-0.5,23.5);
ad300de9 228 hddl->GetXaxis()->SetTitle("Channel");
229 hddl->GetYaxis()->SetTitle("#DDL");
8b7e858c 230 rv = fAliITSQADataMakerRec->Add2RawsList((new TH2D(*hddl)),3+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr);
ad300de9 231 delete hddl;
232 fSDDhRawsTask++;
7a0e5776 233 Int_t indexlast1 = 0;
234
235 fTimeBinSize = 4;
236 indexlast = 0;
237 index1 = 0;
238 indexlast1 = fSDDhRawsTask;
239 char *hname[3];
240 for(Int_t i=0; i<3; i++) hname[i]= new char[50];
241 for(Int_t moduleSDD =0; moduleSDD<fgknSDDmodules; moduleSDD++){
242 for(Int_t iside=0;iside<fgknSide;iside++){
243 AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det);
244 sprintf(hname[0],"SDDchargeMapFSE_L%d_%d_%d_%d",lay,lad,det,iside);
245 sprintf(hname[1],"SDDChargeMapForSingleEvent_L%d_%d_%d_%d",lay,lad,det,iside);
fc89f88c 246 // sprintf(hname[2],"SDDhmonoDMap_L%d_%d_%d_%d",lay,lad,det,iside);
7a0e5776 247 TProfile2D *fModuleChargeMapFSE = new TProfile2D(hname[0],hname[1],256/fTimeBinSize,-0.5,255.5,256,-0.5,255.5);
248 fModuleChargeMapFSE->GetXaxis()->SetTitle("Time Bin");
249 fModuleChargeMapFSE->GetYaxis()->SetTitle("Anode");
8b7e858c 250 rv = fAliITSQADataMakerRec->Add2RawsList((new TProfile2D(*fModuleChargeMapFSE)),indexlast1 + index1 + fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr);
7a0e5776 251 delete fModuleChargeMapFSE;
252
253 fSDDhRawsTask++;
254 index1++;
ebdd0606 255 }
7a0e5776 256 }
257
258 for(Int_t moduleSDD =0; moduleSDD<fgknSDDmodules; moduleSDD++){
259 for(Int_t iside=0;iside<fgknSide;iside++){
260 AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det);
261 sprintf(hname[0],"SDDchargeMap_L%d_%d_%d_%d",lay,lad,det,iside);
262 sprintf(hname[1],"SDDChargeMap_L%d_%d_%d_%d",lay,lad,det,iside);
263 TProfile2D *fModuleChargeMap = new TProfile2D(hname[0],hname[1],256/fTimeBinSize,-0.5,255.5,256,-0.5,255.5);
264 fModuleChargeMap->GetXaxis()->SetTitle("Time Bin");
265 fModuleChargeMap->GetYaxis()->SetTitle("Anode");
8b7e858c 266 rv = fAliITSQADataMakerRec->Add2RawsList((new TProfile2D(*fModuleChargeMap)),indexlast1 + index1 + fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr);
7a0e5776 267 delete fModuleChargeMap;
268
269 fSDDhRawsTask++;
270 index1++;
ebdd0606 271 }
7a0e5776 272 }
273
58ceb8ca 274 //Event Size
275 TH1F *hsize = new TH1F("SDDEventSize","SDD Event Size ",1000,-0.5,999.5);
276 hsize->GetXaxis()->SetTitle("Event Size [kB]");
277 hsize->GetYaxis()->SetTitle("Entries");
278 rv = fAliITSQADataMakerRec->Add2RawsList((new TH1F(*hsize)),indexlast1 + index1 + fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr);
279 delete hsize;
280 fSDDhRawsTask++;
8b7e858c 281
7a0e5776 282 } // kONLINE
ebdd0606 283
5379c4a3 284 AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SDD Raws histograms booked\n",fSDDhRawsTask));
eca4fa66 285 return rv ;
ebdd0606 286}
287
288
289//____________________________________________________________________________
eca4fa66 290Int_t AliITSQASDDDataMakerRec::MakeRaws(AliRawReader* rawReader)
ebdd0606 291{
292 // Fill QA for RAW - SDD -
8b7e858c 293 Int_t rv = 0;
7555afef 294 // Check id histograms already created for this Event Specie
7555afef 295
ebdd0606 296 if(!fDDLModuleMap){
58ceb8ca 297 CreateTheMap();
298 //AliError("SDD DDL module map not available - skipping SDD QA");
299 //return rv;
300
ebdd0606 301 }
eca4fa66 302 if(rawReader->GetType() != 7) return rv; // skips non physical triggers
5379c4a3 303 AliDebug(AliQAv1::GetQADebugLevel(),"entering MakeRaws\n");
e41192d7 304 rawReader->Reset();
58ceb8ca 305 rawReader->Select("ITSSDD");
8b7e858c 306 AliITSRawStream *stream=AliITSRawStreamSDD::CreateRawStreamSDD(rawReader);
307 stream->SetDDLModuleMap(fDDLModuleMap);
e41192d7 308
ebdd0606 309 Int_t lay, lad, det;
7a0e5776 310
ebdd0606 311 Int_t index=0;
312 if(fkOnline) {
313 for(Int_t moduleSDD =0; moduleSDD<fgknSDDmodules; moduleSDD++){
7a0e5776 314 for(Int_t iside=0;iside<fgknSide;iside++) {
8b7e858c 315 if(fSDDhRawsTask > 4 + index) fAliITSQADataMakerRec->GetRawsData(4 + index +fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Reset();
7a0e5776 316 // 4 because the 2D histos for single events start after the fourth position
317 index++;
318 }
ebdd0606 319 }
320 }
e41192d7 321
ebdd0606 322 Int_t cnt = 0;
323 Int_t ildcID = -1;
324 Int_t iddl = -1;
325 Int_t isddmod = -1;
7a0e5776 326 Int_t coord1, coord2, signal, moduleSDD, activeModule, index1;
58ceb8ca 327 //if(fkOnline)
328 //{
329 Int_t prevDDLID = -1;
330 UInt_t size = 0;
331 int totalddl=static_cast<int>(fDDLModuleMap->GetNDDLs());
332 Bool_t *ddldata=new Bool_t[totalddl];
333 for(Int_t jddl=0;jddl<totalddl;jddl++){ddldata[jddl]=kFALSE;}
334 //}
e41192d7 335 while(stream->Next()) {
ebdd0606 336 ildcID = rawReader->GetLDCId();
58ceb8ca 337 iddl = rawReader->GetDDLID();// - fgkDDLIDshift;
338
339
e41192d7 340 isddmod = fDDLModuleMap->GetModuleNumber(iddl,stream->GetCarlosId());
ebdd0606 341 if(isddmod==-1){
5379c4a3 342 AliDebug(AliQAv1::GetQADebugLevel(),Form("Found module with iddl: %d, stream->GetCarlosId: %d \n",iddl,stream->GetCarlosId()));
ebdd0606 343 continue;
344 }
e41192d7 345 if(stream->IsCompletedModule()) {
5379c4a3 346 AliDebug(AliQAv1::GetQADebugLevel(),Form("IsCompletedModule == KTRUE\n"));
ebdd0606 347 continue;
348 }
de075dae 349 if(stream->IsCompletedDDL()) {
58ceb8ca 350
351 if(fkOnline){
352 if ((rawReader->GetDDLID() != prevDDLID)&&(ddldata[iddl])==kFALSE){
353 size += rawReader->GetDataSize();//in bytes
354 prevDDLID = rawReader->GetDDLID();
355 ddldata[iddl]=kTRUE;
356 }
357 }
5379c4a3 358 AliDebug(AliQAv1::GetQADebugLevel(),Form("IsCompletedDDL == KTRUE\n"));
de075dae 359 continue;
360 }
ebdd0606 361
e41192d7 362 coord1 = stream->GetCoord1();
363 coord2 = stream->GetCoord2();
364 signal = stream->GetSignal();
ebdd0606 365
7a0e5776 366 moduleSDD = isddmod - fgkmodoffset;
367
b62d7123 368 if(isddmod <fgkmodoffset|| isddmod>fgknSDDmodules+fgkmodoffset-1) {
5379c4a3 369 AliDebug(AliQAv1::GetQADebugLevel(),Form( "Module SDD = %d, resetting it to 1 \n",isddmod));
b62d7123 370 isddmod = 1;
ebdd0606 371 }
7a0e5776 372
ebdd0606 373 AliITSgeomTGeo::GetModuleId(isddmod, lay, lad, det);
e41192d7 374 Short_t iside = stream->GetChannel();
ad300de9 375
58ceb8ca 376 //printf(" \n%i %i %i %i \n ",lay, lad, det,iside );
377 fAliITSQADataMakerRec->GetRawsData( 0 + fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()] )->Fill(isddmod);
378 if(lay==3) fAliITSQADataMakerRec->GetRawsData(1+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(det+0.5*iside-0.5,lad);
379 if(lay==4) {
380 fAliITSQADataMakerRec->GetRawsData(2+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(det+0.5*iside-0.5,lad);}
381
ebdd0606 382 if(fkOnline) {
7a0e5776 383
58ceb8ca 384 fAliITSQADataMakerRec->GetRawsData(3+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill((stream->GetCarlosId())+0.5*iside -0.5,iddl);
fc89f88c 385
7a0e5776 386 activeModule = moduleSDD;
387 index1 = activeModule * 2 + iside;
388
389 if(index1<0){
5379c4a3 390 AliDebug(AliQAv1::GetQADebugLevel(),Form("Wrong index number %d - patched to 0\n",index1));
7a0e5776 391 index1 = 0;
392 }
78f8430c 393
7a0e5776 394 if(fSDDhRawsTask > 4 + index1) {
8b7e858c 395 ((TProfile2D *)(fAliITSQADataMakerRec->GetRawsData(4 + index1 +fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])))->Fill(coord2, coord1, signal);
396 ((TProfile2D *)(fAliITSQADataMakerRec->GetRawsData(4 + index1 + 260*2 +fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])))->Fill(coord2, coord1, signal);
ebdd0606 397 }
58ceb8ca 398
399 }//online
7a0e5776 400 cnt++;
5379c4a3 401 if(!(cnt%10000)) AliDebug(AliQAv1::GetQADebugLevel(),Form(" %d raw digits read",cnt));
58ceb8ca 402 }//end next()
403 if(fkOnline)
404 {
405 ((TH1F*)(fAliITSQADataMakerRec->GetRawsData(4 + 260*4 +fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])))->Fill(size/1024.);//KB
406 }
5379c4a3 407 AliDebug(AliQAv1::GetQADebugLevel(),Form("Event completed, %d raw digits read",cnt));
e41192d7 408 delete stream;
409 stream = NULL;
8b7e858c 410
411// if(fkOnline) {
412// AnalyseBNG(); // Analyse Baseline, Noise, Gain
413// AnalyseINJ(); // Analyse Injectors
414// }
415
58ceb8ca 416 delete []ddldata;
417 ddldata=NULL;
eca4fa66 418 return rv ;
7a0e5776 419}
ebdd0606 420
44ed7a66 421//____________________________________________________________________________
eca4fa66 422Int_t AliITSQASDDDataMakerRec::InitDigits()
44ed7a66 423{
fc89f88c 424
7555afef 425
44ed7a66 426 // Initialization for DIGIT data - SDD -
427 const Bool_t expert = kTRUE ;
428 const Bool_t image = kTRUE ;
eca4fa66 429 Int_t rv = 0 ;
430// fGenDigitsOffset = (fAliITSQADataMakerRec->fDigitsQAList[AliRecoParam::kDefault])->GetEntries();
44ed7a66 431 //fSDDhTask must be incremented by one unit every time a histogram is ADDED to the QA List
432 TH1F* h0=new TH1F("SDD DIGITS Module Pattern","SDD DIGITS Module Pattern",260,239.5,499.5); //hmod
433 h0->GetXaxis()->SetTitle("SDD Module Number");
434 h0->GetYaxis()->SetTitle("# DIGITS");
4a903927 435 rv = fAliITSQADataMakerRec->Add2DigitsList(h0,fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);
44ed7a66 436 fSDDhDigitsTask ++;
4a903927 437 // printf("Add %s \t the task offset is %i\n",fAliITSQADataMakerRec->GetDigitsData(fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->GetName() , fSDDhDigitsTask );
44ed7a66 438 TH1F* h1=new TH1F("SDD Anode Distribution","DIGITS Anode Distribution",512,-0.5,511.5); //hanocc
439 h1->GetXaxis()->SetTitle("Anode Number");
440 h1->GetYaxis()->SetTitle("# DIGITS");
4a903927 441 rv = fAliITSQADataMakerRec->Add2DigitsList(h1,1+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);
44ed7a66 442 fSDDhDigitsTask ++;
4a903927 443 //printf("Add %s \t the task offset is %i\n",fAliITSQADataMakerRec->GetDigitsData(1+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->GetName() , fSDDhDigitsTask );
44ed7a66 444 TH1F* h2=new TH1F("SDD Tbin Distribution","DIGITS Tbin Distribution",256,-0.5,255.5); //htbocc
445 h2->GetXaxis()->SetTitle("Tbin Number");
446 h2->GetYaxis()->SetTitle("# DIGITS");
4a903927 447 rv = fAliITSQADataMakerRec->Add2DigitsList(h2,2+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);
44ed7a66 448 fSDDhDigitsTask ++;
4a903927 449 //printf("Add %s \t the task offset is %i\n",fAliITSQADataMakerRec->GetDigitsData(2+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->GetName() , fSDDhDigitsTask );
44ed7a66 450 TH1F* h3=new TH1F("SDD ADC Counts Distribution","DIGITS ADC Counts Distribution",200,0.,1024.); //hsig
451 h3->GetXaxis()->SetTitle("ADC Value");
452 h3->GetYaxis()->SetTitle("# DIGITS");
4a903927 453 rv = fAliITSQADataMakerRec->Add2DigitsList(h3,3+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);
44ed7a66 454 fSDDhDigitsTask ++;
4a903927 455 //printf("Add %s \t the task offset is %i\n",fAliITSQADataMakerRec->GetDigitsData(3+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->GetName() , fSDDhDigitsTask );
44ed7a66 456 AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SDD Digits histograms booked\n",fSDDhDigitsTask));
eca4fa66 457 return rv ;
44ed7a66 458}
459
460//____________________________________________________________________________
eca4fa66 461Int_t AliITSQASDDDataMakerRec::MakeDigits(TTree * digits)
44ed7a66 462{
7555afef 463
44ed7a66 464 // Fill QA for DIGIT - SDD -
fc89f88c 465 //AliITS *fITS = (AliITS*)gAlice->GetModule("ITS");
466 //fITS->SetTreeAddress();
467 //TClonesArray *iITSdigits = fITS->DigitsAddress(1);
468
469
eca4fa66 470 Int_t rv = 0 ;
471
fc89f88c 472 TBranch *branchD = digits->GetBranch("ITSDigitsSDD");
473
474 if (!branchD) {
475 AliError("can't get the branch with the ITS SDD digits !");
eca4fa66 476 return rv ;
44ed7a66 477 }
eca4fa66 478 // Check id histograms already created for this Event Specie
8b7e858c 479// if ( ! fAliITSQADataMakerRec->GetDigitsData(fGenDigitsOffset) )
480// rv = InitDigits() ;
eca4fa66 481
fc89f88c 482 static TClonesArray statDigits("AliITSdigitSDD");
44ed7a66 483 TClonesArray *iITSdigits = &statDigits;
484 branchD->SetAddress(&iITSdigits);
fc89f88c 485
44ed7a66 486 for(Int_t i=0; i<260; i++){
487 Int_t nmod=i+240;
488 digits->GetEvent(nmod);
489 Int_t ndigits = iITSdigits->GetEntries();
4a903927 490 fAliITSQADataMakerRec->GetDigitsData(fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(nmod,ndigits);
7555afef 491
44ed7a66 492 for (Int_t idig=0; idig<ndigits; idig++) {
493 AliITSdigit *dig=(AliITSdigit*)iITSdigits->UncheckedAt(idig);
494 Int_t iz=dig->GetCoord1(); // cell number z
495 Int_t ix=dig->GetCoord2(); // cell number x
496 Int_t sig=dig->GetSignal();
4a903927 497 fAliITSQADataMakerRec->GetDigitsData(1+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(iz);
498 fAliITSQADataMakerRec->GetDigitsData(2+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(ix);
499 fAliITSQADataMakerRec->GetDigitsData(3+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(sig);
44ed7a66 500 }
501 }
eca4fa66 502 return rv ;
44ed7a66 503}
504
ebdd0606 505//____________________________________________________________________________
eca4fa66 506Int_t AliITSQASDDDataMakerRec::InitRecPoints()
ebdd0606 507{
7555afef 508
8b7e858c 509 //AliInfo("Initialize SDD recpoints histos\n");
ebdd0606 510 // Initialization for RECPOINTS - SDD -
7d297381 511 const Bool_t expert = kTRUE ;
512 const Bool_t image = kTRUE ;
eca4fa66 513 Int_t rv = 0 ;
514// fGenRecPointsOffset = (fAliITSQADataMakerRec->fRecPointsQAList[AliRecoParam::kDefault])->GetEntries();
ad300de9 515
ebdd0606 516 Int_t nOnline=1;
517 Int_t nOnline2=1;
518 Int_t nOnline3=1;
519 Int_t nOnline4=1;
520 if(fkOnline)
521 {
ebdd0606 522 nOnline=4;
523 nOnline2=28;
524 nOnline3=64;
525 nOnline4=14;
526 }
527
8b7e858c 528 //AliInfo(Form("fAliITSQADataMakerRec->GetEventSpecie() %d\n",fAliITSQADataMakerRec->GetEventSpecie()));
529 //AliInfo(Form("fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()] %d\n",fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()]));
ebdd0606 530 TH1F *h0 = new TH1F("SDDLay3TotCh","Layer 3 total charge",1000/nOnline,-0.5, 499.5); //position number 0
531 h0->GetXaxis()->SetTitle("ADC value");
532 h0->GetYaxis()->SetTitle("Entries");
8b7e858c 533 rv = fAliITSQADataMakerRec->Add2RecPointsList((new TH1F(*h0)), 0 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);
534 //delete h0;
ad300de9 535 fSDDhRecPointsTask++;
ebdd0606 536
537 TH1F *h1 = new TH1F("SDDLay4TotCh","Layer 4 total charge",1000/nOnline,-0.5, 499.5);//position number 1
538 h1->GetXaxis()->SetTitle("ADC value");
539 h1->GetYaxis()->SetTitle("Entries");
8b7e858c 540 rv = fAliITSQADataMakerRec->Add2RecPointsList((new TH1F(*h1)), 1 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);
ebdd0606 541 delete h1;
ad300de9 542 fSDDhRecPointsTask++;
ebdd0606 543
544 char hisnam[50];
545 TH2F *h2 = new TH2F("SDDGlobalCoordDistribYX","YX Global Coord Distrib",5600/nOnline2,-28,28,5600/nOnline2,-28,28);//position number 2
546 h2->GetYaxis()->SetTitle("Y[cm]");
547 h2->GetXaxis()->SetTitle("X[cm]");
8b7e858c 548 rv = fAliITSQADataMakerRec->Add2RecPointsList((new TH2F(*h2)),2+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, !image);
ebdd0606 549 delete h2;
ad300de9 550 fSDDhRecPointsTask++;
ebdd0606 551
552 TH2F *h3 = new TH2F("SDDGlobalCoordDistribRZ","RZ Global Coord Distrib",6400/nOnline3,-32,32,1400/nOnline4,12,26);//position number 3
553 h3->GetYaxis()->SetTitle("R[cm]");
554 h3->GetXaxis()->SetTitle("Z[cm]");
8b7e858c 555 rv = fAliITSQADataMakerRec->Add2RecPointsList((new TH2F(*h3)),3+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, !image);
ebdd0606 556 delete h3;
ad300de9 557 fSDDhRecPointsTask++;
ebdd0606 558
559 TH2F *h4 = new TH2F("SDDGlobalCoordDistribL3PHIZ","#varphi Z Global Coord Distrib L3",6400/nOnline3,-32,32,360/nOnline,-TMath::Pi(),TMath::Pi());//position number 4
560 h4->GetYaxis()->SetTitle("#phi[rad]");
561 h4->GetXaxis()->SetTitle("Z[cm]");
8b7e858c 562 rv = fAliITSQADataMakerRec->Add2RecPointsList((new TH2F(*h4)),4+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);
ebdd0606 563 delete h4;
ad300de9 564 fSDDhRecPointsTask++;
ebdd0606 565
566 TH2F *h5 = new TH2F("SDDGlobalCoordDistribL4PHIZ","#varphi Z Global Coord Distrib L4",6400/nOnline3,-32,32,360/nOnline,-TMath::Pi(),TMath::Pi());//position number 5
567 h5->GetYaxis()->SetTitle("#phi[rad]");
568 h5->GetXaxis()->SetTitle("Z[cm]");
8b7e858c 569 rv = fAliITSQADataMakerRec->Add2RecPointsList((new TH2F(*h5)),5+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);
ebdd0606 570 delete h5;
ad300de9 571 fSDDhRecPointsTask++;
ebdd0606 572
573 TH1F *h6 = new TH1F("SDDModPatternRP","Modules pattern RP",fgknSDDmodules,239.5,499.5); //position number 6
574 h6->GetXaxis()->SetTitle("Module number"); //spd offset = 240
575 h6->GetYaxis()->SetTitle("Entries");
8b7e858c 576 rv = fAliITSQADataMakerRec->Add2RecPointsList((new TH1F(*h6)),6 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);
ebdd0606 577 delete h6;
ad300de9 578 fSDDhRecPointsTask++;
58ceb8ca 579
ebdd0606 580 TH1F *h7 = new TH1F("SDDLadPatternL3RP","Ladder pattern L3 RP",14,0.5,14.5); //position number 7
581 h7->GetXaxis()->SetTitle("Ladder #, Layer 3");
582 h7->GetYaxis()->SetTitle("Entries");
8b7e858c 583 rv = fAliITSQADataMakerRec->Add2RecPointsList((new TH1F(*h7)),7 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);
ebdd0606 584 delete h7;
ad300de9 585 fSDDhRecPointsTask++;
58ceb8ca 586
ebdd0606 587 TH1F *h8 = new TH1F("SDDLadPatternL4RP","Ladder pattern L4 RP",22,0.5,22.5); //position number 8
588 h8->GetXaxis()->SetTitle("Ladder #, Layer 4");
589 h8->GetYaxis()->SetTitle("Entries");
8b7e858c 590 rv = fAliITSQADataMakerRec->Add2RecPointsList((new TH1F(*h8)),8 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);
ebdd0606 591 delete h8;
ad300de9 592 fSDDhRecPointsTask++;
58ceb8ca 593
ebdd0606 594 TH2F *h9 = new TH2F("SDDLocalCoordDistrib","Local Coord Distrib",1000/nOnline,-4,4,1000/nOnline,-4,4);//position number 9
595 h9->GetXaxis()->SetTitle("X local coord, drift, cm");
596 h9->GetYaxis()->SetTitle("Z local coord, anode, cm");
8b7e858c 597 rv = fAliITSQADataMakerRec->Add2RecPointsList((new TH2F(*h9)),9 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);
ebdd0606 598 delete h9;
ad300de9 599 fSDDhRecPointsTask++;
58ceb8ca 600
601 //AliInfo("Create SDD recpoints histos\n");
602
603 TH1F *h10 = new TH1F("SDDrdistrib_Layer3" ,"SDD r distribution Layer3" ,100,14.,18.);//position number 10 (L3)
604 h10->GetXaxis()->SetTitle("r[cm]");
605 h10->GetXaxis()->CenterTitle();
606 h10->GetYaxis()->SetTitle("Entries");
607 rv = fAliITSQADataMakerRec->Add2RecPointsList((new TH1F(*h10)),10 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);
608 delete h10;
609 fSDDhRecPointsTask++;
610
611 TH1F *h11 = new TH1F("SDDrdistrib_Layer4" ,"SDD r distribution Layer4" ,100,22.,26.);// and position number 11 (L4)
612 h11->GetXaxis()->SetTitle("r[cm]");
613 h11->GetXaxis()->CenterTitle();
614 h11->GetYaxis()->SetTitle("Entries");
615 rv = fAliITSQADataMakerRec->Add2RecPointsList((new TH1F(*h11)),11 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);
616 delete h11;
617 fSDDhRecPointsTask++;
618
ebdd0606 619 for(Int_t iLay=0; iLay<=1; iLay++){
620 sprintf(hisnam,"SDDphidistrib_Layer%d",iLay+3);
621 TH1F *h12 = new TH1F(hisnam,hisnam,180,-TMath::Pi(),TMath::Pi());//position number 12 (L3) and position number 13 (L4)
622 h12->GetXaxis()->SetTitle("#varphi[rad]");
623 h12->GetXaxis()->CenterTitle();
624 h12->GetYaxis()->SetTitle("Entries");
8b7e858c 625 rv = fAliITSQADataMakerRec->Add2RecPointsList((new TH1F(*h12)),iLay+12+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);
ebdd0606 626 delete h12;
ad300de9 627 fSDDhRecPointsTask++;
ebdd0606 628 }
58ceb8ca 629
630 for(Int_t iLay=0; iLay<=1; iLay++){
631 sprintf(hisnam,"SDDdrifttime_Layer%d",iLay+3);
632 TH1F *h14 = new TH1F(hisnam,hisnam,200,-0.5,9999.5);//position number 14 (L3) and position number 15 (L4)
633 h14->GetXaxis()->SetTitle("#varphi[rad]");
634 h14->GetXaxis()->CenterTitle();
635 h14->GetYaxis()->SetTitle("Entries");
636 rv = fAliITSQADataMakerRec->Add2RecPointsList((new TH1F(*h14)),iLay+14+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);
637 delete h14;
638 fSDDhRecPointsTask++;
639 }
640
ebdd0606 641 if(fkOnline)
642 {
58ceb8ca 643 TH2F *h16 = new TH2F("SDDGlobalCoordDistribYXFSE","YX Global Coord Distrib FSE",5600/nOnline2,-28,28,5600/nOnline2,-28,28);//position number 16
644 h16->GetYaxis()->SetTitle("Y[cm]");
645 h16->GetXaxis()->SetTitle("X[cm]");
646 rv = fAliITSQADataMakerRec->Add2RecPointsList((new TH2F(*h16)),16+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);
647 delete h16;
ad300de9 648 fSDDhRecPointsTask++;
ebdd0606 649
58ceb8ca 650 TH2F *h17 = new TH2F("SDDGlobalCoordDistribRZFSE","RZ Global Coord Distrib FSE",Int_t(6400/nOnline3),-32,32,1400/nOnline4,12,26);//position number 17
651 h17->GetYaxis()->SetTitle("R[cm]");
652 h17->GetXaxis()->SetTitle("Z[cm]");
653 rv = fAliITSQADataMakerRec->Add2RecPointsList((new TH2F(*h17)),17+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);
654 delete h17;
ad300de9 655 fSDDhRecPointsTask++;
ebdd0606 656
ebdd0606 657 }//online
58ceb8ca 658
5379c4a3 659 AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SDD Recs histograms booked\n",fSDDhRecPointsTask));
58ceb8ca 660
eca4fa66 661 return rv ;
ebdd0606 662}
663
664//____________________________________________________________________________
eca4fa66 665Int_t AliITSQASDDDataMakerRec::MakeRecPoints(TTree * clustersTree)
7a0e5776 666{
ebdd0606 667 // Fill QA for RecPoints - SDD -
eca4fa66 668 Int_t rv = 0 ;
7555afef 669
ebdd0606 670 Int_t lay, lad, det;
8b7e858c 671 //AliInfo("get the branch with the ITS clusters !\n");
ebdd0606 672 TBranch *branchRecP = clustersTree->GetBranch("ITSRecPoints");
673 if (!branchRecP) {
674 AliError("can't get the branch with the ITS clusters !");
eca4fa66 675 return rv ;
ebdd0606 676 }
677
678 static TClonesArray statRecpoints("AliITSRecPoint") ;
679 TClonesArray *recpoints = &statRecpoints;
680 branchRecP->SetAddress(&recpoints);
681 Int_t npoints = 0;
682 Float_t cluglo[3]={0.,0.,0.};
683 if(fkOnline)
684 {
58ceb8ca 685 for(Int_t i=16;i<18;i++)
ebdd0606 686 {
8b7e858c 687 fAliITSQADataMakerRec->GetRecPointsData(i+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Reset();
ebdd0606 688 }
689 }
58ceb8ca 690 for(Int_t module=0; module<clustersTree->GetEntries();module++){
691 //AliInfo(Form("Module %d\n",module));
692 branchRecP->GetEvent(module);
693 npoints += recpoints->GetEntries();
694 //AliInfo(Form("modnumb %d, npoints %d, total points %d\n",module, recpoints->GetEntries(),npoints));
695 AliITSgeomTGeo::GetModuleId(module, lay, lad, det);
696 //AliInfo(Form("modnumb %d, lay %d, lad %d, det %d \n",module, lay, lad, det));
697
698 //AliInfo(Form("modnumb %d, entries %d\n",module, recpoints->GetEntries()));
699 for(Int_t j=0;j<recpoints->GetEntries();j++){
700 //AliInfo(Form("modnumb %d, entry %d \n",module, j));
701 AliITSRecPoint *recp = (AliITSRecPoint*)recpoints->At(j);
702 fAliITSQADataMakerRec->GetRecPointsData(6 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(module);//modpatternrp
703 recp->GetGlobalXYZ(cluglo);
704 Float_t rad=TMath::Sqrt(cluglo[0]*cluglo[0]+cluglo[1]*cluglo[1]);
705 Float_t phi=TMath::ATan2(cluglo[1],cluglo[0]);
706 Float_t drifttime=recp->GetDriftTime();
707 fAliITSQADataMakerRec->GetRecPointsData(9 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(recp->GetDetLocalX(),recp->GetDetLocalZ());//local distribution
708 fAliITSQADataMakerRec->GetRecPointsData(2 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluglo[0],cluglo[1]);//global distribution YX
709 fAliITSQADataMakerRec->GetRecPointsData(3 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluglo[2],rad);//global distribution rz
710 if(fkOnline) {
711 fAliITSQADataMakerRec->GetRecPointsData(16 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluglo[0],cluglo[1]);//global distribution YX FSE
712 fAliITSQADataMakerRec->GetRecPointsData(17 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluglo[2],rad);//global distribution rz FSE
713 }
714 if(recp->GetLayer() == 2) {
715 fAliITSQADataMakerRec->GetRecPointsData(0 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(recp->GetQ()) ;//total charge of layer 3
716 fAliITSQADataMakerRec->GetRecPointsData(7 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(lad);//lad pattern layer 3
717 fAliITSQADataMakerRec->GetRecPointsData(10 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(rad);//r distribution layer 3
718 fAliITSQADataMakerRec->GetRecPointsData(12 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(phi);// phi distribution layer 3
719 fAliITSQADataMakerRec->GetRecPointsData(4 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluglo[2],phi);// zphi distribution layer
720 fAliITSQADataMakerRec->GetRecPointsData(14 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(drifttime);// time distribution layer 3
721 } else if(recp->GetLayer() == 3) {
722 fAliITSQADataMakerRec->GetRecPointsData(1 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(recp->GetQ()) ;//total charge layer 4
723 fAliITSQADataMakerRec->GetRecPointsData(8 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(lad);//ladpatternlayer4
724 fAliITSQADataMakerRec->GetRecPointsData(11 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(rad);//r distribution
725 fAliITSQADataMakerRec->GetRecPointsData(13 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(phi);//phi distribution
726 fAliITSQADataMakerRec->GetRecPointsData(5 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluglo[2],phi);// zphi distribution layer 4
727 fAliITSQADataMakerRec->GetRecPointsData(15 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(drifttime);// time distribution layer 4
728 }
729 }
730 }
731 statRecpoints.Clear();
732 return rv ;
ebdd0606 733}
734
ad300de9 735//_______________________________________________________________
736
4e25ac79 737Int_t AliITSQASDDDataMakerRec::GetOffset(AliQAv1::TASKINDEX_t task)
7a0e5776 738{
ad300de9 739 Int_t offset=0;
4e25ac79 740 if( task == AliQAv1::kRAWS )
7a0e5776 741 {
8b7e858c 742 offset=fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()];
7a0e5776 743 }
eca4fa66 744 else if(task == AliQAv1::kDIGITSR )
745 {
4a903927 746 offset=fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()];
eca4fa66 747 }
748 else if( task == AliQAv1::kRECPOINTS )
749 {
8b7e858c 750 offset=fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()];
eca4fa66 751 }
ad300de9 752 return offset;
753}
754
755//_______________________________________________________________
756
8b7e858c 757void AliITSQASDDDataMakerRec::SetOffset(AliQAv1::TASKINDEX_t task, Int_t offset, Int_t specie) {
eca4fa66 758 // Returns offset number according to the specified task
759 if( task == AliQAv1::kRAWS ) {
8b7e858c 760 fGenRawsOffset[specie]=offset;
eca4fa66 761 }
762 else if( task == AliQAv1::kDIGITSR ) {
4a903927 763 fGenDigitsOffset[specie]=offset;
eca4fa66 764 }
765 else if( task == AliQAv1::kRECPOINTS ) {
8b7e858c 766 fGenRecPointsOffset[specie]=offset;
eca4fa66 767 }
768}
769
770//_______________________________________________________________
771
4e25ac79 772Int_t AliITSQASDDDataMakerRec::GetTaskHisto(AliQAv1::TASKINDEX_t task)
7a0e5776 773{
ad300de9 774
7a0e5776 775 Int_t histotot=0;
ad300de9 776
4e25ac79 777 if( task == AliQAv1::kRAWS )
7a0e5776 778 {
779 histotot=fSDDhRawsTask ;
780 }
eca4fa66 781 else if(task == AliQAv1::kDIGITSR)
782 {
783 histotot=fSDDhDigitsTask;
784 }
785 else if( task == AliQAv1::kRECPOINTS )
786 {
787 histotot=fSDDhRecPointsTask;
788 }
8b7e858c 789 else {
790 AliInfo("No task has been selected. TaskHisto set to zero.\n");
791 }
ad300de9 792 return histotot;
e41192d7 793}
8b7e858c 794
795//_______________________________________________________________
796
797void AliITSQASDDDataMakerRec::AnalyseBNG()
798{
799
800// get file time for Previous test
801 AliInfo("AnalyseBNG\n");
25b66378 802 Int_t bngtimeBasPrevious;
803 FILE *fpinPreviousBas = fopen( "SDDbasHistos.time", "r" );
804 if(fpinPreviousBas) {
805 fscanf(fpinPreviousBas,"%d",&bngtimeBasPrevious);
806 fclose (fpinPreviousBas);
807 } else
808 bngtimeBasPrevious = 0;
809 Int_t bngtimeBasCurrent = 0;
810 gSystem->Exec("perl -e '@d=localtime ((stat(shift))[9]); printf \"%02d%02d%02d%02d%02d\n\", $d[5]-100,$d[4]+1,$d[3],$d[2],$d[1]' SDDbasHistos.root > SDDbasHistos.time");
811 FILE *fpinBas = fopen( "SDDbasHistos.time", "r" );
812 fscanf(fpinBas,"%d",&bngtimeBasCurrent);
813 if(bngtimeBasCurrent>bngtimeBasPrevious )AliInfo(Form("bngtimeBasCurrent %d, bngtimeBasPrevious %d\n",bngtimeBasCurrent,bngtimeBasPrevious));
814
815 Bool_t kAnalyseBas = kTRUE;
816 if(bngtimeBasCurrent <= bngtimeBasPrevious) kAnalyseBas = kFALSE;
817 if(kAnalyseBas) {
818 // new bng file found
819 bngtimeBasPrevious = bngtimeBasCurrent;
820 Bool_t kFilesExist = kTRUE;
821 TFile basFile("SDDbasHistos.root");
822 if(basFile.IsZombie()) kFilesExist = kFALSE;
823 if(kFilesExist) {
824 AnodeStatus();
825 AnalyseHistos(1); // Baseline
826 AnalyseHistos(2); // Uncorrected Noise
827 AnalyseHistos(3); // Common Mode Noise
828 AnalyseHistos(4); // Corrected Noise
829 gSystem->Exec("cp SDDbasHistos.root SDDbasHistosPrevious.root");
830 } else {
831 AliInfo("file SDDbasHistos.root not found \n");
832 }
833 }
834 fclose (fpinBas);
835// delete fpinBas;
836
837 Int_t bngtimeGainPrevious;
8b7e858c 838 FILE *fpinPrevious = fopen( "SDDgainHistos.time", "r" );
839 if(fpinPrevious) {
25b66378 840 fscanf(fpinPrevious,"%d",&bngtimeGainPrevious);
841 fclose (fpinPrevious);
8b7e858c 842 } else
25b66378 843 bngtimeGainPrevious = 0;
844 Int_t bngtimeGainCurrent = 0;
845 gSystem->Exec("perl -e '@d=localtime ((stat(shift))[9]); printf \"%02d%02d%02d%02d%02d\n\", $d[5]-100,$d[4]+1,$d[3],$d[2],$d[1]' SDDgainHistos.root > SDDgainHistos.time");
846 FILE *fpin = fopen( "SDDgainHistos.time", "r" );
847 fscanf(fpin,"%d",&bngtimeGainCurrent);
848 if(bngtimeGainCurrent>bngtimeGainPrevious )AliInfo(Form("bngtimeGainCurrent %d, bngtimeGainPrevious %d\n",bngtimeGainCurrent,bngtimeGainPrevious));
849
8b7e858c 850 Bool_t kAnalyse = kTRUE;
25b66378 851 if(bngtimeGainCurrent <= bngtimeGainPrevious) kAnalyse = kFALSE;
8b7e858c 852 if(kAnalyse) {
25b66378 853 // new bng file found
854 bngtimeGainPrevious = bngtimeGainCurrent;
8b7e858c 855 Bool_t kFilesExist = kTRUE;
25b66378 856 TFile gainFile("SDDgainHistos.root");
857 if(gainFile.IsZombie()) kFilesExist = kFALSE;
8b7e858c 858 if(kFilesExist) {
25b66378 859 AnalyseHistos(5); // Gain
860 gSystem->Exec("cp SDDgainHistos.root SDDgainHistosPrevious.root");
8b7e858c 861 } else {
25b66378 862 AliInfo("file SDDgainHistos.root not found \n");
8b7e858c 863 }
864 }
865 fclose (fpin);
866// delete fpin;
867
868}
869
870//_______________________________________________________________
871
872void AliITSQASDDDataMakerRec::AnalyseINJ()
873{
874// get file time for last test
875
876 AliInfo("AnalyseINJ\n");
25b66378 877 Int_t injtimePrevious;
8b7e858c 878 FILE *fpinPrevious = fopen( "SDDinjectHistos.time", "r" );
879 if(fpinPrevious) {
25b66378 880 fscanf(fpinPrevious,"%d",&injtimePrevious);
881 fclose (fpinPrevious);
8b7e858c 882 } else
25b66378 883 injtimePrevious = 0;
884 Int_t injtimeCurrent = 0;
885 gSystem->Exec("perl -e '@d=localtime ((stat(shift))[9]); printf \"%02d%02d%02d%02d%02d\n\", $d[5]-100,$d[4]+1,$d[3],$d[2],$d[1]' SDDinjectHistos.root > SDDinjectHistos.time");
886 FILE *fpin = fopen( "SDDinjectHistos.time", "r" );
887 fscanf(fpin,"%d",&injtimeCurrent);
888 if(injtimeCurrent>injtimePrevious )AliInfo(Form("injtimeCurrent %d, injtimePrevious %d\n",injtimeCurrent,injtimePrevious));
889
8b7e858c 890 Bool_t kAnalyse = kTRUE;
25b66378 891 if(injtimeCurrent <= injtimePrevious) kAnalyse = kFALSE;
8b7e858c 892 if(kAnalyse) {
893 // new inj file found
25b66378 894 injtimePrevious = injtimeCurrent;
8b7e858c 895 Bool_t kFilesExist = kTRUE;
25b66378 896 TFile gainFile("SDDinjectHistos.root");
897 if(gainFile.IsZombie()) kFilesExist = kFALSE;
898
8b7e858c 899 if(kFilesExist) {
900 AnalyseHistos(6); // Drift Speed
25b66378 901 gSystem->Exec("cp SDDinjectHistos.root SDDinjectHistosPrevious.root");
8b7e858c 902 } else {
25b66378 903 AliInfo("file(s) SDDinjectHistos.root not found \n");
8b7e858c 904 }
905 }
906 fclose (fpin);
8b7e858c 907// delete fpin;
908}
909
910//_______________________________________________________________
911
912void AliITSQASDDDataMakerRec::AnodeStatus()
913{
914 char *hnamePrevious = new char[50];
25b66378 915 fGoodAnodes = 0;
916
917 TFile basFilePrevious("SDDbasHistosPrevious.root");
918 if(!basFilePrevious.IsZombie()) {
919 for(Int_t ddl =0; ddl<fDDLModuleMap->GetNDDLs(); ddl++){
920 for(Int_t crx =0; crx<fDDLModuleMap->GetNModPerDDL(); crx++){
921 for(Int_t iside=0;iside<fgknSide;iside++){
922 Int_t moduleSDD = fDDLModuleMap->GetModuleNumber(ddl,crx);
923 //AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det);
924 sprintf(hnamePrevious,"hgood%02dc%02ds%d",ddl,crx,iside);
925 //AliInfo(Form("get histo %s\n",hnamePrevious));
926 TH1F *hgood = (TH1F *) basFilePrevious.Get(hnamePrevious);
927 if(!hgood) continue;
928 for(Int_t i=0; i<hgood->GetNbinsX();i++) {
58ceb8ca 929 fkAnodeMap[moduleSDD-fgkmodoffset][iside][i] = hgood->GetBinContent(i);
930 if(fkAnodeMap[moduleSDD-fgkmodoffset][iside][i]) fGoodAnodes++;
25b66378 931 }
932 delete hgood;
933 }
934 }
935 }
936 basFilePrevious.Close();
8b7e858c 937 }
8b7e858c 938 fGoodAnodesCurrent = 0;
939 fBadAnodesCurrent = 0;
940 char *hname = new char[50];
941 Int_t nChangedStatus = 0;
942 Bool_t CurrentAnodeMap[fgknSDDmodules][fgknSide][fgknAnode];
25b66378 943 TFile basFile("SDDbasHistos.root");
944 if(!basFile.IsZombie()) {
945 for(Int_t ddl =0; ddl<fDDLModuleMap->GetNDDLs(); ddl++){
946 for(Int_t crx =0; crx<fDDLModuleMap->GetNModPerDDL(); crx++){
947 for(Int_t iside=0;iside<fgknSide;iside++){
948 Int_t moduleSDD = fDDLModuleMap->GetModuleNumber(ddl,crx);
949 //AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det);
950 sprintf(hname,"hgood%02dc%02ds%d",ddl,crx,iside);
951 //AliInfo(Form("get histo %s\n",hname));
952 TH1F *hgood = (TH1F *) basFile.Get(hname);
953 if(!hgood) continue;
954 for(Int_t i=0; i<hgood->GetNbinsX();i++) {
955 CurrentAnodeMap[moduleSDD-fgkmodoffset][iside][i] = hgood->GetBinContent(i);
956 if(CurrentAnodeMap[moduleSDD-fgkmodoffset][iside][i]) fGoodAnodesCurrent++;
957 else fBadAnodesCurrent++;
58ceb8ca 958 if(CurrentAnodeMap[moduleSDD-fgkmodoffset][iside][i] != fkAnodeMap[moduleSDD-fgkmodoffset][iside][i]) {
959 fkAnodeMap[moduleSDD-fgkmodoffset][iside][i] = CurrentAnodeMap[moduleSDD-fgkmodoffset][iside][i];
25b66378 960 nChangedStatus++;
58ceb8ca 961 // AliWarning(Form("DDL %d, CRX %d, Side %d, Anode %d changed status to %d \n",ddl,crx,iside,i,fkAnodeMap[moduleSDD-fgkmodoffset][iside][i]));
25b66378 962 }
963 }
964 delete hgood;
965 }
966 }
967 }
968 basFile.Close();
8b7e858c 969 }
25b66378 970
8b7e858c 971 AliWarning(Form("Number of good anodes changed from %d to %d, that is %f %%\n",fGoodAnodes,fGoodAnodesCurrent,((Float_t) TMath::Abs(fGoodAnodes-fGoodAnodesCurrent))/(fBadAnodesCurrent+fGoodAnodesCurrent)));
972 if(fGoodAnodesCurrent != fGoodAnodes) {
973 fGoodAnodes = fGoodAnodesCurrent;
974 }
975 AliWarning(Form("Number of bad anodes changed from %d to %d, that is %f %%\n",fBadAnodes,fBadAnodesCurrent,((Float_t) TMath::Abs(fBadAnodes-fBadAnodesCurrent))/(fBadAnodesCurrent+fGoodAnodesCurrent)));
976 if(fBadAnodesCurrent != fBadAnodes) {
977 fBadAnodes = fBadAnodesCurrent;
978 }
979// delete hname;
980}
981
982//_______________________________________________________________
983
984void AliITSQASDDDataMakerRec::AnalyseHistos(Int_t type)
985{
986
25b66378 987 if(type < 1 || type > 6) {
988 AliWarning(Form("Wrong type (%d), must be between 1 and 6\n",type));
989 return;
990 }
991
8b7e858c 992 Double_t Current[fgknSDDmodules][fgknSide][fgknAnode];
993 char *hnamePrevious = new char[50];
25b66378 994 TString *fnamePrevious=NULL;
8b7e858c 995
25b66378 996 if(type < 5) fnamePrevious = new TString("SDDbasHistosPrevious.root");
997 else if(type == 5) fnamePrevious = new TString("SDDgainHistosPrevious.root");
998 else if(type == 6) fnamePrevious = new TString("SDDinjectHistosPrevious.root");
999 TFile *gainFilePrevious = new TFile(fnamePrevious->Data());
1000 if(!gainFilePrevious->IsZombie()) {
8b7e858c 1001
25b66378 1002 for(Int_t ddl =0; ddl<fDDLModuleMap->GetNDDLs(); ddl++){
1003 for(Int_t crx =0; crx<fDDLModuleMap->GetNModPerDDL(); crx++){
8b7e858c 1004 for(Int_t iside=0;iside<fgknSide;iside++){
1005 Int_t moduleSDD = fDDLModuleMap->GetModuleNumber(ddl,crx);
1006 //AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det);
1007 if(type == 1) sprintf(hnamePrevious,"hbase%02dc%02ds%d",ddl,crx,iside);
1008 else if(type == 2) sprintf(hnamePrevious,"hnois%02dc%02ds%d",ddl,crx,iside);
1009 else if(type == 3) sprintf(hnamePrevious,"hcmn%02dc%02ds%d",ddl,crx,iside);
1010 else if(type == 4) sprintf(hnamePrevious,"hcorn%02dc%02ds%d",ddl,crx,iside);
1011 else if(type == 5) sprintf(hnamePrevious,"hgain%02dc%02ds%d",ddl,crx,iside);
1012 else if(type == 6) sprintf(hnamePrevious,"hdrsp%02dc%02ds%d",ddl,crx,iside);
1013 //AliInfo(Form("get histo %s\n",hnamePrevious));
1014 TH1F *hhist = (TH1F *) gainFilePrevious->Get(hnamePrevious);
1015 if(!hhist) continue;
1016 for(Int_t i=0; i<hhist->GetNbinsX();i++) {
1017 Current[moduleSDD-fgkmodoffset][iside][i] = hhist->GetBinContent(i);
1018 }
1019 delete hhist;
1020 }
1021 }
25b66378 1022 }
1023 gainFilePrevious->Close();
1024 delete gainFilePrevious;
8b7e858c 1025 }
25b66378 1026 delete fnamePrevious;
8b7e858c 1027
1028 Float_t xmin = 0.;
1029 Float_t xmax = 0;
1030 Int_t nbins = 1;
1031 TH1F *hDist = 0;
1032 TH1F *hDistDiff = 0;
1033 if(type == 1) {
1034 xmin = 0.;
1035 xmax = 500.;
1036 nbins = (Int_t)(xmax-xmin);
1037 hDist = new TH1F("hBaseline","Baseline",nbins,xmin,xmax);
1038 hDistDiff = new TH1F("hBaselineDiff","Baseline Difference",200,-100.,100.);
1039 } else if(type == 2) {
1040 xmin = 0.;
1041 xmax = 10.;
1042 nbins = (Int_t) (100.*(xmax-xmin));
1043 hDist = new TH1F("hNoiseUnc","Noise (before correction)",nbins,xmin,xmax);
1044 hDistDiff = new TH1F("hNoiseUncDiff","Noise (before correction) Difference",200,-10.,10.);
1045 } else if(type == 3) {
1046 xmin = 0.;
1047 xmax = 10.;
1048 nbins = (Int_t)( 100.*(xmax-xmin));
1049 hDist = new TH1F("hNoiseCMN","Noise (common mode)",nbins,xmin,xmax);
1050 hDistDiff = new TH1F("hNoiseCMNDiff","Noise (common mode) Difference",200,-10.,10.);
1051 } else if(type == 4) {
1052 xmin = 0.;
1053 xmax = 10.;
1054 nbins = (Int_t)(100.*(xmax-xmin));
1055 hDist = new TH1F("hNoiseCor","Noise (after correction)",nbins,xmin,xmax);
1056 hDistDiff = new TH1F("hNoiseCorDiff","Noise (after correction) Difference",200,-10.,10.);
1057 } else if(type == 5) {
1058 xmin = 0.;
1059 xmax = 5.;
1060 nbins = (Int_t)(100.*(xmax-xmin));
1061 hDist = new TH1F("hGain","Gain",nbins,xmin,xmax);
1062 hDistDiff = new TH1F("hGainDiff","Gain Difference",200,-10.,10.);
1063 } else if(type == 6) {
1064 xmin = 0.;
1065 xmax = 10.;
1066 nbins = (Int_t)(100.*(xmax-xmin));
1067 hDist = new TH1F("hDriftSpeed","Drift Speed",nbins,xmin,xmax);
1068 hDistDiff = new TH1F("hDriftSpeedDiff","Drift Speed Difference",200,-10.,10.);
1069 }
1070
1071 Float_t binw = (xmax-xmin)/nbins;
1072
25b66378 1073 TString *fnamePrevious2=NULL;
8b7e858c 1074
25b66378 1075 if(type < 5) fnamePrevious2 = new TString("SDDbasHistosPrevious.root");
1076 else if(type == 5) fnamePrevious2 = new TString("SDDgainHistosPrevious.root");
1077 else if(type == 6) fnamePrevious2 = new TString("SDDinjectHistosPrevious.root");
1078 TFile *gainFile = new TFile(fnamePrevious2->Data());
1079 if(!gainFile->IsZombie()) {
1080
1081 for(Int_t ddl =0; ddl<fDDLModuleMap->GetNDDLs(); ddl++){
8b7e858c 1082 for(Int_t crx =0; crx<fDDLModuleMap->GetNModPerDDL(); crx++){
1083 for(Int_t iside=0;iside<fgknSide;iside++){
1084 Int_t moduleSDD = fDDLModuleMap->GetModuleNumber(ddl,crx);
1085 //AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det);
1086 if(type == 1) sprintf(hnamePrevious,"hbase%02dc%02ds%d",ddl,crx,iside);
1087 else if(type == 2) sprintf(hnamePrevious,"hnois%02dc%02ds%d",ddl,crx,iside);
1088 else if(type == 3) sprintf(hnamePrevious,"hcmn%02dc%02ds%d",ddl,crx,iside);
1089 else if(type == 4) sprintf(hnamePrevious,"hcorn%02dc%02ds%d",ddl,crx,iside);
1090 else if(type == 5) sprintf(hnamePrevious,"hgain%02dc%02ds%d",ddl,crx,iside);
1091 else if(type == 6) sprintf(hnamePrevious,"hdrsp%02dc%02ds%d",ddl,crx,iside);
1092 //AliInfo(Form("get histo %s\n",hname));
1093 TH1F *hhist = (TH1F *) gainFile->Get(hnamePrevious);
1094 if(!hhist) continue;
1095 for(Int_t i=0; i<hhist->GetNbinsX();i++) {
58ceb8ca 1096 if(!fkAnodeMap[moduleSDD-fgkmodoffset][iside][i]) continue;
8b7e858c 1097 hDist->Fill(hhist->GetBinContent(i));
1098 hDistDiff->Fill(hhist->GetBinContent(i)-Current[moduleSDD-fgkmodoffset][iside][i]);
1099 }
1100 delete hhist;
1101 }
1102 }
25b66378 1103 }
1104 gainFile->Close();
1105 delete gainFile;
8b7e858c 1106 }
25b66378 1107 delete fnamePrevious2;
8b7e858c 1108
8b7e858c 1109 TF1 ff("ff", "gaus", xmin+0.1, xmax-0.1);
1110 hDist->Fit("ff","NWR");
1111// hDist->Fit("gaus","","",xmin+0.1, xmax-0.1);
1112// Float_t ChiSquared = (Float_t) ff.GetChisquare();
1113// Int_t NDF = ff.GetNumberFitPoints() - ff.GetNpar();
1114 Float_t average = (Float_t) ff.GetParameter(1);
1115 Float_t sigma = (Float_t) ff.GetParameter(2);
1116// Float_t mean = hDist->GetMean();
1117// Float_t rms = hDist->GetRMS();
1118 Int_t badB = 0;
1119 for(Int_t i=0; i<hDist->GetNbinsX();i++) {
1120// if(type < 6)
1121 if(TMath::Abs(i*binw-average) > 4.*sigma) badB += (Int_t)hDist->GetBinContent(i);
1122// else
1123// if(TMath::Abs(i-mean) > 4*rms) badB += hDist->GetBinContent(i);
1124 }
25b66378 1125 Double_t denomi = hDist->GetEntries();
1126 if(denomi == 0) {
1127 denomi = 1;
1128 badB = 0;
1129 }
8b7e858c 1130 if(type == 1) {
25b66378 1131 AliInfo(Form("Number of anodes with baseline out of 4*sigma from average: %d, %f%%\n",badB,100.*((Float_t) badB)/denomi));
8b7e858c 1132 } else if(type == 2) {
25b66378 1133 AliInfo(Form("Number of anodes with uncorrected noise out of 4*sigma from average: %d, %f%%\n",badB,100.*((Float_t) badB)/denomi));
8b7e858c 1134 } else if(type == 3) {
25b66378 1135 AliInfo(Form("Number of anodes with common mode noise out of 4*sigma from average: %d, %f%%\n",badB,100.*((Float_t) badB)/denomi));
8b7e858c 1136 } else if(type == 4) {
25b66378 1137 AliInfo(Form("Number of anodes with corrected noise out of 4*sigma from average: %d, %f%%\n",badB,100.*((Float_t) badB)/denomi));
8b7e858c 1138 } else if(type == 5) {
25b66378 1139 AliInfo(Form("Number of anodes with gain out of 4*sigma from average: %d, %f%%\n",badB,100.*((Float_t) badB)/denomi));
8b7e858c 1140 } else if(type == 6) {
1141 Int_t badspeed = (Int_t)hDist->GetBinContent(1);
1142 AliInfo(Form("Number of anodes with drift speed equal to 0: %d\n",badspeed));
25b66378 1143 AliInfo(Form("Number of anodes with drift speed out of 4*sigma from average: %d, %f%%\n",badB-badspeed,100.*((Float_t) (badB-badspeed))/(denomi-badspeed)));
8b7e858c 1144 }
1145
1146 TH1F *hDistHistoryCurrent = NULL;
1147 TH1F *hDistHistoryPrevious = NULL;
1148
25b66378 1149 TFile *gainHistoryFile=NULL;
1150 if(type < 5)
1151 gainHistoryFile = new TFile("SDDbasHistory.root","UPDATE");
1152 else if(type ==5)
8b7e858c 1153 gainHistoryFile = new TFile("SDDgainHistory.root","UPDATE");
25b66378 1154 else if(type == 6)
8b7e858c 1155 gainHistoryFile = new TFile("SDDinjectHistory.root","UPDATE");
1156 hDist->Write();
1157 hDistDiff->Write();
1158 //AliInfo("SDDgainHistory.root file opened\n");
1159 if(!gainHistoryFile->IsZombie()) {
1160 if(type == 1) hDistHistoryPrevious = (TH1F *) gainHistoryFile->Get("hBaselineHistory");
1161 else if(type == 2) hDistHistoryPrevious = (TH1F *) gainHistoryFile->Get("hNoiseUncHistory");
1162 else if(type == 3) hDistHistoryPrevious = (TH1F *) gainHistoryFile->Get("hNoiseCMNHistory");
1163 else if(type == 4) hDistHistoryPrevious = (TH1F *) gainHistoryFile->Get("hNoiseCorHistory");
1164 else if(type == 5) hDistHistoryPrevious = (TH1F *) gainHistoryFile->Get("hGainHistory");
1165 else if(type == 6) hDistHistoryPrevious = (TH1F *) gainHistoryFile->Get("hDriftSpeedHistory");
1166 //AliInfo(Form("hDistHistoryPrevious %x\n",hDistHistoryPrevious));
1167
1168 if(!hDistHistoryPrevious) {
25b66378 1169 if(type == 1) hDistHistoryCurrent = new TH1F("hBaselineHistory","Average Baseline History",2,0,2);
1170 else if(type == 2) hDistHistoryCurrent = new TH1F("hNoiseUncHistory","Average Uncorrected Noise History",2,0,2);
1171 else if(type == 3) hDistHistoryCurrent = new TH1F("hNoiseCMNHistory","Average Common Mode Noise History",2,0,2);
1172 else if(type == 4) hDistHistoryCurrent = new TH1F("hNoiseCorHistory","Average Corrected Noise History",2,0,2);
1173 else if(type == 5) hDistHistoryCurrent = new TH1F("hGainHistory","Average Gain History",2,0,2);
1174 else if(type == 6) hDistHistoryCurrent = new TH1F("hDriftSpeedHistory","Average Drift Speed History",2,0,2);
8b7e858c 1175 //AliInfo(Form("hDistHistoryCurrent 1 %x\n",hDistHistoryCurrent));
1176// if(type < 6) {
1177 hDistHistoryCurrent->SetBinContent(1,average);
1178 hDistHistoryCurrent->SetBinError(1,sigma);
1179/*
1180 } else {
1181 hDistHistoryCurrent->SetBinContent(1,mean);
1182 hDistHistoryCurrent->SetBinError(1,rms);
1183 }
1184*/
1185 } else {
1186 if(type == 1) hDistHistoryCurrent = new TH1F("hBaselineHistory","Average Baseline History",hDistHistoryPrevious->GetNbinsX()+1,0,hDistHistoryPrevious->GetNbinsX()+1);
1187 else if(type == 2) hDistHistoryCurrent = new TH1F("hNoiseUncHistory","Average Uncorrected Noise History",hDistHistoryPrevious->GetNbinsX()+1,0,hDistHistoryPrevious->GetNbinsX()+1);
1188 else if(type == 3) hDistHistoryCurrent = new TH1F("hNoiseCMNHistory","Average Common Mode Noise History",hDistHistoryPrevious->GetNbinsX()+1,0,hDistHistoryPrevious->GetNbinsX()+1);
1189 else if(type == 4) hDistHistoryCurrent = new TH1F("hNoiseCorHistory","Average Corrected Noise History",hDistHistoryPrevious->GetNbinsX()+1,0,hDistHistoryPrevious->GetNbinsX()+1);
1190 else if(type == 5) hDistHistoryCurrent = new TH1F("hGainHistory","Average Gain History",hDistHistoryPrevious->GetNbinsX()+1,0,hDistHistoryPrevious->GetNbinsX()+1);
1191 else if(type == 6) hDistHistoryCurrent = new TH1F("hDriftSpeedHistory","Average Drift Speed History",hDistHistoryPrevious->GetNbinsX()+1,0,hDistHistoryPrevious->GetNbinsX()+1);
1192 //AliInfo(Form("hBaselineHistory 2 %x\n",hDistHistory));
1193 for(Int_t i=0;i<hDistHistoryPrevious->GetNbinsX();i++) {
1194 hDistHistoryCurrent->SetBinContent(i,hDistHistoryPrevious->GetBinContent(i));
1195 hDistHistoryCurrent->SetBinError(i,hDistHistoryPrevious->GetBinError(i));
1196 }
1197 hDistHistoryCurrent->SetBinContent(hDistHistoryPrevious->GetNbinsX(),average);
1198 hDistHistoryCurrent->SetBinError(hDistHistoryPrevious->GetNbinsX(),sigma);
1199 }
1200 }
1201 hDistHistoryCurrent->Write();
1202 gainHistoryFile->Close();
1203 delete gainHistoryFile;
1204// delete hname;
1205 delete hDist;
1206 delete hDistDiff;
25b66378 1207// if(hDistHistoryCurrent) delete hDistHistoryCurrent;
1208// if(hDistHistoryPrevious) delete hDistHistoryPrevious;
58ceb8ca 1209}
1210
1211//_______________________________________________________________
1212
1213
1214void AliITSQASDDDataMakerRec::CreateTheMap()
1215{
8b7e858c 1216
58ceb8ca 1217 AliCDBEntry *ddlMapSDD = AliCDBManager::Instance()->Get("ITS/Calib/DDLMapSDD");
1218 Bool_t cacheStatus = AliCDBManager::Instance()->GetCacheFlag();
1219 if(!ddlMapSDD)
1220 {
1221 AliError("Calibration object retrieval failed! SDD will not be processed");
1222 fDDLModuleMap = NULL;
1223 //return rv;
1224 }
1225 fDDLModuleMap = (AliITSDDLModuleMapSDD*)ddlMapSDD->GetObject();
1226 if(!cacheStatus)ddlMapSDD->SetObject(NULL);
1227 ddlMapSDD->SetOwner(kTRUE);
1228 if(!cacheStatus)
1229 {
1230 delete ddlMapSDD;
1231 }
1232 AliInfo("DDL Map Created\n ");
1233}