ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
L1CaloCoolChannelId Class Referencefinal

#include <L1CaloCoolChannelId.h>

Collaboration diagram for L1CaloCoolChannelId:

Public Member Functions

 L1CaloCoolChannelId ()
 Create a L1CaloCoolChannelId from the integer ID field. More...
 
 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. More...
 
 L1CaloCoolChannelId (unsigned int id)
 Create a L1CaloCoolChannelId from the integer ID field. More...
 
 L1CaloCoolChannelId (const L1CaloCoolChannelId &id)
 Copy a L1CaloCoolChannelId. More...
 
 ~L1CaloCoolChannelId ()=default
 
unsigned int crate () const
 
L1CaloModuleType moduleType () const
 Return module type of this channel ID. More...
 
unsigned int module (bool logical=true) const
 
unsigned int subModule () const
 
unsigned int channel () const
 
unsigned int id () const
 
L1CaloCoolChannelIdoperator= (const L1CaloCoolChannelId &id)
 
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. More...
 

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:

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 }

◆ 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

◆ module()

unsigned int L1CaloCoolChannelId::module ( bool  logical = true) 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;
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)
  Convert a typeId to a L1CaloModuleType
  \return L1CaloModuleType
&zwj;/

L1CaloModuleType L1CaloCoolChannelId::moduleType(unsigned int mTypeId) const { L1CaloModuleType mType = L1CaloModuleType::None; if (mTypeId == 1) { mType = L1CaloModuleType::Ppm; } else if (mTypeId == 2) { mType = L1CaloModuleType::Cpm; } else if (mTypeId == 3) { mType = L1CaloModuleType::Jem; } else if (mTypeId == 4) { mType = L1CaloModuleType::Cmm; } else if (mTypeId == 5) { mType = L1CaloModuleType::Tcm; } else if (mTypeId == 6) { mType = L1CaloModuleType::L1CaloRod; } else if (mTypeId == 7) { mType = L1CaloModuleType::Cam; } return mType; }

/*! Convert a L1CaloModuleType to a typeId

Returns
unsigned int ‍/ unsigned int L1CaloCoolChannelId::moduleType(L1CaloModuleType mType) const { unsigned int mTypeId = 0; if (mType == L1CaloModuleType::Ppm) { mTypeId = 1; } else if (mType == L1CaloModuleType::Cpm) { mTypeId = 2; } else if (mType == L1CaloModuleType::Jem) { mTypeId = 3; } else if (mType == L1CaloModuleType::Cmm) { mTypeId = 4; } else if (mType == L1CaloModuleType::Tcm) { mTypeId = 5; } else if (mType == L1CaloModuleType::L1CaloRod) { mTypeId = 6; } else if (mType == L1CaloModuleType::Cam) { mTypeId = 7; } return mTypeId; }

unsigned int L1CaloCoolChannelId::module(bool logical) const { unsigned int logicalIndex = (m_id & 0x000f0000) >> 16; if(logical) { return logicalIndex; } else { return this->logicalToPhysicalModule(this->moduleType(), logicalIndex); } }

unsigned int L1CaloCoolChannelId::logicalToPhysicalModule(L1CaloModuleType mType, unsigned int module) const { if (mType == L1CaloModuleType::Ppm) { return module + 5; } //Ppm else if (mType == L1CaloModuleType::Cpm) { return module + 5; } //Cpm else if (mType == L1CaloModuleType::Jem) { return module + 4; } //Jem else { std::cout<<"The physical position of module type: "<<mType.toString()<<" is not known. Returning the logical index instead !"<<std::endl; return module; } }

unsigned int L1CaloCoolChannelId::physicalToLogicalModule(L1CaloModuleType mType, unsigned int module) const { if (mType == L1CaloModuleType::Ppm) { return module - 5; } //Ppm else if (mType == L1CaloModuleType::Cpm) { return module - 5; } //Cpm else if (mType == L1CaloModuleType::Jem) { return module - 4; } //Jem else { std::cout<<"The physical position of module type: "<<mType.toString()<<" is not known. Returning the logical index instead !"<<std::endl; return module; } }


operator=

/*! 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

◆ 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; }

Friends And Related Function Documentation

◆ 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 }

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:
beamspotman.r
def r
Definition: beamspotman.py:676
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
L1CaloCoolChannelId::physicalToLogicalModule
unsigned int physicalToLogicalModule(L1CaloModuleType mType, unsigned int module) const
L1CaloCoolChannelId::crate
unsigned int crate() const
Definition: L1CaloCoolChannelId.h:25
L1CaloModuleType::L1CaloModuleEnum
L1CaloModuleEnum
Definition: L1CaloModuleType.h:15
L1CaloModuleType
Definition: L1CaloModuleType.h:11
L1CaloCoolChannelId::m_id
unsigned int m_id
Definition: L1CaloCoolChannelId.h:51
L1CaloCoolChannelId::channel
unsigned int channel() const
Definition: L1CaloCoolChannelId.h:30
L1CaloCoolChannelId::setId
void setId(unsigned int crate, L1CaloModuleType mType, unsigned int module, unsigned int submodule, unsigned int channel)
Set the CoolChannelId value from its component fields.
Definition: L1CaloCoolChannelId.cxx:89
merge.output
output
Definition: merge.py:17
L1CaloCoolChannelId::module
unsigned int module(bool logical=true) const