Changing once more (hopefully we get it correct this time...) the logic to trig the...
[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;
ef665f5e 34class AliITSDDLModuleMapSDD;
35class AliITSCalibration;
36class AliITSgeom;
ad7f2bfa 37class AliITSFOSignalsSPD;
38class AliITSTriggerConditions;
3b9df642 39
40class AliITSDetTypeSim : public TObject {
7d62fb64 41 public:
42
43 AliITSDetTypeSim();
44 virtual ~AliITSDetTypeSim();
45 AliITSDetTypeSim(const AliITSDetTypeSim &source);
46 AliITSDetTypeSim& operator=(const AliITSDetTypeSim &source);
023ae34b 47 AliITSgeom *GetITSgeom() const {
48 if(fLoader)return ((AliITSLoader*)fLoader)->GetITSgeom();
49 else return 0;}
50 void SetITSgeom(AliITSgeom *geom);
7d62fb64 51
52 virtual void SetSimulationModel(Int_t dettype,AliITSsimulation *sim);
ef665f5e 53 virtual AliITSsimulation* GetSimulationModel(Int_t dettype) const;
54 virtual AliITSsimulation* GetSimulationModelByModule(Int_t module) const;
7d62fb64 55
56 virtual void SetSegmentationModel(Int_t dettype,AliITSsegmentation *seg);
ef665f5e 57 virtual AliITSsegmentation* GetSegmentationModel(Int_t dettype) const;
58 virtual AliITSsegmentation* GetSegmentationModelByModule(Int_t module) const;
7d62fb64 59
fcf95fc7 60 virtual void SetCalibrationModel(Int_t iMod,AliITSCalibration *resp);
ad7f2bfa 61 virtual void SetSPDNoisyModel(Int_t iMod, AliITSCalibration *cal);
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;}
fcf95fc7 74 TObjArray* GetCalibrationArray() const {return fCalibration;}
7d62fb64 75 TObjArray* GetSegmentation() const {return fSegmentation;}
fcf95fc7 76 void ResetCalibrationArray();
7d62fb64 77 void ResetSegmentation();
78
023ae34b 79 virtual void SetLoader(AliITSLoader* loader);
80 AliITSLoader* GetLoader() const {return fLoader;}
7d62fb64 81
82 virtual void SetDefaults();
83 virtual void SetDefaultSimulation();
8ba39da9 84 virtual void SetRunNumber(Int_t rn=0){fRunNumber = rn;}
85 virtual Int_t GetRunNumber() const {return fRunNumber;}
a6e0ebfe 86 virtual void SetTreeAddressS(TTree* treeS, const Char_t* name);
87 virtual void SetTreeAddressD(TTree* treeD, const Char_t* name);
7d62fb64 88
7d62fb64 89 virtual void SetDigits(TObjArray* digits) {fDigits=digits;}
e6b4e6b9 90 const TClonesArray* GetSDigits() const { return &fSDigits;}
7d62fb64 91 TObjArray* GetDigits() const {return fDigits;}
92 Int_t* GetNDigitArray() const {return fNDigits;}
023ae34b 93 TClonesArray *DigitsAddress(Int_t id) const {
94 return ((TClonesArray*)(*fDigits)[id]);}
e6b4e6b9 95 virtual void ResetSDigits(){fNSDigits=0; fSDigits.Clear();}
7d62fb64 96 virtual void ResetDigits();
97 virtual void ResetDigits(Int_t branch);
a6e0ebfe 98 virtual void SDigitsToDigits(Option_t *opt, Char_t* name);
7d62fb64 99
100 virtual void AddSumDigit(AliITSpListItem &sdig);
ef665f5e 101 virtual void AddSimDigit(Int_t branch, const AliITSdigit *d);
8ba39da9 102 virtual void AddSimDigit(Int_t branch,Float_t phys,Int_t* digits,
83ec5e27 103 Int_t* tracks,Int_t *hits,Float_t* trkcharges,
104 Int_t sigexpanded=-1000);
a6e0ebfe 105 virtual void SetDigitClassName(Int_t i, const Char_t* name) {
ef665f5e 106 fkDigClassName[i]=name;}
107 const Char_t* GetDigitClassName(Int_t i) const {return fkDigClassName[i];}
8ba39da9 108
ad7f2bfa 109 virtual void ResetFOSignals() {fFOGenerator.ResetSignals();}
110 virtual void ProcessSPDDigitForFastOr(UInt_t module, UInt_t colM, UInt_t rowM);
111 virtual void ProcessNoiseForFastOr() {fFOGenerator.ProcessNoise();}
112 virtual AliITSFOSignalsSPD* GetFOSignals() {return fFOGenerator.GetFOSignals();}
113 virtual void WriteFOSignals();
114
115
8ba39da9 116 protected:
fcf95fc7 117 virtual void CreateCalibrationArray();
8ba39da9 118 virtual Bool_t GetCalibration();
7d62fb64 119
120 private:
1964ae5f 121 void SetDefaultSegmentation(Int_t idet); // creates def segm.
88128115 122
123 //conversion of the old SSD calibration objects tothe new ones
ef665f5e 124 void ReadOldSSDNoise(const TObjArray *array,
88128115 125 AliITSNoiseSSDv2 *noiseSSD);
ef665f5e 126 void ReadOldSSDBadChannels(const TObjArray *array,
88128115 127 AliITSBadChannelsSSDv2 *badChannelsSSD);
ef665f5e 128 void ReadOldSSDGain(const TObjArray *array,
88128115 129 AliITSGainSSDv2 *gainSSD);
130
8ba39da9 131 static const Int_t fgkNdettypes; // number of different det. types
132 static const Int_t fgkDefaultNModulesSPD; // Total numbers of SPD modules by default
133 static const Int_t fgkDefaultNModulesSDD; // Total numbers of SDD modules by default
134 static const Int_t fgkDefaultNModulesSSD; // Total numbers of SSD modules by default
135 Int_t fNMod[3]; // numbers of modules from different types
136
7d62fb64 137 TObjArray *fSimulation; //! [NDet]
138 TObjArray *fSegmentation; //! [NDet]
fcf95fc7 139 TObjArray *fCalibration; //! [NMod]
3a4cb7b6 140 AliITSCalibrationSSD* fSSDCalibration; //! SSD calibration object
ad7f2bfa 141 TObjArray *fSPDNoisy; //! [fgkDefaultNModulesSPD]
3b9df642 142 Int_t fNSDigits; //! number of SDigits
e6b4e6b9 143 TClonesArray fSDigits; //! Summable digits
7d62fb64 144 Int_t* fNDigits; //! [NDet] number of Digits for det.
023ae34b 145 Int_t fRunNumber; //! run number (to access DB)
146 TObjArray *fDigits; //! [NMod][NDigits]
cd2a0045 147 AliITSSimuParam *fSimuPar; //! detector simulation parameters
979b5a5f 148 AliITSDDLModuleMapSDD *fDDLMapSDD; //! mapping DDL/module -> SDD module number
ef665f5e 149 const Char_t* fkDigClassName[3]; //! String with digit class name.
023ae34b 150 AliITSLoader* fLoader; //! loader
151 Bool_t fFirstcall; //! flag
ad7f2bfa 152 AliITSFOGeneratorSPD fFOGenerator; //! Fast-OR generator object
153 AliITSTriggerConditions* fTriggerConditions; //! Trigger conditions
154
d9ed1779 155 ClassDef(AliITSDetTypeSim,11) // ITS Simulation structure
7d62fb64 156
157};
3b9df642 158
3b9df642 159#endif