//////////////////////////////////////////////////////////////////// /// \class RAT::DS::PMT /// /// \brief Data Structure: PMT hit in triggered event /// /// \author A. Mastbaum /// /// REVISION HISTORY:\n /// 2013/03/28 : A.Mastbaum - copied from DS::PMTCal\n /// 2014/01/26 : F.Descamps - remove CSS flag /// 2016/06/05 : T.Kaptanoglu - add crosstalk flag /// /// \details This represents a calibrated, uncalibrated, or MC-generated /// PMT hit in a detector event. /// /// RAT::DS::PMT is a template class, which can be used to /// create PMTs where the data has arbitrary types, e.g. /// PMT. /// /// The PMT types used in EV are typedefs, defined at the bottom /// of this file as: /// /// PMTUncal = PMT /// //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// /// \class RAT::DS::PMTCal /// /// \brief Data Structure: Calibrated PMT hit in triggered event /// /// \author A. Mastbaum /// /// REVISION HISTORY:\n /// /// \details This represents a calibrated PMT hit in a detector event. /// /// RAT::DS::PMTCal is a specialization of the PMT template class, /// with additional calibration flags. /// //////////////////////////////////////////////////////////////////// #ifndef __RAT_DS_PMT__ #define __RAT_DS_PMT__ #include #include #include namespace RAT { namespace DS { template class PMT : public TObject { public: PMT() : TObject(), id(0), qhs(0), qhl(0), qlx(0), time(0), cellID(0), chanFlags(0), isCrossTalk(0) {} virtual ~PMT() {} /// Get ID number of PMT /// /// @return ID (LCN) of the PMT virtual UInt_t GetID() const { return id; } /// @copydoc GetID virtual UInt_t GetLogicalChannelNumber() const { return id; } /// @copydoc GetID virtual UInt_t GetLCN() const { return id; } /// Get the CCC, Card Crate Channel number /// /// @return the CCC, Card Crate Channel number virtual UInt_t GetCardCrateChannel() const { return 1024 * GetCard() + 32 * GetCrate() + GetChannel(); } /// @copydoc GetCardCrateChannel virtual UInt_t GetCCC() const { return GetCardCrateChannel(); } /// Get the CCCC, Crate Card Channel Cell number /// /// @return the CCCC, Crate Card Channel Cell number virtual UInt_t GetCrateCardChannelCell() const { return 8192 * GetCrate() + 512 * GetCard() + 16 * GetChannel() + static_cast( cellID ); } /// @copydoc GetCrateCardChannelCell virtual UInt_t GetCCCC() const { return GetCrateCardChannelCell(); } /// Get the Crate this PMT resides in /// /// @return the Crate ID virtual UInt_t GetCrate() const { return BitManip::GetBits( id, 9, 5 ); } /// Get the card this PMT resides on /// /// @return the card id virtual UInt_t GetCard() const { return BitManip::GetBits( id, 5, 4 ); } /// Get the channel this PMT resides on /// /// @return the channel id virtual UInt_t GetChannel() const { return BitManip::GetBits( id, 0, 5 ); } /// Set ID number of PMT /// /// @param[in] _id (LCN) of the PMT virtual void SetID(const UInt_t _id) { id = _id; } /// Get charge of PMT sample, high gain short integration time (QHS) /// /// @return QHS integrated charge of the PMT sample virtual T GetQHS() const { return qhs; } /// Set charge of PMT sample, high gain short integration time (QHS) /// /// @param[in] _qhs integrated charge of the PMT sample virtual void SetQHS(const T _qhs) { qhs = _qhs; } /// Get charge of PMT sample, high gain long integration time (QHL) /// /// @return QHL integrated charge of the PMT virtual T GetQHL() const { return qhl; } /// Set charge of PMT sample, high gain long integration time (QHL) /// /// @param[in] _qhl integrated charge of the PMT sample virtual void SetQHL(const T _qhl) { qhl = _qhl; } /// Get charge of PMT sample, low gain (QLX) /// /// @return QLX integrated charge of the PMT sample virtual T GetQLX() const { return qlx; } /// Set charge of PMT sample, low gain (QLX) /// /// @param[in] _qlx integrated charge of the PMT sample virtual void SetQLX(const T _qlx) { qlx = _qlx; } /// Get PMT hit time (TAC) /// /// @return TAC PMT hit time virtual T GetTime() const { return time; } /// Set PMT hit time (TAC) /// /// @param[in] _time PMT hit time virtual void SetTime(const T _time) { time = _time; } /// Get cell number in electronics /// /// @return cellID cell number in electronics virtual UShort_t GetCellID() const { return cellID; } /// Set cell number in electronics /// /// @param[in] _cellID cell number in electronics virtual void SetCellID(const UShort_t _cellID) { cellID = _cellID; } /// Get channel status flags (errors in read-out electronics) /// /// @return chanFlags status flags (errors in read-out electronics) virtual Char_t GetChanFlags() const { return chanFlags; } /// Set channel status flags (errors in read-out electronics) /// /// @param[in] _channelFlags status flags (errors in read-out electronics) virtual void SetChanFlags(const Char_t _channelFlags) { chanFlags = _channelFlags; } /// Get the crosstalk information /// /// @return true if this hit is due to crosstalk Bool_t GetCrossTalkFlag() const { return isCrossTalk; } /// Set the crosstalk flag for this hit /// /// @param[in] crosstalk true if crosstalk hit virtual void SetCrossTalkFlag( const Bool_t crosstalk ) { isCrossTalk = crosstalk; } /// Set all PMT properties at once /// /// @param[in] _id (LCN) of the PMT /// @param[in] _qhs integrated charge of the PMT /// @param[in] _qhl integrated charge of the PMT /// @param[in] _qlx integrated charge of the PMT /// @param[in] _time hit time of the PMT /// @param[in] _cellID cell number in electronics /// @param[in] flags channel status flags (errors in read-out electronics) virtual void SetPMTParameters(const UInt_t _id, const T _qhs, const T _qhl, const T _qlx, const T _time, const UShort_t _cellID, const Char_t flags) { id = _id; qhs = _qhs; qhl = _qhl; qlx = _qlx; time = _time; cellID = _cellID; chanFlags = flags; }; // This ROOT macro adds dictionary methods to this class. // The number should be incremented whenever this class's members are changed. ClassDef(PMT, 2); protected: UInt_t id; ///< PMT ID, i.e. logical channel number T qhs; ///< Charge: high gain, short integration time T qhl; ///< Charge: high gain, long integration time T qlx; ///< Charge: low gain charge T time; ///< Hit time UShort_t cellID; ///< Cell number in electronics Char_t chanFlags; ///< Electronics errors/settings ///< Order, from least sig bit upwards: ///< CGT ES16, CGT ES24, Missed Count, NC/CC Flag, ///< LGISELECT, CMOS ES16 Bool_t isCrossTalk; ///< True if this hit is cause by crosstalk }; class PMTCal : public PMT { public: PMTCal() : PMT() {} virtual ~PMTCal() { } /// Get the status /// /// @return reference to the status bit mask BitMask& GetStatus() { return status; } /// @copydoc GetStatus() const BitMask& GetStatus() const { return status; } /// Set the status /// /// @param[in] status_ to set void SetStatus( const BitMask& status_ ) { status = status_; } using PMT::SetPMTParameters; /// Set all PMT properties at once /// /// @param[in] _id (LCN) of the PMT /// @param[in] _qhs integrated charge of the PMT /// @param[in] _qhl integrated charge of the PMT /// @param[in] _qlx integrated charge of the PMT /// @param[in] _time hit time of the PMT /// @param[in] _cellID cell number in electronics /// @param[in] flags channel status flags (errors in read-out electronics) /// @param[in] status_ of the calibrations virtual void SetPMTParameters(const UInt_t _id, const Double_t _qhs, const Double_t _qhl, const Double_t _qlx, const Double_t _time, const UShort_t _cellID, const Char_t flags, const BitMask& status_) { SetPMTParameters(_id, _qhs, _qhl, _qlx, _time, _cellID, flags); status = status_; }; // This ROOT macro adds dictionary methods to this class. // The number should be incremented whenever this class's members are changed. ClassDef(PMTCal, 1); protected: BitMask status; ///< Status flags for the various calibrations }; typedef PMT PMTFloat; ///< This is only here because C++ fails to compile otherwise /// \class RAT::DS::PMTUncal /// This is a typedef of the PMT class. /// \sa RAT::DS::PMT for full documentation typedef PMT PMTUncal; } // namespace DS } // namespace RAT #endif // __RAT_DS_PMT__