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