CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Protected Member Functions | Protected Attributes
HcalElectronicsMap Class Reference

#include <HcalElectronicsMap.h>

Classes

class  PrecisionItem
 
class  TriggerItem
 

Public Member Functions

std::vector< HcalElectronicsIdallElectronicsId () const
 
std::vector< HcalElectronicsIdallElectronicsIdPrecision () const
 
std::vector< HcalElectronicsIdallElectronicsIdTrigger () const
 
std::vector< HcalGenericDetIdallPrecisionId () const
 
std::vector< HcalTrigTowerDetIdallTriggerId () const
 
 HcalElectronicsMap ()
 
const DetId lookup (HcalElectronicsId fId) const
 lookup the logical detid associated with the given electronics id More...
 
const HcalElectronicsId lookup (DetId fId) const
 brief lookup the electronics detid associated with the given logical id More...
 
bool lookup (const HcalElectronicsId pId, HcalElectronicsId &eid, HcalGenericDetId &did) const
 brief lookup the DetId and full electronics id associated with this partial (dcc/spigot/fiber/fiberchan) id More...
 
bool lookup (const HcalElectronicsId pId, HcalElectronicsId &eid, HcalTrigTowerDetId &did) const
 brief lookup the DetId and full electronics id associated with this partial (dcc/spigot/slb/slbchan) id More...
 
const DetId lookupTrigger (HcalElectronicsId fId) const
 brief lookup the trigger logical detid associated with the given electronics id More...
 
const HcalElectronicsId lookupTrigger (DetId fId) const
 brief lookup the electronics detid associated with the given trigger logical id More...
 
bool mapEId2chId (HcalElectronicsId fElectronicsId, DetId fId)
 
bool mapEId2tId (HcalElectronicsId fElectronicsId, HcalTrigTowerDetId fTriggerId)
 
void sort ()
 
void sortById () const
 
void sortByTriggerId () const
 
 ~HcalElectronicsMap ()
 

Protected Member Functions

const PrecisionItemfindById (unsigned long fId) const
 
const TriggerItemfindByTrigId (unsigned long fTrigId) const
 
const PrecisionItemfindPByElId (unsigned long fElId) const
 
const TriggerItemfindTByElId (unsigned long fElId) const
 

Protected Attributes

std::vector< PrecisionItemmPItems
 
std::vector< const
PrecisionItem * > 
mPItemsById
 
std::vector< TriggerItemmTItems
 
std::vector< const TriggerItem * > mTItemsByTrigId
 
bool sortedByPId
 
bool sortedByTId
 

Detailed Description

Author
Fedor Ratnikov (UMd) POOL object to store map between detector ID, electronics ID and trigger ID $Author: ratnikov
Date:
2007/12/14 13:31:21
Revision:
1.17
Author
Fedor Ratnikov (UMd) POOL object to store mapping for Hcal channels $Author: ratnikov
Date:
2008/01/22 18:58:47
Revision:
1.23

Definition at line 24 of file HcalElectronicsMap.h.

Constructor & Destructor Documentation

HcalElectronicsMap::HcalElectronicsMap ( )

Definition at line 16 of file HcalElectronicsMap.cc.

16  :
19  sortedByPId(false),
20  sortedByTId(false)
21 {}
std::vector< PrecisionItem > mPItems
std::vector< TriggerItem > mTItems
static const int maxLinearIndex
HcalElectronicsMap::~HcalElectronicsMap ( )

Definition at line 28 of file HcalElectronicsMap.cc.

28 {}

Member Function Documentation

std::vector< HcalElectronicsId > HcalElectronicsMap::allElectronicsId ( ) const

Definition at line 112 of file HcalElectronicsMap.cc.

References mPItems, mTItems, and query::result.

Referenced by HcalLuttoDB::analyze().

112  {
113  std::vector <HcalElectronicsId> result;
114  for (std::vector<PrecisionItem>::const_iterator item = mPItems.begin (); item != mPItems.end (); item++)
115  if (item->mElId) result.push_back(HcalElectronicsId(item->mElId));
116  for (std::vector<TriggerItem>::const_iterator item = mTItems.begin (); item != mTItems.end (); item++)
117  if (item->mElId) result.push_back(HcalElectronicsId(item->mElId));
118 
119  return result;
120 }
std::vector< PrecisionItem > mPItems
tuple result
Definition: query.py:137
std::vector< TriggerItem > mTItems
Readout chain identification for Hcal [31:26] Unused (so far) [25] Trigger-chain id flag [24:20] Read...
std::vector< HcalElectronicsId > HcalElectronicsMap::allElectronicsIdPrecision ( ) const

Definition at line 122 of file HcalElectronicsMap.cc.

References mPItems, and query::result.

Referenced by HcalRawDataClient::beginRun(), HcalRawDataMonitor::beginRun(), HcalDetDiagLEDMonitor::CheckStatus(), HcalDetDiagPedestalMonitor::CheckStatus(), EMap::EMap(), HcalDetDiagLEDMonitor::fillHistos(), HcalDetDiagLaserMonitor::fillProblems(), HcalDetDiagLEDMonitor::SaveReference(), HcalDetDiagPedestalMonitor::SaveReference(), and HcalDetDiagLaserMonitor::SaveReference().

122  {
123  std::vector <HcalElectronicsId> result;
124  for (std::vector<PrecisionItem>::const_iterator item = mPItems.begin (); item != mPItems.end (); item++)
125  if (item->mElId) result.push_back(HcalElectronicsId(item->mElId));
126  return result;
127 }
std::vector< PrecisionItem > mPItems
tuple result
Definition: query.py:137
Readout chain identification for Hcal [31:26] Unused (so far) [25] Trigger-chain id flag [24:20] Read...
std::vector< HcalElectronicsId > HcalElectronicsMap::allElectronicsIdTrigger ( ) const

Definition at line 129 of file HcalElectronicsMap.cc.

References mTItems, and query::result.

Referenced by EMap::EMap().

129  {
130  std::vector <HcalElectronicsId> result;
131  for (std::vector<TriggerItem>::const_iterator item = mTItems.begin (); item != mTItems.end (); item++)
132  if (item->mElId) result.push_back(HcalElectronicsId(item->mElId));
133 
134  return result;
135 }
tuple result
Definition: query.py:137
std::vector< TriggerItem > mTItems
Readout chain identification for Hcal [31:26] Unused (so far) [25] Trigger-chain id flag [24:20] Read...
std::vector< HcalGenericDetId > HcalElectronicsMap::allPrecisionId ( ) const

Definition at line 137 of file HcalElectronicsMap.cc.

References mPItems, and query::result.

Referenced by HcalCholeskyDecomp::analyze(), HcalPedestalMCWidths::analyze(), and HcalPedestalsAnalysis::analyze().

137  {
138  std::vector <HcalGenericDetId> result;
139  std::set <unsigned long> allIds;
140  for (std::vector<PrecisionItem>::const_iterator item = mPItems.begin (); item != mPItems.end (); item++)
141  if (item->mId) allIds.insert (item->mId);
142  for (std::set <unsigned long>::const_iterator channel = allIds.begin (); channel != allIds.end (); channel++) {
143  result.push_back (HcalGenericDetId (*channel));
144  }
145  return result;
146 }
std::vector< PrecisionItem > mPItems
tuple result
Definition: query.py:137
std::vector< HcalTrigTowerDetId > HcalElectronicsMap::allTriggerId ( ) const

Definition at line 148 of file HcalElectronicsMap.cc.

References mTItems, and query::result.

148  {
149  std::vector <HcalTrigTowerDetId> result;
150  std::set <unsigned long> allIds;
151  for (std::vector<TriggerItem>::const_iterator item = mTItems.begin (); item != mTItems.end (); item++)
152  if (item->mTrigId) allIds.insert (item->mTrigId);
153  for (std::set <unsigned long>::const_iterator channel = allIds.begin (); channel != allIds.end (); channel++)
154  result.push_back (HcalTrigTowerDetId (*channel));
155  return result;
156 }
tuple result
Definition: query.py:137
std::vector< TriggerItem > mTItems
const HcalElectronicsMap::PrecisionItem * HcalElectronicsMap::findById ( unsigned long  fId) const
protected

Definition at line 30 of file HcalElectronicsMap.cc.

References mPItemsById, sortById(), sortedByPId, and filterCSVwithJSON::target.

Referenced by lookup().

30  {
31  PrecisionItem target (fId, 0);
32  std::vector<const HcalElectronicsMap::PrecisionItem*>::const_iterator item;
33 
34  if (!sortedByPId) sortById();
35 
36  item = std::lower_bound (mPItemsById.begin(), mPItemsById.end(), &target, hcal_impl::LessById());
37  if (item == mPItemsById.end() || (*item)->mId != fId)
38  // throw cms::Exception ("Conditions not found") << "Unavailable Electronics map for cell " << fId;
39  return 0;
40  return *item;
41 }
std::vector< const PrecisionItem * > mPItemsById
const HcalElectronicsMap::TriggerItem * HcalElectronicsMap::findByTrigId ( unsigned long  fTrigId) const
protected

Definition at line 60 of file HcalElectronicsMap.cc.

References mTItemsByTrigId, sortByTriggerId(), sortedByTId, and filterCSVwithJSON::target.

Referenced by lookupTrigger().

60  {
61  TriggerItem target (fTrigId,0);
62  std::vector<const HcalElectronicsMap::TriggerItem*>::const_iterator item;
63 
65 
66  item = std::lower_bound (mTItemsByTrigId.begin(), mTItemsByTrigId.end(), &target, hcal_impl::LessByTrigId());
67  if (item == mTItemsByTrigId.end() || (*item)->mTrigId != fTrigId)
68  // throw cms::Exception ("Conditions not found") << "Unavailable Electronics map for cell " << fId;
69  return 0;
70  return *item;
71 }
std::vector< const TriggerItem * > mTItemsByTrigId
void sortByTriggerId() const
const HcalElectronicsMap::PrecisionItem * HcalElectronicsMap::findPByElId ( unsigned long  fElId) const
protected

Definition at line 43 of file HcalElectronicsMap.cc.

References i, HcalElectronicsId::linearIndex(), HcalElectronicsMap::PrecisionItem::mElId, and mPItems.

Referenced by lookup().

43  {
44  HcalElectronicsId eid(fElId);
45  const PrecisionItem* i=&(mPItems[eid.linearIndex()]);
46 
47  if (i!=0 && i->mElId!=fElId) i=0;
48  return i;
49 }
int i
Definition: DBlmapReader.cc:9
std::vector< PrecisionItem > mPItems
Readout chain identification for Hcal [31:26] Unused (so far) [25] Trigger-chain id flag [24:20] Read...
const HcalElectronicsMap::TriggerItem * HcalElectronicsMap::findTByElId ( unsigned long  fElId) const
protected

Definition at line 51 of file HcalElectronicsMap.cc.

References i, HcalElectronicsId::linearIndex(), HcalElectronicsMap::TriggerItem::mElId, and mTItems.

Referenced by lookupTrigger().

51  {
52  HcalElectronicsId eid(fElId);
53  const TriggerItem* i=&(mTItems[eid.linearIndex()]);
54 
55  if (i!=0 && i->mElId!=fElId) i=0;
56  return i;
57 }
int i
Definition: DBlmapReader.cc:9
std::vector< TriggerItem > mTItems
Readout chain identification for Hcal [31:26] Unused (so far) [25] Trigger-chain id flag [24:20] Read...
const DetId HcalElectronicsMap::lookup ( HcalElectronicsId  fId) const
const HcalElectronicsId HcalElectronicsMap::lookup ( DetId  fId) const

brief lookup the electronics detid associated with the given logical id

Definition at line 78 of file HcalElectronicsMap.cc.

References findById(), HcalElectronicsMap::PrecisionItem::mElId, and DetId::rawId().

78  {
79  const PrecisionItem* item = findById (fId.rawId ());
80  return HcalElectronicsId (item ? item->mElId : 0);
81 }
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
const PrecisionItem * findById(unsigned long fId) const
Readout chain identification for Hcal [31:26] Unused (so far) [25] Trigger-chain id flag [24:20] Read...
bool HcalElectronicsMap::lookup ( const HcalElectronicsId  pId,
HcalElectronicsId eid,
HcalGenericDetId did 
) const

brief lookup the DetId and full electronics id associated with this partial (dcc/spigot/fiber/fiberchan) id

Definition at line 93 of file HcalElectronicsMap.cc.

References i, HcalElectronicsId::linearIndex(), HcalElectronicsMap::PrecisionItem::mElId, HcalElectronicsMap::PrecisionItem::mId, and mPItems.

93  {
94  const PrecisionItem* i=&(mPItems[pid.linearIndex()]);
95  if (i!=0 && i->mId!=0) {
96  eid=HcalElectronicsId(i->mElId);
97  did=HcalGenericDetId(i->mId);
98  return true;
99  } else return false;
100 }
int i
Definition: DBlmapReader.cc:9
std::vector< PrecisionItem > mPItems
Readout chain identification for Hcal [31:26] Unused (so far) [25] Trigger-chain id flag [24:20] Read...
bool HcalElectronicsMap::lookup ( const HcalElectronicsId  pId,
HcalElectronicsId eid,
HcalTrigTowerDetId did 
) const

brief lookup the DetId and full electronics id associated with this partial (dcc/spigot/slb/slbchan) id

Definition at line 102 of file HcalElectronicsMap.cc.

References i, HcalElectronicsId::linearIndex(), HcalElectronicsMap::TriggerItem::mElId, mTItems, and HcalElectronicsMap::TriggerItem::mTrigId.

102  {
103  const TriggerItem* i=&(mTItems[pid.linearIndex()]);
104  if (i!=0 && i->mTrigId!=0) {
105  eid=HcalElectronicsId(i->mElId);
106  did=HcalGenericDetId(i->mTrigId);
107  return true;
108  } else return false;
109 }
int i
Definition: DBlmapReader.cc:9
std::vector< TriggerItem > mTItems
Readout chain identification for Hcal [31:26] Unused (so far) [25] Trigger-chain id flag [24:20] Read...
const DetId HcalElectronicsMap::lookupTrigger ( HcalElectronicsId  fId) const

brief lookup the trigger logical detid associated with the given electronics id

Definition at line 83 of file HcalElectronicsMap.cc.

References findTByElId(), HcalElectronicsMap::TriggerItem::mTrigId, and HcalElectronicsId::rawId().

Referenced by HcalLuttoDB::analyze(), EMap::EMap(), and HcalUnpacker::unpack().

83  {
84  const TriggerItem* item = findTByElId (fId.rawId ());
85  return DetId (item ? item->mTrigId : 0);
86 }
uint32_t rawId() const
Definition: DetId.h:20
const TriggerItem * findTByElId(unsigned long fElId) const
const HcalElectronicsId HcalElectronicsMap::lookupTrigger ( DetId  fId) const

brief lookup the electronics detid associated with the given trigger logical id

Definition at line 88 of file HcalElectronicsMap.cc.

References findByTrigId(), HcalElectronicsMap::TriggerItem::mElId, and DetId::rawId().

88  {
89  const TriggerItem* item = findByTrigId (fId.rawId ());
90  return HcalElectronicsId (item ? item->mElId : 0);
91 }
const TriggerItem * findByTrigId(unsigned long fTrigId) const
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
Readout chain identification for Hcal [31:26] Unused (so far) [25] Trigger-chain id flag [24:20] Read...
bool HcalElectronicsMap::mapEId2chId ( HcalElectronicsId  fElectronicsId,
DetId  fId 
)

Definition at line 173 of file HcalElectronicsMap.cc.

References HcalElectronicsId::linearIndex(), HcalElectronicsMap::PrecisionItem::mElId, HcalElectronicsMap::PrecisionItem::mId, mPItems, HcalElectronicsId::rawId(), DetId::rawId(), and sortedByPId.

Referenced by HcalLogicalMap::generateHcalElectronicsMap(), and HcalDbOnline::getObject().

173  {
174  PrecisionItem& item = mPItems[fElectronicsId.linearIndex()];
175 
176  sortedByPId=false;
177  if (item.mElId==0) item.mElId=fElectronicsId.rawId();
178  if (item.mId == 0) {
179  item.mId = fId.rawId ();
180  }
181  else if (item.mId != fId.rawId ()) {
182  edm::LogWarning("HCAL") << "HcalElectronicsMap::mapEId2tId-> Electronics channel " << fElectronicsId << " already mapped to channel "
183  << HcalGenericDetId(item.mId) << ". New value " << HcalGenericDetId(fId) << " is ignored" ;
184  return false;
185  }
186  return true;
187 }
uint32_t rawId() const
std::vector< PrecisionItem > mPItems
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
int linearIndex() const
get a fast, compact, unique index for linear lookups (maximum value = 16384)
bool HcalElectronicsMap::mapEId2tId ( HcalElectronicsId  fElectronicsId,
HcalTrigTowerDetId  fTriggerId 
)

Definition at line 158 of file HcalElectronicsMap.cc.

References HcalElectronicsId::linearIndex(), HcalElectronicsMap::TriggerItem::mElId, mTItems, HcalElectronicsMap::TriggerItem::mTrigId, HcalElectronicsId::rawId(), DetId::rawId(), and sortedByTId.

Referenced by HcalLogicalMap::generateHcalElectronicsMap().

158  {
159  TriggerItem& item = mTItems[fElectronicsId.linearIndex()];
160  sortedByTId=false;
161  if (item.mElId==0) item.mElId=fElectronicsId.rawId();
162  if (item.mTrigId == 0) {
163  item.mTrigId = fTriggerId.rawId (); // just cast avoiding long machinery
164  }
165  else if (item.mTrigId != fTriggerId.rawId ()) {
166  edm::LogWarning("HCAL") << "HcalElectronicsMap::mapEId2tId-> Electronics channel " << fElectronicsId << " already mapped to trigger channel "
167  << (HcalTrigTowerDetId(item.mTrigId)) << ". New value " << fTriggerId << " is ignored" ;
168  return false;
169  }
170  return true;
171 }
uint32_t rawId() const
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
std::vector< TriggerItem > mTItems
int linearIndex() const
get a fast, compact, unique index for linear lookups (maximum value = 16384)
void HcalElectronicsMap::sort ( )
inline
void HcalElectronicsMap::sortById ( ) const

Definition at line 189 of file HcalElectronicsMap.cc.

References i, mPItems, mPItemsById, python.multivaluedict::sort(), and sortedByPId.

Referenced by findById().

189  {
190  if (!sortedByPId) {
191  mPItemsById.clear();
192  for (std::vector<PrecisionItem>::const_iterator i=mPItems.begin(); i!=mPItems.end(); ++i) {
193  if (i->mElId) mPItemsById.push_back(&(*i));
194  }
195 
197  sortedByPId=true;
198  }
199 }
int i
Definition: DBlmapReader.cc:9
std::vector< PrecisionItem > mPItems
std::vector< const PrecisionItem * > mPItemsById
void HcalElectronicsMap::sortByTriggerId ( ) const

Definition at line 201 of file HcalElectronicsMap.cc.

References i, mTItems, mTItemsByTrigId, python.multivaluedict::sort(), and sortedByTId.

Referenced by findByTrigId().

201  {
202  if (!sortedByTId) {
203  mTItemsByTrigId.clear();
204  for (std::vector<TriggerItem>::const_iterator i=mTItems.begin(); i!=mTItems.end(); ++i) {
205  if (i->mElId) mTItemsByTrigId.push_back(&(*i));
206  }
207 
209  sortedByTId=true;
210  }
211 }
int i
Definition: DBlmapReader.cc:9
std::vector< TriggerItem > mTItems
std::vector< const TriggerItem * > mTItemsByTrigId

Member Data Documentation

std::vector<PrecisionItem> HcalElectronicsMap::mPItems
protected
std::vector<const PrecisionItem*> HcalElectronicsMap::mPItemsById
mutableprotected

Definition at line 88 of file HcalElectronicsMap.h.

Referenced by findById(), and sortById().

std::vector<TriggerItem> HcalElectronicsMap::mTItems
protected
std::vector<const TriggerItem*> HcalElectronicsMap::mTItemsByTrigId
mutableprotected

Definition at line 90 of file HcalElectronicsMap.h.

Referenced by findByTrigId(), and sortByTriggerId().

bool HcalElectronicsMap::sortedByPId
mutableprotected

Definition at line 89 of file HcalElectronicsMap.h.

Referenced by findById(), mapEId2chId(), and sortById().

bool HcalElectronicsMap::sortedByTId
mutableprotected

Definition at line 91 of file HcalElectronicsMap.h.

Referenced by findByTrigId(), mapEId2tId(), and sortByTriggerId().