]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSsimulationSPD.h
New SPD simulation (Massimo):
[u/mrichter/AliRoot.git] / ITS / AliITSsimulationSPD.h
1 #ifndef ALIITSSIMULATIONSPD_H
2 #define ALIITSSIMULATIONSPD_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 #include "TH1F.h"
8 #include "TObjArray.h"
9 #include "AliITSsimulation.h"
10 #include "AliITSCalibrationSPD.h"
11 #include "AliITSsegmentationSPD.h"
12 #include "AliITSresponseSPD.h"
13 #include "AliCDBEntry.h"
14 #include "AliCDBLocal.h"
15
16 class AliITSmodule;
17
18 //-------------------------------------------------------------------
19
20 class AliITSsimulationSPD : public AliITSsimulation {
21  public:
22     AliITSsimulationSPD();
23     //    AliITSsimulationSPD(AliITSsegmentation *seg,AliITSCalibration *res);
24     AliITSsimulationSPD(AliITSDetTypeSim *dettyp);
25     virtual ~AliITSsimulationSPD();
26     // copy constructor
27     AliITSsimulationSPD(const AliITSsimulationSPD &source); 
28      // ass. operator
29     AliITSsimulationSPD& operator=(const AliITSsimulationSPD &s);
30     virtual AliITSsimulation& operator=(const AliITSsimulation &source);
31     // Initilizes the variables
32     void Init();
33     // Get pointers (calObj[]) to the calibration objects
34     // ??? Is there a better way to do this ???
35     void GetCalibrationObjects(Int_t RunNr);
36
37     // General User calling routines
38     // Initilize simulation for a specific event and module
39     void InitSimulationModule(Int_t module, Int_t event);
40     // Finish and write S Digitization
41     void FinishSDigitiseModule();
42     // From hits to Digits, without creating SDigits
43     void DigitiseModule(AliITSmodule *mod,Int_t,Int_t);
44
45     // More or less Internal Routines
46     // Create S Digits from specific module
47     void SDigitiseModule(AliITSmodule *mod, Int_t mask, Int_t event);
48     // Write S Digits to the tree of SDigits.
49     void WriteSDigits();
50     // fill pList from hits, charge sharing, diffusion, coupling
51     void HitToSDigit(AliITSmodule *mod);
52     // fill pList from hits, charge sharing, diffusion, coupling  (faster method optimized by Bjorne)
53     void HitToSDigitFast(AliITSmodule *mod);
54     // Removes dead pixels from pList
55     void RemoveDeadPixels(AliITSmodule *mod);
56     // Take pList of signals and apply noise... create Digis
57     void pListToDigits();
58     //
59     void CreateHistograms();
60     void FillHistograms(Int_t ix,Int_t iz,Double_t v=1.0);
61     void ResetHistograms();
62     TH1F* GetHistogram(Int_t i){return (TH1F*)(fHis->At(i));}// get histogram
63     TObjArray*  GetHistArray() {return fHis;}// get hist array
64     TString& GetHistName(){return fSPDname;}
65     void SetHistName(TString &n){fSPDname = n;}
66     //
67     // For backwards compatibility
68     void SDigitsToDigits(){ FinishSDigitiseModule();};
69     void HitToDigit(AliITSmodule *mod){
70         // Standard interface to DigitiseModule
71         // Inputs:
72         //    AliITSmodule *mod  Pointer to this module
73         // Outputs:
74         //    none.
75         // Return:
76         //    none.
77         DigitiseModule(mod,GetModuleNumber(),0);};
78
79  private:
80     void SpreadCharge(Double_t x0,Double_t z0,Int_t ix0,Int_t iz0,
81                       Double_t el,Double_t sig,Int_t t,Int_t hi);
82     void SpreadChargeAsym(Double_t x0,Double_t z0,Int_t ix0,Int_t iz0,
83                       Double_t el,Double_t sigx,Double_t sigz,Int_t t,Int_t hi);
84     void UpdateMapSignal(Int_t ix,Int_t iz,Int_t trk,Int_t ht,Double_t signal){
85         //  This function adds a signal to the pList from the pList class
86         //  Inputs:
87         //    Int_t       iz     // row number
88         //    Int_t       ix     // column number
89         //    Int_t       trk    // track number
90         //    Int_t       ht     // hit number
91         //    Double_t    signal // signal strength
92         //  Outputs:
93         //    none.
94         //  Return:
95         //    none
96         GetMap()->AddSignal(iz,ix,trk,ht,GetModuleNumber(),signal);};
97     void UpdateMapNoise(Int_t ix,Int_t iz,Float_t noise){
98         //  This function adds noise to data in the MapA2 as well as the pList
99         //  Inputs:
100         //    Int_t       iz       // row number
101         //    Int_t       ix       // column number
102         //    Double_t    ns    // electronic noise generated by pListToDigits
103         //  Outputs:
104         //    none.
105         //  Return:
106         //    none
107         GetMap()->AddNoise(iz,ix,GetModuleNumber(),noise);}
108     // Get a pointer to the segmentation object
109     virtual AliITSsegmentation* GetSegmentationModel(Int_t /*dt*/){return fDetType->GetSegmentationModel(0);}
110     // set pointer to segmentation objec
111     virtual void SetSegmentationModel(Int_t /*dt*/, AliITSsegmentation *seg){fDetType->SetSegmentationModel(0,seg);}
112     // Bari-Salerno Coupling parameters
113     // "New" coupling routine  Tiziano Virgili
114     void SetCoupling(Int_t row,Int_t col,Int_t ntrack,Int_t idhit);
115     // "Old" coupling routine  Rocco Caliandro
116     void SetCouplingOld(Int_t row, Int_t col,Int_t ntrack,Int_t idhit);
117     // Getters for data kept in fSegmentation and fResponse.
118     // Returns the Threshold in electrons
119     Double_t GetThreshold(){
120       Double_t th,sig;AliITSCalibrationSPD* res=(AliITSCalibrationSPD*)GetCalibrationModel(GetModuleNumber()); 
121         res->Thresholds(th,sig);return th;};
122     // Returns the couplings Columb and Row.
123     void GetCouplings(Double_t &cc,Double_t &cr){
124       AliITSCalibrationSPD* res = (AliITSCalibrationSPD*)GetCalibrationModel(GetModuleNumber());
125       res->GetCouplingParam(cc,cr);};
126     // Returns the number of pixels in x
127     Int_t GetNPixelsX(){return GetSegmentationModel(0)->Npx();};
128     // Returns the number of pixels in z
129     Int_t GetNPixelsZ(){return GetSegmentationModel(0)->Npz();};
130
131     TObjArray    *fHis;          //! just in case for histogramming
132     TString       fSPDname;      //! Histogram name
133     Int_t         fCoupling;     // Sets the coupling to be used.
134                                  // ==1 use SetCoupling, ==2 use SetCouplingOld
135     AliITSCalibrationSPD* calObj[240];
136     ClassDef(AliITSsimulationSPD,2)  // Simulation of SPD clusters
137 };
138 #endif