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