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