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