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