CMS 3D CMS Logo

HcalElectronicsMap Class Reference

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
More...

#include <CondFormats/HcalObjects/interface/HcalElectronicsMap.h>

List of all members.

Public Member Functions

std::vector< HcalElectronicsIdallElectronicsId () const
std::vector< HcalElectronicsIdallElectronicsIdPrecision () const
std::vector< HcalElectronicsIdallElectronicsIdTrigger () const
std::vector< HcalGenericDetIdallPrecisionId () const
std::vector< HcalTrigTowerDetIdallTriggerId () const
 HcalElectronicsMap ()
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
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
const HcalElectronicsId lookup (DetId fId) const
 brief lookup the electronics detid associated with the given logical id
const DetId lookup (HcalElectronicsId fId) const
 lookup the logical detid associated with the given electronics id
const HcalElectronicsId lookupTrigger (DetId fId) const
 brief lookup the electronics detid associated with the given trigger logical id
const DetId lookupTrigger (HcalElectronicsId fId) const
 brief lookup the trigger logical detid associated with the given electronics id
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

Classes

class  PrecisionItem
class  TriggerItem


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.

00016                                        : 
00017   mPItems(HcalElectronicsId::maxLinearIndex+1),
00018   mTItems(HcalElectronicsId::maxLinearIndex+1),
00019   sortedByPId(false),
00020   sortedByTId(false)
00021 {}

HcalElectronicsMap::~HcalElectronicsMap (  ) 

Definition at line 28 of file HcalElectronicsMap.cc.

00028 {}


Member Function Documentation

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

Definition at line 112 of file HcalElectronicsMap.cc.

References mPItems, mTItems, and HLT_VtxMuL3::result.

Referenced by HcalLuttoDB::analyze().

00112                                                                           {
00113   std::vector <HcalElectronicsId> result;
00114   for (std::vector<PrecisionItem>::const_iterator item = mPItems.begin (); item != mPItems.end (); item++) 
00115     if (item->mElId) result.push_back(HcalElectronicsId(item->mElId));
00116   for (std::vector<TriggerItem>::const_iterator item = mTItems.begin (); item != mTItems.end (); item++) 
00117     if (item->mElId) result.push_back(HcalElectronicsId(item->mElId));
00118 
00119   return result;
00120 }

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

Definition at line 122 of file HcalElectronicsMap.cc.

References mPItems, and HLT_VtxMuL3::result.

Referenced by HcalMonitorModule::beginJob().

00122                                                                                   {
00123   std::vector <HcalElectronicsId> result;
00124   for (std::vector<PrecisionItem>::const_iterator item = mPItems.begin (); item != mPItems.end (); item++) 
00125     if (item->mElId) result.push_back(HcalElectronicsId(item->mElId));
00126   return result;
00127 }

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

Definition at line 129 of file HcalElectronicsMap.cc.

References mTItems, and HLT_VtxMuL3::result.

00129                                                                                 {
00130   std::vector <HcalElectronicsId> result;
00131   for (std::vector<TriggerItem>::const_iterator item = mTItems.begin (); item != mTItems.end (); item++) 
00132     if (item->mElId) result.push_back(HcalElectronicsId(item->mElId));
00133 
00134   return result;
00135 }

std::vector< HcalGenericDetId > HcalElectronicsMap::allPrecisionId (  )  const

Definition at line 137 of file HcalElectronicsMap.cc.

References mPItems, and HLT_VtxMuL3::result.

Referenced by HcalQIEDataCheck::analyze(), HcalPedestalsCheck::analyze(), HcalPedestalWidthsCheck::analyze(), HcalGainsCheck::analyze(), and HcalPedestalsAnalysis::analyze().

00137                                                                        {
00138   std::vector <HcalGenericDetId> result;
00139   std::set <unsigned long> allIds;
00140   for (std::vector<PrecisionItem>::const_iterator item = mPItems.begin (); item != mPItems.end (); item++)  
00141     if (item->mId) allIds.insert (item->mId);
00142   for (std::set <unsigned long>::const_iterator channel = allIds.begin (); channel != allIds.end (); channel++) {
00143       result.push_back (HcalGenericDetId (*channel));
00144   }
00145   return result;
00146 }

std::vector< HcalTrigTowerDetId > HcalElectronicsMap::allTriggerId (  )  const

Definition at line 148 of file HcalElectronicsMap.cc.

References mTItems, and HLT_VtxMuL3::result.

00148                                                                        {
00149   std::vector <HcalTrigTowerDetId> result;
00150   std::set <unsigned long> allIds;
00151   for (std::vector<TriggerItem>::const_iterator item = mTItems.begin (); item != mTItems.end (); item++)  
00152     if (item->mTrigId) allIds.insert (item->mTrigId);
00153   for (std::set <unsigned long>::const_iterator channel = allIds.begin (); channel != allIds.end (); channel++)
00154     result.push_back (HcalTrigTowerDetId (*channel));
00155   return result;
00156 }

const HcalElectronicsMap::PrecisionItem * HcalElectronicsMap::findById ( unsigned long  fId  )  const [protected]

Definition at line 30 of file HcalElectronicsMap.cc.

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

Referenced by lookup().

00030                                                                                             {
00031   PrecisionItem target (fId, 0);
00032   std::vector<const HcalElectronicsMap::PrecisionItem*>::const_iterator item;
00033 
00034   if (!sortedByPId) sortById();
00035   
00036   item = std::lower_bound (mPItemsById.begin(), mPItemsById.end(), &target, hcal_impl::LessById());
00037   if (item == mPItemsById.end() || (*item)->mId != fId) 
00038     //    throw cms::Exception ("Conditions not found") << "Unavailable Electronics map for cell " << fId;
00039     return 0;
00040   return *item;
00041 }

const HcalElectronicsMap::TriggerItem * HcalElectronicsMap::findByTrigId ( unsigned long  fTrigId  )  const [protected]

Definition at line 60 of file HcalElectronicsMap.cc.

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

Referenced by lookupTrigger().

00060                                                                                                   {
00061   TriggerItem target (fTrigId,0);
00062   std::vector<const HcalElectronicsMap::TriggerItem*>::const_iterator item;
00063 
00064   if (!sortedByTId) sortByTriggerId();
00065   
00066   item = std::lower_bound (mTItemsByTrigId.begin(), mTItemsByTrigId.end(), &target, hcal_impl::LessByTrigId());
00067   if (item == mTItemsByTrigId.end() || (*item)->mTrigId != fTrigId) 
00068     //    throw cms::Exception ("Conditions not found") << "Unavailable Electronics map for cell " << fId;
00069     return 0;
00070   return *item;
00071 }

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().

00043                                                                                                  {
00044   HcalElectronicsId eid(fElId);
00045   const PrecisionItem* i=&(mPItems[eid.linearIndex()]);
00046   
00047   if (i!=0 && i->mElId!=fElId) i=0;
00048   return i;
00049 }

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().

00051                                                                                                {
00052   HcalElectronicsId eid(fElId);
00053   const TriggerItem* i=&(mTItems[eid.linearIndex()]);
00054   
00055   if (i!=0 && i->mElId!=fElId) i=0;
00056   return i;
00057 }

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.

00102                                                                                                                   {
00103   const TriggerItem* i=&(mTItems[pid.linearIndex()]);
00104   if (i!=0 && i->mTrigId!=0) {
00105     eid=HcalElectronicsId(i->mElId);
00106     did=HcalGenericDetId(i->mTrigId);
00107     return true;
00108   } else return false;  
00109 }

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.

00093                                                                                                                 {
00094   const PrecisionItem* i=&(mPItems[pid.linearIndex()]);
00095   if (i!=0 && i->mId!=0) {
00096     eid=HcalElectronicsId(i->mElId);
00097     did=HcalGenericDetId(i->mId);
00098     return true;
00099   } else return false;
00100 }

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().

00078                                                                   {
00079   const PrecisionItem* item = findById (fId.rawId ());
00080   return HcalElectronicsId (item ? item->mElId : 0);
00081 }

const DetId HcalElectronicsMap::lookup ( HcalElectronicsId  fId  )  const

lookup the logical detid associated with the given electronics id

Definition at line 73 of file HcalElectronicsMap.cc.

References findPByElId(), HcalElectronicsMap::PrecisionItem::mId, and HcalElectronicsId::rawId().

Referenced by HtrXmlPattern::analyze(), HcalLuttoDB::analyze(), HcalMonitorModule::beginJob(), HcalMonitorModule::CheckSubdetectorStatus(), HcalLEDClient::getHistograms(), HcalPacker::pack(), HcalPatternSource::produce(), HcalDataFormatMonitor::unpack(), and HcalUnpacker::unpack().

00073                                                                    {
00074   const PrecisionItem* item = findPByElId (fId.rawId ());
00075   return DetId (item ? item->mId : 0);
00076 }

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().

00088                                                                          {
00089   const TriggerItem* item = findByTrigId (fId.rawId ());
00090   return HcalElectronicsId (item ? item->mElId : 0);
00091 }

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(), HcalTrigPrimMonitor::processEvent(), and HcalUnpacker::unpack().

00083                                                                          {
00084   const TriggerItem* item = findTByElId (fId.rawId ());
00085   return DetId (item ? item->mTrigId : 0);
00086 }

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 HcalDbOnline::getObject().

00173                                                                                  {
00174   PrecisionItem& item = mPItems[fElectronicsId.linearIndex()];
00175 
00176   sortedByPId=false;
00177   if (item.mElId==0) item.mElId=fElectronicsId.rawId();
00178   if (item.mId == 0) {
00179     item.mId = fId.rawId ();
00180   } 
00181   else if (item.mId != fId.rawId ()) {
00182      edm::LogWarning("HCAL") << "HcalElectronicsMap::mapEId2tId-> Electronics channel " <<  fElectronicsId << " already mapped to channel " 
00183                              << HcalGenericDetId(item.mId) << ". New value " << HcalGenericDetId(fId) << " is ignored" ;
00184        return false;
00185   }
00186   return true;
00187 }

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.

00158                                                                                                     {
00159   TriggerItem& item = mTItems[fElectronicsId.linearIndex()];
00160   sortedByTId=false;
00161   if (item.mElId==0) item.mElId=fElectronicsId.rawId();
00162   if (item.mTrigId == 0) {
00163     item.mTrigId = fTriggerId.rawId (); // just cast avoiding long machinery
00164   } 
00165   else if (item.mTrigId != fTriggerId.rawId ()) {
00166     edm::LogWarning("HCAL") << "HcalElectronicsMap::mapEId2tId-> Electronics channel " <<  fElectronicsId  << " already mapped to trigger channel " 
00167               << (HcalTrigTowerDetId(item.mTrigId)) << ". New value " << fTriggerId << " is ignored" ;
00168     return false;
00169   }
00170   return true;
00171 }

void HcalElectronicsMap::sort (  )  [inline]

Definition at line 62 of file HcalElectronicsMap.h.

Referenced by fillDefaults(), and HcalDbOnline::getObject().

00062 {}

void HcalElectronicsMap::sortById (  )  const

Definition at line 189 of file HcalElectronicsMap.cc.

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

Referenced by findById().

00189                                          {
00190   if (!sortedByPId) {
00191     mPItemsById.clear();
00192     for (std::vector<PrecisionItem>::const_iterator i=mPItems.begin(); i!=mPItems.end(); ++i) {
00193       if (i->mElId) mPItemsById.push_back(&(*i));
00194     }
00195     
00196     std::sort (mPItemsById.begin(), mPItemsById.end(), hcal_impl::LessById ());
00197     sortedByPId=true;
00198   }
00199 }

void HcalElectronicsMap::sortByTriggerId (  )  const

Definition at line 201 of file HcalElectronicsMap.cc.

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

Referenced by findByTrigId().

00201                                                 {
00202   if (!sortedByTId) {
00203     mTItemsByTrigId.clear();
00204     for (std::vector<TriggerItem>::const_iterator i=mTItems.begin(); i!=mTItems.end(); ++i) {
00205       if (i->mElId) mTItemsByTrigId.push_back(&(*i));
00206     }
00207     
00208     std::sort (mTItemsByTrigId.begin(), mTItemsByTrigId.end(), hcal_impl::LessByTrigId ());
00209     sortedByTId=true;
00210   }
00211 }


Member Data Documentation

std::vector<PrecisionItem> HcalElectronicsMap::mPItems [protected]

Definition at line 86 of file HcalElectronicsMap.h.

Referenced by allElectronicsId(), allElectronicsIdPrecision(), allPrecisionId(), findPByElId(), lookup(), mapEId2chId(), and sortById().

std::vector<const PrecisionItem*> HcalElectronicsMap::mPItemsById [mutable, protected]

Definition at line 88 of file HcalElectronicsMap.h.

Referenced by findById(), and sortById().

std::vector<TriggerItem> HcalElectronicsMap::mTItems [protected]

Definition at line 87 of file HcalElectronicsMap.h.

Referenced by allElectronicsId(), allElectronicsIdTrigger(), allTriggerId(), findTByElId(), lookup(), mapEId2tId(), and sortByTriggerId().

std::vector<const TriggerItem*> HcalElectronicsMap::mTItemsByTrigId [mutable, protected]

Definition at line 90 of file HcalElectronicsMap.h.

Referenced by findByTrigId(), and sortByTriggerId().

bool HcalElectronicsMap::sortedByPId [mutable, protected]

Definition at line 89 of file HcalElectronicsMap.h.

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

bool HcalElectronicsMap::sortedByTId [mutable, protected]

Definition at line 91 of file HcalElectronicsMap.h.

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


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:23:40 2009 for CMSSW by  doxygen 1.5.4