@@ -42,13 +42,13 @@ class HcalElectronicsId {
4242 /* * VME Constructor from slb channel,slb site,spigot,dccid */
4343 constexpr HcalElectronicsId (int slbChan, int slbSite, int spigot, int dccid, int crate, int slot, int tb)
4444 : hcalElectronicsId_(
45- (uint32_t )((slbChan & 0x3 ) | (((slbSite)& 0x7) << 2) | ((spigot & 0xF ) << 5) | ((dccid & 0x1F ) << 9))) {
45+ (uint32_t )((slbChan & 0x3 ) | (((slbSite) & 0x7) << 2) | ((spigot & 0xF ) << 5) | ((dccid & 0x1F ) << 9))) {
4646 hcalElectronicsId_ |= ((tb & 0x1 ) << 19 ) | ((slot & 0x1f ) << 14 ) | ((crate & 0x3f ) << 20 );
4747 hcalElectronicsId_ |= 0x02000000 ;
4848 }
4949 /* * uTCA constructor */
5050 constexpr HcalElectronicsId (int crate, int slot, int fiber, int fc, bool isTrigger)
51- : hcalElectronicsId_((int )((fc & 0xF ) | (((fiber)& 0x1F) << 4) | ((slot & 0xF ) << 9) | ((crate & 0x3F ) << 13))) {
51+ : hcalElectronicsId_((int )((fc & 0xF ) | (((fiber) & 0x1F) << 4) | ((slot & 0xF ) << 9) | ((crate & 0x3F ) << 13))) {
5252 if (isTrigger)
5353 hcalElectronicsId_ |= 0x02000000 ;
5454 hcalElectronicsId_ |= 0x04000000 ;
@@ -71,45 +71,51 @@ class HcalElectronicsId {
7171 }
7272
7373 // / get subtype for this channel (valid for uTCA only)
74- constexpr int subtype () const { return (isUTCAid ()) ? ((hcalElectronicsId_ >> 21 ) & 0x1F ) : (-1 ); }
74+ constexpr int32_t subtype () const {
75+ return (isUTCAid ()) ? static_cast <int32_t >((hcalElectronicsId_ >> 21 ) & 0x1F ) : (-1 );
76+ }
7577 // / get the fiber channel id (which of channels on a fiber)
76- constexpr int fiberChanId () const { return (isVMEid ()) ? (hcalElectronicsId_ & 0x3 ) : (hcalElectronicsId_ & 0xF ); }
78+ constexpr int32_t fiberChanId () const {
79+ return (isVMEid ()) ? static_cast <int32_t >(hcalElectronicsId_ & 0x3 ) : (hcalElectronicsId_ & 0xF );
80+ }
7781 // / get the fiber index. For VME 1-8 (which of eight fibers carried by a spigot), for uTCA fibers are zero-based
78- constexpr int fiberIndex () const {
82+ constexpr int32_t fiberIndex () const {
7983 return (isVMEid ()) ? (((hcalElectronicsId_ >> 2 ) & 0x7 ) + 1 ) : ((hcalElectronicsId_ >> 4 ) & 0x1F );
8084 }
8185 // / get the SLB channel index (valid only for VME trigger-chain ids)
82- constexpr int slbChannelIndex () const { return hcalElectronicsId_ & 0x3 ; }
86+ constexpr int32_t slbChannelIndex () const { return hcalElectronicsId_ & 0x3 ; }
8387 // / get the SLB site number (valid only for VME trigger-chain ids)
84- constexpr int slbSiteNumber () const { return ((hcalElectronicsId_ >> 2 ) & 0x7 ); }
88+ constexpr int32_t slbSiteNumber () const { return ((hcalElectronicsId_ >> 2 ) & 0x7 ); }
8589
8690 // / get the HTR channel id (1-24)
87- constexpr int htrChanId () const { return isVMEid () ? ((fiberChanId () + 1 ) + ((fiberIndex () - 1 ) * 3 )) : (0 ); }
91+ constexpr int32_t htrChanId () const { return isVMEid () ? ((fiberChanId () + 1 ) + ((fiberIndex () - 1 ) * 3 )) : (0 ); }
8892
8993 // / get the HTR-wide slb channel code (letter plus number)
9094 std::string slbChannelCode () const ;
9195
9296 // / get the spigot (input number on DCC, AMC card number for uTCA)
93- constexpr int spigot () const { return (isVMEid ()) ? ((hcalElectronicsId_ >> 5 ) & 0xF ) : slot (); }
97+ constexpr int32_t spigot () const { return (isVMEid ()) ? ((hcalElectronicsId_ >> 5 ) & 0xF ) : slot (); }
9498 // / get the (Hcal local) DCC id for VME, crate number for uTCA
95- constexpr int dccid () const { return (isVMEid ()) ? ((hcalElectronicsId_ >> 9 ) & 0x1F ) : crateId (); }
99+ constexpr int32_t dccid () const { return (isVMEid ()) ? ((hcalElectronicsId_ >> 9 ) & 0x1F ) : crateId (); }
96100 // / get the htr slot
97- constexpr int htrSlot () const { return slot (); }
101+ constexpr int32_t htrSlot () const { return slot (); }
98102 // / get the htr or uHTR slot
99- constexpr int slot () const {
103+ constexpr int32_t slot () const {
100104 return (isVMEid ()) ? ((hcalElectronicsId_ >> 14 ) & 0x1F ) : ((hcalElectronicsId_ >> 9 ) & 0xF );
101105 }
102106 // / get the htr top/bottom (1=top/0=bottom), valid for VME
103- constexpr int htrTopBottom () const { return (isVMEid ()) ? ((hcalElectronicsId_ >> 19 ) & 0x1 ) : (-1 ); }
107+ constexpr int32_t htrTopBottom () const {
108+ return (isVMEid ()) ? static_cast <int32_t >((hcalElectronicsId_ >> 19 ) & 0x1 ) : (-1 );
109+ }
104110 // / get the readout VME crate number
105- constexpr int readoutVMECrateId () const { return crateId (); }
111+ constexpr int32_t readoutVMECrateId () const { return crateId (); }
106112 // / get the readout VME crate number
107- constexpr int crateId () const {
113+ constexpr int32_t crateId () const {
108114 return (isVMEid ()) ? ((hcalElectronicsId_ >> 20 ) & 0x1F ) : ((hcalElectronicsId_ >> 13 ) & 0x3F );
109115 }
110116 // / get a fast, compact, unique index for linear lookups
111- constexpr int linearIndex () const {
112- return (isVMEid ()) ? ((hcalElectronicsId_)& 0x3FFF ) : ((hcalElectronicsId_)& 0x7FFFF );
117+ constexpr int32_t linearIndex () const {
118+ return (isVMEid ()) ? ((hcalElectronicsId_) & 0x3FFF ) : ((hcalElectronicsId_) & 0x7FFFF );
113119 }
114120
115121 static const int maxLinearIndex = 0x7FFFF ; //
0 commit comments