fix bugs add new features
[u/mrichter/AliRoot.git] / ITS / AliITSDetTypeSim.h
CommitLineData
3b9df642 1#ifndef ALIITSDETTYPESIM_H
2#define ALIITSDETTYPESIM_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6/*
7$Id$
8*/
9
7d62fb64 10/////////////////////////////////////////////////////////////////////////
11// * This class contains all of the "external" information needed to do//
12// * detector specific simulations for the ITS. //
13/////////////////////////////////////////////////////////////////////////
14
3b9df642 15#include <TObject.h>
023ae34b 16#include "AliITSLoader.h"
ef665f5e 17#include "AliITSSimuParam.h"
ad7f2bfa 18#include "AliITSFOGeneratorSPD.h"
3b9df642 19
ef665f5e 20class TObjArray;
21class TClonesArray;
8ba39da9 22class TTree;
23class AliCDBMetaData;
7d62fb64 24class AliITSdigit;
25class AliITSmodule;
26class AliITSpListItem;
3b9df642 27class AliITSsimulation;
28class AliITSsegmentation;
681e8104 29class AliITSresponse;
3a4cb7b6 30class AliITSCalibrationSSD;
88128115 31class AliITSGainSSDv2;
32class AliITSBadChannelsSSDv2;
33class AliITSNoiseSSDv2;
dfd6be22 34class AliITSresponseSDD;
ef665f5e 35class AliITSDDLModuleMapSDD;
36class AliITSCalibration;
37class AliITSgeom;
ad7f2bfa 38class AliITSFOSignalsSPD;
39class AliITSTriggerConditions;
3b9df642 40
41class AliITSDetTypeSim : public TObject {
7d62fb64 42 public:
43
44 AliITSDetTypeSim();
45 virtual ~AliITSDetTypeSim();
023ae34b 46 AliITSgeom *GetITSgeom() const {
47 if(fLoader)return ((AliITSLoader*)fLoader)->GetITSgeom();
48 else return 0;}
49 void SetITSgeom(AliITSgeom *geom);
7d62fb64 50
51 virtual void SetSimulationModel(Int_t dettype,AliITSsimulation *sim);
ef665f5e 52 virtual AliITSsimulation* GetSimulationModel(Int_t dettype) const;
53 virtual AliITSsimulation* GetSimulationModelByModule(Int_t module) const;
7d62fb64 54
55 virtual void SetSegmentationModel(Int_t dettype,AliITSsegmentation *seg);
ef665f5e 56 virtual AliITSsegmentation* GetSegmentationModel(Int_t dettype) const;
57 virtual AliITSsegmentation* GetSegmentationModelByModule(Int_t module) const;
7d62fb64 58
fcf95fc7 59 virtual void SetCalibrationModel(Int_t iMod,AliITSCalibration *resp);
9806b6f8 60 virtual void SetSPDNoisyModel(Int_t iMod, AliITSCalibration *cal);
61 virtual void SetSPDSparseDeadModel(Int_t iMod, AliITSCalibration *cal);
ad7f2bfa 62
ef665f5e 63 virtual AliITSCalibration* GetCalibrationModel(Int_t iMod) const;
ad7f2bfa 64 virtual AliITSCalibration* GetSPDNoisyModel(Int_t iMod) const;
65 virtual AliITSTriggerConditions* GetTriggerConditions();
ef665f5e 66
67 virtual void SetSimuParam(const AliITSSimuParam* spar){
cd2a0045 68 if(fSimuPar) delete fSimuPar;
69 fSimuPar = new AliITSSimuParam(*spar);
70 }
71 virtual AliITSSimuParam* GetSimuParam() const {return fSimuPar;}
72
979b5a5f 73 virtual AliITSDDLModuleMapSDD* GetDDLModuleMapSDD()const { return fDDLMapSDD;}
dfd6be22 74 virtual AliITSresponseSDD* GetResponseSDD() const { return fRespSDD;}
fcf95fc7 75 TObjArray* GetCalibrationArray() const {return fCalibration;}
7d62fb64 76 TObjArray* GetSegmentation() const {return fSegmentation;}
fcf95fc7 77 void ResetCalibrationArray();
7d62fb64 78 void ResetSegmentation();
79
023ae34b 80 virtual void SetLoader(AliITSLoader* loader);
81 AliITSLoader* GetLoader() const {return fLoader;}
7d62fb64 82
83 virtual void SetDefaults();
84 virtual void SetDefaultSimulation();
8ba39da9 85 virtual void SetRunNumber(Int_t rn=0){fRunNumber = rn;}
86 virtual Int_t GetRunNumber() const {return fRunNumber;}
a6e0ebfe 87 virtual void SetTreeAddressS(TTree* treeS, const Char_t* name);
88 virtual void SetTreeAddressD(TTree* treeD, const Char_t* name);
7d62fb64 89
7d62fb64 90 virtual void SetDigits(TObjArray* digits) {fDigits=digits;}
e6b4e6b9 91 const TClonesArray* GetSDigits() const { return &fSDigits;}
7d62fb64 92 TObjArray* GetDigits() const {return fDigits;}
93 Int_t* GetNDigitArray() const {return fNDigits;}
023ae34b 94 TClonesArray *DigitsAddress(Int_t id) const {
95 return ((TClonesArray*)(*fDigits)[id]);}
e6b4e6b9 96 virtual void ResetSDigits(){fNSDigits=0; fSDigits.Clear();}
7d62fb64 97 virtual void ResetDigits();
98 virtual void ResetDigits(Int_t branch);
a6e0ebfe 99 virtual void SDigitsToDigits(Option_t *opt, Char_t* name);
7d62fb64 100
101 virtual void AddSumDigit(AliITSpListItem &sdig);
ef665f5e 102 virtual void AddSimDigit(Int_t branch, const AliITSdigit *d);
8ba39da9 103 virtual void AddSimDigit(Int_t branch,Float_t phys,Int_t* digits,
83ec5e27 104 Int_t* tracks,Int_t *hits,Float_t* trkcharges,
105 Int_t sigexpanded=-1000);
a6e0ebfe 106 virtual void SetDigitClassName(Int_t i, const Char_t* name) {
ef665f5e 107 fkDigClassName[i]=name;}
108 const Char_t* GetDigitClassName(Int_t i) const {return fkDigClassName[i];}
8ba39da9 109
ad7f2bfa 110 virtual void ResetFOSignals() {fFOGenerator.ResetSignals();}
111 virtual void ProcessSPDDigitForFastOr(UInt_t module, UInt_t colM, UInt_t rowM);
112 virtual void ProcessNoiseForFastOr() {fFOGenerator.ProcessNoise();}
113 virtual AliITSFOSignalsSPD* GetFOSignals() {return fFOGenerator.GetFOSignals();}
114 virtual void WriteFOSignals();
cf8425ac 115 virtual Float_t GetAverageGainSDD() const {
116 if(fAveGainSDD>0.) return fAveGainSDD;
117 else return 1.;
118 }
ad7f2bfa 119
120
8ba39da9 121 protected:
fcf95fc7 122 virtual void CreateCalibrationArray();
8ba39da9 123 virtual Bool_t GetCalibration();
7d62fb64 124
125 private:
b50b5855 126 AliITSDetTypeSim(const AliITSDetTypeSim &source);
127 AliITSDetTypeSim& operator=(const AliITSDetTypeSim &source);
1964ae5f 128 void SetDefaultSegmentation(Int_t idet); // creates def segm.
88128115 129
130 //conversion of the old SSD calibration objects tothe new ones
ef665f5e 131 void ReadOldSSDNoise(const TObjArray *array,
88128115 132 AliITSNoiseSSDv2 *noiseSSD);
ef665f5e 133 void ReadOldSSDBadChannels(const TObjArray *array,
88128115 134 AliITSBadChannelsSSDv2 *badChannelsSSD);
ef665f5e 135 void ReadOldSSDGain(const TObjArray *array,
88128115 136 AliITSGainSSDv2 *gainSSD);
137
8ba39da9 138 static const Int_t fgkNdettypes; // number of different det. types
139 static const Int_t fgkDefaultNModulesSPD; // Total numbers of SPD modules by default
140 static const Int_t fgkDefaultNModulesSDD; // Total numbers of SDD modules by default
141 static const Int_t fgkDefaultNModulesSSD; // Total numbers of SSD modules by default
8ba39da9 142
7d62fb64 143 TObjArray *fSimulation; //! [NDet]
144 TObjArray *fSegmentation; //! [NDet]
fcf95fc7 145 TObjArray *fCalibration; //! [NMod]
3a4cb7b6 146 AliITSCalibrationSSD* fSSDCalibration; //! SSD calibration object
ad7f2bfa 147 TObjArray *fSPDNoisy; //! [fgkDefaultNModulesSPD]
9806b6f8 148 TObjArray *fSPDSparseDead;//! [fgkDefaultNModulesSPD]
3b9df642 149 Int_t fNSDigits; //! number of SDigits
e6b4e6b9 150 TClonesArray fSDigits; //! Summable digits
7d62fb64 151 Int_t* fNDigits; //! [NDet] number of Digits for det.
023ae34b 152 Int_t fRunNumber; //! run number (to access DB)
153 TObjArray *fDigits; //! [NMod][NDigits]
cd2a0045 154 AliITSSimuParam *fSimuPar; //! detector simulation parameters
979b5a5f 155 AliITSDDLModuleMapSDD *fDDLMapSDD; //! mapping DDL/module -> SDD module number
dfd6be22 156 AliITSresponseSDD *fRespSDD; //! SDD response parameters
cf8425ac 157 Float_t fAveGainSDD; //! Average gain of SDD good anodes
ef665f5e 158 const Char_t* fkDigClassName[3]; //! String with digit class name.
023ae34b 159 AliITSLoader* fLoader; //! loader
160 Bool_t fFirstcall; //! flag
ad7f2bfa 161 AliITSFOGeneratorSPD fFOGenerator; //! Fast-OR generator object
162 AliITSTriggerConditions* fTriggerConditions; //! Trigger conditions
163
9806b6f8 164 ClassDef(AliITSDetTypeSim,15) // ITS Simulation structure
7d62fb64 165
166};
3b9df642 167
3b9df642 168#endif