]>
Commit | Line | Data |
---|---|---|
3b9df642 | 1 | /*************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
b17dae48 | 5 | * Conributors are mentioned in the code where appropriate. * |
3b9df642 | 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 | /* | |
140e5249 | 17 | $Id$ |
3b9df642 | 18 | */ |
19 | ||
7d62fb64 | 20 | //////////////////////////////////////////////////////////////////////// |
21 | // This class defines the "Standard" reconstruction for the ITS // | |
22 | // detector. // | |
23 | // // | |
24 | //////////////////////////////////////////////////////////////////////// | |
25 | #include "TObjArray.h" | |
26 | #include "TTree.h" | |
27 | ||
8ba39da9 | 28 | #include "AliCDBManager.h" |
8ba39da9 | 29 | #include "AliCDBEntry.h" |
7d62fb64 | 30 | #include "AliITSClusterFinder.h" |
7d62fb64 | 31 | #include "AliITSClusterFinderV2SPD.h" |
32 | #include "AliITSClusterFinderV2SDD.h" | |
33 | #include "AliITSClusterFinderV2SSD.h" | |
3b9df642 | 34 | #include "AliITSDetTypeRec.h" |
ef665f5e | 35 | #include "AliITSDDLModuleMapSDD.h" |
7d62fb64 | 36 | #include "AliITSRecPoint.h" |
fcf95fc7 | 37 | #include "AliITSCalibrationSDD.h" |
54af1add | 38 | #include "AliITSMapSDD.h" |
2f8ed7ab | 39 | #include "AliITSHLTforSDD.h" |
fb4dfab9 | 40 | #include "AliITSCalibrationSSD.h" |
88128115 | 41 | #include "AliITSNoiseSSDv2.h" |
42 | #include "AliITSGainSSDv2.h" | |
43 | #include "AliITSBadChannelsSSDv2.h" | |
fb4dfab9 | 44 | #include "AliITSNoiseSSD.h" |
45 | #include "AliITSGainSSD.h" | |
46 | #include "AliITSBadChannelsSSD.h" | |
dc5c67dc | 47 | #include "AliITSresponseSDD.h" |
7d62fb64 | 48 | #include "AliITSsegmentationSPD.h" |
49 | #include "AliITSsegmentationSDD.h" | |
50 | #include "AliITSsegmentationSSD.h" | |
00a7cc50 | 51 | #include "AliLog.h" |
ad7f2bfa | 52 | #include "AliITSRawStreamSPD.h" |
53 | #include "AliITSTriggerConditions.h" | |
54 | #include "AliITSFOSignalsSPD.h" | |
55 | #include "AliRunLoader.h" | |
56 | #include "AliDataLoader.h" | |
57 | #include "AliITSLoader.h" | |
7d62fb64 | 58 | |
ef665f5e | 59 | class AliITSDriftSpeedArraySDD; |
54af1add | 60 | class AliITSCorrMapSDD; |
ef665f5e | 61 | class AliITSRecoParam; |
3b9df642 | 62 | |
7d62fb64 | 63 | const Int_t AliITSDetTypeRec::fgkNdettypes = 3; |
8ba39da9 | 64 | const Int_t AliITSDetTypeRec::fgkDefaultNModulesSPD = 240; |
65 | const Int_t AliITSDetTypeRec::fgkDefaultNModulesSDD = 260; | |
66 | const Int_t AliITSDetTypeRec::fgkDefaultNModulesSSD = 1698; | |
67 | ||
3b9df642 | 68 | ClassImp(AliITSDetTypeRec) |
69 | ||
7d62fb64 | 70 | //________________________________________________________________ |
e56160b8 | 71 | AliITSDetTypeRec::AliITSDetTypeRec(): TObject(), |
72 | fNMod(0), | |
6cae184e | 73 | fITSgeom(0), |
e56160b8 | 74 | fReconstruction(0), |
75 | fSegmentation(0), | |
76 | fCalibration(0), | |
ced4d9bc | 77 | fSSDCalibration(0), |
23197852 | 78 | fSPDDead(0), |
ad7f2bfa | 79 | fTriggerConditions(0), |
e56160b8 | 80 | fDigits(0), |
ad7f2bfa | 81 | fFOSignals(0), |
979b5a5f | 82 | fDDLMapSDD(0), |
253e68a0 | 83 | fRespSDD(0), |
75065a60 | 84 | fAveGainSDD(0), |
2f8ed7ab | 85 | fIsHLTmodeC(0), |
e56160b8 | 86 | fRecPoints(0), |
87 | fNRecPoints(0), | |
62b93da7 | 88 | fFirstcall(kTRUE), |
ff44c37c | 89 | fLoadOnlySPDCalib(0), |
90 | fFastOrFiredMap(1200){ | |
8e50d897 | 91 | // Standard Constructor |
92 | // Inputs: | |
93 | // none. | |
94 | // Outputs: | |
95 | // none. | |
96 | // Return: | |
97 | // | |
7d62fb64 | 98 | |
7d62fb64 | 99 | fReconstruction = new TObjArray(fgkNdettypes); |
7d62fb64 | 100 | fDigits = new TObjArray(fgkNdettypes); |
8e50d897 | 101 | for(Int_t i=0; i<3; i++){ |
ef665f5e | 102 | fkDigClassName[i]=0; |
8e50d897 | 103 | } |
ced4d9bc | 104 | fSSDCalibration=new AliITSCalibrationSSD(); |
8e50d897 | 105 | fNMod = new Int_t [fgkNdettypes]; |
106 | fNMod[0] = fgkDefaultNModulesSPD; | |
107 | fNMod[1] = fgkDefaultNModulesSDD; | |
108 | fNMod[2] = fgkDefaultNModulesSSD; | |
00a7cc50 | 109 | fRecPoints = new TClonesArray("AliITSRecPoint",3000); |
7d62fb64 | 110 | fNRecPoints = 0; |
7d62fb64 | 111 | |
7d62fb64 | 112 | |
7d62fb64 | 113 | } |
7537d03c | 114 | |
7d62fb64 | 115 | //______________________________________________________________________ |
7537d03c | 116 | AliITSDetTypeRec::AliITSDetTypeRec(const AliITSDetTypeRec & rec):TObject(rec), |
117 | fNMod(rec.fNMod), | |
6cae184e | 118 | fITSgeom(rec.fITSgeom), |
7537d03c | 119 | fReconstruction(rec.fReconstruction), |
120 | fSegmentation(rec.fSegmentation), | |
121 | fCalibration(rec.fCalibration), | |
ced4d9bc | 122 | fSSDCalibration(rec.fSSDCalibration), |
23197852 | 123 | fSPDDead(rec.fSPDDead), |
ad7f2bfa | 124 | fTriggerConditions(rec.fTriggerConditions), |
7537d03c | 125 | fDigits(rec.fDigits), |
ad7f2bfa | 126 | fFOSignals(rec.fFOSignals), |
979b5a5f | 127 | fDDLMapSDD(rec.fDDLMapSDD), |
253e68a0 | 128 | fRespSDD(rec.fRespSDD), |
75065a60 | 129 | fAveGainSDD(rec.fAveGainSDD), |
2f8ed7ab | 130 | fIsHLTmodeC(rec.fIsHLTmodeC), |
7537d03c | 131 | fRecPoints(rec.fRecPoints), |
132 | fNRecPoints(rec.fNRecPoints), | |
62b93da7 | 133 | fFirstcall(rec.fFirstcall), |
ff44c37c | 134 | fLoadOnlySPDCalib(rec.fLoadOnlySPDCalib), |
135 | fFastOrFiredMap(rec.fFastOrFiredMap){ | |
7d62fb64 | 136 | |
e56160b8 | 137 | // Copy constructor. |
7537d03c | 138 | |
7d62fb64 | 139 | } |
140 | //______________________________________________________________________ | |
e56160b8 | 141 | AliITSDetTypeRec& AliITSDetTypeRec::operator=(const AliITSDetTypeRec& source){ |
7537d03c | 142 | // Assignment operator. |
143 | this->~AliITSDetTypeRec(); | |
144 | new(this) AliITSDetTypeRec(source); | |
145 | return *this; | |
7d62fb64 | 146 | |
e56160b8 | 147 | } |
7537d03c | 148 | |
7d62fb64 | 149 | //_____________________________________________________________________ |
3b9df642 | 150 | AliITSDetTypeRec::~AliITSDetTypeRec(){ |
7d62fb64 | 151 | //Destructor |
6cae184e | 152 | |
fcf95fc7 | 153 | if(fReconstruction){ |
154 | fReconstruction->Delete(); | |
155 | delete fReconstruction; | |
156 | fReconstruction = 0; | |
157 | } | |
158 | if(fSegmentation){ | |
159 | fSegmentation->Delete(); | |
160 | delete fSegmentation; | |
161 | fSegmentation = 0; | |
162 | } | |
6cae184e | 163 | if(fCalibration){ |
7032f6a2 | 164 | if(!(AliCDBManager::Instance()->GetCacheFlag())) { |
7032f6a2 | 165 | fCalibration->Delete(); |
166 | delete fCalibration; | |
167 | fCalibration = 0; | |
253e68a0 | 168 | if(fRespSDD) delete fRespSDD; |
169 | if(fDDLMapSDD) delete fDDLMapSDD; | |
170 | } | |
fcf95fc7 | 171 | } |
ced4d9bc | 172 | if(fSSDCalibration) delete fSSDCalibration; |
173 | if(fSPDDead){ | |
23197852 | 174 | if(!(AliCDBManager::Instance()->GetCacheFlag())) { |
175 | fSPDDead->Delete(); | |
176 | delete fSPDDead; | |
177 | fSPDDead = 0; | |
178 | } | |
ad7f2bfa | 179 | } |
180 | if(fTriggerConditions){ | |
181 | if(!(AliCDBManager::Instance()->GetCacheFlag())) { | |
182 | fTriggerConditions->Delete(); | |
183 | delete fTriggerConditions; | |
184 | fTriggerConditions = 0; | |
185 | } | |
186 | } | |
7d62fb64 | 187 | if(fDigits){ |
188 | fDigits->Delete(); | |
189 | delete fDigits; | |
190 | fDigits=0; | |
191 | } | |
192 | if(fRecPoints){ | |
193 | fRecPoints->Delete(); | |
194 | delete fRecPoints; | |
195 | fRecPoints=0; | |
196 | } | |
8e50d897 | 197 | delete [] fNMod; |
7d62fb64 | 198 | |
6cae184e | 199 | if (fITSgeom) delete fITSgeom; |
200 | ||
7d62fb64 | 201 | } |
8e50d897 | 202 | |
7d62fb64 | 203 | //___________________________________________________________________ |
204 | void AliITSDetTypeRec::SetReconstructionModel(Int_t dettype,AliITSClusterFinder *clf){ | |
205 | ||
206 | //Set reconstruction model for detector type | |
207 | ||
208 | if(fReconstruction==0) fReconstruction = new TObjArray(fgkNdettypes); | |
209 | if(fReconstruction->At(dettype)!=0) delete fReconstruction->At(dettype); | |
210 | fReconstruction->AddAt(clf,dettype); | |
211 | } | |
212 | //______________________________________________________________________ | |
04c81913 | 213 | AliITSClusterFinder* AliITSDetTypeRec::GetReconstructionModel(Int_t dettype) const{ |
7d62fb64 | 214 | |
215 | //Get reconstruction model for detector type | |
216 | if(fReconstruction==0) { | |
217 | Warning("GetReconstructionModel","fReconstruction is 0!"); | |
218 | return 0; | |
219 | } | |
220 | return (AliITSClusterFinder*)fReconstruction->At(dettype); | |
221 | } | |
222 | ||
223 | //______________________________________________________________________ | |
224 | void AliITSDetTypeRec::SetSegmentationModel(Int_t dettype,AliITSsegmentation *seg){ | |
225 | ||
226 | //Set segmentation model for detector type | |
227 | ||
228 | if(fSegmentation==0) fSegmentation = new TObjArray(fgkNdettypes); | |
229 | if(fSegmentation->At(dettype)!=0) delete fSegmentation->At(dettype); | |
230 | fSegmentation->AddAt(seg,dettype); | |
231 | ||
232 | } | |
233 | //______________________________________________________________________ | |
04c81913 | 234 | AliITSsegmentation* AliITSDetTypeRec::GetSegmentationModel(Int_t dettype) const { |
7d62fb64 | 235 | |
236 | //Get segmentation model for detector type | |
237 | ||
238 | if(fSegmentation==0) { | |
239 | Warning("GetSegmentationModel","fSegmentation is 0!"); | |
240 | return 0; | |
241 | } | |
242 | return (AliITSsegmentation*)fSegmentation->At(dettype); | |
243 | ||
244 | } | |
245 | //_______________________________________________________________________ | |
fcf95fc7 | 246 | void AliITSDetTypeRec::SetCalibrationModel(Int_t iMod, AliITSCalibration *cal){ |
8ba39da9 | 247 | |
248 | //Set calibration (response) for the module iMod of type dettype | |
249 | if (fCalibration==0) { | |
8e50d897 | 250 | fCalibration = new TObjArray(GetITSgeom()->GetIndexMax()); |
8ba39da9 | 251 | fCalibration->SetOwner(kTRUE); |
252 | fCalibration->Clear(); | |
253 | } | |
254 | ||
255 | if (fCalibration->At(iMod) != 0) | |
fcf95fc7 | 256 | delete (AliITSCalibration*) fCalibration->At(iMod); |
8ba39da9 | 257 | fCalibration->AddAt(cal,iMod); |
7d62fb64 | 258 | |
7d62fb64 | 259 | } |
260 | //_______________________________________________________________________ | |
23197852 | 261 | void AliITSDetTypeRec::SetSPDDeadModel(Int_t iMod, AliITSCalibration *cal){ |
262 | ||
263 | //Set dead pixel info for the SPD module iMod | |
264 | if (fSPDDead==0) { | |
265 | fSPDDead = new TObjArray(fgkDefaultNModulesSPD); | |
266 | fSPDDead->SetOwner(kTRUE); | |
267 | fSPDDead->Clear(); | |
268 | } | |
269 | ||
270 | if (fSPDDead->At(iMod) != 0) | |
271 | delete (AliITSCalibration*) fSPDDead->At(iMod); | |
272 | fSPDDead->AddAt(cal,iMod); | |
273 | } | |
274 | //_______________________________________________________________________ | |
04c81913 | 275 | AliITSCalibration* AliITSDetTypeRec::GetCalibrationModel(Int_t iMod) const { |
7d62fb64 | 276 | |
8ba39da9 | 277 | //Get calibration model for module type |
7d62fb64 | 278 | |
279 | if(fCalibration==0) { | |
8ba39da9 | 280 | Warning("GetalibrationModel","fCalibration is 0!"); |
7d62fb64 | 281 | return 0; |
282 | } | |
8ba39da9 | 283 | |
ced4d9bc | 284 | if(iMod<fgkDefaultNModulesSPD+fgkDefaultNModulesSDD){ |
285 | return (AliITSCalibration*)fCalibration->At(iMod); | |
286 | }else{ | |
287 | Int_t i=iMod-(fgkDefaultNModulesSPD+fgkDefaultNModulesSDD); | |
288 | fSSDCalibration->SetModule(i); | |
289 | return (AliITSCalibration*)fSSDCalibration; | |
290 | } | |
291 | ||
7d62fb64 | 292 | } |
23197852 | 293 | //_______________________________________________________________________ |
04c81913 | 294 | AliITSCalibration* AliITSDetTypeRec::GetSPDDeadModel(Int_t iMod) const { |
23197852 | 295 | |
296 | //Get SPD dead for module iMod | |
297 | ||
298 | if(fSPDDead==0) { | |
299 | AliWarning("fSPDDead is 0!"); | |
300 | return 0; | |
301 | } | |
23197852 | 302 | return (AliITSCalibration*)fSPDDead->At(iMod); |
303 | } | |
ad7f2bfa | 304 | //_______________________________________________________________________ |
305 | AliITSTriggerConditions* AliITSDetTypeRec::GetTriggerConditions() const { | |
306 | //Get Pixel Trigger Conditions | |
307 | if (fTriggerConditions==0) { | |
308 | AliWarning("fTriggerConditions is 0!"); | |
309 | } | |
310 | return fTriggerConditions; | |
311 | } | |
7d62fb64 | 312 | //______________________________________________________________________ |
dc5c67dc | 313 | void AliITSDetTypeRec::SetTreeAddressD(TTree* const treeD){ |
7d62fb64 | 314 | // Set branch address for the tree of digits. |
315 | ||
ad7f2bfa | 316 | const char *det[4] = {"SPD","SDD","SSD","ITS"}; |
317 | TBranch *branch; | |
318 | const Char_t* digclass; | |
319 | Int_t i; | |
320 | char branchname[30]; | |
321 | ||
322 | if(!treeD) return; | |
323 | if (fDigits == 0x0) fDigits = new TObjArray(fgkNdettypes); | |
324 | for (i=0; i<fgkNdettypes; i++) { | |
325 | digclass = GetDigitClassName(i); | |
326 | if(!(fDigits->At(i))) { | |
327 | fDigits->AddAt(new TClonesArray(digclass,1000),i); | |
328 | } | |
329 | else{ | |
330 | ResetDigits(i); | |
7d62fb64 | 331 | } |
ad7f2bfa | 332 | if (fgkNdettypes==3) sprintf(branchname,"%sDigits%s",det[3],det[i]); |
333 | else sprintf(branchname,"%sDigits%d",det[3],i+1); | |
334 | if (fDigits) { | |
335 | branch = treeD->GetBranch(branchname); | |
336 | if (branch) branch->SetAddress(&((*fDigits)[i])); | |
337 | } | |
338 | } | |
339 | ||
7d62fb64 | 340 | } |
341 | ||
342 | //_______________________________________________________________________ | |
dc5c67dc | 343 | TBranch* AliITSDetTypeRec::MakeBranchInTree(TTree* const tree, |
344 | const char* name, const char *classname, | |
345 | void* address,Int_t size,Int_t splitlevel) | |
7d62fb64 | 346 | { |
347 | // | |
348 | // Makes branch in given tree and diverts them to a separate file | |
349 | // | |
350 | // | |
351 | // | |
352 | ||
353 | if (tree == 0x0) { | |
354 | Error("MakeBranchInTree","Making Branch %s Tree is NULL",name); | |
355 | return 0x0; | |
356 | } | |
357 | TBranch *branch = tree->GetBranch(name); | |
358 | if (branch) { | |
359 | return branch; | |
360 | } | |
361 | if (classname){ | |
362 | branch = tree->Branch(name,classname,address,size,splitlevel); | |
363 | } | |
364 | else { | |
365 | branch = tree->Bronch(name, "TClonesArray", address, size, splitlevel); | |
366 | } | |
367 | ||
368 | return branch; | |
369 | } | |
370 | ||
371 | //____________________________________________________________________ | |
372 | void AliITSDetTypeRec::SetDefaults(){ | |
373 | ||
374 | //Set defaults for segmentation and response | |
375 | ||
8e50d897 | 376 | if(!GetITSgeom()){ |
377 | Warning("SetDefaults","null pointer to AliITSgeomGeom !"); | |
7d62fb64 | 378 | return; |
379 | } | |
380 | ||
381 | AliITSsegmentation* seg; | |
8ba39da9 | 382 | if(!GetCalibration()) {AliFatal("Exit");exit(0);} |
7d62fb64 | 383 | |
384 | for(Int_t dettype=0;dettype<fgkNdettypes;dettype++){ | |
385 | if(dettype==0){ | |
d24bc9d6 | 386 | seg = new AliITSsegmentationSPD(); |
7d62fb64 | 387 | SetSegmentationModel(dettype,seg); |
3a7c3e6d | 388 | SetDigitClassName(dettype,"AliITSdigitSPD"); |
7d62fb64 | 389 | } |
62b93da7 | 390 | if(fLoadOnlySPDCalib==kFALSE){ |
391 | if(dettype==1){ | |
392 | seg = new AliITSsegmentationSDD(); | |
393 | AliITSCalibrationSDD* cal=(AliITSCalibrationSDD*)GetCalibrationModel(fgkDefaultNModulesSPD+1); | |
394 | if(cal->IsAMAt20MHz()){ | |
395 | seg->SetPadSize(seg->Dpz(0),20.); | |
396 | seg->SetNPads(seg->Npz()/2,128); | |
397 | } | |
398 | SetSegmentationModel(dettype,seg); | |
399 | SetDigitClassName(dettype,"AliITSdigitSDD"); | |
b27af87f | 400 | } |
7d62fb64 | 401 | } |
402 | if(dettype==2){ | |
d24bc9d6 | 403 | AliITSsegmentationSSD* seg2 = new AliITSsegmentationSSD(); |
7d62fb64 | 404 | SetSegmentationModel(dettype,seg2); |
7d62fb64 | 405 | SetDigitClassName(dettype,"AliITSdigitSSD"); |
7d62fb64 | 406 | } |
7d62fb64 | 407 | } |
7d62fb64 | 408 | } |
8ba39da9 | 409 | //______________________________________________________________________ |
410 | Bool_t AliITSDetTypeRec::GetCalibration() { | |
411 | // Get Default calibration if a storage is not defined. | |
412 | ||
b17dae48 | 413 | if(!fFirstcall){ |
414 | AliITSCalibration* cal = GetCalibrationModel(0); | |
415 | if(cal)return kTRUE; | |
62b93da7 | 416 | }else { |
b17dae48 | 417 | fFirstcall = kFALSE; |
418 | } | |
06232459 | 419 | |
6cae184e | 420 | // SetRunNumber((Int_t)AliCDBManager::Instance()->GetRun()); |
421 | // Int_t run=GetRunNumber(); | |
b17dae48 | 422 | |
6cae184e | 423 | Bool_t cacheStatus = AliCDBManager::Instance()->GetCacheFlag(); |
b17dae48 | 424 | if (fCalibration==0) { |
425 | fCalibration = new TObjArray(GetITSgeom()->GetIndexMax()); | |
6cae184e | 426 | fCalibration->SetOwner(!cacheStatus); |
b17dae48 | 427 | fCalibration->Clear(); |
428 | } | |
75065a60 | 429 | |
430 | Bool_t retCode=GetCalibrationSPD(cacheStatus); | |
431 | if(retCode==kFALSE) return kFALSE; | |
432 | ||
433 | if(fLoadOnlySPDCalib==kFALSE){ | |
434 | retCode=GetCalibrationSDD(cacheStatus); | |
435 | if(retCode==kFALSE) return kFALSE; | |
436 | retCode=GetCalibrationSSD(cacheStatus); | |
437 | if(retCode==kFALSE) return kFALSE; | |
438 | } | |
439 | ||
440 | AliInfo(Form("%i SPD, %i SDD and %i SSD in calibration database", | |
441 | fNMod[0], fNMod[1], fNMod[2])); | |
442 | return kTRUE; | |
443 | } | |
444 | //______________________________________________________________________ | |
445 | Bool_t AliITSDetTypeRec::GetCalibrationSPD(Bool_t cacheStatus) { | |
446 | // Get SPD calibration objects from OCDB | |
8d37cc87 | 447 | // dead pixel are not used for local reconstruction |
75065a60 | 448 | |
ad7f2bfa | 449 | |
450 | AliCDBEntry *noisySPD = AliCDBManager::Instance()->Get("ITS/Calib/SPDNoisy"); | |
23197852 | 451 | AliCDBEntry *deadSPD = AliCDBManager::Instance()->Get("ITS/Calib/SPDDead"); |
ad7f2bfa | 452 | AliCDBEntry *pitCond = AliCDBManager::Instance()->Get("ITS/Calib/PITConditions"); |
453 | if(!noisySPD || !deadSPD || !pitCond ){ | |
62b93da7 | 454 | AliFatal("SPD Calibration object retrieval failed! "); |
455 | return kFALSE; | |
ad7f2bfa | 456 | } |
75065a60 | 457 | |
ad7f2bfa | 458 | TObjArray *calNoisySPD = (TObjArray*) noisySPD->GetObject(); |
459 | if (!cacheStatus) noisySPD->SetObject(NULL); | |
460 | noisySPD->SetOwner(kTRUE); | |
fb4dfab9 | 461 | |
ad7f2bfa | 462 | TObjArray *calDeadSPD = (TObjArray*) deadSPD->GetObject(); |
463 | if (!cacheStatus) deadSPD->SetObject(NULL); | |
62b93da7 | 464 | deadSPD->SetOwner(kTRUE); |
465 | ||
ad7f2bfa | 466 | AliITSTriggerConditions *calPitCond = (AliITSTriggerConditions*) pitCond->GetObject(); |
467 | if (!cacheStatus) pitCond->SetObject(NULL); | |
468 | pitCond->SetOwner(kTRUE); | |
b457135f | 469 | |
62b93da7 | 470 | if(!cacheStatus){ |
ad7f2bfa | 471 | delete noisySPD; |
62b93da7 | 472 | delete deadSPD; |
ad7f2bfa | 473 | delete pitCond; |
62b93da7 | 474 | } |
ad7f2bfa | 475 | if ((!calNoisySPD) || (!calDeadSPD) || (!calPitCond)){ |
62b93da7 | 476 | AliWarning("Can not get SPD calibration from calibration database !"); |
477 | return kFALSE; | |
478 | } | |
479 | ||
ad7f2bfa | 480 | fNMod[0] = calNoisySPD->GetEntries(); |
62b93da7 | 481 | |
482 | AliITSCalibration* cal; | |
483 | for (Int_t i=0; i<fNMod[0]; i++) { | |
ad7f2bfa | 484 | cal = (AliITSCalibration*) calNoisySPD->At(i); |
62b93da7 | 485 | SetCalibrationModel(i, cal); |
ad7f2bfa | 486 | cal = (AliITSCalibration*) calDeadSPD->At(i); |
62b93da7 | 487 | SetSPDDeadModel(i, cal); |
488 | } | |
ad7f2bfa | 489 | fTriggerConditions = calPitCond; |
62b93da7 | 490 | |
62b93da7 | 491 | return kTRUE; |
492 | } | |
75065a60 | 493 | |
62b93da7 | 494 | //______________________________________________________________________ |
75065a60 | 495 | Bool_t AliITSDetTypeRec::GetCalibrationSDD(Bool_t cacheStatus) { |
496 | // Get SDD calibration objects from OCDB | |
497 | ||
62b93da7 | 498 | AliCDBEntry *entrySDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD"); |
6cae184e | 499 | AliCDBEntry *entry2SDD = AliCDBManager::Instance()->Get("ITS/Calib/RespSDD"); |
18da6e54 | 500 | AliCDBEntry *drSpSDD = AliCDBManager::Instance()->Get("ITS/Calib/DriftSpeedSDD"); |
979b5a5f | 501 | AliCDBEntry *ddlMapSDD = AliCDBManager::Instance()->Get("ITS/Calib/DDLMapSDD"); |
2f8ed7ab | 502 | AliCDBEntry *hltforSDD = AliCDBManager::Instance()->Get("ITS/Calib/HLTforSDD"); |
62b93da7 | 503 | // AliCDBEntry *mapASDD = AliCDBManager::Instance()->Get("ITS/Calib/MapsAnodeSDD"); |
028a3709 | 504 | AliCDBEntry *mapTSDD = AliCDBManager::Instance()->Get("ITS/Calib/MapsTimeSDD"); |
06232459 | 505 | |
75065a60 | 506 | if(!entrySDD || !entry2SDD || !drSpSDD || !ddlMapSDD || !hltforSDD || !mapTSDD ){ |
507 | AliFatal("SDD Calibration object retrieval failed! "); | |
e8c4cf33 | 508 | return kFALSE; |
566f73ca | 509 | } |
510 | ||
23197852 | 511 | |
fcf95fc7 | 512 | |
b17dae48 | 513 | TObjArray *calSDD = (TObjArray *)entrySDD->GetObject(); |
6cae184e | 514 | if(!cacheStatus)entrySDD->SetObject(NULL); |
8ba39da9 | 515 | entrySDD->SetOwner(kTRUE); |
fcf95fc7 | 516 | |
517 | AliITSresponseSDD *pSDD = (AliITSresponseSDD*)entry2SDD->GetObject(); | |
6cae184e | 518 | if(!cacheStatus)entry2SDD->SetObject(NULL); |
fcf95fc7 | 519 | entry2SDD->SetOwner(kTRUE); |
520 | ||
18da6e54 | 521 | TObjArray *drSp = (TObjArray *)drSpSDD->GetObject(); |
522 | if(!cacheStatus)drSpSDD->SetObject(NULL); | |
523 | drSpSDD->SetOwner(kTRUE); | |
524 | ||
979b5a5f | 525 | AliITSDDLModuleMapSDD *ddlsdd=(AliITSDDLModuleMapSDD*)ddlMapSDD->GetObject(); |
526 | if(!cacheStatus)ddlMapSDD->SetObject(NULL); | |
527 | ddlMapSDD->SetOwner(kTRUE); | |
528 | ||
2f8ed7ab | 529 | AliITSHLTforSDD* hltsdd=(AliITSHLTforSDD*)hltforSDD->GetObject(); |
530 | if(!cacheStatus)hltforSDD->SetObject(NULL); | |
531 | hltforSDD->SetOwner(kTRUE); | |
532 | ||
2ebd5518 | 533 | // TObjArray *mapAn = (TObjArray *)mapASDD->GetObject(); |
534 | // if(!cacheStatus)mapASDD->SetObject(NULL); | |
535 | // mapASDD->SetOwner(kTRUE); | |
028a3709 | 536 | |
537 | TObjArray *mapT = (TObjArray *)mapTSDD->GetObject(); | |
538 | if(!cacheStatus)mapTSDD->SetObject(NULL); | |
539 | mapTSDD->SetOwner(kTRUE); | |
540 | ||
75065a60 | 541 | |
542 | // DB entries are deleted. In this way metadeta objects are deleted as well | |
543 | if(!cacheStatus){ | |
544 | delete entrySDD; | |
545 | delete entry2SDD; | |
546 | //delete mapASDD; | |
547 | delete hltforSDD; | |
548 | delete mapTSDD; | |
549 | delete drSpSDD; | |
550 | delete ddlMapSDD; | |
551 | } | |
552 | ||
553 | if ((!pSDD)||(!calSDD) || (!drSp) || (!ddlsdd) || (!hltsdd) || (!mapT) ){ | |
554 | AliWarning("Can not get SDD calibration from calibration database !"); | |
555 | return kFALSE; | |
556 | } | |
557 | ||
558 | fNMod[1] = calSDD->GetEntries(); | |
559 | ||
560 | fDDLMapSDD=ddlsdd; | |
561 | fRespSDD=pSDD; | |
562 | fIsHLTmodeC=hltsdd->IsHLTmodeC(); | |
563 | AliITSCalibration* cal; | |
564 | Float_t avegain=0.; | |
565 | Float_t nGdAnodes=0; | |
54af1add | 566 | Bool_t oldMapFormat=kFALSE; |
567 | TObject* objmap=(TObject*)mapT->At(0); | |
568 | TString cname(objmap->ClassName()); | |
569 | if(cname.CompareTo("AliITSMapSDD")==0){ | |
570 | oldMapFormat=kTRUE; | |
571 | AliInfo("SDD Maps converted to new format"); | |
572 | } | |
75065a60 | 573 | for(Int_t iddl=0; iddl<AliITSDDLModuleMapSDD::GetNDDLs(); iddl++){ |
574 | for(Int_t icar=0; icar<AliITSDDLModuleMapSDD::GetNModPerDDL();icar++){ | |
575 | Int_t iMod=fDDLMapSDD->GetModuleNumber(iddl,icar); | |
576 | if(iMod==-1) continue; | |
577 | Int_t i=iMod - fgkDefaultNModulesSPD; | |
578 | cal = (AliITSCalibration*) calSDD->At(i); | |
579 | Int_t i0=2*i; | |
580 | Int_t i1=1+2*i; | |
581 | for(Int_t iAnode=0;iAnode< ((AliITSCalibrationSDD*)cal)->NOfAnodes(); iAnode++){ | |
582 | if(((AliITSCalibrationSDD*)cal)->IsBadChannel(iAnode)) continue; | |
583 | avegain+= ((AliITSCalibrationSDD*)cal)->GetChannelGain(iAnode); | |
584 | nGdAnodes++; | |
585 | } | |
586 | AliITSDriftSpeedArraySDD* arr0 = (AliITSDriftSpeedArraySDD*) drSp->At(i0); | |
75065a60 | 587 | AliITSDriftSpeedArraySDD* arr1 = (AliITSDriftSpeedArraySDD*) drSp->At(i1); |
54af1add | 588 | |
589 | AliITSCorrMapSDD* mt0 = 0; | |
590 | AliITSCorrMapSDD* mt1 = 0; | |
591 | if(oldMapFormat){ | |
592 | AliITSMapSDD* oldmap0=(AliITSMapSDD*)mapT->At(i0); | |
593 | AliITSMapSDD* oldmap1=(AliITSMapSDD*)mapT->At(i1); | |
594 | mt0=oldmap0->ConvertToNewFormat(); | |
595 | mt1=oldmap1->ConvertToNewFormat(); | |
596 | }else{ | |
597 | mt0=(AliITSCorrMapSDD*)mapT->At(i0); | |
598 | mt1=(AliITSCorrMapSDD*)mapT->At(i1); | |
599 | } | |
75065a60 | 600 | cal->SetDriftSpeed(0,arr0); |
601 | cal->SetDriftSpeed(1,arr1); | |
75065a60 | 602 | cal->SetMapT(0,mt0); |
603 | cal->SetMapT(1,mt1); | |
604 | SetCalibrationModel(iMod, cal); | |
605 | } | |
606 | } | |
607 | if(nGdAnodes) fAveGainSDD=avegain/nGdAnodes; | |
608 | return kTRUE; | |
609 | } | |
610 | ||
611 | ||
612 | //______________________________________________________________________ | |
613 | Bool_t AliITSDetTypeRec::GetCalibrationSSD(Bool_t cacheStatus) { | |
614 | // Get SSD calibration objects from OCDB | |
615 | // AliCDBEntry *entrySSD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSSD"); | |
616 | ||
617 | AliCDBEntry *entryNoiseSSD = AliCDBManager::Instance()->Get("ITS/Calib/NoiseSSD"); | |
618 | AliCDBEntry *entryGainSSD = AliCDBManager::Instance()->Get("ITS/Calib/GainSSD"); | |
619 | AliCDBEntry *entryBadChannelsSSD = AliCDBManager::Instance()->Get("ITS/Calib/BadChannelsSSD"); | |
620 | ||
621 | if(!entryNoiseSSD || !entryGainSSD || !entryBadChannelsSSD){ | |
622 | AliFatal("SSD Calibration object retrieval failed! "); | |
623 | return kFALSE; | |
624 | } | |
625 | ||
88128115 | 626 | TObject *emptyssd = 0; TString ssdobjectname = 0; |
627 | AliITSNoiseSSDv2 *noiseSSD = new AliITSNoiseSSDv2(); | |
628 | emptyssd = (TObject *)entryNoiseSSD->GetObject(); | |
629 | ssdobjectname = emptyssd->GetName(); | |
630 | if(ssdobjectname=="TObjArray") { | |
631 | TObjArray *noiseSSDOld = (TObjArray *)entryNoiseSSD->GetObject(); | |
632 | ReadOldSSDNoise(noiseSSDOld, noiseSSD); | |
633 | } | |
634 | else if(ssdobjectname=="AliITSNoiseSSDv2") | |
635 | noiseSSD = (AliITSNoiseSSDv2 *)entryNoiseSSD->GetObject(); | |
fb4dfab9 | 636 | if(!cacheStatus)entryNoiseSSD->SetObject(NULL); |
637 | entryNoiseSSD->SetOwner(kTRUE); | |
638 | ||
88128115 | 639 | AliITSGainSSDv2 *gainSSD = new AliITSGainSSDv2(); |
640 | emptyssd = (TObject *)entryGainSSD->GetObject(); | |
641 | ssdobjectname = emptyssd->GetName(); | |
642 | if(ssdobjectname=="Gain") { | |
643 | TObjArray *gainSSDOld = (TObjArray *)entryGainSSD->GetObject(); | |
644 | ReadOldSSDGain(gainSSDOld, gainSSD); | |
645 | } | |
646 | else if(ssdobjectname=="AliITSGainSSDv2") | |
647 | gainSSD = (AliITSGainSSDv2 *)entryGainSSD->GetObject(); | |
fb4dfab9 | 648 | if(!cacheStatus)entryGainSSD->SetObject(NULL); |
649 | entryGainSSD->SetOwner(kTRUE); | |
650 | ||
88128115 | 651 | AliITSBadChannelsSSDv2 *badChannelsSSD = new AliITSBadChannelsSSDv2(); |
652 | emptyssd = (TObject *)entryBadChannelsSSD->GetObject(); | |
653 | ssdobjectname = emptyssd->GetName(); | |
654 | if(ssdobjectname=="TObjArray") { | |
655 | TObjArray *badChannelsSSDOld = (TObjArray *)entryBadChannelsSSD->GetObject(); | |
656 | ReadOldSSDBadChannels(badChannelsSSDOld, badChannelsSSD); | |
657 | } | |
658 | else if(ssdobjectname=="AliITSBadChannelsSSDv2") | |
659 | badChannelsSSD = (AliITSBadChannelsSSDv2*)entryBadChannelsSSD->GetObject(); | |
fb4dfab9 | 660 | if(!cacheStatus)entryBadChannelsSSD->SetObject(NULL); |
661 | entryBadChannelsSSD->SetOwner(kTRUE); | |
fcf95fc7 | 662 | |
b17dae48 | 663 | // DB entries are deleted. In this way metadeta objects are deleted as well |
6cae184e | 664 | if(!cacheStatus){ |
fb4dfab9 | 665 | delete entryNoiseSSD; |
666 | delete entryGainSSD; | |
667 | delete entryBadChannelsSSD; | |
b17dae48 | 668 | } |
06232459 | 669 | |
75065a60 | 670 | if ((!noiseSSD)|| (!gainSSD)|| (!badChannelsSSD)) { |
671 | AliWarning("Can not get SSD calibration from calibration database !"); | |
8ba39da9 | 672 | return kFALSE; |
673 | } | |
fcf95fc7 | 674 | |
ced4d9bc | 675 | fSSDCalibration->SetNoise(noiseSSD); |
ced4d9bc | 676 | fSSDCalibration->SetGain(gainSSD); |
88128115 | 677 | fSSDCalibration->SetBadChannels(badChannelsSSD); |
ced4d9bc | 678 | //fSSDCalibration->FillBadChipMap(); |
679 | ||
8ba39da9 | 680 | return kTRUE; |
681 | } | |
682 | ||
7d62fb64 | 683 | //________________________________________________________________ |
3a7c3e6d | 684 | void AliITSDetTypeRec::SetDefaultClusterFindersV2(Bool_t rawdata){ |
7d62fb64 | 685 | |
686 | //Set defaults for cluster finder V2 | |
687 | ||
8e50d897 | 688 | if(!GetITSgeom()){ |
689 | Warning("SetDefaults","Null pointer to AliITSgeom !"); | |
7d62fb64 | 690 | return; |
691 | } | |
692 | ||
7d62fb64 | 693 | AliITSClusterFinder *clf; |
694 | ||
3a7c3e6d | 695 | for(Int_t dettype=0;dettype<fgkNdettypes;dettype++){ |
7d62fb64 | 696 | //SPD |
697 | if(dettype==0){ | |
698 | if(!GetReconstructionModel(dettype)){ | |
8ba39da9 | 699 | clf = new AliITSClusterFinderV2SPD(this); |
7d62fb64 | 700 | clf->InitGeometry(); |
3a7c3e6d | 701 | if(!rawdata) clf->SetDigits(DigitsAddress(0)); |
7d62fb64 | 702 | SetReconstructionModel(dettype,clf); |
703 | ||
704 | } | |
705 | } | |
706 | //SDD | |
707 | if(dettype==1){ | |
708 | if(!GetReconstructionModel(dettype)){ | |
8ba39da9 | 709 | clf = new AliITSClusterFinderV2SDD(this); |
710 | clf->InitGeometry(); | |
3a7c3e6d | 711 | if(!rawdata) clf->SetDigits(DigitsAddress(1)); |
7d62fb64 | 712 | SetReconstructionModel(dettype,clf); |
713 | } | |
714 | ||
715 | } | |
716 | ||
717 | //SSD | |
718 | if(dettype==2){ | |
719 | if(!GetReconstructionModel(dettype)){ | |
8ba39da9 | 720 | clf = new AliITSClusterFinderV2SSD(this); |
7d62fb64 | 721 | clf->InitGeometry(); |
3a7c3e6d | 722 | if(!rawdata) clf->SetDigits(DigitsAddress(2)); |
7d62fb64 | 723 | SetReconstructionModel(dettype,clf); |
724 | } | |
725 | } | |
726 | ||
727 | } | |
728 | ||
729 | } | |
730 | //______________________________________________________________________ | |
6cae184e | 731 | void AliITSDetTypeRec::MakeBranch(TTree* tree, Option_t* option){ |
7d62fb64 | 732 | |
733 | //Creates branches for clusters and recpoints | |
734 | Bool_t cR = (strstr(option,"R")!=0); | |
735 | Bool_t cRF = (strstr(option,"RF")!=0); | |
7d62fb64 | 736 | |
737 | if(cRF)cR = kFALSE; | |
738 | ||
6cae184e | 739 | if(cR) MakeBranchR(tree); |
740 | if(cRF) MakeBranchRF(tree); | |
7d62fb64 | 741 | |
742 | } | |
743 | ||
7d62fb64 | 744 | //___________________________________________________________________ |
745 | void AliITSDetTypeRec::ResetDigits(){ | |
746 | // Reset number of digits and the digits array for the ITS detector. | |
747 | ||
748 | if(!fDigits) return; | |
749 | for(Int_t i=0;i<fgkNdettypes;i++){ | |
750 | ResetDigits(i); | |
751 | } | |
752 | } | |
753 | //___________________________________________________________________ | |
754 | void AliITSDetTypeRec::ResetDigits(Int_t branch){ | |
755 | // Reset number of digits and the digits array for this branch. | |
756 | ||
757 | if(fDigits->At(branch)) ((TClonesArray*)fDigits->At(branch))->Clear(); | |
7d62fb64 | 758 | |
7d62fb64 | 759 | } |
760 | //__________________________________________________________________ | |
6cae184e | 761 | void AliITSDetTypeRec::MakeBranchR(TTree *treeR, Option_t *opt){ |
7d62fb64 | 762 | |
763 | //Creates tree branches for recpoints | |
764 | // Inputs: | |
765 | // cont char *file File name where RecPoints branch is to be written | |
766 | // to. If blank it write the SDigits to the same | |
767 | // file in which the Hits were found. | |
768 | ||
7d62fb64 | 769 | Int_t buffsz = 4000; |
770 | char branchname[30]; | |
771 | ||
772 | // only one branch for rec points for all detector types | |
773 | Bool_t oFast= (strstr(opt,"Fast")!=0); | |
7d62fb64 | 774 | |
775 | Char_t detname[10] = "ITS"; | |
776 | ||
777 | ||
778 | if(oFast){ | |
779 | sprintf(branchname,"%sRecPointsF",detname); | |
7d62fb64 | 780 | } else { |
781 | sprintf(branchname,"%sRecPoints",detname); | |
782 | } | |
783 | ||
00a7cc50 | 784 | if(!fRecPoints)fRecPoints = new TClonesArray("AliITSRecPoint",1000); |
6cae184e | 785 | if (treeR) |
786 | MakeBranchInTree(treeR,branchname,0,&fRecPoints,buffsz,99); | |
7d62fb64 | 787 | } |
788 | //______________________________________________________________________ | |
dc5c67dc | 789 | void AliITSDetTypeRec::SetTreeAddressR(TTree* const treeR){ |
7d62fb64 | 790 | // Set branch address for the Reconstructed points Trees. |
3b9df642 | 791 | // Inputs: |
7d62fb64 | 792 | // TTree *treeR Tree containing the RecPoints. |
3b9df642 | 793 | // Outputs: |
7d62fb64 | 794 | // none. |
3b9df642 | 795 | // Return: |
7d62fb64 | 796 | |
ad7f2bfa | 797 | char branchname[30]; |
798 | Char_t namedet[10]="ITS"; | |
7d62fb64 | 799 | |
ad7f2bfa | 800 | if(!treeR) return; |
801 | if(fRecPoints==0x0) fRecPoints = new TClonesArray("AliITSRecPoint",1000); | |
802 | TBranch *branch; | |
803 | sprintf(branchname,"%sRecPoints",namedet); | |
804 | branch = treeR->GetBranch(branchname); | |
805 | if (branch) { | |
00a7cc50 | 806 | branch->SetAddress(&fRecPoints); |
ad7f2bfa | 807 | } |
808 | else { | |
00a7cc50 | 809 | sprintf(branchname,"%sRecPointsF",namedet); |
7d62fb64 | 810 | branch = treeR->GetBranch(branchname); |
811 | if (branch) { | |
00a7cc50 | 812 | branch->SetAddress(&fRecPoints); |
7d62fb64 | 813 | } |
ad7f2bfa | 814 | } |
3b9df642 | 815 | } |
7d62fb64 | 816 | //____________________________________________________________________ |
817 | void AliITSDetTypeRec::AddRecPoint(const AliITSRecPoint &r){ | |
818 | // Add a reconstructed space point to the list | |
819 | // Inputs: | |
820 | // const AliITSRecPoint &r RecPoint class to be added to the tree | |
821 | // of reconstructed points TreeR. | |
822 | // Outputs: | |
823 | // none. | |
824 | // Return: | |
825 | // none. | |
826 | ||
827 | TClonesArray &lrecp = *fRecPoints; | |
828 | new(lrecp[fNRecPoints++]) AliITSRecPoint(r); | |
829 | } | |
7d62fb64 | 830 | |
831 | //______________________________________________________________________ | |
5d2c2f86 | 832 | void AliITSDetTypeRec::DigitsToRecPoints(TTree *treeD,TTree *treeR,Int_t lastentry,Option_t *opt, Int_t optCluFind){ |
7d62fb64 | 833 | // cluster finding and reconstruction of space points |
834 | // the condition below will disappear when the geom class will be | |
835 | // initialized for all versions - for the moment it is only for v5 ! | |
836 | // 7 is the SDD beam test version | |
837 | // Inputs: | |
6cae184e | 838 | // TTree *treeD Digits tree |
839 | // TTree *treeR Clusters tree | |
7d62fb64 | 840 | // Int_t lastentry Offset for module when not all of the modules |
841 | // are processed. | |
842 | // Option_t *opt String indicating which ITS sub-detectors should | |
843 | // be processed. If ="All" then all of the ITS | |
844 | // sub detectors are processed. | |
845 | ||
7d62fb64 | 846 | const char *all = strstr(opt,"All"); |
847 | const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"), | |
848 | strstr(opt,"SSD")}; | |
5d2c2f86 | 849 | if(optCluFind==0){ |
00a7cc50 | 850 | SetDefaultClusterFindersV2(); |
851 | AliInfo("V2 cluster finder has been selected \n"); | |
5d2c2f86 | 852 | }else{ |
853 | SetDefaultClusterFindersV2(); | |
06a7cbee | 854 | AliInfo("Cluster Finder Option not implemented, V2 cluster finder will be used \n"); |
00a7cc50 | 855 | } |
7d62fb64 | 856 | |
ad7f2bfa | 857 | |
858 | // Reset Fast-OR fired map | |
859 | ResetFastOrFiredMap(); | |
860 | ||
861 | if (all || det[0]) { // SPD present | |
862 | // Get the FO signals for this event | |
863 | AliRunLoader* runLoader = AliRunLoader::Instance(); | |
864 | AliITSLoader* itsLoader = (AliITSLoader*) runLoader->GetLoader("ITSLoader"); | |
865 | if (!itsLoader) { | |
866 | AliError("ITS loader is NULL."); | |
867 | } | |
a0d76912 | 868 | else { |
869 | fFOSignals = (AliITSFOSignalsSPD*)itsLoader->TreeD()->GetUserInfo()->FindObject("AliITSFOSignalsSPD"); | |
870 | if(!fFOSignals) AliError("FO signals not retrieved"); | |
871 | } | |
872 | ||
ad7f2bfa | 873 | } |
874 | ||
875 | ||
7d62fb64 | 876 | AliITSClusterFinder *rec = 0; |
877 | Int_t id,module,first=0; | |
8e50d897 | 878 | for(module=0;module<GetITSgeom()->GetIndexMax();module++){ |
879 | id = GetITSgeom()->GetModuleType(module); | |
7d62fb64 | 880 | if (!all && !det[id]) continue; |
8e50d897 | 881 | if(det[id]) first = GetITSgeom()->GetStartDet(id); |
7d62fb64 | 882 | rec = (AliITSClusterFinder*)GetReconstructionModel(id); |
883 | TClonesArray *itsDigits = DigitsAddress(id); | |
6cae184e | 884 | if (!rec) |
885 | AliFatal("The reconstruction class was not instanciated!"); | |
5e5bc8f1 | 886 | ResetDigits(); // MvL: Not sure we neeed this when rereading anyways |
7d62fb64 | 887 | if (all) { |
6cae184e | 888 | treeD->GetEvent(lastentry+module); |
ad7f2bfa | 889 | } |
890 | else { | |
891 | treeD->GetEvent(lastentry+(module-first)); | |
892 | } | |
893 | Int_t ndigits = itsDigits->GetEntriesFast(); | |
894 | if (ndigits>0 || id==0) { // for SPD we always want to call FindRawClusters (to process FO signals) | |
895 | rec->SetDetTypeRec(this); | |
896 | rec->SetDigits(DigitsAddress(id)); | |
897 | // rec->SetClusters(ClustersAddress(id)); | |
898 | rec->FindRawClusters(module); | |
899 | } // end if | |
900 | treeR->Fill(); | |
901 | ResetRecPoints(); | |
902 | } | |
903 | ||
904 | // Remove PIT in-active chips from Fast-OR fired map | |
905 | if (all || det[0]) { // SPD present | |
906 | RemoveFastOrFiredInActive(); | |
907 | } | |
7d62fb64 | 908 | } |
909 | //______________________________________________________________________ | |
8484b32d | 910 | void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader,TTree *treeR,Option_t *opt){ |
7d62fb64 | 911 | // cluster finding and reconstruction of space points |
912 | // the condition below will disappear when the geom class will be | |
913 | // initialized for all versions - for the moment it is only for v5 ! | |
914 | // 7 is the SDD beam test version | |
915 | // Inputs: | |
6cae184e | 916 | // AliRawReader *rawReader Pointer to the raw-data reader |
917 | // TTree *treeR Clusters tree | |
7d62fb64 | 918 | // Outputs: |
919 | // none. | |
920 | // Return: | |
921 | // none. | |
8484b32d | 922 | const char *all = strstr(opt,"All"); |
923 | const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"), | |
924 | strstr(opt,"SSD")}; | |
ad7f2bfa | 925 | |
926 | // Reset Fast-OR fired map | |
927 | ResetFastOrFiredMap(); | |
928 | ||
5d2c2f86 | 929 | AliITSClusterFinder *rec = 0; |
7d62fb64 | 930 | Int_t id=0; |
931 | ||
00a7cc50 | 932 | TClonesArray *array=new TClonesArray("AliITSRecPoint",1000); |
6cae184e | 933 | TBranch *branch = treeR->Branch("ITSRecPoints",&array); |
7d62fb64 | 934 | delete array; |
935 | ||
8e50d897 | 936 | TClonesArray** clusters = new TClonesArray*[GetITSgeom()->GetIndexMax()]; |
937 | for (Int_t iModule = 0; iModule < GetITSgeom()->GetIndexMax(); iModule++) { | |
7d62fb64 | 938 | clusters[iModule] = NULL; |
939 | } | |
940 | for(id=0;id<3;id++){ | |
8484b32d | 941 | if (!all && !det[id]) continue; |
5d2c2f86 | 942 | rec = (AliITSClusterFinder*)GetReconstructionModel(id); |
c157c94e | 943 | if (!rec) |
ff44c37c | 944 | AliFatal("The reconstruction class was not instantiated"); |
6cae184e | 945 | rec->SetDetTypeRec(this); |
7d62fb64 | 946 | rec->RawdataToClusters(rawReader,clusters); |
947 | } | |
948 | Int_t nClusters =0; | |
c157c94e | 949 | TClonesArray *emptyArray=new TClonesArray("AliITSRecPoint"); |
8e50d897 | 950 | for(Int_t iModule=0;iModule<GetITSgeom()->GetIndexMax();iModule++){ |
8484b32d | 951 | id = GetITSgeom()->GetModuleType(iModule); |
952 | if (!all && !det[id]) continue; | |
7d62fb64 | 953 | array = clusters[iModule]; |
954 | if(!array){ | |
c157c94e | 955 | AliDebug(1,Form("data for module %d missing!",iModule)); |
956 | array = emptyArray; | |
7d62fb64 | 957 | } |
6cae184e | 958 | branch->SetAddress(&array); |
959 | treeR->Fill(); | |
7d62fb64 | 960 | nClusters+=array->GetEntriesFast(); |
5ef4644f | 961 | |
962 | if (array != emptyArray) { | |
963 | array->Delete(); | |
964 | delete array; | |
965 | } | |
7d62fb64 | 966 | } |
c157c94e | 967 | delete emptyArray; |
968 | ||
7d62fb64 | 969 | delete[] clusters; |
00a7cc50 | 970 | Info("DigitsToRecPoints", "total number of found recpoints in ITS: %d\n", |
7d62fb64 | 971 | nClusters); |
972 | ||
ad7f2bfa | 973 | // Remove PIT in-active chips from Fast-OR fired map |
974 | if (all || det[0]) { // SPD present | |
975 | RemoveFastOrFiredInActive(); | |
976 | } | |
7d62fb64 | 977 | } |
978 | ||
88128115 | 979 | //______________________________________________________________________ |
ef665f5e | 980 | void AliITSDetTypeRec::ReadOldSSDNoise(const TObjArray *array, |
88128115 | 981 | AliITSNoiseSSDv2 *noiseSSD) { |
982 | //Reads the old SSD calibration object and converts it to the new format | |
983 | const Int_t fgkSSDSTRIPSPERMODULE = 1536; | |
984 | const Int_t fgkSSDPSIDESTRIPSPERMODULE = 768; | |
985 | ||
3dd31ed2 | 986 | Int_t gNMod = array->GetEntries(); |
88128115 | 987 | cout<<"Converting old calibration object for noise..."<<endl; |
988 | ||
989 | //NOISE | |
990 | Double_t noise = 0.0; | |
3dd31ed2 | 991 | for (Int_t iModule = 0; iModule < gNMod; iModule++) { |
88128115 | 992 | AliITSNoiseSSD *noiseModule = (AliITSNoiseSSD*) (array->At(iModule)); |
993 | for(Int_t iStrip = 0; iStrip < fgkSSDSTRIPSPERMODULE; iStrip++) { | |
994 | noise = (iStrip < fgkSSDPSIDESTRIPSPERMODULE) ? noiseModule->GetNoiseP(iStrip) : noiseModule->GetNoiseN(1535 - iStrip); | |
995 | if(iStrip < fgkSSDPSIDESTRIPSPERMODULE) | |
996 | noiseSSD->AddNoiseP(iModule,iStrip,noise); | |
997 | if(iStrip >= fgkSSDPSIDESTRIPSPERMODULE) | |
998 | noiseSSD->AddNoiseN(iModule,1535 - iStrip,noise); | |
999 | }//loop over strips | |
1000 | }//loop over modules | |
1001 | } | |
1002 | ||
1003 | //______________________________________________________________________ | |
ef665f5e | 1004 | void AliITSDetTypeRec::ReadOldSSDBadChannels(const TObjArray *array, |
88128115 | 1005 | AliITSBadChannelsSSDv2 *badChannelsSSD) { |
1006 | //Reads the old SSD calibration object and converts it to the new format | |
3dd31ed2 | 1007 | Int_t gNMod = array->GetEntries(); |
88128115 | 1008 | cout<<"Converting old calibration object for bad channels..."<<endl; |
3dd31ed2 | 1009 | for (Int_t iModule = 0; iModule < gNMod; iModule++) { |
88128115 | 1010 | //for (Int_t iModule = 0; iModule < 1; iModule++) { |
1011 | AliITSBadChannelsSSD *bad = (AliITSBadChannelsSSD*) (array->At(iModule)); | |
1012 | TArrayI arrayPSide = bad->GetBadPChannelsList(); | |
1013 | for(Int_t iPCounter = 0; iPCounter < arrayPSide.GetSize(); iPCounter++) | |
1014 | badChannelsSSD->AddBadChannelP(iModule, | |
1015 | iPCounter, | |
1016 | (Char_t)arrayPSide.At(iPCounter)); | |
1017 | ||
1018 | TArrayI arrayNSide = bad->GetBadNChannelsList(); | |
1019 | for(Int_t iNCounter = 0; iNCounter < arrayNSide.GetSize(); iNCounter++) | |
1020 | badChannelsSSD->AddBadChannelN(iModule, | |
1021 | iNCounter, | |
1022 | (Char_t)arrayNSide.At(iNCounter)); | |
1023 | ||
1024 | }//loop over modules | |
1025 | } | |
1026 | ||
1027 | //______________________________________________________________________ | |
ef665f5e | 1028 | void AliITSDetTypeRec::ReadOldSSDGain(const TObjArray *array, |
88128115 | 1029 | AliITSGainSSDv2 *gainSSD) { |
1030 | //Reads the old SSD calibration object and converts it to the new format | |
1031 | ||
3dd31ed2 | 1032 | Int_t gNMod = array->GetEntries(); |
88128115 | 1033 | cout<<"Converting old calibration object for gain..."<<endl; |
1034 | ||
1035 | //GAIN | |
3dd31ed2 | 1036 | for (Int_t iModule = 0; iModule < gNMod; iModule++) { |
88128115 | 1037 | AliITSGainSSD *gainModule = (AliITSGainSSD*) (array->At(iModule)); |
1038 | TArrayF arrayPSide = gainModule->GetGainP(); | |
1039 | for(Int_t iPCounter = 0; iPCounter < arrayPSide.GetSize(); iPCounter++) | |
1040 | gainSSD->AddGainP(iModule, | |
1041 | iPCounter, | |
1042 | arrayPSide.At(iPCounter)); | |
1043 | TArrayF arrayNSide = gainModule->GetGainN(); | |
1044 | for(Int_t iNCounter = 0; iNCounter < arrayNSide.GetSize(); iNCounter++) | |
1045 | gainSSD->AddGainN(iModule, | |
1046 | iNCounter, | |
1047 | arrayNSide.At(iNCounter)); | |
1048 | }//loop over modules | |
1049 | } | |
ad7f2bfa | 1050 | //______________________________________________________________________ |
1051 | void AliITSDetTypeRec::RemoveFastOrFiredInActive() { | |
1052 | // Removes the chips that were in-active in the pixel trigger (from fast-or fired map) | |
1053 | if (fTriggerConditions==NULL) { | |
1054 | AliError("Pixel trigger conditions are missing."); | |
1055 | return; | |
1056 | } | |
1057 | Int_t eq = -1; | |
1058 | Int_t hs = -1; | |
1059 | Int_t chip = -1; | |
1060 | while (fTriggerConditions->GetNextInActiveChip(eq,hs,chip)) { | |
1061 | UInt_t chipKey = AliITSRawStreamSPD::GetOfflineChipKeyFromOnline(eq,hs,chip); | |
1062 | fFastOrFiredMap.SetBitNumber(chipKey,kFALSE); | |
1063 | } | |
1064 | } | |
1065 | //______________________________________________________________________ | |
1066 | void AliITSDetTypeRec::SetFastOrFiredMapOnline(UInt_t eq, UInt_t hs, UInt_t chip) { | |
1067 | // Set fast-or fired map for this chip | |
1068 | Int_t chipKey = AliITSRawStreamSPD::GetOfflineChipKeyFromOnline(eq,hs,chip); | |
1069 | return SetFastOrFiredMap(chipKey); | |
1070 | } | |
88128115 | 1071 | |
8ba39da9 | 1072 |