]>
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. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
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 | ||
fcf95fc7 | 20 | |
7d62fb64 | 21 | ///////////////////////////////////////////////////////////////////// |
22 | // Base simulation functions for ITS // | |
23 | // // | |
24 | // // | |
25 | ///////////////////////////////////////////////////////////////////// | |
26 | #include "TBranch.h" | |
27 | #include "TClonesArray.h" | |
28 | #include "TObjArray.h" | |
29 | #include "TTree.h" | |
30 | ||
31 | #include "AliRun.h" | |
8ba39da9 | 32 | |
33 | #include "AliCDBManager.h" | |
34 | #include "AliCDBId.h" | |
35 | #include "AliCDBStorage.h" | |
36 | #include "AliCDBEntry.h" | |
37 | #include "AliCDBMetaData.h" | |
38 | ||
7d62fb64 | 39 | #include "AliITSdigit.h" |
40 | #include "AliITSdigitSPD.h" | |
41 | #include "AliITSdigitSDD.h" | |
42 | #include "AliITSdigitSSD.h" | |
3b9df642 | 43 | #include "AliITSDetTypeSim.h" |
7d62fb64 | 44 | #include "AliITSpListItem.h" |
fcf95fc7 | 45 | #include "AliITSCalibrationSDD.h" |
028a3709 | 46 | #include "AliITSMapSDD.h" |
18da6e54 | 47 | #include "AliITSDriftSpeedArraySDD.h" |
140e5249 | 48 | #include "AliITSDriftSpeedSDD.h" |
fcf95fc7 | 49 | #include "AliITSCalibrationSSD.h" |
88128115 | 50 | #include "AliITSNoiseSSDv2.h" |
51 | #include "AliITSGainSSDv2.h" | |
52 | #include "AliITSBadChannelsSSDv2.h" | |
fb4dfab9 | 53 | #include "AliITSNoiseSSD.h" |
54 | #include "AliITSGainSSD.h" | |
55 | #include "AliITSBadChannelsSSD.h" | |
56 | #include "AliITSCalibrationSSD.h" | |
7d62fb64 | 57 | #include "AliITSsegmentationSPD.h" |
58 | #include "AliITSsegmentationSDD.h" | |
59 | #include "AliITSsegmentationSSD.h" | |
60 | #include "AliITSsimulation.h" | |
61 | #include "AliITSsimulationSPD.h" | |
62 | #include "AliITSsimulationSDD.h" | |
63 | #include "AliITSsimulationSSD.h" | |
64 | ||
65 | ||
66 | const Int_t AliITSDetTypeSim::fgkNdettypes = 3; | |
8ba39da9 | 67 | const Int_t AliITSDetTypeSim::fgkDefaultNModulesSPD = 240; |
68 | const Int_t AliITSDetTypeSim::fgkDefaultNModulesSDD = 260; | |
69 | const Int_t AliITSDetTypeSim::fgkDefaultNModulesSSD = 1698; | |
3b9df642 | 70 | |
71 | ClassImp(AliITSDetTypeSim) | |
72 | ||
73 | //---------------------------------------------------------------------- | |
74 | AliITSDetTypeSim::AliITSDetTypeSim(): | |
75 | TObject(), | |
3b9df642 | 76 | fSimulation(), // [NDet] |
77 | fSegmentation(), // [NDet] | |
fcf95fc7 | 78 | fCalibration(), // [NMod] |
ced4d9bc | 79 | fSSDCalibration(0), |
3b9df642 | 80 | fPreProcess(), // [] e.g. Fill fHitModule with hits |
81 | fPostProcess(), // [] e.g. Wright Raw data | |
3b9df642 | 82 | fNSDigits(0), //! number of SDigits |
e6b4e6b9 | 83 | fSDigits("AliITSpListItem",1000), |
3b9df642 | 84 | fNDigits(0), //! number of Digits |
023ae34b | 85 | fRunNumber(0), //! Run number (to access DB) |
3b9df642 | 86 | fDigits(), //! [NMod][NDigits] |
cd2a0045 | 87 | fSimuPar(0), |
979b5a5f | 88 | fDDLMapSDD(0), |
3b9df642 | 89 | fHitClassName(), // String with Hit class name. |
90 | fSDigClassName(),// String with SDigit class name. | |
023ae34b | 91 | fDigClassName(), // String with digit class name. |
92 | fLoader(0), // local pointer to loader | |
93 | fFirstcall(kTRUE){ // flag | |
3b9df642 | 94 | // Default Constructor |
95 | // Inputs: | |
96 | // none. | |
97 | // Outputs: | |
98 | // none. | |
99 | // Return: | |
100 | // A properly zero-ed AliITSDetTypeSim class. | |
023ae34b | 101 | |
7d62fb64 | 102 | fSimulation = new TObjArray(fgkNdettypes); |
103 | fSegmentation = new TObjArray(fgkNdettypes); | |
1964ae5f | 104 | fSegmentation->SetOwner(kTRUE); |
7d62fb64 | 105 | fDigits = new TObjArray(fgkNdettypes); |
106 | fNDigits = new Int_t[fgkNdettypes]; | |
979b5a5f | 107 | fDDLMapSDD=new AliITSDDLModuleMapSDD(); |
cd2a0045 | 108 | fSimuPar= new AliITSSimuParam(); |
ced4d9bc | 109 | fSSDCalibration=new AliITSCalibrationSSD(); |
8ba39da9 | 110 | fNMod[0] = fgkDefaultNModulesSPD; |
111 | fNMod[1] = fgkDefaultNModulesSDD; | |
112 | fNMod[2] = fgkDefaultNModulesSSD; | |
113 | SetRunNumber(); | |
3b9df642 | 114 | } |
115 | //---------------------------------------------------------------------- | |
116 | AliITSDetTypeSim::~AliITSDetTypeSim(){ | |
117 | // Destructor | |
118 | // Inputs: | |
119 | // none. | |
120 | // Outputs: | |
121 | // none. | |
122 | // Return: | |
123 | // Nothing. | |
023ae34b | 124 | |
7d62fb64 | 125 | if(fSimulation){ |
023ae34b | 126 | fSimulation->Delete(); |
127 | delete fSimulation; | |
7d62fb64 | 128 | } |
023ae34b | 129 | fSimulation = 0; |
7d62fb64 | 130 | if(fSegmentation){ |
023ae34b | 131 | fSegmentation->Delete(); |
132 | delete fSegmentation; | |
7d62fb64 | 133 | } |
023ae34b | 134 | fSegmentation = 0; |
b17dae48 | 135 | if(fCalibration && fRunNumber<0){ |
023ae34b | 136 | AliITSresponse* rspd = ((AliITSCalibration*)fCalibration->At( |
137 | GetITSgeom()->GetStartSPD()))->GetResponse(); | |
023ae34b | 138 | AliITSresponse* rssd = ((AliITSCalibration*)fCalibration->At( |
139 | GetITSgeom()->GetStartSSD()))->GetResponse(); | |
140 | if(rspd) delete rspd; | |
023ae34b | 141 | if(rssd) delete rssd; |
142 | fCalibration->Delete(); | |
143 | delete fCalibration; | |
7d62fb64 | 144 | } |
023ae34b | 145 | fCalibration = 0; |
ced4d9bc | 146 | if(fSSDCalibration) delete fSSDCalibration; |
147 | if(fPreProcess){ | |
023ae34b | 148 | fPreProcess->Delete(); |
149 | delete fPreProcess; | |
7d62fb64 | 150 | } |
023ae34b | 151 | fPreProcess = 0; |
7d62fb64 | 152 | if(fPostProcess){ |
023ae34b | 153 | fPostProcess->Delete(); |
154 | delete fPostProcess; | |
7d62fb64 | 155 | } |
023ae34b | 156 | fPostProcess = 0; |
cd2a0045 | 157 | if(fSimuPar) delete fSimuPar; |
979b5a5f | 158 | if(fDDLMapSDD) delete fDDLMapSDD; |
2a476797 | 159 | if(fNDigits) delete [] fNDigits; |
023ae34b | 160 | fNDigits = 0; |
161 | if (fLoader)fLoader->GetModulesFolder()->Remove(this); | |
162 | fLoader = 0; // Not deleting it. | |
e6b4e6b9 | 163 | fSDigits.Delete(); |
7d62fb64 | 164 | if (fDigits) { |
165 | fDigits->Delete(); | |
166 | delete fDigits; | |
7d62fb64 | 167 | } |
023ae34b | 168 | fDigits=0; |
3b9df642 | 169 | } |
170 | //---------------------------------------------------------------------- | |
7537d03c | 171 | AliITSDetTypeSim::AliITSDetTypeSim(const AliITSDetTypeSim &source) : TObject(source), |
172 | fSimulation(source.fSimulation), // [NDet] | |
173 | fSegmentation(source.fSegmentation), // [NDet] | |
174 | fCalibration(source.fCalibration), // [NMod] | |
ced4d9bc | 175 | fSSDCalibration(source.fSSDCalibration), |
7537d03c | 176 | fPreProcess(source.fPreProcess), // [] e.g. Fill fHitModule with hits |
177 | fPostProcess(source.fPostProcess), // [] e.g. Wright Raw data | |
178 | fNSDigits(source.fNSDigits), //! number of SDigits | |
e6b4e6b9 | 179 | fSDigits(*((TClonesArray*)source.fSDigits.Clone())), |
7537d03c | 180 | fNDigits(source.fNDigits), //! number of Digits |
181 | fRunNumber(source.fRunNumber), //! Run number (to access DB) | |
182 | fDigits(source.fDigits), //! [NMod][NDigits] | |
cd2a0045 | 183 | fSimuPar(source.fSimuPar), |
979b5a5f | 184 | fDDLMapSDD(source.fDDLMapSDD), |
7537d03c | 185 | fHitClassName(source.fHitClassName), // String with Hit class name. |
186 | fSDigClassName(source.fSDigClassName),// String with SDigit class name. | |
187 | fDigClassName(), // String with digit class name. | |
188 | fLoader(source.fLoader), // local pointer to loader | |
189 | fFirstcall(source.fFirstcall) | |
190 | { | |
7d62fb64 | 191 | // Copy Constructor for object AliITSDetTypeSim not allowed |
7537d03c | 192 | for(Int_t i=0;i<fgkNdettypes;i++){ |
193 | fDigClassName[i] = source.fDigClassName[i]; | |
194 | } | |
3b9df642 | 195 | } |
196 | //---------------------------------------------------------------------- | |
7d62fb64 | 197 | AliITSDetTypeSim& AliITSDetTypeSim::operator=(const AliITSDetTypeSim &source){ |
3b9df642 | 198 | // The = operator for object AliITSDetTypeSim |
7d62fb64 | 199 | |
7537d03c | 200 | this->~AliITSDetTypeSim(); |
201 | new(this) AliITSDetTypeSim(source); | |
202 | return *this; | |
3b9df642 | 203 | } |
7d62fb64 | 204 | |
023ae34b | 205 | //______________________________________________________________________ |
206 | void AliITSDetTypeSim::SetITSgeom(AliITSgeom *geom){ | |
207 | // Sets/replaces the existing AliITSgeom object kept in AliITSLoader | |
208 | // | |
209 | // Inputs: | |
210 | // AliITSgoem *geom The AliITSgeom object to be used. | |
211 | // Output: | |
212 | // none. | |
213 | // Return: | |
214 | // none. | |
215 | if(!fLoader){ | |
216 | Error("SetITSgeom","No pointer to loader - nothing done"); | |
217 | return; | |
218 | } | |
219 | else { | |
220 | fLoader->SetITSgeom(geom); // protections in AliITSLoader::SetITSgeom | |
221 | } | |
222 | ||
223 | } | |
224 | //______________________________________________________________________ | |
225 | void AliITSDetTypeSim::SetLoader(AliITSLoader *loader){ | |
226 | // Sets the local copy of the AliITSLoader, and passes on the | |
227 | // AliITSgeom object as needed. | |
228 | // Inputs | |
229 | // AliITSLoader *loader pointer to AliITSLoader for local use | |
230 | // Outputs: | |
231 | // none. | |
232 | // Return: | |
233 | // none. | |
234 | ||
235 | if(fLoader==loader) return; // Same do nothing | |
236 | if(fLoader){ // alread have an existing loader | |
237 | Error("SetLoader", | |
238 | "Already have an exisiting loader ptr=%p Nothing done", | |
239 | fLoader); | |
240 | } // end if | |
241 | fLoader = loader; | |
242 | } | |
3b9df642 | 243 | //______________________________________________________________________ |
7d62fb64 | 244 | void AliITSDetTypeSim::SetSimulationModel(Int_t dettype,AliITSsimulation *sim){ |
245 | ||
246 | //Set simulation model for detector type | |
247 | ||
248 | if(fSimulation==0) fSimulation = new TObjArray(fgkNdettypes); | |
249 | fSimulation->AddAt(sim,dettype); | |
250 | } | |
251 | //______________________________________________________________________ | |
252 | AliITSsimulation* AliITSDetTypeSim::GetSimulationModel(Int_t dettype){ | |
253 | ||
254 | //Get simulation model for detector type | |
255 | if(fSimulation==0) { | |
256 | Warning("GetSimulationModel","fSimulation is 0!"); | |
257 | return 0; | |
258 | } | |
259 | return (AliITSsimulation*)(fSimulation->At(dettype)); | |
260 | } | |
261 | //______________________________________________________________________ | |
262 | AliITSsimulation* AliITSDetTypeSim::GetSimulationModelByModule(Int_t module){ | |
263 | ||
264 | //Get simulation model by module number | |
023ae34b | 265 | if(GetITSgeom()==0) { |
266 | Warning("GetSimulationModelByModule","GetITSgeom() is 0!"); | |
7d62fb64 | 267 | return 0; |
268 | } | |
269 | ||
023ae34b | 270 | return GetSimulationModel(GetITSgeom()->GetModuleType(module)); |
7d62fb64 | 271 | } |
fcf95fc7 | 272 | //_______________________________________________________________________ |
1964ae5f | 273 | void AliITSDetTypeSim::SetDefaultSegmentation(Int_t idet){ |
023ae34b | 274 | // Set default segmentation model objects |
275 | AliITSsegmentation *seg; | |
1964ae5f | 276 | |
023ae34b | 277 | if(fSegmentation==0x0){ |
278 | fSegmentation = new TObjArray(fgkNdettypes); | |
279 | fSegmentation->SetOwner(kTRUE); | |
280 | } | |
281 | if(GetSegmentationModel(idet)) | |
282 | delete (AliITSsegmentation*)fSegmentation->At(idet); | |
283 | if(idet==0){ | |
d24bc9d6 | 284 | seg = new AliITSsegmentationSPD(); |
023ae34b | 285 | }else if(idet==1){ |
d24bc9d6 | 286 | seg = new AliITSsegmentationSDD(); |
023ae34b | 287 | }else { |
d24bc9d6 | 288 | seg = new AliITSsegmentationSSD(); |
023ae34b | 289 | } |
290 | SetSegmentationModel(idet,seg); | |
291 | } | |
7d62fb64 | 292 | //______________________________________________________________________ |
023ae34b | 293 | void AliITSDetTypeSim::SetSegmentationModel(Int_t dettype, |
294 | AliITSsegmentation *seg){ | |
7d62fb64 | 295 | |
296 | //Set segmentation model for detector type | |
fcf95fc7 | 297 | if(fSegmentation==0x0){ |
1964ae5f | 298 | fSegmentation = new TObjArray(fgkNdettypes); |
299 | fSegmentation->SetOwner(kTRUE); | |
300 | } | |
7d62fb64 | 301 | fSegmentation->AddAt(seg,dettype); |
7d62fb64 | 302 | } |
303 | //______________________________________________________________________ | |
304 | AliITSsegmentation* AliITSDetTypeSim::GetSegmentationModel(Int_t dettype){ | |
7d62fb64 | 305 | //Get segmentation model for detector type |
306 | ||
307 | if(fSegmentation==0) { | |
023ae34b | 308 | Warning("GetSegmentationModel","fSegmentation is 0!"); |
309 | return 0; | |
7d62fb64 | 310 | } |
311 | return (AliITSsegmentation*)(fSegmentation->At(dettype)); | |
7d62fb64 | 312 | } |
313 | //_______________________________________________________________________ | |
314 | AliITSsegmentation* AliITSDetTypeSim::GetSegmentationModelByModule(Int_t module){ | |
023ae34b | 315 | //Get segmentation model by module number |
316 | if(GetITSgeom()==0){ | |
317 | Warning("GetSegmentationModelByModule","GetITSgeom() is 0!"); | |
318 | return 0; | |
319 | } | |
320 | return GetSegmentationModel(GetITSgeom()->GetModuleType(module)); | |
7d62fb64 | 321 | } |
322 | //_______________________________________________________________________ | |
fcf95fc7 | 323 | void AliITSDetTypeSim::CreateCalibrationArray() { |
023ae34b | 324 | //Create the container of calibration functions with correct size |
325 | if (fCalibration) { | |
326 | Warning("CreateCalibration","pointer to calibration object exists\n"); | |
327 | fCalibration->Delete(); | |
328 | delete fCalibration; | |
329 | } | |
8ba39da9 | 330 | |
023ae34b | 331 | Int_t nModTot = GetITSgeom()->GetIndexMax(); |
332 | fCalibration = new TObjArray(nModTot); | |
333 | fCalibration->SetOwner(kTRUE); | |
334 | fCalibration->Clear(); | |
8ba39da9 | 335 | } |
336 | //_______________________________________________________________________ | |
fcf95fc7 | 337 | void AliITSDetTypeSim::SetCalibrationModel(Int_t iMod, AliITSCalibration *resp){ |
023ae34b | 338 | //Set response model for modules |
8ba39da9 | 339 | |
023ae34b | 340 | if (fCalibration==0) CreateCalibrationArray(); |
8ba39da9 | 341 | |
023ae34b | 342 | if (fCalibration->At(iMod)!=0) |
343 | delete (AliITSCalibration*) fCalibration->At(iMod); | |
344 | fCalibration->AddAt(resp, iMod); | |
8ba39da9 | 345 | } |
7d62fb64 | 346 | //______________________________________________________________________ |
fcf95fc7 | 347 | void AliITSDetTypeSim::ResetCalibrationArray(){ |
023ae34b | 348 | //resets response array |
349 | if(fCalibration && fRunNumber<0){ // if fRunNumber<0 fCalibration is owner | |
350 | AliITSresponse* rspd = ((AliITSCalibration*)fCalibration->At( | |
351 | GetITSgeom()->GetStartSPD()))->GetResponse(); | |
023ae34b | 352 | AliITSresponse* rssd = ((AliITSCalibration*)fCalibration->At( |
353 | GetITSgeom()->GetStartSSD()))->GetResponse(); | |
354 | if(rspd) delete rspd; | |
023ae34b | 355 | if(rssd) delete rssd; |
356 | fCalibration->Clear(); | |
357 | }else if (fCalibration && fRunNumber>=0){ | |
358 | fCalibration->Clear(); | |
359 | } | |
7d62fb64 | 360 | } |
361 | //______________________________________________________________________ | |
362 | void AliITSDetTypeSim::ResetSegmentation(){ | |
023ae34b | 363 | //Resets segmentation array |
364 | if(fSegmentation) fSegmentation->Clear(); | |
7d62fb64 | 365 | } |
7d62fb64 | 366 | //_______________________________________________________________________ |
fcf95fc7 | 367 | AliITSCalibration* AliITSDetTypeSim::GetCalibrationModel(Int_t iMod){ |
023ae34b | 368 | //Get response model for module number iMod |
8ba39da9 | 369 | |
023ae34b | 370 | if(fCalibration==0) { |
371 | AliError("fCalibration is 0!"); | |
372 | return 0; | |
373 | } | |
ced4d9bc | 374 | if(iMod<fgkDefaultNModulesSPD+fgkDefaultNModulesSDD){ |
375 | return (AliITSCalibration*)fCalibration->At(iMod); | |
376 | }else{ | |
377 | Int_t i=iMod-(fgkDefaultNModulesSPD+fgkDefaultNModulesSDD); | |
378 | fSSDCalibration->SetModule(i); | |
379 | return (AliITSCalibration*)fSSDCalibration; | |
380 | } | |
381 | ||
7d62fb64 | 382 | } |
383 | //_______________________________________________________________________ | |
384 | void AliITSDetTypeSim::SetDefaults(){ | |
023ae34b | 385 | //Set defaults for segmentation and response |
386 | ||
387 | if(GetITSgeom()==0){ | |
388 | Warning("SetDefaults","GetITSgeom() is 0!"); | |
389 | return; | |
390 | } // end if | |
391 | if (fCalibration==0) { | |
392 | CreateCalibrationArray(); | |
393 | } // end if | |
394 | ||
395 | ResetSegmentation(); | |
396 | if(!GetCalibration()){AliFatal("Exit"); exit(0);} | |
397 | ||
fa4f0f62 | 398 | SetDigitClassName(0,"AliITSdigitSPD"); |
399 | SetDigitClassName(1,"AliITSdigitSDD"); | |
400 | SetDigitClassName(2,"AliITSdigitSSD"); | |
401 | ||
023ae34b | 402 | for(Int_t idet=0;idet<fgkNdettypes;idet++){ |
fa4f0f62 | 403 | if(!GetSegmentationModel(idet)) SetDefaultSegmentation(idet); |
404 | } | |
8ba39da9 | 405 | } |
8ba39da9 | 406 | //______________________________________________________________________ |
407 | Bool_t AliITSDetTypeSim::GetCalibration() { | |
408 | // Get Default calibration if a storage is not defined. | |
7d62fb64 | 409 | |
b17dae48 | 410 | if(!fFirstcall){ |
411 | AliITSCalibration* cal = GetCalibrationModel(0); | |
412 | if(cal)return kTRUE; | |
413 | } | |
414 | else { | |
415 | fFirstcall = kFALSE; | |
416 | } | |
417 | ||
418 | SetRunNumber((Int_t)AliCDBManager::Instance()->GetRun()); | |
419 | Int_t run=GetRunNumber(); | |
b17dae48 | 420 | |
421 | Bool_t origCacheStatus = AliCDBManager::Instance()->GetCacheFlag(); | |
422 | Bool_t isCacheActive = kTRUE; | |
423 | if(GetRunNumber()<0){ | |
424 | isCacheActive=kFALSE; | |
425 | fCalibration->SetOwner(kTRUE); | |
426 | } | |
427 | else{ | |
428 | fCalibration->SetOwner(kFALSE); | |
429 | } | |
430 | ||
431 | AliCDBManager::Instance()->SetCacheFlag(isCacheActive); | |
432 | ||
6727e2db | 433 | AliCDBEntry *entrySPD = AliCDBManager::Instance()->Get("ITS/Calib/SPDDead", run); |
b17dae48 | 434 | AliCDBEntry *entrySDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD", run); |
18da6e54 | 435 | AliCDBEntry *drSpSDD = AliCDBManager::Instance()->Get("ITS/Calib/DriftSpeedSDD",run); |
979b5a5f | 436 | AliCDBEntry *ddlMapSDD = AliCDBManager::Instance()->Get("ITS/Calib/DDLMapSDD",run); |
028a3709 | 437 | AliCDBEntry *mapASDD = AliCDBManager::Instance()->Get("ITS/Calib/MapsAnodeSDD",run); |
438 | AliCDBEntry *mapTSDD = AliCDBManager::Instance()->Get("ITS/Calib/MapsTimeSDD",run); | |
fb4dfab9 | 439 | // AliCDBEntry *entrySSD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSSD", run); |
028a3709 | 440 | AliCDBEntry *entryNoiseSSD = AliCDBManager::Instance()->Get("ITS/Calib/NoiseSSD"); |
441 | AliCDBEntry *entryGainSSD = AliCDBManager::Instance()->Get("ITS/Calib/GainSSD"); | |
442 | AliCDBEntry *entryBadChannelsSSD = AliCDBManager::Instance()->Get("ITS/Calib/BadChannelsSSD"); | |
fb4dfab9 | 443 | |
b17dae48 | 444 | AliCDBEntry *entry2SPD = AliCDBManager::Instance()->Get("ITS/Calib/RespSPD", run); |
b17dae48 | 445 | AliCDBEntry *entry2SSD = AliCDBManager::Instance()->Get("ITS/Calib/RespSSD", run); |
06232459 | 446 | |
fb4dfab9 | 447 | if(!entrySPD || !entrySDD || !entryNoiseSSD || !entryGainSSD || !entryBadChannelsSSD || |
253e68a0 | 448 | !entry2SPD || !entry2SSD || !drSpSDD || !ddlMapSDD || !mapASDD ||!mapTSDD){ |
fb4dfab9 | 449 | AliFatal("Calibration object retrieval failed! "); |
450 | return kFALSE; | |
451 | } | |
8ba39da9 | 452 | |
028a3709 | 453 | // if(!entrySPD || !entrySDD || !entryNoiseSSD || !entryGainSSD || !entryBadChannelsSSD || |
253e68a0 | 454 | // !entry2SPD || !entry2SSD){ |
028a3709 | 455 | // AliFatal("Calibration object retrieval failed! "); |
456 | // return kFALSE; | |
457 | // } | |
06232459 | 458 | |
b17dae48 | 459 | TObjArray *calSPD = (TObjArray *)entrySPD->GetObject(); |
460 | if(!isCacheActive)entrySPD->SetObject(NULL); | |
8ba39da9 | 461 | entrySPD->SetOwner(kTRUE); |
06232459 | 462 | |
fcf95fc7 | 463 | AliITSresponseSPD *pSPD = (AliITSresponseSPD*)entry2SPD->GetObject(); |
b17dae48 | 464 | if(!isCacheActive)entry2SPD->SetObject(NULL); |
fcf95fc7 | 465 | entry2SPD->SetOwner(kTRUE); |
466 | ||
b17dae48 | 467 | TObjArray *calSDD = (TObjArray *)entrySDD->GetObject(); |
468 | if(!isCacheActive)entrySDD->SetObject(NULL); | |
8ba39da9 | 469 | entrySDD->SetOwner(kTRUE); |
06232459 | 470 | |
18da6e54 | 471 | TObjArray *drSp = (TObjArray *)drSpSDD->GetObject(); |
472 | if(!isCacheActive)drSpSDD->SetObject(NULL); | |
473 | drSpSDD->SetOwner(kTRUE); | |
474 | ||
979b5a5f | 475 | AliITSDDLModuleMapSDD *ddlsdd=(AliITSDDLModuleMapSDD*)ddlMapSDD->GetObject(); |
476 | if(!isCacheActive)ddlMapSDD->SetObject(NULL); | |
477 | ddlMapSDD->SetOwner(kTRUE); | |
478 | ||
028a3709 | 479 | TObjArray *mapAn = (TObjArray *)mapASDD->GetObject(); |
480 | if(!isCacheActive)mapASDD->SetObject(NULL); | |
481 | mapASDD->SetOwner(kTRUE); | |
482 | ||
483 | TObjArray *mapT = (TObjArray *)mapTSDD->GetObject(); | |
484 | if(!isCacheActive)mapTSDD->SetObject(NULL); | |
485 | mapTSDD->SetOwner(kTRUE); | |
486 | ||
fb4dfab9 | 487 | /* |
b17dae48 | 488 | TObjArray *calSSD = (TObjArray *)entrySSD->GetObject(); |
489 | if(!isCacheActive)entrySSD->SetObject(NULL); | |
8ba39da9 | 490 | entrySSD->SetOwner(kTRUE); |
fb4dfab9 | 491 | */ |
492 | ||
88128115 | 493 | TObject *emptyssd = 0; TString ssdobjectname = 0; |
494 | AliITSNoiseSSDv2 *noiseSSD = new AliITSNoiseSSDv2(); | |
495 | emptyssd = (TObject *)entryNoiseSSD->GetObject(); | |
496 | ssdobjectname = emptyssd->GetName(); | |
497 | if(ssdobjectname=="TObjArray") { | |
498 | TObjArray *noiseSSDOld = (TObjArray *)entryNoiseSSD->GetObject(); | |
499 | ReadOldSSDNoise(noiseSSDOld, noiseSSD); | |
500 | } | |
501 | else if(ssdobjectname=="AliITSNoiseSSDv2") | |
502 | noiseSSD = (AliITSNoiseSSDv2 *)entryNoiseSSD->GetObject(); | |
fb4dfab9 | 503 | if(!isCacheActive)entryNoiseSSD->SetObject(NULL); |
504 | entryNoiseSSD->SetOwner(kTRUE); | |
505 | ||
88128115 | 506 | AliITSGainSSDv2 *gainSSD = new AliITSGainSSDv2(); |
507 | emptyssd = (TObject *)entryGainSSD->GetObject(); | |
508 | ssdobjectname = emptyssd->GetName(); | |
509 | if(ssdobjectname=="Gain") { | |
510 | TObjArray *gainSSDOld = (TObjArray *)entryGainSSD->GetObject(); | |
511 | ReadOldSSDGain(gainSSDOld, gainSSD); | |
512 | } | |
513 | else if(ssdobjectname=="AliITSGainSSDv2") | |
514 | gainSSD = (AliITSGainSSDv2 *)entryGainSSD->GetObject(); | |
fb4dfab9 | 515 | if(!isCacheActive)entryGainSSD->SetObject(NULL); |
516 | entryGainSSD->SetOwner(kTRUE); | |
517 | ||
88128115 | 518 | AliITSBadChannelsSSDv2 *badChannelsSSD = new AliITSBadChannelsSSDv2(); |
519 | emptyssd = (TObject *)entryBadChannelsSSD->GetObject(); | |
520 | ssdobjectname = emptyssd->GetName(); | |
521 | if(ssdobjectname=="TObjArray") { | |
522 | TObjArray *badChannelsSSDOld = (TObjArray *)entryBadChannelsSSD->GetObject(); | |
523 | ReadOldSSDBadChannels(badChannelsSSDOld, badChannelsSSD); | |
524 | } | |
525 | else if(ssdobjectname=="AliITSBadChannelsSSDv2") | |
526 | badChannelsSSD = (AliITSBadChannelsSSDv2*)entryBadChannelsSSD->GetObject(); | |
fb4dfab9 | 527 | if(!isCacheActive)entryBadChannelsSSD->SetObject(NULL); |
528 | entryBadChannelsSSD->SetOwner(kTRUE); | |
06232459 | 529 | |
88128115 | 530 | /*AliITSNoiseSSDv2 *noiseSSD = (AliITSNoiseSSDv2 *)entryNoiseSSD->GetObject(); |
531 | if(!isCacheActive)entryNoiseSSD->SetObject(NULL); | |
532 | entryNoiseSSD->SetOwner(kTRUE); | |
533 | ||
534 | AliITSGainSSDv2 *gainSSD = (AliITSGainSSDv2 *)entryGainSSD->GetObject(); | |
535 | if(!isCacheActive)entryGainSSD->SetObject(NULL); | |
536 | entryGainSSD->SetOwner(kTRUE); | |
537 | ||
538 | AliITSBadChannelsSSDv2 *badchannelsSSD = | |
539 | (AliITSBadChannelsSSDv2 *)entryBadChannelsSSD->GetObject(); | |
540 | if(!isCacheActive)entryBadChannelsSSD->SetObject(NULL); | |
541 | entryBadChannelsSSD->SetOwner(kTRUE);*/ | |
542 | ||
fcf95fc7 | 543 | AliITSresponseSSD *pSSD = (AliITSresponseSSD*)entry2SSD->GetObject(); |
b17dae48 | 544 | if(!isCacheActive)entry2SSD->SetObject(NULL); |
fcf95fc7 | 545 | entry2SSD->SetOwner(kTRUE); |
546 | ||
b17dae48 | 547 | // DB entries are deleted. In this way metadeta objects are deleted as well |
548 | if(!isCacheActive){ | |
549 | delete entrySPD; | |
550 | delete entrySDD; | |
fb4dfab9 | 551 | delete entryNoiseSSD; |
552 | delete entryGainSSD; | |
553 | delete entryBadChannelsSSD; | |
b17dae48 | 554 | delete entry2SPD; |
b17dae48 | 555 | delete entry2SSD; |
028a3709 | 556 | delete mapASDD; |
557 | delete mapTSDD; | |
18da6e54 | 558 | delete drSpSDD; |
979b5a5f | 559 | delete ddlMapSDD; |
b17dae48 | 560 | } |
fcf95fc7 | 561 | |
b17dae48 | 562 | AliCDBManager::Instance()->SetCacheFlag(origCacheStatus); |
563 | ||
253e68a0 | 564 | if ((!pSPD)||(!pSSD) || (!calSPD) || (!calSDD) || (!drSp) || (!ddlsdd) |
88128115 | 565 | || (!mapAn) || (!mapT) || (!noiseSSD)|| (!gainSSD)|| (!badChannelsSSD)) { |
8ba39da9 | 566 | AliWarning("Can not get calibration from calibration database !"); |
567 | return kFALSE; | |
568 | } | |
fb4dfab9 | 569 | |
b17dae48 | 570 | fNMod[0] = calSPD->GetEntries(); |
571 | fNMod[1] = calSDD->GetEntries(); | |
ced4d9bc | 572 | // fNMod[2] = noiseSSD->GetEntries(); |
8ba39da9 | 573 | AliInfo(Form("%i SPD, %i SDD and %i SSD in calibration database", |
574 | fNMod[0], fNMod[1], fNMod[2])); | |
b17dae48 | 575 | AliITSCalibration* cal; |
8ba39da9 | 576 | for (Int_t i=0; i<fNMod[0]; i++) { |
b17dae48 | 577 | cal = (AliITSCalibration*) calSPD->At(i); |
578 | cal->SetResponse(pSPD); | |
579 | SetCalibrationModel(i, cal); | |
18da6e54 | 580 | } |
140e5249 | 581 | |
582 | fDDLMapSDD->SetDDLMap(ddlsdd); | |
946db678 | 583 | |
584 | for (Int_t i=0; i<fgkDefaultNModulesSDD; i++) { | |
585 | Int_t iddl,icarlos; | |
586 | Int_t iMod = i + fgkDefaultNModulesSPD; | |
587 | fDDLMapSDD->FindInDDLMap(iMod,iddl,icarlos); | |
588 | if(iddl<0){ | |
589 | AliITSCalibrationSDD* calsdddead=new AliITSCalibrationSDD(); | |
946db678 | 590 | calsdddead->SetBad(); |
591 | AliITSDriftSpeedSDD* driftspdef = new AliITSDriftSpeedSDD(); | |
592 | AliITSDriftSpeedArraySDD* arrdrsp=new AliITSDriftSpeedArraySDD(1); | |
593 | arrdrsp->AddDriftSpeed(driftspdef); | |
594 | calsdddead->SetDriftSpeed(0,arrdrsp); | |
595 | calsdddead->SetDriftSpeed(1,arrdrsp); | |
596 | SetCalibrationModel(iMod, calsdddead); | |
597 | AliWarning(Form("SDD module %d not present in DDL map: set it as dead",iMod)); | |
598 | }else{ | |
140e5249 | 599 | cal = (AliITSCalibration*) calSDD->At(i); |
140e5249 | 600 | Int_t i0=2*i; |
601 | Int_t i1=1+2*i; | |
602 | AliITSDriftSpeedArraySDD* arr0 = (AliITSDriftSpeedArraySDD*) drSp->At(i0); | |
603 | AliITSMapSDD* ma0 = (AliITSMapSDD*)mapAn->At(i0); | |
604 | AliITSMapSDD* mt0 = (AliITSMapSDD*)mapT->At(i0); | |
605 | AliITSDriftSpeedArraySDD* arr1 = (AliITSDriftSpeedArraySDD*) drSp->At(i1); | |
606 | AliITSMapSDD* ma1 = (AliITSMapSDD*)mapAn->At(i1); | |
607 | AliITSMapSDD* mt1 = (AliITSMapSDD*)mapT->At(i1); | |
608 | cal->SetDriftSpeed(0,arr0); | |
609 | cal->SetDriftSpeed(1,arr1); | |
610 | cal->SetMapA(0,ma0); | |
611 | cal->SetMapA(1,ma1); | |
612 | cal->SetMapT(0,mt0); | |
613 | cal->SetMapT(1,mt1); | |
614 | SetCalibrationModel(iMod, cal); | |
615 | } | |
616 | } | |
946db678 | 617 | |
ced4d9bc | 618 | fSSDCalibration->SetResponse((AliITSresponse*)pSSD); |
619 | fSSDCalibration->SetNoise(noiseSSD); | |
620 | fSSDCalibration->SetGain(gainSSD); | |
88128115 | 621 | fSSDCalibration->SetBadChannels(badChannelsSSD); |
ced4d9bc | 622 | //fSSDCalibration->FillBadChipMap(); |
623 | ||
624 | ||
625 | /* | |
8ba39da9 | 626 | for (Int_t i=0; i<fNMod[2]; i++) { |
fb4dfab9 | 627 | AliITSCalibrationSSD *calibSSD = new AliITSCalibrationSSD(); |
628 | calibSSD->SetResponse((AliITSresponse*)pSSD); | |
629 | ||
630 | AliITSNoiseSSD *noise = (AliITSNoiseSSD*) (noiseSSD->At(i)); | |
631 | calibSSD->SetNoise(noise); | |
632 | AliITSGainSSD *gain = (AliITSGainSSD*) (gainSSD->At(i)); | |
633 | calibSSD->SetGain(gain); | |
634 | AliITSBadChannelsSSD *bad = (AliITSBadChannelsSSD*) (badchannelsSSD->At(i)); | |
635 | calibSSD->SetBadChannels(bad); | |
636 | ||
6cc25d49 | 637 | Int_t iMod = i + fgkDefaultNModulesSPD + fgkDefaultNModulesSDD; |
fb4dfab9 | 638 | SetCalibrationModel(iMod, calibSSD); |
639 | ||
ced4d9bc | 640 | } |
641 | */ | |
642 | ||
643 | ||
8ba39da9 | 644 | return kTRUE; |
7d62fb64 | 645 | } |
7d62fb64 | 646 | //_______________________________________________________________________ |
647 | void AliITSDetTypeSim::SetDefaultSimulation(){ | |
7d62fb64 | 648 | //Set default simulation for detector type |
649 | ||
023ae34b | 650 | if(GetITSgeom()==0){ |
651 | Warning("SetDefaultSimulation","GetITSgeom() is 0!"); | |
8ba39da9 | 652 | return; |
653 | } | |
fcf95fc7 | 654 | if(fCalibration==0){ |
655 | Warning("SetDefaultSimulation","fCalibration is 0!"); | |
7d62fb64 | 656 | return; |
657 | } | |
fcf95fc7 | 658 | if(fSegmentation==0){ |
659 | Warning("SetDefaultSimulation","fSegmentation is 0!"); | |
660 | for(Int_t i=0;i<fgkNdettypes;i++) SetDefaultSegmentation(i); | |
023ae34b | 661 | }else for(Int_t i=0;i<fgkNdettypes;i++) if(!GetSegmentationModel(i)){ |
662 | Warning("SetDefaultSimulation", | |
663 | "Segmentation not defined for det %d - Default taken\n!",i); | |
664 | SetDefaultSegmentation(i); | |
1964ae5f | 665 | } |
7d62fb64 | 666 | AliITSsimulation* sim; |
667 | ||
668 | for(Int_t idet=0;idet<fgkNdettypes;idet++){ | |
669 | //SPD | |
670 | if(idet==0){ | |
023ae34b | 671 | sim = GetSimulationModel(idet); |
7d62fb64 | 672 | if(!sim){ |
8ba39da9 | 673 | sim = new AliITSsimulationSPD(this); |
7d62fb64 | 674 | SetSimulationModel(idet,sim); |
7d62fb64 | 675 | } |
676 | } | |
677 | //SDD | |
678 | if(idet==1){ | |
679 | sim = GetSimulationModel(idet); | |
680 | if(!sim){ | |
8ba39da9 | 681 | sim = new AliITSsimulationSDD(this); |
7d62fb64 | 682 | SetSimulationModel(idet,sim); |
023ae34b | 683 | } |
7d62fb64 | 684 | } |
685 | //SSD | |
686 | if(idet==2){ | |
687 | sim = GetSimulationModel(idet); | |
688 | if(!sim){ | |
8ba39da9 | 689 | sim = new AliITSsimulationSSD(this); |
7d62fb64 | 690 | SetSimulationModel(idet,sim); |
7d62fb64 | 691 | } |
7d62fb64 | 692 | } |
693 | ||
694 | } | |
695 | } | |
7d62fb64 | 696 | //___________________________________________________________________ |
697 | void AliITSDetTypeSim::SetTreeAddressS(TTree* treeS, Char_t* name){ | |
023ae34b | 698 | // Set branch address for the ITS summable digits Trees. |
7d62fb64 | 699 | char branchname[30]; |
700 | ||
701 | if(!treeS){ | |
702 | return; | |
703 | } | |
7d62fb64 | 704 | TBranch *branch; |
705 | sprintf(branchname,"%s",name); | |
706 | branch = treeS->GetBranch(branchname); | |
e6b4e6b9 | 707 | TClonesArray *sdigi = &fSDigits; |
708 | if (branch) branch->SetAddress(&sdigi); | |
7d62fb64 | 709 | |
710 | } | |
711 | //___________________________________________________________________ | |
712 | void AliITSDetTypeSim::SetTreeAddressD(TTree* treeD, Char_t* name){ | |
713 | // Set branch address for the digit Trees. | |
714 | ||
715 | const char *det[3] = {"SPD","SDD","SSD"}; | |
716 | TBranch *branch; | |
717 | ||
718 | char branchname[30]; | |
719 | ||
720 | if(!treeD){ | |
721 | return; | |
722 | } | |
723 | if(!fDigits){ | |
724 | fDigits = new TObjArray(fgkNdettypes); | |
725 | } | |
726 | for(Int_t i=0;i<fgkNdettypes;i++){ | |
727 | Char_t* digclass = GetDigitClassName(i); | |
728 | if(digclass==0x0){ | |
729 | if(i==0) SetDigitClassName(i,"AliITSdigitSPD"); | |
730 | if(i==1) SetDigitClassName(i,"AliITSdigitSDD"); | |
731 | if(i==2) SetDigitClassName(i,"AliITSdigitSSD"); | |
732 | digclass = GetDigitClassName(i); | |
733 | } | |
734 | TString classn = digclass; | |
735 | if(!(fDigits->At(i))){ | |
736 | fDigits->AddAt(new TClonesArray(classn.Data(),1000),i); | |
3b9df642 | 737 | }else{ |
7d62fb64 | 738 | ResetDigits(i); |
739 | } | |
740 | ||
741 | if(fgkNdettypes==3) sprintf(branchname,"%sDigits%s",name,det[i]); | |
742 | else sprintf(branchname,"%sDigits%d",name,i+1); | |
743 | if(fDigits){ | |
744 | branch = treeD->GetBranch(branchname); | |
745 | if(branch) branch->SetAddress(&((*fDigits)[i])); | |
746 | } | |
747 | } | |
3b9df642 | 748 | |
3b9df642 | 749 | } |
7d62fb64 | 750 | //___________________________________________________________________ |
751 | void AliITSDetTypeSim::ResetDigits(){ | |
023ae34b | 752 | // Reset number of digits and the digits array for the ITS detector. |
7d62fb64 | 753 | |
754 | if(!fDigits){ | |
755 | Error("ResetDigits","fDigits is null!"); | |
756 | return; | |
757 | } | |
758 | for(Int_t i=0;i<fgkNdettypes;i++){ | |
759 | ResetDigits(i); | |
760 | } | |
761 | } | |
762 | //___________________________________________________________________ | |
763 | void AliITSDetTypeSim::ResetDigits(Int_t branch){ | |
764 | // Reset number of digits and the digits array for this branch. | |
765 | ||
766 | if(fDigits->At(branch)){ | |
767 | ((TClonesArray*)fDigits->At(branch))->Clear(); | |
768 | } | |
769 | if(fNDigits) fNDigits[branch]=0; | |
770 | ||
771 | } | |
772 | ||
773 | ||
774 | ||
775 | //_______________________________________________________________________ | |
776 | void AliITSDetTypeSim::SDigitsToDigits(Option_t* opt, Char_t* name){ | |
777 | // Standard Summable digits to Digits function. | |
023ae34b | 778 | if(!GetITSgeom()){ |
779 | Warning("SDigitsToDigits","GetITSgeom() is null!!"); | |
7d62fb64 | 780 | return; |
781 | } | |
782 | ||
783 | const char *all = strstr(opt,"All"); | |
784 | const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"), | |
785 | strstr(opt,"SSD")}; | |
786 | if( !det[0] && !det[1] && !det[2] ) all = "All"; | |
787 | else all = 0; | |
788 | static Bool_t setDef = kTRUE; | |
789 | if(setDef) SetDefaultSimulation(); | |
790 | setDef = kFALSE; | |
791 | ||
792 | AliITSsimulation *sim =0; | |
793 | TTree* trees = fLoader->TreeS(); | |
794 | if( !(trees && GetSDigits()) ){ | |
795 | Error("SDigits2Digits","Error: No trees or SDigits. Returning."); | |
796 | return; | |
797 | } | |
798 | sprintf(name,"%s",name); | |
799 | TBranch* brchSDigits = trees->GetBranch(name); | |
800 | ||
801 | Int_t id; | |
023ae34b | 802 | for(Int_t module=0;module<GetITSgeom()->GetIndexMax();module++){ |
803 | id = GetITSgeom()->GetModuleType(module); | |
7d62fb64 | 804 | if (!all && !det[id]) continue; |
805 | sim = (AliITSsimulation*)GetSimulationModel(id); | |
806 | if(!sim){ | |
807 | Error("SDigit2Digits","The simulation class was not " | |
808 | "instanciated for module %d type %s!",module, | |
023ae34b | 809 | GetITSgeom()->GetModuleTypeName(module)); |
7d62fb64 | 810 | exit(1); |
811 | } | |
812 | sim->InitSimulationModule(module,gAlice->GetEvNumber()); | |
813 | ||
e6b4e6b9 | 814 | fSDigits.Clear(); |
7d62fb64 | 815 | brchSDigits->GetEvent(module); |
e6b4e6b9 | 816 | sim->AddSDigitsToModule(&fSDigits,0); |
7d62fb64 | 817 | sim->FinishSDigitiseModule(); |
818 | fLoader->TreeD()->Fill(); | |
819 | ResetDigits(); | |
820 | } | |
821 | fLoader->TreeD()->GetEntries(); | |
822 | fLoader->TreeD()->AutoSave(); | |
823 | fLoader->TreeD()->Reset(); | |
824 | } | |
7d62fb64 | 825 | //_________________________________________________________ |
023ae34b | 826 | void AliITSDetTypeSim::AddSumDigit(AliITSpListItem &sdig){ |
7d62fb64 | 827 | //Adds the module full of summable digits to the summable digits tree. |
023ae34b | 828 | |
e6b4e6b9 | 829 | new(fSDigits[fNSDigits++]) AliITSpListItem(sdig); |
7d62fb64 | 830 | } |
831 | //__________________________________________________________ | |
023ae34b | 832 | void AliITSDetTypeSim::AddSimDigit(Int_t branch, AliITSdigit* d){ |
7d62fb64 | 833 | // Add a simulated digit. |
023ae34b | 834 | |
7d62fb64 | 835 | TClonesArray &ldigits = *((TClonesArray*)fDigits->At(branch)); |
836 | switch(branch){ | |
837 | case 0: | |
838 | new(ldigits[fNDigits[branch]++]) AliITSdigitSPD(*((AliITSdigitSPD*)d)); | |
839 | break; | |
840 | case 1: | |
841 | new(ldigits[fNDigits[branch]++]) AliITSdigitSDD(*((AliITSdigitSDD*)d)); | |
842 | break; | |
843 | case 2: | |
844 | new(ldigits[fNDigits[branch]++]) AliITSdigitSSD(*((AliITSdigitSSD*)d)); | |
845 | break; | |
023ae34b | 846 | } |
7d62fb64 | 847 | } |
3b9df642 | 848 | //______________________________________________________________________ |
7d62fb64 | 849 | void AliITSDetTypeSim::AddSimDigit(Int_t branch,Float_t phys,Int_t *digits, |
83ec5e27 | 850 | Int_t *tracks,Int_t *hits,Float_t *charges, |
851 | Int_t sigexpanded){ | |
7d62fb64 | 852 | // Add a simulated digit to the list. |
853 | ||
854 | TClonesArray &ldigits = *((TClonesArray*)fDigits->At(branch)); | |
7d62fb64 | 855 | switch(branch){ |
856 | case 0: | |
857 | new(ldigits[fNDigits[branch]++]) AliITSdigitSPD(digits,tracks,hits); | |
858 | break; | |
859 | case 1: | |
7d62fb64 | 860 | new(ldigits[fNDigits[branch]++]) AliITSdigitSDD(phys,digits,tracks, |
83ec5e27 | 861 | hits,charges,sigexpanded); |
7d62fb64 | 862 | break; |
863 | case 2: | |
864 | new(ldigits[fNDigits[branch]++]) AliITSdigitSSD(digits,tracks,hits); | |
865 | break; | |
866 | } | |
3b9df642 | 867 | } |
8ba39da9 | 868 | //______________________________________________________________________ |
023ae34b | 869 | void AliITSDetTypeSim::StoreCalibration(Int_t firstRun, Int_t lastRun, |
870 | AliCDBMetaData &md) { | |
8ba39da9 | 871 | // Store calibration in the calibration database |
8ba39da9 | 872 | // The database must be created in an external piece of code (i.e. |
873 | // a configuration macro ) | |
874 | ||
875 | if(!AliCDBManager::Instance()->IsDefaultStorageSet()) { | |
06232459 | 876 | AliWarning("No storage set! Will use dummy one"); |
8ba39da9 | 877 | AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT"); |
8ba39da9 | 878 | } |
879 | ||
fcf95fc7 | 880 | if (!fCalibration) { |
881 | AliError("AliITSCalibration classes are not defined - nothing done"); | |
8ba39da9 | 882 | return; |
883 | } | |
6727e2db | 884 | AliCDBId idRespSPD("ITS/Calib/SPDDead",firstRun, lastRun); |
fcf95fc7 | 885 | AliCDBId idRespSDD("ITS/Calib/CalibSDD",firstRun, lastRun); |
886 | AliCDBId idRespSSD("ITS/Calib/CalibSSD",firstRun, lastRun); | |
8ba39da9 | 887 | |
888 | TObjArray respSPD(fNMod[0]); | |
889 | TObjArray respSDD(fNMod[1]-fNMod[0]); | |
890 | TObjArray respSSD(fNMod[2]-fNMod[1]); | |
891 | respSPD.SetOwner(kFALSE); | |
892 | respSSD.SetOwner(kFALSE); | |
893 | respSSD.SetOwner(kFALSE); | |
894 | ||
895 | Int_t index[fgkNdettypes]; | |
896 | for (Int_t i = 0; i<fgkNdettypes; i++ ) { | |
897 | index[i] = 0; | |
898 | for (Int_t j = 0; j<=i; j++ ) | |
899 | index[i]+=fNMod[j]; | |
900 | } | |
901 | ||
902 | for (Int_t i = 0; i<index[0]; i++ ) | |
fcf95fc7 | 903 | respSPD.Add(fCalibration->At(i)); |
8ba39da9 | 904 | |
905 | for (Int_t i = index[0]; i<index[1]; i++ ) | |
fcf95fc7 | 906 | respSDD.Add(fCalibration->At(i)); |
8ba39da9 | 907 | |
908 | for (Int_t i = index[1]; i<index[2]; i++ ) | |
fcf95fc7 | 909 | respSSD.Add(fCalibration->At(i)); |
8ba39da9 | 910 | |
06232459 | 911 | AliCDBManager::Instance()->Put(&respSPD, idRespSPD, &md); |
912 | AliCDBManager::Instance()->Put(&respSDD, idRespSDD, &md); | |
913 | AliCDBManager::Instance()->Put(&respSSD, idRespSSD, &md); | |
8ba39da9 | 914 | } |
915 | ||
88128115 | 916 | //______________________________________________________________________ |
917 | void AliITSDetTypeSim::ReadOldSSDNoise(TObjArray *array, | |
918 | AliITSNoiseSSDv2 *noiseSSD) { | |
919 | //Reads the old SSD calibration object and converts it to the new format | |
920 | const Int_t fgkSSDSTRIPSPERMODULE = 1536; | |
921 | const Int_t fgkSSDPSIDESTRIPSPERMODULE = 768; | |
922 | ||
923 | Int_t fNMod = array->GetEntries(); | |
924 | cout<<"Converting old calibration object for noise..."<<endl; | |
925 | ||
926 | //NOISE | |
927 | Double_t noise = 0.0; | |
928 | for (Int_t iModule = 0; iModule < fNMod; iModule++) { | |
929 | AliITSNoiseSSD *noiseModule = (AliITSNoiseSSD*) (array->At(iModule)); | |
930 | for(Int_t iStrip = 0; iStrip < fgkSSDSTRIPSPERMODULE; iStrip++) { | |
931 | noise = (iStrip < fgkSSDPSIDESTRIPSPERMODULE) ? noiseModule->GetNoiseP(iStrip) : noiseModule->GetNoiseN(1535 - iStrip); | |
932 | if(iStrip < fgkSSDPSIDESTRIPSPERMODULE) | |
933 | noiseSSD->AddNoiseP(iModule,iStrip,noise); | |
934 | if(iStrip >= fgkSSDPSIDESTRIPSPERMODULE) | |
935 | noiseSSD->AddNoiseN(iModule,1535 - iStrip,noise); | |
936 | }//loop over strips | |
937 | }//loop over modules | |
938 | } | |
939 | ||
940 | //______________________________________________________________________ | |
941 | void AliITSDetTypeSim::ReadOldSSDBadChannels(TObjArray *array, | |
942 | AliITSBadChannelsSSDv2 *badChannelsSSD) { | |
943 | //Reads the old SSD calibration object and converts it to the new format | |
944 | Int_t fNMod = array->GetEntries(); | |
945 | cout<<"Converting old calibration object for bad channels..."<<endl; | |
946 | for (Int_t iModule = 0; iModule < fNMod; iModule++) { | |
947 | //for (Int_t iModule = 0; iModule < 1; iModule++) { | |
948 | AliITSBadChannelsSSD *bad = (AliITSBadChannelsSSD*) (array->At(iModule)); | |
949 | TArrayI arrayPSide = bad->GetBadPChannelsList(); | |
950 | for(Int_t iPCounter = 0; iPCounter < arrayPSide.GetSize(); iPCounter++) | |
951 | badChannelsSSD->AddBadChannelP(iModule, | |
952 | iPCounter, | |
953 | (Char_t)arrayPSide.At(iPCounter)); | |
954 | ||
955 | TArrayI arrayNSide = bad->GetBadNChannelsList(); | |
956 | for(Int_t iNCounter = 0; iNCounter < arrayNSide.GetSize(); iNCounter++) | |
957 | badChannelsSSD->AddBadChannelN(iModule, | |
958 | iNCounter, | |
959 | (Char_t)arrayNSide.At(iNCounter)); | |
960 | ||
961 | }//loop over modules | |
962 | } | |
963 | ||
964 | //______________________________________________________________________ | |
965 | void AliITSDetTypeSim::ReadOldSSDGain(TObjArray *array, | |
966 | AliITSGainSSDv2 *gainSSD) { | |
967 | //Reads the old SSD calibration object and converts it to the new format | |
968 | ||
969 | Int_t fNMod = array->GetEntries(); | |
970 | cout<<"Converting old calibration object for gain..."<<endl; | |
971 | ||
972 | //GAIN | |
973 | for (Int_t iModule = 0; iModule < fNMod; iModule++) { | |
974 | AliITSGainSSD *gainModule = (AliITSGainSSD*) (array->At(iModule)); | |
975 | TArrayF arrayPSide = gainModule->GetGainP(); | |
976 | for(Int_t iPCounter = 0; iPCounter < arrayPSide.GetSize(); iPCounter++) | |
977 | gainSSD->AddGainP(iModule, | |
978 | iPCounter, | |
979 | arrayPSide.At(iPCounter)); | |
980 | TArrayF arrayNSide = gainModule->GetGainN(); | |
981 | for(Int_t iNCounter = 0; iNCounter < arrayNSide.GetSize(); iNCounter++) | |
982 | gainSSD->AddGainN(iModule, | |
983 | iNCounter, | |
984 | arrayNSide.At(iNCounter)); | |
985 | }//loop over modules | |
986 | } | |
8ba39da9 | 987 |