#ifndef TECALChannelId_hxx_seen #define TECALChannelId_hxx_seen #include "IECALTrigChannelId.hxx" namespace COMET { class IECALChannelId; } ///Channel ID class for Channels using the ECAL electronics hierarchy /// ///Can answer detailed questions about its elements. ///This should be used for constructing IECALChannelIds from the information available. class COMET::IECALChannelId : public COMET::IECALTrigChannelId { public: ///Construct a ECAL channel ID from a raw UInt_t explicit IECALChannelId(UInt_t id =0); ///Constructor to specialise a Channel ID as a ECAL channel ID explicit IECALChannelId(const COMET::IChannelId& src); ///Construct an ECAL channel ID from its electronics-space co-ordinates. ///The sub-detector ID should be COMET::IChannelId::kECAL, but is explicitly required. IECALChannelId(const UInt_t subDet, const UInt_t Channel); ///Construct an ECAL channel ID from its geometrical parameters. ///This internally calls SetFromGeomComponentNumber. ///The sub-detector ID should be COMET::IChannelId::kECAL, but is explicitly required. IECALChannelId(const UInt_t subDet, const UInt_t block, const UInt_t crystal); virtual ~IECALChannelId(); ///Format as a human readable string virtual std::string AsString() const; /// Encode set of the SimG4 geometry component numbers into ChannelId void SetFromGeomComponentNumber(const UInt_t block, const UInt_t crystal); /// Convert this ChannelId into SimG4 geometrical component numbers. bool GetComponentNumber(UInt_t& block, UInt_t& crystal) const; /// Convert this ECALChannelId into the corresponding ECALTrigChannelId inline IECALTrigChannelId GetTrigChannelId() const { return IECALTrigChannelId(COMET::IChannelId::kECALTrig, GetChannel()); } protected: /// @{ Define the sub-detector specific part of the channel id. The /// sub-detector specific part of the channel id is a 25 bit field with /// bits number from 0 (lsb) to 24 (msb). The sub-fields are defined /// /// [ bb ... bb ] cccc [ xx ... xx ] /// /// b(12) [24 : bb ] -- Block (Module) Channel defined by IECALTrigChannel /// c(4) [bb-1: bb-4] -- 4 bit Crystal (Module) Channel /// x(9) [bb-5: 0 ] -- Spare (all the remaining space) /// /// Note: The shift and the least significant bit (lsb) must be the same. enum BitDefinitions { // Upper bit fields is defined by IECALChannelId kCrystalMSB = IECALTrigChannelId::kBlockLSB - 1, kCrystalLSB = kCrystalMSB - 3, kSpareMSB = kCrystalLSB - 1, kSpareLSB = 0 }; /// @} private: /// Set the channel virtual void SetChannel(int val); // Release note: // Ver.1 (unknown ) Bit fields defined as the same as ECALGeomId // Ver.2 (2015/11/16) Bit fields defined only for the block and crystal modules. ClassDef(IECALChannelId, 2) }; #endif