/*! * @file SChannel.h * @author Dan Saunders & Mathieu Labare, on behalf of the SoLid collaboration. * @date 16 Feb 2016 */ #ifndef SChannel_h_ #define SChannel_h_ #include #include #include #include "SContainers/SEvent.h" #include "SContainers/SPeak.h" #include "SContainers/SWaveform.h" //! Object for storing information about a specific channel. /*! Depending on the detector setup and data taking period, each channel has a * spatial position, a clock speed, and set of calibration constants. This * information is retrieved from the SoLid data base. Data from each channel * also form various reconsturction objects, and pointers to those objects are * stored in this class for convienience. * * Each channel has two spatial positions. (xLoc, yLoc, zLoc) - the local * position - is the position of the channel in integer steps. These values * increase sequentially regardless of alignment. (x, y, z) - the global * position - is the position of the channel in meters, taking into account * alignment effects (such as the calibration slabs). */ class SChannel { private: // See safChanIndex() and (same method, shortered name) ID(). unsigned int m_safChanIndex; //! See xLoc() int m_xLoc; //! See yLoc() int m_yLoc; //! See zLoc() int m_zLoc; //! See xGlob() float m_xGlob; //! See yGlob() float m_yGlob; //! See zGlob() float m_zGlob; //! See baseline() float m_baseline; //! See masked() bool m_masked; //! See waveforms() std::vector m_waveforms; //! See peaks() std::vector m_peaks; //! See sampleWidthNs() double m_sampleWidthNs; //! See findBaselinesAuto() bool m_findBaselinesAuto; public: SChannel(unsigned int safChanIndex, int xLoc, int yLoc, int zLoc, float xGlob, float yGlob, float zGlob); ~SChannel(); void findBaseline(SWaveform * w); void clear(); // Setters and getters _______________________________________________________ //! Local x position of the channel (units of cubes). /*! Increases sequntially regarless of alignment (e.g calibration slabs). */ int xLoc() {return m_xLoc;} //! Local y position of the channel (units of cubes). /*! Increases sequntially regarless of alignment (e.g calibration slabs). */ int yLoc() {return m_yLoc;} //! Local z position of the channel (units of cubes). /*! Increases sequntially regarless of alignment (e.g calibration slabs). */ int zLoc() {return m_zLoc;} //! Global x position of the channel (units of meters). /*! Takes into account alignment effects. */ float xGlob() {return m_xGlob;} //! Global y position of the channel (units of meters). /*! Takes into account alignment effects. */ float yGlob() {return m_yGlob;} //! Global z position of the channel (units of meters). /*! Takes into account alignment effects. */ float zGlob() {return m_zGlob;} //! Saffron specific channel index (indexed from zero). /* Exact mapping depends on detector configuration - documented elsewhere. * Guarenteed to be in the range [0, nTotChans). */ unsigned int safChanIndex() {return m_safChanIndex;} //! Shortened name version of safChanIndex() unsigned int ID() {return m_safChanIndex;} //! Channel baseline (in ADC) - see also setBaseline(float) /*! Should be loaded from the SoLid database. Defaults to 8500 */ float baseline() {return m_baseline;} void setBaseline(float b) {m_baseline = b;} //! Masked channel flag. See also setMasked(). /*! Channel masking can be specified in the options file, using the SafChanIndex. */ bool masked() {return m_masked;} void setMasked(bool mask) {m_masked = mask;} //! Waveforms from this channel. std::vector * waveforms() {return &m_waveforms;} //! Add a waveform - should be used instead of the vector directly. void addWaveform(SWaveform * w); //! Peaks. std::vector * peaks() {return &m_peaks;} //! Sample width (e.g 25ns for phase 1) double sampleWidthNs() {return m_sampleWidthNs;} //! Flag for whether to estimate baselines from first waveform. bool findBaselinesAuto() {return m_findBaselinesAuto;} void setFindBaselinesAuto(bool f) {m_findBaselinesAuto = f;} }; #endif /* SChannel_h_ */