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