ATLAS Offline Software
Loading...
Searching...
No Matches
LArCondFEBIdChanMap Class Reference

This class maps FEB IDs to/from COOL channel ids. More...

#include <LArCondFEBIdChanMap.h>

Collaboration diagram for LArCondFEBIdChanMap:

Public Types

enum  CorrectionType {
  Original = 0 , PSBA = 1001 , PSBC = 1002 , PSECA = 1003 ,
  PSECC = 1004 , EMBA = 1005 , EMBC = 1006 , EMECA = 1007 ,
  EMECC = 1008 , HECA = 1009 , HECC = 1010 , FCALA = 1011 ,
  FCALC = 1012 , NCORRTYPE = 12
}
 Correction type. More...
typedef unsigned int FEBId
 Public typedefs.
typedef std::vector< FEBIdFEBIdVector
typedef std::vector< FEBIdVectorChannelMap
typedef std::map< FEBId, unsigned int > FEBIdMap

Public Member Functions

 LArCondFEBIdChanMap ()
 Default constructor.
 LArCondFEBIdChanMap (unsigned int nChanPerGain, unsigned int minGain, unsigned int nGain)
 Constructor defining the number of channels per gain, min gain value, and the number of gain values.
virtual ~LArCondFEBIdChanMap ()=default
 destructor
const FEBIdVectorfebIdVector (unsigned int gain, unsigned int coolChannel) const
 Access to a FEB ID vector for a given gain and COOL channel.
bool getChannel (FEBId febId, unsigned int gain, unsigned int &coolChannel) const
 Access to the cool channel number for a given FEB ID and gain - bool == false if not found.
bool getCorrectionSetChannels (unsigned int gain, std::vector< unsigned int > &coolChannels) const
 Access to the cool channel numbers for the correction sets of a particular gain - bool == false if not found.
unsigned int nGroups () const
 Number of groups - minimum is 2 (1 correction group, 1 FEB ID group)
unsigned int groupNumber (unsigned int coolChannel) const
 Group number of a cool channel (0 - correction group, 1-N for FEB ID groups)
unsigned int channelsPerGain () const
 Number of cool channels per gain.
unsigned int minGain () const
 Mininum gain value.
unsigned int nGains () const
 Number of gain values.
unsigned int nOffsetChannels () const
 Number of offset channels - i.e. correction channels.
unsigned int totalChannels () const
 Total number of channels for all gains and includes special offset channels.
void addFEBIdVector (unsigned int channel, const FEBIdVector &febIdVec)
 Add in a FEBIdVector - channel number should be from 0 to NChannelsPerGain-1.
void dump (std::ostream &o, const LArOnlineID *onlineID=NULL) const

Private Types

enum  ChanMapOffets { NUMOFFSETCHANNELSPERGAIN = 1 , CORRECTIONSETCHANNEL = 0 }
 Offsets for the special channels. More...

Private Member Functions

void fillMap (unsigned int channel, const FEBIdVector &febIdVec)
 Fill map from chan/febid vec - channel here is 0 to chansPerGain-1.

Private Attributes

ChannelMap m_febIdVecs
 File map from existing ChannelMap - e.g. on read back.
FEBIdMap m_channelMap
unsigned int m_chansPerGain
unsigned int m_totalChannels
unsigned int m_minGain
unsigned int m_maxGain
unsigned int m_nGains
unsigned int m_numOffsetChannels
FEBIdVector m_empty

Detailed Description

This class maps FEB IDs to/from COOL channel ids.

This class is needed to store LAr conditions data into multiple channels in COOL. Each COOL channel will correspond to a subset of the FEB ids, and this class allows to lookup in either direction.

The COOL channel mapping works as follows: there are N groups of FEB IDs which are each mapped into a different channel. Then the overall channel mapping has:

ngain special channels to store the correction subsets for each gain N*ngain channels for each FEB ID group, repeated for each of the possible gains

One may identify which channels belong to the same group via the "group number". Here 0 signifies the corrections group and 1 to N for each of the groups of FEB IDs.

Note that the default is have all FEB IDs with in a single group

Definition at line 48 of file LArCondFEBIdChanMap.h.

Member Typedef Documentation

◆ ChannelMap

Definition at line 55 of file LArCondFEBIdChanMap.h.

◆ FEBId

typedef unsigned int LArCondFEBIdChanMap::FEBId

Public typedefs.

Definition at line 53 of file LArCondFEBIdChanMap.h.

◆ FEBIdMap

typedef std::map<FEBId, unsigned int> LArCondFEBIdChanMap::FEBIdMap

Definition at line 56 of file LArCondFEBIdChanMap.h.

◆ FEBIdVector

Definition at line 54 of file LArCondFEBIdChanMap.h.

Member Enumeration Documentation

◆ ChanMapOffets

Offsets for the special channels.

Enumerator
NUMOFFSETCHANNELSPERGAIN 
CORRECTIONSETCHANNEL 

Definition at line 139 of file LArCondFEBIdChanMap.h.

139 {
140 NUMOFFSETCHANNELSPERGAIN = 1, // Number of special channels per gain
141 CORRECTIONSETCHANNEL = 0 // Channel for the correction sets
142 };

◆ CorrectionType

Correction type.

Enumerator
Original 
PSBA 
PSBC 
PSECA 
PSECC 
EMBA 
EMBC 
EMECA 
EMECC 
HECA 
HECC 
FCALA 
FCALC 
NCORRTYPE 

Definition at line 59 of file LArCondFEBIdChanMap.h.

Constructor & Destructor Documentation

◆ LArCondFEBIdChanMap() [1/2]

LArCondFEBIdChanMap::LArCondFEBIdChanMap ( )
inline

Default constructor.

Definition at line 167 of file LArCondFEBIdChanMap.h.

168 :
169 m_febIdVecs(1),
172 m_minGain(0),
173 m_maxGain(2),
174 m_nGains(3),
176
177
178{}
ChannelMap m_febIdVecs
File map from existing ChannelMap - e.g. on read back.

◆ LArCondFEBIdChanMap() [2/2]

LArCondFEBIdChanMap::LArCondFEBIdChanMap ( unsigned int nChanPerGain,
unsigned int minGain,
unsigned int nGain )
inline

Constructor defining the number of channels per gain, min gain value, and the number of gain values.

nchannels input should NOT include the special offset channels

Definition at line 181 of file LArCondFEBIdChanMap.h.

184 :
185 m_febIdVecs(chansPerGain),
186 m_chansPerGain(chansPerGain),
192
193{}
unsigned int minGain() const
Mininum gain value.
unsigned int nGains() const
Number of gain values.

◆ ~LArCondFEBIdChanMap()

virtual LArCondFEBIdChanMap::~LArCondFEBIdChanMap ( )
virtualdefault

destructor

Member Function Documentation

◆ addFEBIdVector()

void LArCondFEBIdChanMap::addFEBIdVector ( unsigned int channel,
const FEBIdVector & febIdVec )
inline

Add in a FEBIdVector - channel number should be from 0 to NChannelsPerGain-1.

Definition at line 344 of file LArCondFEBIdChanMap.h.

345{
346 // Make sure vector is large enough - should have been sized in
347 // constructor!!
348 if (channel >= m_chansPerGain) m_febIdVecs.resize(channel + 1);
349 m_febIdVecs[channel] = febIdVec;
350 fillMap(channel, febIdVec);
351}
void fillMap(unsigned int channel, const FEBIdVector &febIdVec)
Fill map from chan/febid vec - channel here is 0 to chansPerGain-1.

◆ channelsPerGain()

unsigned int LArCondFEBIdChanMap::channelsPerGain ( ) const
inline

Number of cool channels per gain.

Definition at line 308 of file LArCondFEBIdChanMap.h.

309{
310 return (m_chansPerGain);
311}

◆ dump()

void LArCondFEBIdChanMap::dump ( std::ostream & o,
const LArOnlineID * onlineID = NULL ) const

Definition at line 7 of file LArCondFEBIdChanMap.cxx.

7 {
8
9 //FEBIdMap::const_iterator itmap->
10 //ChannelMap::const_iterator itmap=m_febIdVecs->begin();
11 //ChannelMap::const_iterator itmap_e=m_febIdVecs->end();
12 for (unsigned int iCoolChannel=0;iCoolChannel<m_febIdVecs.size();iCoolChannel++) {
13 out << "Cool Channel #:" << std::setw(3) << iCoolChannel << " FEB id:" << std::endl;
14 const FEBIdVector& febIdVec=m_febIdVecs[iCoolChannel];
15 FEBIdVector::const_iterator it=febIdVec.begin();
16 FEBIdVector::const_iterator it_e=febIdVec.end();
17 for (;it!=it_e;++it) {
18 out << " " << (*it) << "(0x" << std::hex << *it << std::dec << ")";
19 if (onlineID) {
20 const HWIdentifier hwid((*it));
21 int barrel_ec = onlineID->barrel_ec(hwid);
22 std::string bc;
23 if (barrel_ec==0)
24 bc="Barrel";
25 else if (barrel_ec==1)
26 bc="Endcap";
27 else
28 bc="unknown";
29
30 int pos_neg = onlineID->pos_neg(hwid);
31 std::string pn;
32 if (pos_neg==0)
33 pn="C-Side";
34 else if (pos_neg==1)
35 pn="A-Side";
36 else
37 pn="unknown";
38 int FT = onlineID->feedthrough(hwid);
39 int slot = onlineID->slot(hwid);
40 out << " (" << bc << "/" << pn << "/FT=" << FT << "/Slot=" << slot << ")";
41 }
42 out << std::endl;
43 }
44 out << std::endl;
45 }
46 out.flush();
47}
std::vector< FEBId > FEBIdVector
int feedthrough(const HWIdentifier id) const
Return the feedthrough of a hardware cell identifier : feedthrough = [0,31] Barrel - A/C side or H/...
int slot(const HWIdentifier id) const
Return the slot number of a hardware cell identifier: slot = [1,15] Slot-ID in top part of the crat...
int barrel_ec(const HWIdentifier id) const
Return the position barrel or endcap of a hardware cell identifier: barrel_ec = [0,...
int pos_neg(const HWIdentifier id) const
Return the side of a hardware cell identifier pos_neg = [0,1] positive-side or negative-side Barrel...

◆ febIdVector()

const LArCondFEBIdChanMap::FEBIdVector & LArCondFEBIdChanMap::febIdVector ( unsigned int gain,
unsigned int coolChannel ) const
inline

Access to a FEB ID vector for a given gain and COOL channel.

Definition at line 226 of file LArCondFEBIdChanMap.h.

227{
228
229 unsigned int channel = m_chansPerGain;
230 if (coolChannel >= (gain - m_minGain)*m_chansPerGain + m_numOffsetChannels) {
232 }
233 if (channel < m_chansPerGain) {
234 return (m_febIdVecs[channel]);
235 }
236 return (m_empty);
237}

◆ fillMap()

void LArCondFEBIdChanMap::fillMap ( unsigned int channel,
const FEBIdVector & febIdVec )
inlineprivate

Fill map from chan/febid vec - channel here is 0 to chansPerGain-1.

Definition at line 197 of file LArCondFEBIdChanMap.h.

198{
199 // add channel to map for each feb id
200 for (unsigned int i = 0; i < febIdVec.size(); ++i) {
201 m_channelMap[febIdVec[i]] = channel;
202 }
203}

◆ getChannel()

bool LArCondFEBIdChanMap::getChannel ( FEBId febId,
unsigned int gain,
unsigned int & coolChannel ) const
inline

Access to the cool channel number for a given FEB ID and gain - bool == false if not found.

Definition at line 241 of file LArCondFEBIdChanMap.h.

244{
245 if (1 == m_chansPerGain) {
246 // All FEB IDs in the same group
247 coolChannel = (gain - m_minGain) + m_numOffsetChannels;
248 return (true);
249 }
250 coolChannel = 9999;
251 FEBIdMap::const_iterator it = m_channelMap.find(febId);
252 if (it != m_channelMap.end()) {
253 if (m_minGain <= gain && gain <= m_maxGain) {
254 coolChannel = (gain - m_minGain)*m_chansPerGain + (*it).second + m_numOffsetChannels;
255 return (true);
256 }
257 }
258 return (false);
259}

◆ getCorrectionSetChannels()

bool LArCondFEBIdChanMap::getCorrectionSetChannels ( unsigned int gain,
std::vector< unsigned int > & coolChannels ) const
inline

Access to the cool channel numbers for the correction sets of a particular gain - bool == false if not found.

Definition at line 263 of file LArCondFEBIdChanMap.h.

265{
266 coolChannels.clear();
267 if (m_minGain <= gain && gain <= m_maxGain) {
268 coolChannels.reserve(1 + NCORRTYPE);
269 // loop over all correction types, including the "old" first
270 // one which included everything
271 coolChannels.push_back( (gain - m_minGain) + CORRECTIONSETCHANNEL);
272 unsigned int gainOffset = (gain - m_minGain)*NCORRTYPE;
273 coolChannels.push_back(PSBA + gainOffset);
274 coolChannels.push_back(PSBC + gainOffset);
275 coolChannels.push_back(PSECA + gainOffset);
276 coolChannels.push_back(PSECC + gainOffset);
277 coolChannels.push_back(EMBA + gainOffset);
278 coolChannels.push_back(EMBC + gainOffset);
279 coolChannels.push_back(EMECA + gainOffset);
280 coolChannels.push_back(EMECC + gainOffset);
281 coolChannels.push_back(HECA + gainOffset);
282 coolChannels.push_back(HECC + gainOffset);
283 coolChannels.push_back(FCALA + gainOffset);
284 coolChannels.push_back(FCALC + gainOffset);
285 return (true);
286 }
287 return (false);
288}

◆ groupNumber()

unsigned int LArCondFEBIdChanMap::groupNumber ( unsigned int coolChannel) const
inline

Group number of a cool channel (0 - correction group, 1-N for FEB ID groups)

Definition at line 300 of file LArCondFEBIdChanMap.h.

301{
302 return (coolChannel/m_nGains);
303}

◆ minGain()

unsigned int LArCondFEBIdChanMap::minGain ( ) const
inline

Mininum gain value.

Definition at line 315 of file LArCondFEBIdChanMap.h.

316{
317 return (m_minGain);
318}

◆ nGains()

unsigned int LArCondFEBIdChanMap::nGains ( ) const
inline

Number of gain values.

Definition at line 322 of file LArCondFEBIdChanMap.h.

323{
324 return (m_nGains);
325}

◆ nGroups()

unsigned int LArCondFEBIdChanMap::nGroups ( ) const
inline

Number of groups - minimum is 2 (1 correction group, 1 FEB ID group)

Definition at line 292 of file LArCondFEBIdChanMap.h.

293{
295}

◆ nOffsetChannels()

unsigned int LArCondFEBIdChanMap::nOffsetChannels ( ) const
inline

Number of offset channels - i.e. correction channels.

Definition at line 329 of file LArCondFEBIdChanMap.h.

330{
331 return (m_numOffsetChannels);
332}

◆ totalChannels()

unsigned int LArCondFEBIdChanMap::totalChannels ( ) const
inline

Total number of channels for all gains and includes special offset channels.

Definition at line 337 of file LArCondFEBIdChanMap.h.

338{
339 return (m_totalChannels);
340}

Member Data Documentation

◆ m_channelMap

FEBIdMap LArCondFEBIdChanMap::m_channelMap
private

Definition at line 153 of file LArCondFEBIdChanMap.h.

◆ m_chansPerGain

unsigned int LArCondFEBIdChanMap::m_chansPerGain
private

Definition at line 154 of file LArCondFEBIdChanMap.h.

◆ m_empty

FEBIdVector LArCondFEBIdChanMap::m_empty
private

Definition at line 160 of file LArCondFEBIdChanMap.h.

◆ m_febIdVecs

ChannelMap LArCondFEBIdChanMap::m_febIdVecs
private

File map from existing ChannelMap - e.g. on read back.

Definition at line 152 of file LArCondFEBIdChanMap.h.

◆ m_maxGain

unsigned int LArCondFEBIdChanMap::m_maxGain
private

Definition at line 157 of file LArCondFEBIdChanMap.h.

◆ m_minGain

unsigned int LArCondFEBIdChanMap::m_minGain
private

Definition at line 156 of file LArCondFEBIdChanMap.h.

◆ m_nGains

unsigned int LArCondFEBIdChanMap::m_nGains
private

Definition at line 158 of file LArCondFEBIdChanMap.h.

◆ m_numOffsetChannels

unsigned int LArCondFEBIdChanMap::m_numOffsetChannels
private

Definition at line 159 of file LArCondFEBIdChanMap.h.

◆ m_totalChannels

unsigned int LArCondFEBIdChanMap::m_totalChannels
private

Definition at line 155 of file LArCondFEBIdChanMap.h.


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