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