Line data Source code
1 : #ifndef ALIITSSIMULATIONSPD_H
2 : #define ALIITSSIMULATIONSPD_H
3 :
4 : /* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
5 : * See cxx source for full Copyright notice */
6 :
7 : /* $Id$ */
8 :
9 : ////////////////////////////////////////////////////////////
10 : // Simulation class for SPD //
11 : ////////////////////////////////////////////////////////////
12 :
13 : #include "TObjArray.h"
14 : #include "AliITSsimulation.h"
15 : #include "AliITSsegmentationSPD.h"
16 :
17 : class TH1F;
18 : class AliITSmodule;
19 : //class AliITSresponseSPD;
20 :
21 : //-------------------------------------------------------------------
22 :
23 : class AliITSsimulationSPD : public AliITSsimulation {
24 : public:
25 : AliITSsimulationSPD();
26 : // AliITSsimulationSPD(AliITSsegmentation *seg,AliITSCalibration *res);
27 : AliITSsimulationSPD(AliITSDetTypeSim *dettyp);
28 : virtual ~AliITSsimulationSPD();
29 : // copy constructor
30 : AliITSsimulationSPD(const AliITSsimulationSPD &source);
31 : // ass. operator
32 : AliITSsimulationSPD& operator=(const AliITSsimulationSPD &s);
33 : // virtual AliITSsimulation& operator=(const AliITSsimulation &source);
34 : // Initilizes the variables
35 : void Init();
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 : // Adds noisy pixels to pList
55 : void AddNoisyPixels();
56 : // Removes dead pixels from pList
57 : void RemoveDeadPixels();
58 : // Take pList of signals and apply noise... create Digits
59 : void FrompListToDigits();
60 : // This set the Lorentz drift of Electrons and Holes: by deafult equal weights to Electrons and Holes
61 : void SetLorentzDrift(Bool_t b=kFALSE)
62 3 : {fLorentz=b; if(fLorentz) SetTanLorAngle();};
63 : // This function set the relative contribution between holes and electrons: use 0<=WeightHole<=1
64 : Bool_t SetTanLorAngle(Double_t WeightHole=1.0);
65 : // Getter for the Lorentz angle
66 0 : Double_t GetTanLorAngle() const {return fTanLorAng;};
67 : //
68 : void CreateHistograms();
69 : void FillHistograms(Int_t ix,Int_t iz,Double_t v=1.0);
70 : void ResetHistograms();
71 0 : TH1F* GetHistogram(Int_t i){return (TH1F*)(fHis->At(i));}// get histogram
72 78643200 : TObjArray* GetHistArray() {return fHis;}// get hist array
73 0 : TString& GetHistName(){return fSPDname;}
74 0 : void SetHistName(TString &n){fSPDname = n;}
75 : //
76 : // For backwards compatibility
77 0 : void SDigitsToDigits(){ FinishSDigitiseModule();};
78 : void HitToDigit(AliITSmodule *mod){
79 : // Standard interface to DigitiseModule Inputs: AliITSmodule *mod Pointer to this module
80 0 : DigitiseModule(mod,GetModuleNumber(),0);};
81 :
82 : // This sets fStrobe flag and allows generating the strobe and applying it to select hits
83 0 : void SetStrobeGeneration(Bool_t b=kFALSE) {fStrobe=b;};
84 : void GenerateStrobePhase();
85 :
86 : private:
87 : void SpreadCharge(Double_t x0,Double_t z0,Int_t ix0,Int_t iz0,
88 : Double_t el,Double_t sig,Double_t ld,Int_t t,Int_t hi);
89 : void SpreadChargeAsym(Double_t x0,Double_t z0,Int_t ix0,Int_t iz0,
90 : Double_t el,Double_t sigx,Double_t sigz,Double_t ld,Int_t t,Int_t hi);
91 : void UpdateMapSignal(Int_t ix,Int_t iz,Int_t trk,Int_t ht,Double_t signal){
92 : // This function adds a signal to the pList from the pList class
93 : // Inputs: iz column number ix row number trk track number ht hit number signal signal strength
94 : GetMap()->AddSignal(iz,ix,trk,ht,GetModuleNumber(),signal);};
95 : void UpdateMapNoise(Int_t ix,Int_t iz,Float_t noise){
96 : // This function adds noise to data in the MapA2 as well as the pList
97 : // Inputs: iz column number ix row number noise electronic noise generated by FrompListToDigits
98 78643200 : GetMap()->AddNoise(iz,ix,GetModuleNumber(),noise);}
99 : // Get a pointer to the segmentation object
100 79290220 : virtual AliITSsegmentation* GetSegmentationModel(Int_t /*dt*/){return fDetType->GetSegmentationModel(0);}
101 : // set pointer to segmentation objec
102 0 : virtual void SetSegmentationModel(Int_t /*dt*/, AliITSsegmentation *seg){fDetType->SetSegmentationModel(0,seg);}
103 : // Bari-Salerno Coupling parameters
104 : // "New" coupling routine Tiziano Virgili
105 : void SetCoupling(Int_t col,Int_t row);
106 : // "Old" coupling routine Rocco Caliandro
107 : void SetCouplingOld(Int_t col, Int_t row);
108 : // Getters for data kept in fSegmentation and fResponse.
109 : // Returns the Threshold in electrons
110 : Double_t GetThreshold(){
111 78667818 : Double_t th,sig;AliITSSimuParam* simpar = fDetType->GetSimuParam();
112 39333909 : simpar->SPDThresholds(GetModuleNumber(),th,sig);return th;};
113 : // Returns the couplings Columb and Row.
114 : void GetCouplings(Double_t &cc,Double_t &cr){
115 6126 : AliITSSimuParam* simpar = fDetType->GetSimuParam();
116 3063 : simpar->GetSPDCouplingParam(cc,cr);};
117 : // Returns the number of pixels in x
118 78962644 : Int_t GetNPixelsX(){return GetSegmentationModel(0)->Npx();};
119 : // Returns the number of pixels in z
120 321374 : Int_t GetNPixelsZ(){return GetSegmentationModel(0)->Npz();};
121 :
122 : TObjArray *fHis; //! just in case for histogramming
123 : TString fSPDname; //! Histogram name
124 : Int_t fCoupling; // Sets the coupling to be used.
125 : // ==1 use SetCoupling, ==2 use SetCouplingOld
126 : Bool_t fLorentz; // kTRUE if Lorentz drift has been allowed
127 : Double_t fTanLorAng; //! Tangent of the Lorentz Angle (weighted average for hole and electrons)
128 : Bool_t fStrobe; // kTRUE if readout strobe with proper phase applied to select hits
129 : Int_t fStrobeLenght; // Strobe signal lenght in units of 25 ns
130 : Double_t fStrobePhase; // The phase of the strobe signal with respect to the trigger
131 6114 : ClassDef(AliITSsimulationSPD,4) // Simulation of SPD clusters
132 : };
133 : #endif
|