]>
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(); |
b27af87f | 413 | AliITSCalibrationSDD* cal=(AliITSCalibrationSDD*)GetCalibrationModel(fgkDefaultNModulesSPD+1); |
414 | if(cal->IsAMAt20MHz()){ | |
415 | seg->SetPadSize(seg->Dpz(0),20.); | |
416 | seg->SetNPads(seg->Npz()/2,128); | |
417 | } | |
7d62fb64 | 418 | SetSegmentationModel(dettype,seg); |
fa4f0f62 | 419 | SetDigitClassName(dettype,"AliITSdigitSDD"); |
3a7c3e6d | 420 | SetClusterClassName(dettype,"AliITSRawClusterSDD"); |
7d62fb64 | 421 | } |
422 | if(dettype==2){ | |
d24bc9d6 | 423 | AliITSsegmentationSSD* seg2 = new AliITSsegmentationSSD(); |
7d62fb64 | 424 | SetSegmentationModel(dettype,seg2); |
7d62fb64 | 425 | SetDigitClassName(dettype,"AliITSdigitSSD"); |
426 | SetClusterClassName(dettype,"AliITSRawClusterSSD"); | |
427 | } | |
7d62fb64 | 428 | } |
7d62fb64 | 429 | |
430 | } | |
8ba39da9 | 431 | //______________________________________________________________________ |
432 | Bool_t AliITSDetTypeRec::GetCalibration() { | |
433 | // Get Default calibration if a storage is not defined. | |
434 | ||
b17dae48 | 435 | if(!fFirstcall){ |
436 | AliITSCalibration* cal = GetCalibrationModel(0); | |
437 | if(cal)return kTRUE; | |
438 | } | |
439 | else { | |
440 | fFirstcall = kFALSE; | |
441 | } | |
06232459 | 442 | |
6cae184e | 443 | // SetRunNumber((Int_t)AliCDBManager::Instance()->GetRun()); |
444 | // Int_t run=GetRunNumber(); | |
b17dae48 | 445 | |
6cae184e | 446 | Bool_t cacheStatus = AliCDBManager::Instance()->GetCacheFlag(); |
b17dae48 | 447 | if (fCalibration==0) { |
448 | fCalibration = new TObjArray(GetITSgeom()->GetIndexMax()); | |
6cae184e | 449 | fCalibration->SetOwner(!cacheStatus); |
b17dae48 | 450 | fCalibration->Clear(); |
451 | } | |
452 | ||
8d37cc87 | 453 | // dead pixel are not used for local reconstruction |
454 | AliCDBEntry *entrySPD = AliCDBManager::Instance()->Get("ITS/Calib/SPDNoisy"); | |
23197852 | 455 | AliCDBEntry *deadSPD = AliCDBManager::Instance()->Get("ITS/Calib/SPDDead"); |
6cae184e | 456 | AliCDBEntry *entrySDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD"); |
fb4dfab9 | 457 | |
458 | // AliCDBEntry *entrySSD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSSD"); | |
23197852 | 459 | AliCDBEntry *entryNoiseSSD = AliCDBManager::Instance()->Get("ITS/Calib/NoiseSSD"); |
23197852 | 460 | AliCDBEntry *entryGainSSD = AliCDBManager::Instance()->Get("ITS/Calib/GainSSD"); |
461 | AliCDBEntry *entryBadChannelsSSD = AliCDBManager::Instance()->Get("ITS/Calib/BadChannelsSSD"); | |
6cae184e | 462 | AliCDBEntry *entry2SPD = AliCDBManager::Instance()->Get("ITS/Calib/RespSPD"); |
463 | AliCDBEntry *entry2SDD = AliCDBManager::Instance()->Get("ITS/Calib/RespSDD"); | |
464 | AliCDBEntry *entry2SSD = AliCDBManager::Instance()->Get("ITS/Calib/RespSSD"); | |
18da6e54 | 465 | AliCDBEntry *drSpSDD = AliCDBManager::Instance()->Get("ITS/Calib/DriftSpeedSDD"); |
979b5a5f | 466 | AliCDBEntry *ddlMapSDD = AliCDBManager::Instance()->Get("ITS/Calib/DDLMapSDD"); |
2ebd5518 | 467 | // AliCDBEntry *mapASDD = AliCDBManager::Instance()->Get("ITS/Calib/MapsAnodeSDD"); |
028a3709 | 468 | AliCDBEntry *mapTSDD = AliCDBManager::Instance()->Get("ITS/Calib/MapsTimeSDD"); |
06232459 | 469 | |
23197852 | 470 | if(!entrySPD || !deadSPD || !entrySDD || !entryNoiseSSD || !entryGainSSD || |
88128115 | 471 | !entryBadChannelsSSD || |
2ebd5518 | 472 | !entry2SPD || !entry2SDD || !entry2SSD || !drSpSDD || !ddlMapSDD || !mapTSDD ){ |
566f73ca | 473 | AliFatal("Calibration object retrieval failed! "); |
e8c4cf33 | 474 | return kFALSE; |
566f73ca | 475 | } |
476 | ||
b17dae48 | 477 | TObjArray *calSPD = (TObjArray *)entrySPD->GetObject(); |
6cae184e | 478 | if(!cacheStatus)entrySPD->SetObject(NULL); |
8ba39da9 | 479 | entrySPD->SetOwner(kTRUE); |
fcf95fc7 | 480 | |
23197852 | 481 | TObjArray *caldeadSPD = (TObjArray *)deadSPD->GetObject(); |
482 | if(!cacheStatus)deadSPD->SetObject(NULL); | |
483 | deadSPD->SetOwner(kTRUE); | |
484 | ||
fcf95fc7 | 485 | AliITSresponseSPD *pSPD = (AliITSresponseSPD*)entry2SPD->GetObject(); |
6cae184e | 486 | if(!cacheStatus)entry2SPD->SetObject(NULL); |
fcf95fc7 | 487 | entry2SPD->SetOwner(kTRUE); |
488 | ||
b17dae48 | 489 | TObjArray *calSDD = (TObjArray *)entrySDD->GetObject(); |
6cae184e | 490 | if(!cacheStatus)entrySDD->SetObject(NULL); |
8ba39da9 | 491 | entrySDD->SetOwner(kTRUE); |
fcf95fc7 | 492 | |
493 | AliITSresponseSDD *pSDD = (AliITSresponseSDD*)entry2SDD->GetObject(); | |
6cae184e | 494 | if(!cacheStatus)entry2SDD->SetObject(NULL); |
fcf95fc7 | 495 | entry2SDD->SetOwner(kTRUE); |
496 | ||
18da6e54 | 497 | TObjArray *drSp = (TObjArray *)drSpSDD->GetObject(); |
498 | if(!cacheStatus)drSpSDD->SetObject(NULL); | |
499 | drSpSDD->SetOwner(kTRUE); | |
500 | ||
979b5a5f | 501 | AliITSDDLModuleMapSDD *ddlsdd=(AliITSDDLModuleMapSDD*)ddlMapSDD->GetObject(); |
502 | if(!cacheStatus)ddlMapSDD->SetObject(NULL); | |
503 | ddlMapSDD->SetOwner(kTRUE); | |
504 | ||
2ebd5518 | 505 | // TObjArray *mapAn = (TObjArray *)mapASDD->GetObject(); |
506 | // if(!cacheStatus)mapASDD->SetObject(NULL); | |
507 | // mapASDD->SetOwner(kTRUE); | |
028a3709 | 508 | |
509 | TObjArray *mapT = (TObjArray *)mapTSDD->GetObject(); | |
510 | if(!cacheStatus)mapTSDD->SetObject(NULL); | |
511 | mapTSDD->SetOwner(kTRUE); | |
512 | ||
88128115 | 513 | TObject *emptyssd = 0; TString ssdobjectname = 0; |
514 | AliITSNoiseSSDv2 *noiseSSD = new AliITSNoiseSSDv2(); | |
515 | emptyssd = (TObject *)entryNoiseSSD->GetObject(); | |
516 | ssdobjectname = emptyssd->GetName(); | |
517 | if(ssdobjectname=="TObjArray") { | |
518 | TObjArray *noiseSSDOld = (TObjArray *)entryNoiseSSD->GetObject(); | |
519 | ReadOldSSDNoise(noiseSSDOld, noiseSSD); | |
520 | } | |
521 | else if(ssdobjectname=="AliITSNoiseSSDv2") | |
522 | noiseSSD = (AliITSNoiseSSDv2 *)entryNoiseSSD->GetObject(); | |
fb4dfab9 | 523 | if(!cacheStatus)entryNoiseSSD->SetObject(NULL); |
524 | entryNoiseSSD->SetOwner(kTRUE); | |
525 | ||
88128115 | 526 | AliITSGainSSDv2 *gainSSD = new AliITSGainSSDv2(); |
527 | emptyssd = (TObject *)entryGainSSD->GetObject(); | |
528 | ssdobjectname = emptyssd->GetName(); | |
529 | if(ssdobjectname=="Gain") { | |
530 | TObjArray *gainSSDOld = (TObjArray *)entryGainSSD->GetObject(); | |
531 | ReadOldSSDGain(gainSSDOld, gainSSD); | |
532 | } | |
533 | else if(ssdobjectname=="AliITSGainSSDv2") | |
534 | gainSSD = (AliITSGainSSDv2 *)entryGainSSD->GetObject(); | |
fb4dfab9 | 535 | if(!cacheStatus)entryGainSSD->SetObject(NULL); |
536 | entryGainSSD->SetOwner(kTRUE); | |
537 | ||
88128115 | 538 | AliITSBadChannelsSSDv2 *badChannelsSSD = new AliITSBadChannelsSSDv2(); |
539 | emptyssd = (TObject *)entryBadChannelsSSD->GetObject(); | |
540 | ssdobjectname = emptyssd->GetName(); | |
541 | if(ssdobjectname=="TObjArray") { | |
542 | TObjArray *badChannelsSSDOld = (TObjArray *)entryBadChannelsSSD->GetObject(); | |
543 | ReadOldSSDBadChannels(badChannelsSSDOld, badChannelsSSD); | |
544 | } | |
545 | else if(ssdobjectname=="AliITSBadChannelsSSDv2") | |
546 | badChannelsSSD = (AliITSBadChannelsSSDv2*)entryBadChannelsSSD->GetObject(); | |
fb4dfab9 | 547 | if(!cacheStatus)entryBadChannelsSSD->SetObject(NULL); |
548 | entryBadChannelsSSD->SetOwner(kTRUE); | |
fcf95fc7 | 549 | |
550 | AliITSresponseSSD *pSSD = (AliITSresponseSSD*)entry2SSD->GetObject(); | |
6cae184e | 551 | if(!cacheStatus)entry2SSD->SetObject(NULL); |
fcf95fc7 | 552 | entry2SSD->SetOwner(kTRUE); |
553 | ||
b17dae48 | 554 | // DB entries are deleted. In this way metadeta objects are deleted as well |
6cae184e | 555 | if(!cacheStatus){ |
b17dae48 | 556 | delete entrySPD; |
23197852 | 557 | delete deadSPD; |
b17dae48 | 558 | delete entrySDD; |
fb4dfab9 | 559 | delete entryNoiseSSD; |
560 | delete entryGainSSD; | |
561 | delete entryBadChannelsSSD; | |
b17dae48 | 562 | delete entry2SPD; |
563 | delete entry2SDD; | |
564 | delete entry2SSD; | |
2ebd5518 | 565 | //delete mapASDD; |
028a3709 | 566 | delete mapTSDD; |
18da6e54 | 567 | delete drSpSDD; |
979b5a5f | 568 | delete ddlMapSDD; |
b17dae48 | 569 | } |
06232459 | 570 | |
23197852 | 571 | if ((!pSPD)||(!pSDD)||(!pSSD) || (!calSPD) || (!caldeadSPD) ||(!calSDD) || (!drSp) || (!ddlsdd) |
2ebd5518 | 572 | || (!mapT) || (!noiseSSD)|| (!gainSSD)|| (!badChannelsSSD)) { |
8ba39da9 | 573 | AliWarning("Can not get calibration from calibration database !"); |
574 | return kFALSE; | |
575 | } | |
fcf95fc7 | 576 | |
b17dae48 | 577 | fNMod[0] = calSPD->GetEntries(); |
578 | fNMod[1] = calSDD->GetEntries(); | |
ced4d9bc | 579 | //fNMod[2] = noiseSSD->GetEntries(); |
8ba39da9 | 580 | AliInfo(Form("%i SPD, %i SDD and %i SSD in calibration database", |
581 | fNMod[0], fNMod[1], fNMod[2])); | |
622d99ba | 582 | AliITSCalibration* cal; |
8ba39da9 | 583 | for (Int_t i=0; i<fNMod[0]; i++) { |
622d99ba | 584 | cal = (AliITSCalibration*) calSPD->At(i); |
585 | cal->SetResponse((AliITSresponse*)pSPD); | |
586 | SetCalibrationModel(i, cal); | |
23197852 | 587 | cal = (AliITSCalibration*) caldeadSPD->At(i); |
588 | SetSPDDeadModel(i, cal); | |
028a3709 | 589 | } |
140e5249 | 590 | |
253e68a0 | 591 | fDDLMapSDD=ddlsdd; |
592 | fRespSDD=pSDD; | |
140e5249 | 593 | for(Int_t iddl=0; iddl<AliITSDDLModuleMapSDD::GetNDDLs(); iddl++){ |
594 | for(Int_t icar=0; icar<AliITSDDLModuleMapSDD::GetNModPerDDL();icar++){ | |
595 | Int_t iMod=fDDLMapSDD->GetModuleNumber(iddl,icar); | |
596 | if(iMod==-1) continue; | |
6cc25d49 | 597 | Int_t i=iMod - fgkDefaultNModulesSPD; |
140e5249 | 598 | cal = (AliITSCalibration*) calSDD->At(i); |
140e5249 | 599 | Int_t i0=2*i; |
600 | Int_t i1=1+2*i; | |
601 | AliITSDriftSpeedArraySDD* arr0 = (AliITSDriftSpeedArraySDD*) drSp->At(i0); | |
2ebd5518 | 602 | // AliITSMapSDD* ma0 = (AliITSMapSDD*)mapAn->At(i0); |
140e5249 | 603 | AliITSMapSDD* mt0 = (AliITSMapSDD*)mapT->At(i0); |
604 | AliITSDriftSpeedArraySDD* arr1 = (AliITSDriftSpeedArraySDD*) drSp->At(i1); | |
2ebd5518 | 605 | // AliITSMapSDD* ma1 = (AliITSMapSDD*)mapAn->At(i1); |
140e5249 | 606 | AliITSMapSDD* mt1 = (AliITSMapSDD*)mapT->At(i1); |
607 | cal->SetDriftSpeed(0,arr0); | |
608 | cal->SetDriftSpeed(1,arr1); | |
2ebd5518 | 609 | // cal->SetMapA(0,ma0); |
610 | // cal->SetMapA(1,ma1); | |
140e5249 | 611 | cal->SetMapT(0,mt0); |
612 | cal->SetMapT(1,mt1); | |
613 | SetCalibrationModel(iMod, cal); | |
614 | } | |
028a3709 | 615 | } |
ced4d9bc | 616 | |
617 | fSSDCalibration->SetResponse((AliITSresponse*)pSSD); | |
618 | fSSDCalibration->SetNoise(noiseSSD); | |
ced4d9bc | 619 | fSSDCalibration->SetGain(gainSSD); |
88128115 | 620 | fSSDCalibration->SetBadChannels(badChannelsSSD); |
ced4d9bc | 621 | //fSSDCalibration->FillBadChipMap(); |
622 | ||
623 | ||
624 | /* | |
8ba39da9 | 625 | for (Int_t i=0; i<fNMod[2]; i++) { |
fb4dfab9 | 626 | |
627 | AliITSCalibrationSSD *calibSSD = new AliITSCalibrationSSD(); | |
628 | calibSSD->SetResponse((AliITSresponse*)pSSD); | |
629 | ||
630 | AliITSNoiseSSD *noise = (AliITSNoiseSSD*) (noiseSSD->At(i)); | |
631 | calibSSD->SetNoise(noise); | |
b42cfa25 | 632 | AliITSPedestalSSD *pedestal = (AliITSPedestalSSD*) (pedestalSSD->At(i)); |
633 | calibSSD->SetPedestal(pedestal); | |
fb4dfab9 | 634 | AliITSGainSSD *gain = (AliITSGainSSD*) (gainSSD->At(i)); |
635 | calibSSD->SetGain(gain); | |
636 | AliITSBadChannelsSSD *bad = (AliITSBadChannelsSSD*) (badchannelsSSD->At(i)); | |
637 | calibSSD->SetBadChannels(bad); | |
23197852 | 638 | calibSSD->FillBadChipMap(); |
fb4dfab9 | 639 | |
6cc25d49 | 640 | Int_t iMod = i + fgkDefaultNModulesSPD + fgkDefaultNModulesSDD; |
fb4dfab9 | 641 | SetCalibrationModel(iMod, calibSSD); |
8ba39da9 | 642 | } |
ced4d9bc | 643 | */ |
8ba39da9 | 644 | |
645 | return kTRUE; | |
646 | } | |
647 | ||
7d62fb64 | 648 | |
649 | //________________________________________________________________ | |
650 | void AliITSDetTypeRec::SetDefaultClusterFinders(){ | |
651 | ||
652 | //set defaults for standard cluster finder | |
653 | ||
8e50d897 | 654 | if(!GetITSgeom()){ |
655 | Warning("SetDefaults","null pointer to AliITSgeom!"); | |
7d62fb64 | 656 | return; |
657 | } | |
658 | ||
7d62fb64 | 659 | AliITSClusterFinder *clf; |
660 | ||
6cae184e | 661 | for(Int_t dettype=0;dettype<fgkNdettypes;dettype++){ |
7d62fb64 | 662 | //SPD |
663 | if(dettype==0){ | |
664 | if(!GetReconstructionModel(dettype)){ | |
7d62fb64 | 665 | TClonesArray *dig0 = DigitsAddress(0); |
666 | TClonesArray *rec0 = ClustersAddress(0); | |
8ba39da9 | 667 | clf = new AliITSClusterFinderSPD(this,dig0,rec0); |
7d62fb64 | 668 | SetReconstructionModel(dettype,clf); |
8ba39da9 | 669 | |
7d62fb64 | 670 | } |
671 | } | |
8ba39da9 | 672 | |
7d62fb64 | 673 | //SDD |
674 | if(dettype==1){ | |
675 | if(!GetReconstructionModel(dettype)){ | |
7d62fb64 | 676 | TClonesArray *dig1 = DigitsAddress(1); |
677 | TClonesArray *rec1 = ClustersAddress(1); | |
8ba39da9 | 678 | clf = new AliITSClusterFinderSDD(this,dig1,rec1); |
7d62fb64 | 679 | SetReconstructionModel(dettype,clf); |
680 | } | |
681 | ||
682 | } | |
683 | //SSD | |
684 | if(dettype==2){ | |
685 | if(!GetReconstructionModel(dettype)){ | |
7d62fb64 | 686 | TClonesArray* dig2 = DigitsAddress(2); |
8ba39da9 | 687 | clf = new AliITSClusterFinderSSD(this,dig2); |
7d62fb64 | 688 | SetReconstructionModel(dettype,clf); |
689 | } | |
690 | } | |
691 | ||
692 | } | |
693 | ||
694 | ||
695 | } | |
696 | ||
697 | //________________________________________________________________ | |
3a7c3e6d | 698 | void AliITSDetTypeRec::SetDefaultClusterFindersV2(Bool_t rawdata){ |
7d62fb64 | 699 | |
700 | //Set defaults for cluster finder V2 | |
701 | ||
8e50d897 | 702 | if(!GetITSgeom()){ |
703 | Warning("SetDefaults","Null pointer to AliITSgeom !"); | |
7d62fb64 | 704 | return; |
705 | } | |
706 | ||
7d62fb64 | 707 | AliITSClusterFinder *clf; |
708 | ||
3a7c3e6d | 709 | for(Int_t dettype=0;dettype<fgkNdettypes;dettype++){ |
7d62fb64 | 710 | //SPD |
711 | if(dettype==0){ | |
712 | if(!GetReconstructionModel(dettype)){ | |
8ba39da9 | 713 | clf = new AliITSClusterFinderV2SPD(this); |
7d62fb64 | 714 | clf->InitGeometry(); |
3a7c3e6d | 715 | if(!rawdata) clf->SetDigits(DigitsAddress(0)); |
7d62fb64 | 716 | SetReconstructionModel(dettype,clf); |
717 | ||
718 | } | |
719 | } | |
720 | //SDD | |
721 | if(dettype==1){ | |
722 | if(!GetReconstructionModel(dettype)){ | |
8ba39da9 | 723 | clf = new AliITSClusterFinderV2SDD(this); |
724 | clf->InitGeometry(); | |
3a7c3e6d | 725 | if(!rawdata) clf->SetDigits(DigitsAddress(1)); |
7d62fb64 | 726 | SetReconstructionModel(dettype,clf); |
727 | } | |
728 | ||
729 | } | |
730 | ||
731 | //SSD | |
732 | if(dettype==2){ | |
733 | if(!GetReconstructionModel(dettype)){ | |
8ba39da9 | 734 | clf = new AliITSClusterFinderV2SSD(this); |
7d62fb64 | 735 | clf->InitGeometry(); |
3a7c3e6d | 736 | if(!rawdata) clf->SetDigits(DigitsAddress(2)); |
7d62fb64 | 737 | SetReconstructionModel(dettype,clf); |
738 | } | |
739 | } | |
740 | ||
741 | } | |
742 | ||
743 | } | |
744 | //______________________________________________________________________ | |
6cae184e | 745 | void AliITSDetTypeRec::MakeBranch(TTree* tree, Option_t* option){ |
7d62fb64 | 746 | |
747 | //Creates branches for clusters and recpoints | |
748 | Bool_t cR = (strstr(option,"R")!=0); | |
749 | Bool_t cRF = (strstr(option,"RF")!=0); | |
7d62fb64 | 750 | |
751 | if(cRF)cR = kFALSE; | |
752 | ||
6cae184e | 753 | if(cR) MakeBranchR(tree); |
754 | if(cRF) MakeBranchRF(tree); | |
7d62fb64 | 755 | |
756 | } | |
757 | ||
758 | //___________________________________________________________________ | |
759 | void AliITSDetTypeRec::AddCluster(Int_t id, AliITSRawCluster *c){ | |
760 | ||
761 | // Adds a raw cluster to the list | |
762 | TClonesArray &lc = *((TClonesArray*)fCtype->At(id)); | |
763 | switch(id){ | |
764 | case 0: | |
765 | new(lc[fNctype[id]++]) AliITSRawClusterSPD(*((AliITSRawClusterSPD*)c)); | |
766 | break; | |
767 | case 1: | |
768 | new(lc[fNctype[id]++]) AliITSRawClusterSDD(*((AliITSRawClusterSDD*)c)); | |
769 | break; | |
770 | case 2: | |
771 | new(lc[fNctype[id]++]) AliITSRawClusterSSD(*((AliITSRawClusterSSD*)c)); | |
772 | break; | |
773 | } | |
774 | } | |
775 | //___________________________________________________________________ | |
776 | void AliITSDetTypeRec::ResetDigits(){ | |
777 | // Reset number of digits and the digits array for the ITS detector. | |
778 | ||
779 | if(!fDigits) return; | |
780 | for(Int_t i=0;i<fgkNdettypes;i++){ | |
781 | ResetDigits(i); | |
782 | } | |
783 | } | |
784 | //___________________________________________________________________ | |
785 | void AliITSDetTypeRec::ResetDigits(Int_t branch){ | |
786 | // Reset number of digits and the digits array for this branch. | |
787 | ||
788 | if(fDigits->At(branch)) ((TClonesArray*)fDigits->At(branch))->Clear(); | |
789 | if(fNdtype) fNdtype[branch]=0; | |
790 | ||
791 | } | |
792 | ||
793 | //__________________________________________________________________ | |
794 | void AliITSDetTypeRec::ResetClusters(){ | |
795 | ||
796 | //Resets number of clusters and the cluster array | |
797 | for(Int_t i=0;i<fgkNdettypes;i++){ | |
798 | ResetClusters(i); | |
799 | } | |
800 | } | |
801 | ||
802 | //__________________________________________________________________ | |
803 | void AliITSDetTypeRec::ResetClusters(Int_t i){ | |
804 | ||
805 | //Resets number of clusters and the cluster array for this branch | |
806 | ||
807 | if (fCtype->At(i)) ((TClonesArray*)fCtype->At(i))->Clear(); | |
808 | if (fNctype) fNctype[i]=0; | |
809 | } | |
810 | //__________________________________________________________________ | |
6cae184e | 811 | void AliITSDetTypeRec::MakeBranchR(TTree *treeR, Option_t *opt){ |
7d62fb64 | 812 | |
813 | //Creates tree branches for recpoints | |
814 | // Inputs: | |
815 | // cont char *file File name where RecPoints branch is to be written | |
816 | // to. If blank it write the SDigits to the same | |
817 | // file in which the Hits were found. | |
818 | ||
7d62fb64 | 819 | Int_t buffsz = 4000; |
820 | char branchname[30]; | |
821 | ||
822 | // only one branch for rec points for all detector types | |
823 | Bool_t oFast= (strstr(opt,"Fast")!=0); | |
7d62fb64 | 824 | |
825 | Char_t detname[10] = "ITS"; | |
826 | ||
827 | ||
828 | if(oFast){ | |
829 | sprintf(branchname,"%sRecPointsF",detname); | |
7d62fb64 | 830 | } else { |
831 | sprintf(branchname,"%sRecPoints",detname); | |
832 | } | |
833 | ||
00a7cc50 | 834 | if(!fRecPoints)fRecPoints = new TClonesArray("AliITSRecPoint",1000); |
6cae184e | 835 | if (treeR) |
836 | MakeBranchInTree(treeR,branchname,0,&fRecPoints,buffsz,99); | |
7d62fb64 | 837 | } |
838 | //______________________________________________________________________ | |
839 | void AliITSDetTypeRec::SetTreeAddressR(TTree *treeR){ | |
840 | // Set branch address for the Reconstructed points Trees. | |
3b9df642 | 841 | // Inputs: |
7d62fb64 | 842 | // TTree *treeR Tree containing the RecPoints. |
3b9df642 | 843 | // Outputs: |
7d62fb64 | 844 | // none. |
3b9df642 | 845 | // Return: |
7d62fb64 | 846 | |
847 | char branchname[30]; | |
848 | Char_t namedet[10]="ITS"; | |
849 | ||
850 | if(!treeR) return; | |
851 | if(fRecPoints==0x0) fRecPoints = new TClonesArray("AliITSRecPoint",1000); | |
00a7cc50 | 852 | TBranch *branch; |
853 | sprintf(branchname,"%sRecPoints",namedet); | |
854 | branch = treeR->GetBranch(branchname); | |
855 | if (branch) { | |
856 | branch->SetAddress(&fRecPoints); | |
857 | }else { | |
858 | sprintf(branchname,"%sRecPointsF",namedet); | |
7d62fb64 | 859 | branch = treeR->GetBranch(branchname); |
860 | if (branch) { | |
00a7cc50 | 861 | branch->SetAddress(&fRecPoints); |
7d62fb64 | 862 | } |
00a7cc50 | 863 | |
7d62fb64 | 864 | } |
3b9df642 | 865 | } |
7d62fb64 | 866 | //____________________________________________________________________ |
867 | void AliITSDetTypeRec::AddRecPoint(const AliITSRecPoint &r){ | |
868 | // Add a reconstructed space point to the list | |
869 | // Inputs: | |
870 | // const AliITSRecPoint &r RecPoint class to be added to the tree | |
871 | // of reconstructed points TreeR. | |
872 | // Outputs: | |
873 | // none. | |
874 | // Return: | |
875 | // none. | |
876 | ||
877 | TClonesArray &lrecp = *fRecPoints; | |
878 | new(lrecp[fNRecPoints++]) AliITSRecPoint(r); | |
879 | } | |
7d62fb64 | 880 | |
881 | //______________________________________________________________________ | |
6cae184e | 882 | void AliITSDetTypeRec::DigitsToRecPoints(TTree *treeD,TTree *treeR,Int_t lastentry,Option_t *opt, Bool_t v2){ |
7d62fb64 | 883 | // cluster finding and reconstruction of space points |
884 | // the condition below will disappear when the geom class will be | |
885 | // initialized for all versions - for the moment it is only for v5 ! | |
886 | // 7 is the SDD beam test version | |
887 | // Inputs: | |
6cae184e | 888 | // TTree *treeD Digits tree |
889 | // TTree *treeR Clusters tree | |
7d62fb64 | 890 | // Int_t lastentry Offset for module when not all of the modules |
891 | // are processed. | |
892 | // Option_t *opt String indicating which ITS sub-detectors should | |
893 | // be processed. If ="All" then all of the ITS | |
894 | // sub detectors are processed. | |
895 | ||
7d62fb64 | 896 | const char *all = strstr(opt,"All"); |
897 | const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"), | |
898 | strstr(opt,"SSD")}; | |
00a7cc50 | 899 | if(!v2) { |
900 | SetDefaultClusterFinders(); | |
901 | AliInfo("Original cluster finder has been selected\n"); | |
902 | } | |
903 | else { | |
904 | SetDefaultClusterFindersV2(); | |
905 | AliInfo("V2 cluster finder has been selected \n"); | |
906 | } | |
7d62fb64 | 907 | |
7d62fb64 | 908 | AliITSClusterFinder *rec = 0; |
909 | Int_t id,module,first=0; | |
8e50d897 | 910 | for(module=0;module<GetITSgeom()->GetIndexMax();module++){ |
911 | id = GetITSgeom()->GetModuleType(module); | |
7d62fb64 | 912 | if (!all && !det[id]) continue; |
8e50d897 | 913 | if(det[id]) first = GetITSgeom()->GetStartDet(id); |
7d62fb64 | 914 | rec = (AliITSClusterFinder*)GetReconstructionModel(id); |
915 | TClonesArray *itsDigits = DigitsAddress(id); | |
6cae184e | 916 | if (!rec) |
917 | AliFatal("The reconstruction class was not instanciated!"); | |
5e5bc8f1 | 918 | ResetDigits(); // MvL: Not sure we neeed this when rereading anyways |
7d62fb64 | 919 | if (all) { |
6cae184e | 920 | treeD->GetEvent(lastentry+module); |
7d62fb64 | 921 | }else { |
6cae184e | 922 | treeD->GetEvent(lastentry+(module-first)); |
7d62fb64 | 923 | } |
924 | Int_t ndigits = itsDigits->GetEntriesFast(); | |
925 | if(ndigits>0){ | |
926 | rec->SetDetTypeRec(this); | |
7d62fb64 | 927 | rec->SetDigits(DigitsAddress(id)); |
6cae184e | 928 | // rec->SetClusters(ClustersAddress(id)); |
7d62fb64 | 929 | rec->FindRawClusters(module); |
930 | } // end if | |
6cae184e | 931 | treeR->Fill(); |
7d62fb64 | 932 | ResetRecPoints(); |
7d62fb64 | 933 | ResetClusters(); |
934 | } | |
7d62fb64 | 935 | } |
936 | //______________________________________________________________________ | |
8484b32d | 937 | void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader,TTree *treeR,Option_t *opt){ |
7d62fb64 | 938 | // cluster finding and reconstruction of space points |
939 | // the condition below will disappear when the geom class will be | |
940 | // initialized for all versions - for the moment it is only for v5 ! | |
941 | // 7 is the SDD beam test version | |
942 | // Inputs: | |
6cae184e | 943 | // AliRawReader *rawReader Pointer to the raw-data reader |
944 | // TTree *treeR Clusters tree | |
7d62fb64 | 945 | // Outputs: |
946 | // none. | |
947 | // Return: | |
948 | // none. | |
8484b32d | 949 | const char *all = strstr(opt,"All"); |
950 | const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"), | |
951 | strstr(opt,"SSD")}; | |
7d62fb64 | 952 | AliITSClusterFinderV2 *rec = 0; |
953 | Int_t id=0; | |
954 | ||
00a7cc50 | 955 | TClonesArray *array=new TClonesArray("AliITSRecPoint",1000); |
6cae184e | 956 | TBranch *branch = treeR->Branch("ITSRecPoints",&array); |
7d62fb64 | 957 | delete array; |
958 | ||
8e50d897 | 959 | TClonesArray** clusters = new TClonesArray*[GetITSgeom()->GetIndexMax()]; |
960 | for (Int_t iModule = 0; iModule < GetITSgeom()->GetIndexMax(); iModule++) { | |
7d62fb64 | 961 | clusters[iModule] = NULL; |
962 | } | |
963 | for(id=0;id<3;id++){ | |
8484b32d | 964 | if (!all && !det[id]) continue; |
7d62fb64 | 965 | rec = (AliITSClusterFinderV2*)GetReconstructionModel(id); |
c157c94e | 966 | if (!rec) |
967 | AliFatal("The reconstruction class was not instanciated"); | |
6cae184e | 968 | rec->SetDetTypeRec(this); |
7d62fb64 | 969 | rec->RawdataToClusters(rawReader,clusters); |
970 | } | |
971 | Int_t nClusters =0; | |
c157c94e | 972 | TClonesArray *emptyArray=new TClonesArray("AliITSRecPoint"); |
8e50d897 | 973 | for(Int_t iModule=0;iModule<GetITSgeom()->GetIndexMax();iModule++){ |
8484b32d | 974 | id = GetITSgeom()->GetModuleType(iModule); |
975 | if (!all && !det[id]) continue; | |
7d62fb64 | 976 | array = clusters[iModule]; |
977 | if(!array){ | |
c157c94e | 978 | AliDebug(1,Form("data for module %d missing!",iModule)); |
979 | array = emptyArray; | |
7d62fb64 | 980 | } |
6cae184e | 981 | branch->SetAddress(&array); |
982 | treeR->Fill(); | |
7d62fb64 | 983 | nClusters+=array->GetEntriesFast(); |
5ef4644f | 984 | |
985 | if (array != emptyArray) { | |
986 | array->Delete(); | |
987 | delete array; | |
988 | } | |
7d62fb64 | 989 | } |
c157c94e | 990 | delete emptyArray; |
991 | ||
7d62fb64 | 992 | delete[] clusters; |
00a7cc50 | 993 | Info("DigitsToRecPoints", "total number of found recpoints in ITS: %d\n", |
7d62fb64 | 994 | nClusters); |
995 | ||
996 | } | |
997 | ||
88128115 | 998 | //______________________________________________________________________ |
999 | void AliITSDetTypeRec::ReadOldSSDNoise(TObjArray *array, | |
1000 | AliITSNoiseSSDv2 *noiseSSD) { | |
1001 | //Reads the old SSD calibration object and converts it to the new format | |
1002 | const Int_t fgkSSDSTRIPSPERMODULE = 1536; | |
1003 | const Int_t fgkSSDPSIDESTRIPSPERMODULE = 768; | |
1004 | ||
1005 | Int_t fNMod = array->GetEntries(); | |
1006 | cout<<"Converting old calibration object for noise..."<<endl; | |
1007 | ||
1008 | //NOISE | |
1009 | Double_t noise = 0.0; | |
1010 | for (Int_t iModule = 0; iModule < fNMod; iModule++) { | |
1011 | AliITSNoiseSSD *noiseModule = (AliITSNoiseSSD*) (array->At(iModule)); | |
1012 | for(Int_t iStrip = 0; iStrip < fgkSSDSTRIPSPERMODULE; iStrip++) { | |
1013 | noise = (iStrip < fgkSSDPSIDESTRIPSPERMODULE) ? noiseModule->GetNoiseP(iStrip) : noiseModule->GetNoiseN(1535 - iStrip); | |
1014 | if(iStrip < fgkSSDPSIDESTRIPSPERMODULE) | |
1015 | noiseSSD->AddNoiseP(iModule,iStrip,noise); | |
1016 | if(iStrip >= fgkSSDPSIDESTRIPSPERMODULE) | |
1017 | noiseSSD->AddNoiseN(iModule,1535 - iStrip,noise); | |
1018 | }//loop over strips | |
1019 | }//loop over modules | |
1020 | } | |
1021 | ||
1022 | //______________________________________________________________________ | |
1023 | void AliITSDetTypeRec::ReadOldSSDBadChannels(TObjArray *array, | |
1024 | AliITSBadChannelsSSDv2 *badChannelsSSD) { | |
1025 | //Reads the old SSD calibration object and converts it to the new format | |
1026 | Int_t fNMod = array->GetEntries(); | |
1027 | cout<<"Converting old calibration object for bad channels..."<<endl; | |
1028 | for (Int_t iModule = 0; iModule < fNMod; iModule++) { | |
1029 | //for (Int_t iModule = 0; iModule < 1; iModule++) { | |
1030 | AliITSBadChannelsSSD *bad = (AliITSBadChannelsSSD*) (array->At(iModule)); | |
1031 | TArrayI arrayPSide = bad->GetBadPChannelsList(); | |
1032 | for(Int_t iPCounter = 0; iPCounter < arrayPSide.GetSize(); iPCounter++) | |
1033 | badChannelsSSD->AddBadChannelP(iModule, | |
1034 | iPCounter, | |
1035 | (Char_t)arrayPSide.At(iPCounter)); | |
1036 | ||
1037 | TArrayI arrayNSide = bad->GetBadNChannelsList(); | |
1038 | for(Int_t iNCounter = 0; iNCounter < arrayNSide.GetSize(); iNCounter++) | |
1039 | badChannelsSSD->AddBadChannelN(iModule, | |
1040 | iNCounter, | |
1041 | (Char_t)arrayNSide.At(iNCounter)); | |
1042 | ||
1043 | }//loop over modules | |
1044 | } | |
1045 | ||
1046 | //______________________________________________________________________ | |
1047 | void AliITSDetTypeRec::ReadOldSSDGain(TObjArray *array, | |
1048 | AliITSGainSSDv2 *gainSSD) { | |
1049 | //Reads the old SSD calibration object and converts it to the new format | |
1050 | ||
1051 | Int_t fNMod = array->GetEntries(); | |
1052 | cout<<"Converting old calibration object for gain..."<<endl; | |
1053 | ||
1054 | //GAIN | |
1055 | for (Int_t iModule = 0; iModule < fNMod; iModule++) { | |
1056 | AliITSGainSSD *gainModule = (AliITSGainSSD*) (array->At(iModule)); | |
1057 | TArrayF arrayPSide = gainModule->GetGainP(); | |
1058 | for(Int_t iPCounter = 0; iPCounter < arrayPSide.GetSize(); iPCounter++) | |
1059 | gainSSD->AddGainP(iModule, | |
1060 | iPCounter, | |
1061 | arrayPSide.At(iPCounter)); | |
1062 | TArrayF arrayNSide = gainModule->GetGainN(); | |
1063 | for(Int_t iNCounter = 0; iNCounter < arrayNSide.GetSize(); iNCounter++) | |
1064 | gainSSD->AddGainN(iModule, | |
1065 | iNCounter, | |
1066 | arrayNSide.At(iNCounter)); | |
1067 | }//loop over modules | |
1068 | } | |
1069 | ||
8ba39da9 | 1070 |