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