//========================================================================== // PndEmcWaveform.h // // Class to hold waveforms created from Emc Hits // // Hits will be converted to waveforms using the standard // formula for an exponential decay convoluted with CR-RC (or CR-2RC) // shaping. // // Public functions: // // AddElecNoise(Double_t) // Adds gaussian noise with width // given by the Double_t parameter. // // Digitise(Double_t) Simple digitisation, given // the value of one bit in energy // equivalent units. // // AddElecNoiseAndDigitse(Double_t, Double_t) Do both // // AddShapedElecNoiseAndDigitse(Double_t, Double_t) Do both, but with // noise tyhat is not just plain gaussian, but passed through the // shaping. Only use for detailed studies- this is like // adding a Hit to *every bin* and is very slow if you are doing // a calorimiter's worth. // // GetScale() Return the maximum peak of a 1 GeV hit. // // Software developed for the BaBar Detector at the SLAC B-Factory. // Adapted for the PANDA experiment at GSI // // P.D.Strother Imperial College // Dima Melnichuk - adaption for PANDA //======================================================================= //#pragma once #ifndef PNDEMCWAVEFORM_H #define PNDEMCWAVEFORM_H #include #include "TObject.h" #include "PndEmcTwoCoordIndex.h" #include "PndEmcCRRCPulseshape.h" #include "PndEmcCR2RCPulseshape.h" #include "PndEmcHit.h" #include "FairTimeStamp.h" #include "TGraphErrors.h" #define TIMEBASEDSIM class PndEmcHit; /** * @brief represents a simulated waveform in an emc crystal * @ingroup PndEmc */ class PndEmcWaveform: public FairTimeStamp { friend class PndEmcAbsWaveformModifier; public: // Constructors PndEmcWaveform(); PndEmcWaveform(int trackId, long detId, const std::vector& signal, Int_t hitIndex=-1); PndEmcWaveform(long detId, const std::vector& signal, const FairMultiLinkedData& links); PndEmcWaveform(Int_t trackId,Long_t detId, Double_t sampleRate, Long_t waveform_length=64, Int_t hitIndex=-1, Double_t time=0. ); // Destructor: virtual ~PndEmcWaveform(); // Copy generated by compiler: //PndEmcWaveform(const PndEmcWaveform& copy); //virtual PndEmcWaveform& operator=(const PndEmcWaveform& copy); // Selectors long GetDetectorId() const {return fDetectorId;} int GetTrackId() const {return fTrackId;} Short_t GetModule() const { return (fDetectorId/100000000);}; PndEmcTwoCoordIndex* GetTCI() const; virtual std::vector GetSignal() const { return fSignal ;}; virtual std::vector GetSignalError() const { return fSignalError; } Int_t GetHitIndex() const {return fHitIndex;} //Operators virtual bool operator == (const PndEmcWaveform& otherWave) const; virtual bool operator < (const PndEmcWaveform& otherWave) const; virtual bool operator != (const PndEmcWaveform& otherWave) const; virtual bool equal(FairTimeStamp* data); PndEmcWaveform& operator += (const PndEmcWaveform& otherWave); Double_t GetSampleRate() const { return fSampleRate; } //in s^(-1) Double_t GetScale(Double_t sampleRate, PndEmcAbsPulseshape *pulseshape) const; Double_t GetNormalisation(Double_t sampleRate, PndEmcAbsPulseshape *pulseshape) const; Int_t GetWaveformLength() const {return fWaveformLength;} // Modifiers void SetSampleRate(Double_t rate) {fSampleRate = rate;}; //in s^(-1) void UpdateWaveform(PndEmcHit *hit, Double_t pePerMeV, Bool_t usePhotonStatistic, Double_t excessNoiseFactor, Double_t firstADCBinTime, Double_t sampleRate, PndEmcAbsPulseshape *pulseshape, Double_t=0); void MakeWaveform(Double_t energy, Double_t time, Double_t pePerMeV, Bool_t usePhotonStatistic, Double_t excessNoiseFactor, Double_t firstADCBinTime, Double_t sampleRate, PndEmcAbsPulseshape *pulseshape, Double_t=0); void AddElecNoise(Double_t); void Digitise(Double_t); void AddElecNoiseAndDigitise(Double_t,Double_t,Double_t=0); //void AddElecNoiseAndDigitise(Double_t,Double_t, Double_t* noise); // Both add noise and digitise. The first Double_t is the noise width (GeV), // the second is the one bit resolution void AddShapedElecNoiseAndDigitise(Double_t noise_width,Double_t oneBitResolution, PndEmcAbsPulseshape *pulseshape, Double_t firstADCBinTime, Double_t sampleRate,Double_t=0); // Add shaped noise and digitise. void SetWaveform(std::vector&signal,Int_t length); Double_t Max(); virtual void clearAndReset(); virtual void Clear(Option_t *option=""){fSignal.clear();}; Double_t GetActiveTime() const { return GetTimeStamp() + (fWaveformLength-1)/fSampleRate*1.0e9; }//nano seconds Int_t GetPileupCount() const {return fEvt.size() - 1; } void AddEvt(Int_t evtNo) { fEvt.push_back(evtNo);} const std::vector& GetEvtList() const { return fEvt; } TGraphErrors* ToTGraph() const ; Double_t GetBaseline() const { return fBaselineValue;} Double_t Integral() const ; protected: Int_t fTrackId; Int_t fDetectorId; Int_t fWaveformLength; std::vector fSignal; // Signal after FADC std::vector fSignalError; // Signal after FADC Int_t fHitIndex; Double_t fSampleRate; //in s^(-1) Double_t fBaselineValue; std::vector fEvt;//combined waveforms from which events, for check. //for pileup static Double_t BarrelOverlapTime; static Double_t ForwardOverlapTime; static Double_t ShashylikOverlapTime; ClassDef(PndEmcWaveform,7) }; #endif