1 #ifndef ALIITSSIMULATIONSPD_H
2 #define ALIITSSIMULATIONSPD_H
4 /* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
9 ////////////////////////////////////////////////////////////
10 // Simulation class for SPD //
11 ////////////////////////////////////////////////////////////
13 #include "TObjArray.h"
14 #include "AliITSsimulation.h"
15 #include "AliITSCalibrationSPD.h"
16 #include "AliITSsegmentationSPD.h"
20 class AliITSresponseSPD;
22 //-------------------------------------------------------------------
24 class AliITSsimulationSPD : public AliITSsimulation {
26 AliITSsimulationSPD();
27 // AliITSsimulationSPD(AliITSsegmentation *seg,AliITSCalibration *res);
28 AliITSsimulationSPD(AliITSDetTypeSim *dettyp);
29 virtual ~AliITSsimulationSPD();
31 AliITSsimulationSPD(const AliITSsimulationSPD &source);
33 AliITSsimulationSPD& operator=(const AliITSsimulationSPD &s);
34 // virtual AliITSsimulation& operator=(const AliITSsimulation &source);
35 // Initilizes the variables
38 // General User calling routines
39 // Initilize simulation for a specific event and module
40 void InitSimulationModule(Int_t module, Int_t event);
41 // Finish and write S Digitization
42 void FinishSDigitiseModule();
43 // From hits to Digits, without creating SDigits
44 void DigitiseModule(AliITSmodule *mod,Int_t,Int_t);
46 // More or less Internal Routines
47 // Create S Digits from specific module
48 void SDigitiseModule(AliITSmodule *mod, Int_t mask, Int_t event);
49 // Write S Digits to the tree of SDigits.
51 // fill pList from hits, charge sharing, diffusion, coupling
52 void HitToSDigit(AliITSmodule *mod);
53 // fill pList from hits, charge sharing, diffusion, coupling (faster method optimized by Bjorne)
54 void HitToSDigitFast(AliITSmodule *mod);
55 // Removes dead pixels from pList
56 void RemoveDeadPixels(AliITSmodule *mod);
57 // Take pList of signals and apply noise... create Digits
58 void FrompListToDigits();
59 // This set the Lorentz drift of Electrons and Holes: by deafult equal weights to Electrons and Holes
60 void SetLorentzDrift(Bool_t b=kFALSE)
61 {fLorentz=b; if(fLorentz) SetTanLorAngle();};
62 // This function set the relative contribution between holes and electrons: use 0<=WeightHole<=1
63 Bool_t SetTanLorAngle(Double_t WeightHole=0.5);
64 // Getter for the Lorentz angle
65 Double_t GetTanLorAngle(){return fTanLorAng;};
67 void CreateHistograms();
68 void FillHistograms(Int_t ix,Int_t iz,Double_t v=1.0);
69 void ResetHistograms();
70 TH1F* GetHistogram(Int_t i){return (TH1F*)(fHis->At(i));}// get histogram
71 TObjArray* GetHistArray() {return fHis;}// get hist array
72 TString& GetHistName(){return fSPDname;}
73 void SetHistName(TString &n){fSPDname = n;}
75 // For backwards compatibility
76 void SDigitsToDigits(){ FinishSDigitiseModule();};
77 void HitToDigit(AliITSmodule *mod){
78 // Standard interface to DigitiseModule Inputs: AliITSmodule *mod Pointer to this module
79 DigitiseModule(mod,GetModuleNumber(),0);};
82 void SpreadCharge(Double_t x0,Double_t z0,Int_t ix0,Int_t iz0,
83 Double_t el,Double_t sig,Double_t ld,Int_t t,Int_t hi);
84 void SpreadChargeAsym(Double_t x0,Double_t z0,Int_t ix0,Int_t iz0,
85 Double_t el,Double_t sigx,Double_t sigz,Double_t ld,Int_t t,Int_t hi);
86 void UpdateMapSignal(Int_t ix,Int_t iz,Int_t trk,Int_t ht,Double_t signal){
87 // This function adds a signal to the pList from the pList class
88 // Inputs: iz column number ix row number trk track number ht hit number signal signal strength
89 GetMap()->AddSignal(iz,ix,trk,ht,GetModuleNumber(),signal);};
90 void UpdateMapNoise(Int_t ix,Int_t iz,Float_t noise){
91 // This function adds noise to data in the MapA2 as well as the pList
92 // Inputs: iz column number ix row number noise electronic noise generated by FrompListToDigits
93 GetMap()->AddNoise(iz,ix,GetModuleNumber(),noise);}
94 // Get a pointer to the segmentation object
95 virtual AliITSsegmentation* GetSegmentationModel(Int_t /*dt*/){return fDetType->GetSegmentationModel(0);}
96 // set pointer to segmentation objec
97 virtual void SetSegmentationModel(Int_t /*dt*/, AliITSsegmentation *seg){fDetType->SetSegmentationModel(0,seg);}
98 // Bari-Salerno Coupling parameters
99 // "New" coupling routine Tiziano Virgili
100 void SetCoupling(Int_t col,Int_t row,Int_t ntrack,Int_t idhit);
101 // "Old" coupling routine Rocco Caliandro
102 void SetCouplingOld(Int_t col, Int_t row,Int_t ntrack,Int_t idhit);
103 // Getters for data kept in fSegmentation and fResponse.
104 // Returns the Threshold in electrons
105 Double_t GetThreshold(){
106 Double_t th,sig;AliITSCalibrationSPD* res=(AliITSCalibrationSPD*)GetCalibrationModel(GetModuleNumber());
107 res->Thresholds(th,sig);return th;};
108 // Returns the couplings Columb and Row.
109 void GetCouplings(Double_t &cc,Double_t &cr){
110 AliITSCalibrationSPD* res = (AliITSCalibrationSPD*)GetCalibrationModel(GetModuleNumber());
111 res->GetCouplingParam(cc,cr);};
112 // Returns the number of pixels in x
113 Int_t GetNPixelsX(){return GetSegmentationModel(0)->Npx();};
114 // Returns the number of pixels in z
115 Int_t GetNPixelsZ(){return GetSegmentationModel(0)->Npz();};
117 TObjArray *fHis; //! just in case for histogramming
118 TString fSPDname; //! Histogram name
119 Int_t fCoupling; // Sets the coupling to be used.
120 // ==1 use SetCoupling, ==2 use SetCouplingOld
121 Bool_t fLorentz; // kTRUE if Lorentz drift has been allowed
122 Double_t fTanLorAng; //! Tangent of the Lorentz Angle (weighted average for hole and electrons)
123 ClassDef(AliITSsimulationSPD,3) // Simulation of SPD clusters