source: trunk/MagicSoft/Mars/melectronics/MAvalanchePhotoDiode.h@ 9492

Last change on this file since 9492 was 9462, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 2.0 KB
Line 
1#ifndef MARS_MAvalanchePhotoDiode
2#define MARS_MAvalanchePhotoDiode
3
4#ifndef ROOT_TH2
5#include <TH2.h>
6#endif
7
8class APD : public TObject // FIXME: Derive from TH2?
9{
10private:
11 TH2F fHist;
12
13 Float_t fCrosstalkProb; // Probability that a converted photon creates another one in a neighboring cell
14 Float_t fDeadTime; // Deadtime of a single cell after a hit
15 Float_t fRecoveryTime; // Recoverytime after Deadtime (1-exp(-t/fRecoveryTime)
16
17 Float_t fTime; // A user settable time of the system
18
19 Float_t HitCellImp(Int_t x, Int_t y, Float_t t=0);
20
21public:
22 APD(Int_t n, Float_t prob=0, Float_t dt=0, Float_t rt=0);
23
24 Float_t HitCell(Int_t x, Int_t y, Float_t t=0);
25 Float_t HitRandomCell(Float_t t=0);
26 Float_t HitRandomCellRelative(Float_t t=0) { return HitRandomCell(fTime+t); }
27
28 void FillEmpty(Float_t t=0);
29 void FillRandom(Float_t rate, Float_t t=0);
30
31 void Init(Float_t rate) { if (fTime<0) FillRandom(rate); else Relax(rate); }
32
33 Int_t CountDeadCells(Float_t t=0) const;
34 Int_t CountRecoveringCells(Float_t t=0) const;
35
36 Float_t GetCellContent(Int_t x, Int_t y) const { return fHist.GetBinContent(x, y); }
37 Int_t GetNumCellsX() const { return fHist.GetNbinsX(); }
38
39 Float_t GetCrosstalkProb() const { return fCrosstalkProb; }
40 Float_t GetDeadTime() const { return fDeadTime; }
41 Float_t GetRecoveryTime() const { return fRecoveryTime; }
42 Float_t GetTime() const { return fTime; }
43
44 Float_t GetRelaxationTime(Float_t threshold=0.001) const;
45
46 Float_t GetLastHit() const { return fHist.GetMaximum(); }
47
48 void SetTime(Float_t tm) { fTime=tm; }
49 void IncreaseTime(Float_t dt) { fTime += dt; }
50
51 Float_t Evolve(Double_t freq, Double_t dt);
52 Float_t Relax(Double_t freq, Float_t threshold=0.001) { return Evolve(freq, GetRelaxationTime(threshold)); }
53
54 void Draw(Option_t *o="") { fHist.Draw(o); }
55 void DrawCopy(Option_t *o="") { fHist.DrawCopy(o); }
56
57 ClassDef(APD, 1) // An object representing a Geigermode APD
58};
59
60#endif
Note: See TracBrowser for help on using the repository browser.