ATLAS Offline Software
Loading...
Searching...
No Matches
L1CaloCoolChannelId Class Referencefinal

Encapsulates the ID of one channel of conditions data in COOL, ie the ID of a row in a table. More...

#include <L1CaloCoolChannelId.h>

Collaboration diagram for L1CaloCoolChannelId:

Public Member Functions

 L1CaloCoolChannelId ()
 Create a L1CaloCoolChannelId from the integer ID field.
 L1CaloCoolChannelId (unsigned int crate, L1CaloModuleType mType, unsigned int module, unsigned int submodule, unsigned int channel, bool logical=true)
 Create a L1CaloCoolChannelId from its component fields.
 L1CaloCoolChannelId (unsigned int id)
 Create a L1CaloCoolChannelId from the integer ID field.
 L1CaloCoolChannelId (const L1CaloCoolChannelId &id)
 Copy a L1CaloCoolChannelId.
 ~L1CaloCoolChannelId ()=default
unsigned int crate () const
L1CaloModuleType moduleType () const
 Return module type of this channel ID.
unsigned int module (bool logical=true) const
 Convert a typeId to a L1CaloModuleType.
unsigned int subModule () const
unsigned int channel () const
unsigned int id () const
L1CaloCoolChannelIdoperator= (const L1CaloCoolChannelId &id)
 Copy a L1CaloCoolChannelId.
bool operator== (const L1CaloCoolChannelId &id) const
bool operator< (const L1CaloCoolChannelId &id) const

Private Member Functions

unsigned int logicalToPhysicalModule (L1CaloModuleType mType, unsigned int module) const
unsigned int physicalToLogicalModule (L1CaloModuleType mType, unsigned int module) const
void setId (unsigned int crate, L1CaloModuleType mType, unsigned int module, unsigned int submodule, unsigned int channel)
 Set the CoolChannelId value from its component fields.

Private Attributes

unsigned int m_id

Friends

std::ostream & operator<< (std::ostream &output, const L1CaloCoolChannelId &r)

Detailed Description

Encapsulates the ID of one channel of conditions data in COOL, ie the ID of a row in a table.

At present, COOL can only handle integer IDs, so we encode crate, module type, module in crate, submodule, and channel with module or submodule into a 32 bit quantity as follows:

  • bits 31-24 crate number (0-7=PP, 8-11=CP, 12-13=JEP, 14-15=ROD)
  • bits 23-20 module type (1=PPM, 2=CPM, 3=JEM, 4=CMM, 5=TCM, 6=ROD, 7=CAM)
  • bits 19-16 module number in crate
  • bits 15-08 submodule number in module (if appropriate)
  • bits 08-00 channel number in (sub)module (if appropriate)

This class is a very close adaptation of the online coolL1Calo/L1CaloCoolChannelId class

Definition at line 10 of file L1CaloCoolChannelId.h.

Constructor & Destructor Documentation

◆ L1CaloCoolChannelId() [1/4]

L1CaloCoolChannelId::L1CaloCoolChannelId ( )

Create a L1CaloCoolChannelId from the integer ID field.

Definition at line 34 of file L1CaloCoolChannelId.cxx.

35 : m_id(0)
36{
37}

◆ L1CaloCoolChannelId() [2/4]

L1CaloCoolChannelId::L1CaloCoolChannelId ( unsigned int crate,
L1CaloModuleType mType,
unsigned int module,
unsigned int submodule,
unsigned int channel,
bool logical = true )

Create a L1CaloCoolChannelId from its component fields.

Definition at line 45 of file L1CaloCoolChannelId.cxx.

51 : m_id(0)
52{
53 if(logical) this->setId(crate, mType, module, submodule, channel);
54 else {
55 unsigned int moduleIndex = this->physicalToLogicalModule(mType, module);
56 this->setId(crate, mType, moduleIndex, submodule, channel);
57 }
58}
unsigned int physicalToLogicalModule(L1CaloModuleType mType, unsigned int module) const
unsigned int module(bool logical=true) const
Convert a typeId to a L1CaloModuleType.
unsigned int crate() const
void setId(unsigned int crate, L1CaloModuleType mType, unsigned int module, unsigned int submodule, unsigned int channel)
Set the CoolChannelId value from its component fields.
unsigned int channel() const

◆ L1CaloCoolChannelId() [3/4]

L1CaloCoolChannelId::L1CaloCoolChannelId ( unsigned int id)

Create a L1CaloCoolChannelId from the integer ID field.

Definition at line 66 of file L1CaloCoolChannelId.cxx.

67 : m_id(id)
68{
69}

◆ L1CaloCoolChannelId() [4/4]

L1CaloCoolChannelId::L1CaloCoolChannelId ( const L1CaloCoolChannelId & id)

Copy a L1CaloCoolChannelId.

Definition at line 77 of file L1CaloCoolChannelId.cxx.

78 : m_id(id.m_id)
79{
80}

◆ ~L1CaloCoolChannelId()

L1CaloCoolChannelId::~L1CaloCoolChannelId ( )
default

Member Function Documentation

◆ channel()

unsigned int L1CaloCoolChannelId::channel ( ) const
inline

Definition at line 30 of file L1CaloCoolChannelId.h.

30{ return (m_id & 0x000000ff); }

◆ crate()

unsigned int L1CaloCoolChannelId::crate ( ) const
inline

Definition at line 25 of file L1CaloCoolChannelId.h.

25{ return (m_id & 0xff000000) >> 24; }

◆ id()

unsigned int L1CaloCoolChannelId::id ( ) const
inline

Definition at line 32 of file L1CaloCoolChannelId.h.

32{ return m_id; }

◆ logicalToPhysicalModule()

unsigned int L1CaloCoolChannelId::logicalToPhysicalModule ( L1CaloModuleType mType,
unsigned int module ) const
private

Definition at line 171 of file L1CaloCoolChannelId.cxx.

171 {
172 if (mType == L1CaloModuleType::Ppm) { return module + 5; } //Ppm
173 else if (mType == L1CaloModuleType::Cpm) { return module + 5; } //Cpm
174 else if (mType == L1CaloModuleType::Jem) { return module + 4; } //Jem
175 else {
176 std::cout<<"The physical position of module type: "<<mType.toString()<<" is not known. Returning the logical index instead !"<<std::endl;
177 return module;
178 }
179}
const std::string toString() const
Compare with type value.

◆ module()

unsigned int L1CaloCoolChannelId::module ( bool logical = true) const

Convert a typeId to a L1CaloModuleType.

Returns
L1CaloModuleType

Convert a L1CaloModuleType to a typeId

Returns
unsigned int

Definition at line 162 of file L1CaloCoolChannelId.cxx.

162 {
163 unsigned int logicalIndex = (m_id & 0x000f0000) >> 16;
164 if(logical) {
165 return logicalIndex;
166 } else {
167 return this->logicalToPhysicalModule(this->moduleType(), logicalIndex);
168 }
169}
L1CaloModuleType moduleType() const
Return module type of this channel ID.
unsigned int logicalToPhysicalModule(L1CaloModuleType mType, unsigned int module) const

◆ moduleType()

L1CaloModuleType L1CaloCoolChannelId::moduleType ( ) const

Return module type of this channel ID.

Returns
L1CaloModuleType

Definition at line 120 of file L1CaloCoolChannelId.cxx.

121{
122 unsigned int mTypeId = (m_id & 0x00f00000) >> 20;
123 return L1CaloModuleType((L1CaloModuleType::L1CaloModuleEnum)mTypeId);
124}

◆ operator<()

bool L1CaloCoolChannelId::operator< ( const L1CaloCoolChannelId & id) const

Definition at line 205 of file L1CaloCoolChannelId.cxx.

205 {
206 return m_id<id.m_id;
207}

◆ operator=()

L1CaloCoolChannelId & L1CaloCoolChannelId::operator= ( const L1CaloCoolChannelId & id)

Copy a L1CaloCoolChannelId.

Definition at line 199 of file L1CaloCoolChannelId.cxx.

200{
201 if (this != &id) m_id = id.m_id;
202 return *this;
203}

◆ operator==()

bool L1CaloCoolChannelId::operator== ( const L1CaloCoolChannelId & id) const

Definition at line 209 of file L1CaloCoolChannelId.cxx.

209 {
210 return m_id==id.m_id;
211}

◆ physicalToLogicalModule()

unsigned int L1CaloCoolChannelId::physicalToLogicalModule ( L1CaloModuleType mType,
unsigned int module ) const
private

Definition at line 181 of file L1CaloCoolChannelId.cxx.

181 {
182 if (mType == L1CaloModuleType::Ppm) { return module - 5; } //Ppm
183 else if (mType == L1CaloModuleType::Cpm) { return module - 5; } //Cpm
184 else if (mType == L1CaloModuleType::Jem) { return module - 4; } //Jem
185 else {
186 std::cout<<"The physical position of module type: "<<mType.toString()<<" is not known. Returning the logical index instead !"<<std::endl;
187 return module;
188 }
189}

◆ setId()

void L1CaloCoolChannelId::setId ( unsigned int crate,
L1CaloModuleType mType,
unsigned int module,
unsigned int submodule,
unsigned int channel )
private

Set the CoolChannelId value from its component fields.

Definition at line 89 of file L1CaloCoolChannelId.cxx.

94{
95 m_id = (crate & 0xff) << 24 | (module & 0x0f) << 16 |
96 (submodule & 0xff) << 8 | (channel & 0xff);
97 // We only have a limited number of module types that will
98 // provide conditions data, so convert module types here.
99 // Ignore any other module type.
100
101 m_id |= ((unsigned int)mType & 0x0f) << 20;
102
103// if (mType == L1CaloModuleType::Ppm) { m_id |= 0x00100000; }
104// else if (mType == L1CaloModuleType::Cpm) { m_id |= 0x00200000; }
105// else if (mType == L1CaloModuleType::Jem) { m_id |= 0x00300000; }
106// else if (mType == L1CaloModuleType::Cmm) { m_id |= 0x00400000; }
107// else if (mType == L1CaloModuleType::Tcm) { m_id |= 0x00500000; }
108// else if (mType == L1CaloModuleType::L1CaloRod) { m_id |= 0x00600000; }
109// else if (mType == L1CaloModuleType::Cam) { m_id |= 0x00700000; }
110}

◆ subModule()

unsigned int L1CaloCoolChannelId::subModule ( ) const
inline

Definition at line 29 of file L1CaloCoolChannelId.h.

29{ return (m_id & 0x0000ff00) >> 8; }

◆ operator<<

std::ostream & operator<< ( std::ostream & output,
const L1CaloCoolChannelId & r )
friend

Definition at line 213 of file L1CaloCoolChannelId.cxx.

213 {
214 output << "coolChannelId: 0x" << std::hex <<r.id() << std::dec <<"("<<r.id()<<"), crate: "<<r.crate()<<", module: "<<r.module()<<", submodule: "<<r.subModule()<<", channel: "<<r.channel();
215 return output;
216}
int r
Definition globals.cxx:22
output
Definition merge.py:16

Member Data Documentation

◆ m_id

unsigned int L1CaloCoolChannelId::m_id
private

Definition at line 51 of file L1CaloCoolChannelId.h.


The documentation for this class was generated from the following files: