| 1 | #include "MFadcDefine.h" | 
|---|
| 2 | #include "MTriggerDefine.h" | 
|---|
| 3 |  | 
|---|
| 4 | #ifndef __MStarLight__ | 
|---|
| 5 | #define __MStarLight__ | 
|---|
| 6 | // | 
|---|
| 7 | //     class MStarLight | 
|---|
| 8 | // | 
|---|
| 9 | // | 
|---|
| 10 | #include "TROOT.h" | 
|---|
| 11 | #include "TH1.h" | 
|---|
| 12 | #include "TFile.h" | 
|---|
| 13 | #include <iostream> | 
|---|
| 14 | #include <fstream> | 
|---|
| 15 | #include "stdlib.h" | 
|---|
| 16 | #include "TRandom2.h" | 
|---|
| 17 |  | 
|---|
| 18 | #define VERSIONSR   1003.0 | 
|---|
| 19 | #define TIMERANGE   10000  // ns | 
|---|
| 20 |  | 
|---|
| 21 | class MStarLight { | 
|---|
| 22 |  | 
|---|
| 23 | private: | 
|---|
| 24 |  | 
|---|
| 25 | Float_t  fBrightness;  // the brightness of the star in phe/nsec | 
|---|
| 26 |  | 
|---|
| 27 | Float_t  fTimeRange;   // the time range of the trigger response | 
|---|
| 28 |  | 
|---|
| 29 | Int_t    fBinsTrig;    // Number of Bins in the trigger database | 
|---|
| 30 | Int_t    fTrigShape;   // a number that indicate the shape type of | 
|---|
| 31 | // the signal | 
|---|
| 32 | // = 0 --> a gaussian | 
|---|
| 33 | Float_t  fAmplTrig;    // the amplitude of the trigger in mV | 
|---|
| 34 | Float_t  fFwhmTrig;    // the width of the signal in nsec | 
|---|
| 35 |  | 
|---|
| 36 | Int_t    fBinsFadc;    // Number of Bins in the FADC database | 
|---|
| 37 | Int_t    fFadcShape;   // a number that indicate the shape type of | 
|---|
| 38 | // the signal | 
|---|
| 39 | // = 0 --> a gaussian | 
|---|
| 40 | Float_t  fIntegFadc;   // the integral of the single phe response | 
|---|
| 41 | // in the FADC (in FADC counts) | 
|---|
| 42 | Float_t  fFwhmFadc;    // the width of the signal in nsec | 
|---|
| 43 |  | 
|---|
| 44 | Float_t  *fTrig;       // Trigger branch "history" for 10000 nanoseconds | 
|---|
| 45 | Float_t  *fTrigResp;   // the shape of the response for trigger | 
|---|
| 46 | Float_t  *fFadc;       // FADC "history" for 10000 nanoseconds | 
|---|
| 47 | Float_t  *fFadcResp;   // the shape of the response for FADC | 
|---|
| 48 |  | 
|---|
| 49 | Float_t  fFadcSlicesPerNanosec; // Number of FADC slices per ns | 
|---|
| 50 | // (may be < 1 if FADC is faster than 1 GHz) | 
|---|
| 51 |  | 
|---|
| 52 | Int_t    fResponseSlicesFadc; | 
|---|
| 53 |  | 
|---|
| 54 | public: | 
|---|
| 55 |  | 
|---|
| 56 | MStarLight(Float_t fadc_slices_per_ns = 0., | 
|---|
| 57 | Int_t response_slices_fadc = 0); | 
|---|
| 58 |  | 
|---|
| 59 | void Reset(); | 
|---|
| 60 |  | 
|---|
| 61 | void SetBrightness(Float_t in); | 
|---|
| 62 | void SetAmplTrig(Float_t in); | 
|---|
| 63 | void SetFwhmTrig(Float_t in); | 
|---|
| 64 | void SetShapeFadc(Int_t in)              {fFadcShape=in;} | 
|---|
| 65 | void SetIntegFadc(Float_t in); | 
|---|
| 66 | void SetFwhmFadc(Float_t in); | 
|---|
| 67 | void SetFadcSlicesPerNanosec(Float_t in); | 
|---|
| 68 |  | 
|---|
| 69 |  | 
|---|
| 70 | Float_t GetBrightness(); | 
|---|
| 71 | Float_t GetAmplTrig(); | 
|---|
| 72 | Float_t GetFwhmTrig(); | 
|---|
| 73 | Int_t   GetShapeFadc()            {return fFadcShape;} | 
|---|
| 74 | Float_t GetIntegFadc(); | 
|---|
| 75 | Float_t GetFwhmFadc(); | 
|---|
| 76 | Int_t   GetBinsTrig()             {return fBinsTrig;} | 
|---|
| 77 | Int_t   GetBinsFadc()             {return fBinsFadc;} | 
|---|
| 78 | Float_t GetTimeRange()            {return fTimeRange;} | 
|---|
| 79 | Float_t GetFadcSlicesPerNanosec() {return fFadcSlicesPerNanosec;} | 
|---|
| 80 |  | 
|---|
| 81 | void SetTrigResponse(Float_t *in); | 
|---|
| 82 | void SetFadcResponse(Float_t *in); | 
|---|
| 83 |  | 
|---|
| 84 | void FillResponse(Float_t ampl, Float_t time); | 
|---|
| 85 |  | 
|---|
| 86 | void ElecNoise ( Float_t noiseTrig =  0.3 , Float_t noiseFadc = .5 ); | 
|---|
| 87 |  | 
|---|
| 88 | Float_t GetTrig (Int_t i); | 
|---|
| 89 | Float_t GetFadc (Int_t i); | 
|---|
| 90 |  | 
|---|
| 91 | Float_t* GetTrigPointer (Int_t i) { return &(fTrig[i]); } | 
|---|
| 92 | Float_t* GetFadcPointer (Int_t i) { return &(fFadc[i]); } | 
|---|
| 93 |  | 
|---|
| 94 | void StoreHisto  (char *filename ); | 
|---|
| 95 |  | 
|---|
| 96 | void WriteBinary (char *filename ); | 
|---|
| 97 |  | 
|---|
| 98 | void ReadBinary (char *filename ); | 
|---|
| 99 |  | 
|---|
| 100 | }; | 
|---|
| 101 |  | 
|---|
| 102 | #endif | 
|---|