// ESAF : Euso Simulation and Analysis Framework // class PMT // $Id: Photomultiplier.hh,v 1.25 2005/07/05 20:43:03 thea Exp $ // 10-4-2001 M.P. created // 26-3-2003 A.T. modified to become the base virtual class for all PMT // Simulate a multi-anode pmt #ifndef __PHOTOMULTIPLIER_HH_ #define __PHOTOMULTIPLIER_HH_ #include #include "euso.hh" #include "PmtSignal.hh" #include "Photon.hh" #include "PmtGeometry.hh" #include "EsafConfigurable.hh" #include "EsafMsgSource.hh" #define MAX_PMT_CHANNELS 64 class FrontEndChip; class MacroCell; class ElementaryCell; typedef Int_t ChannelUniqueId; enum PmtState {kPmtIdle, kPmtFilling, kPmtDone }; class Photomultiplier : public EsafConfigurable, public EsafMsgSource { protected: Photomultiplier( Int_t , PmtGeometry* ); public: virtual ~Photomultiplier(); EsafConfigClass(Electronics,Photomultiplier) // return parameters for this kind of pmt static Double_t GetQuantum() {return fgQuantum;} static Double_t GetGain() {return fgGain;} static Double_t GetGainSigma() {return fgGainSigma;} static Double_t GetWidth() {return fgWidth;} static Double_t GetGtuLength() {return fgGtuLength;} static Double_t GetDarkNoiseRate() {return fgDarkNoiseRate;} // static reset class variables static void ResetClass(); // Pmt identifier inline Int_t Id() const {return fId;} // unique id handlers // set first unique id associated to this pmt inline void SetStartUniqueId(ChannelUniqueId start) {Geometry()->SetStartUniqueId(start);} // get unique id for a given channel ChannelUniqueId GetUniqueId(Int_t ch) const; // get first unique id belonging to this pmt inline ChannelUniqueId GetStartUniqueId() const {return Geometry()->GetStartUniqueId();} // get last unique id belonging to this pmt inline ChannelUniqueId GetLastUniqueId() const {return Geometry()->GetLastUniqueId();} // get channel number (from 0 to pmtsize) given a unique id // returns -1 does not exist Int_t GetChannel(ChannelUniqueId id) const {return Geometry()->GetChannel(id);} // Pmt Status: can be kPmtIdle (after startup or reset), kPmtFilling // (after an Add call but before Simulate()) and kPmtDone (after Simulate) inline PmtState Status() const {return fState;} // number of PMT anodes virtual Int_t NumChan() const { return Geometry()->NumPads();} // returns true if n is a valid channel // channels run from 0 to NumChan()-1 virtual Bool_t isValid(Int_t n) const { if ( n>=0 && n& Signals(Int_t ch) { return *(fPmtHits[ch]);} protected: PmtState fState; // state of the PMT inline void SetState(PmtState val) {fState=val;} Int_t fId; // this pmt id number ChannelUniqueId fStartUniqueId; // unique id of first channel map fFeMap; // mapping between pmt and front end channels FrontEndChip* fFrontEnd; // pointer to its front end chip PmtGeometry* fGeometry; // pointer to the geometry object MacroCell* fCell; // pointer to the macrocell ElementaryCell* fEC; // pointer to the elementary cell virtual void BuildFrontEndMap(Int_t, Int_t); // helper function to map pmt and front end // a map associating to each channel a vector that is a list of pointers to PmtSignals map* > fPmtHits; Bool_t fEmpty; Double_t fStartTime, fEndTime; // add function for electronic test only virtual void AddTest(Double_t,Int_t); static Double_t fgQuantum; // quantum efficiency static Double_t fgGain; // nominal gain static Double_t fgGainSigma; // gain spread static Double_t fgWidth; // time width static Double_t fgDarkNoiseRate; // darknoise [microsec^-1] static Double_t fgGtuLength; // gtu length in ns friend class ElecTestDetTransManager; ClassDef(Photomultiplier,0) }; #endif