#ifndef ALIITSSIMULATIONSPD_H
#define ALIITSSIMULATIONSPD_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+////////////////////////////////////////////////////////////
+// Simulation class for SPD //
+////////////////////////////////////////////////////////////
+
+#include "TObjArray.h"
#include "AliITSsimulation.h"
+#include "AliITSCalibrationSPD.h"
+#include "AliITSsegmentationSPD.h"
-class AliITSMapA2;
-class AliITSsegmentation;
-class AliITSresponse;
+class TH1F;
class AliITSmodule;
+class AliITSresponseSPD;
//-------------------------------------------------------------------
class AliITSsimulationSPD : public AliITSsimulation {
+ public:
+ AliITSsimulationSPD();
+ // AliITSsimulationSPD(AliITSsegmentation *seg,AliITSCalibration *res);
+ AliITSsimulationSPD(AliITSDetTypeSim *dettyp);
+ virtual ~AliITSsimulationSPD();
+ // copy constructor
+ AliITSsimulationSPD(const AliITSsimulationSPD &source);
+ // ass. operator
+ AliITSsimulationSPD& operator=(const AliITSsimulationSPD &s);
+ virtual AliITSsimulation& operator=(const AliITSsimulation &source);
+ // Initilizes the variables
+ void Init();
+ // Get pointers (calObj[]) to the calibration objects
+ // ??? Is there a better way to do this ???
+ void GetCalibrationObjects(Int_t RunNr);
-public:
-
- AliITSsimulationSPD();
- AliITSsimulationSPD(AliITSsegmentation *seg, AliITSresponse *res);
- ~AliITSsimulationSPD();
- AliITSsimulationSPD(const AliITSsimulationSPD &source); // copy constructor
- AliITSsimulationSPD& operator=(const AliITSsimulationSPD &source); // ass. operator
-
- void DigitiseModule(AliITSmodule *mod,Int_t module, Int_t dummy);
- void SetFluctuations(Float_t **pList);
- void HitToDigit(AliITSmodule *mod, Int_t hitpos, Int_t module,
- Int_t *frowpixel, Int_t *fcolpixel, Double_t *fenepixel,
- Float_t **pList);
-
- void UpdateMap( Int_t row, Int_t col, Double_t ene);
- void ChargeSharing(Float_t x1l,Float_t z1l,Float_t x2l,
- Float_t z2l,Int_t c1,Int_t r1,Int_t c2,
- Int_t r2,Float_t etot,
- Int_t &npixel,Int_t *frowpixel,
- Int_t *fcolpixel,Double_t *fenepixel);
-
- void SetCoupling(Int_t row, Int_t col, Int_t ntrack, Int_t idhit, Float_t **pList);
- void CreateDigit(Int_t nhits, Int_t module, Float_t **pList);
- void GetList(Int_t track,Int_t idhit, Float_t **pList, Int_t row, Int_t col);
-
- void CreateHistograms();
- void ResetHistograms();
- TObjArray* GetHistArray() {
- // get hist array
- return fHis;
- }
+ // General User calling routines
+ // Initilize simulation for a specific event and module
+ void InitSimulationModule(Int_t module, Int_t event);
+ // Finish and write S Digitization
+ void FinishSDigitiseModule();
+ // From hits to Digits, without creating SDigits
+ void DigitiseModule(AliITSmodule *mod,Int_t,Int_t);
-private:
+ // More or less Internal Routines
+ // Create S Digits from specific module
+ void SDigitiseModule(AliITSmodule *mod, Int_t mask, Int_t event);
+ // Write S Digits to the tree of SDigits.
+ void WriteSDigits();
+ // fill pList from hits, charge sharing, diffusion, coupling
+ void HitToSDigit(AliITSmodule *mod);
+ // fill pList from hits, charge sharing, diffusion, coupling (faster method optimized by Bjorne)
+ void HitToSDigitFast(AliITSmodule *mod);
+ // Removes dead pixels from pList
+ void RemoveDeadPixels(AliITSmodule *mod);
+ // Take pList of signals and apply noise... create Digis
+ void FrompListToDigits();
+ //
+ void CreateHistograms();
+ void FillHistograms(Int_t ix,Int_t iz,Double_t v=1.0);
+ void ResetHistograms();
+ TH1F* GetHistogram(Int_t i){return (TH1F*)(fHis->At(i));}// get histogram
+ TObjArray* GetHistArray() {return fHis;}// get hist array
+ TString& GetHistName(){return fSPDname;}
+ void SetHistName(TString &n){fSPDname = n;}
+ //
+ // For backwards compatibility
+ void SDigitsToDigits(){ FinishSDigitiseModule();};
+ void HitToDigit(AliITSmodule *mod){
+ // Standard interface to DigitiseModule Inputs: AliITSmodule *mod Pointer to this module
+ DigitiseModule(mod,GetModuleNumber(),0);};
- AliITSMapA2 *fMapA2; // MapA2
- Float_t fThresh; // Threshold
- Float_t fSigma; // Noise
- Float_t fCouplCol; // Coupling along columns
- Float_t fCouplRow; // Coupling along rows
- Int_t fNPixelsX; // NPixelsX
- Int_t fNPixelsZ; // NPixelsZ
-
- TObjArray *fHis; // just in case for histogramming
-
- ClassDef(AliITSsimulationSPD,1) // Simulation of SPD clusters
+ private:
+ void SpreadCharge(Double_t x0,Double_t z0,Int_t ix0,Int_t iz0,
+ Double_t el,Double_t sig,Int_t t,Int_t hi);
+ void SpreadChargeAsym(Double_t x0,Double_t z0,Int_t ix0,Int_t iz0,
+ Double_t el,Double_t sigx,Double_t sigz,Int_t t,Int_t hi);
+ void UpdateMapSignal(Int_t ix,Int_t iz,Int_t trk,Int_t ht,Double_t signal){
+ // This function adds a signal to the pList from the pList class
+ // Inputs: iz column number ix row number trk track number ht hit number signal signal strength
+ GetMap()->AddSignal(iz,ix,trk,ht,GetModuleNumber(),signal);};
+ void UpdateMapNoise(Int_t ix,Int_t iz,Float_t noise){
+ // This function adds noise to data in the MapA2 as well as the pList
+ // Inputs: iz column number ix row number noise electronic noise generated by FrompListToDigits
+ GetMap()->AddNoise(iz,ix,GetModuleNumber(),noise);}
+ // Get a pointer to the segmentation object
+ virtual AliITSsegmentation* GetSegmentationModel(Int_t /*dt*/){return fDetType->GetSegmentationModel(0);}
+ // set pointer to segmentation objec
+ virtual void SetSegmentationModel(Int_t /*dt*/, AliITSsegmentation *seg){fDetType->SetSegmentationModel(0,seg);}
+ // Bari-Salerno Coupling parameters
+ // "New" coupling routine Tiziano Virgili
+ void SetCoupling(Int_t col,Int_t row,Int_t ntrack,Int_t idhit);
+ // "Old" coupling routine Rocco Caliandro
+ void SetCouplingOld(Int_t col, Int_t row,Int_t ntrack,Int_t idhit);
+ // Getters for data kept in fSegmentation and fResponse.
+ // Returns the Threshold in electrons
+ Double_t GetThreshold(){
+ Double_t th,sig;AliITSCalibrationSPD* res=(AliITSCalibrationSPD*)GetCalibrationModel(GetModuleNumber());
+ res->Thresholds(th,sig);return th;};
+ // Returns the couplings Columb and Row.
+ void GetCouplings(Double_t &cc,Double_t &cr){
+ AliITSCalibrationSPD* res = (AliITSCalibrationSPD*)GetCalibrationModel(GetModuleNumber());
+ res->GetCouplingParam(cc,cr);};
+ // Returns the number of pixels in x
+ Int_t GetNPixelsX(){return GetSegmentationModel(0)->Npx();};
+ // Returns the number of pixels in z
+ Int_t GetNPixelsZ(){return GetSegmentationModel(0)->Npz();};
+ TObjArray *fHis; //! just in case for histogramming
+ TString fSPDname; //! Histogram name
+ Int_t fCoupling; // Sets the coupling to be used.
+ // ==1 use SetCoupling, ==2 use SetCouplingOld
+ AliITSCalibrationSPD* fCalObj[240]; // Calibration objects (per module)
+ ClassDef(AliITSsimulationSPD,2) // Simulation of SPD clusters
};
-
#endif
-