00001 00014 #ifndef DETECTORPROPERTIES_HH 00015 #define DETECTORPROPERTIES_HH 00016 00017 #include "LArUtilBase.hh" 00018 00019 namespace larutil { 00027 class DetectorProperties : public LArUtilBase { 00028 00029 private: 00030 00032 DetectorProperties(bool default_load=true); 00033 00035 virtual ~DetectorProperties(){}; 00036 00037 static DetectorProperties* _me; 00038 00039 public: 00040 00042 static const DetectorProperties* GetME(bool default_load=true) 00043 { 00044 if(!_me) _me = new DetectorProperties(default_load); 00045 return _me; 00046 } 00047 00048 //--- LArSoft Function Implementations ---// 00049 00050 Double_t SamplingRate() const { return fSamplingRate; } 00051 Double_t ElectronsToADC() const { return fElectronsToADC; } 00052 UInt_t NumberTimeSamples() const { return fNumberTimeSamples; } 00053 UInt_t ReadOutWindowSize() const { return fReadOutWindowSize; } 00054 Int_t TriggerOffset() const { return fTriggerOffset;} 00055 Double_t TimeOffsetU() const { return fTimeOffsetU; } 00056 Double_t TimeOffsetV() const { return fTimeOffsetV; } 00057 Double_t TimeOffsetZ() const { return fTimeOffsetZ; } 00058 00059 Double_t ConvertXToTicks(Double_t X, Int_t p) { 00060 return (X / fXTicksCoefficient + fXTicksOffsets.at(p)); 00061 } 00062 00063 Double_t ConvertTicksToX(Double_t ticks, Int_t p) { 00064 return (ticks - fXTicksOffsets.at(p) ) * fXTicksCoefficient; 00065 } 00066 00067 Double_t GetXTicksOffset(Int_t p) { 00068 return fXTicksOffsets.at(p); 00069 } 00070 00071 Double_t GetXTicksCoefficient() { 00072 return fXTicksCoefficient; 00073 } 00074 00075 // Following functions are intentionally commented out by Kazu for LArLight 00076 // as they do not make any sense to him (he thinks they are wrong). 00077 /* 00078 Double_t ConvertTDCToTicks(Double_t tdc) const 00079 { return fNumberTimeSamples == fReadOutWindowSize ? tdc : tdc - fReadOutWindowSize;} 00080 00081 Double_t ConvertTicksToTDC(Double_t ticks) const 00082 { return fNumberTimeSamples == fReadOutWindowSize ? ticks : ticks + fReadOutWindowSize;} 00083 */ 00084 00085 protected: 00086 00087 virtual bool ReadTree(); 00088 virtual void ClearData(); 00089 00090 Double_t fSamplingRate; 00091 Int_t fTriggerOffset; 00092 Double_t fElectronsToADC; 00093 UInt_t fNumberTimeSamples; 00094 UInt_t fReadOutWindowSize; 00095 Double_t fTimeOffsetU; 00096 Double_t fTimeOffsetV; 00097 Double_t fTimeOffsetZ; 00098 00099 bool fInheritTriggerOffset; 00100 bool fInheritNumberTimeSamples; 00101 00102 Double_t fXTicksCoefficient; 00103 bool fXTicksParamsLoaded; 00104 std::vector<Double_t> fXTicksOffsets; 00105 00106 }; 00107 } 00108 #endif 00109 // end of doxygen group 00110