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