CMS 3D CMS Logo

CastorElectronicsMap Class Reference

Author:
Panos Katsas (UoA)
More...

#include <CondFormats/CastorObjects/interface/CastorElectronicsMap.h>

List of all members.

Public Member Functions

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

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:
Panos Katsas (UoA)

Description: POOL object to store map between detector ID, electronics ID and trigger ID

POOL object to store mapping for Castor channels (based on HCAL electronics map)

Definition at line 24 of file CastorElectronicsMap.h.


Constructor & Destructor Documentation

CastorElectronicsMap::CastorElectronicsMap (  ) 

Definition at line 17 of file CastorElectronicsMap.cc.

CastorElectronicsMap::~CastorElectronicsMap (  ) 

Definition at line 29 of file CastorElectronicsMap.cc.

00029 {}


Member Function Documentation

std::vector< CastorElectronicsId > CastorElectronicsMap::allElectronicsId (  )  const

Definition at line 113 of file CastorElectronicsMap.cc.

References mPItems, mTItems, and HLT_VtxMuL3::result.

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

std::vector< CastorElectronicsId > CastorElectronicsMap::allElectronicsIdPrecision (  )  const

Definition at line 123 of file CastorElectronicsMap.cc.

References mPItems, and HLT_VtxMuL3::result.

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

std::vector< CastorElectronicsId > CastorElectronicsMap::allElectronicsIdTrigger (  )  const

Definition at line 130 of file CastorElectronicsMap.cc.

References mTItems, and HLT_VtxMuL3::result.

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

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

Definition at line 138 of file CastorElectronicsMap.cc.

References mPItems, and HLT_VtxMuL3::result.

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

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

Definition at line 149 of file CastorElectronicsMap.cc.

References mTItems, and HLT_VtxMuL3::result.

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

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

Definition at line 31 of file CastorElectronicsMap.cc.

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

Referenced by lookup().

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

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

Definition at line 61 of file CastorElectronicsMap.cc.

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

Referenced by lookupTrigger().

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

const CastorElectronicsMap::PrecisionItem * CastorElectronicsMap::findPByElId ( unsigned long  fElId  )  const [protected]

Definition at line 44 of file CastorElectronicsMap.cc.

References i, CastorElectronicsId::linearIndex(), CastorElectronicsMap::PrecisionItem::mElId, and mPItems.

Referenced by lookup().

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

const CastorElectronicsMap::TriggerItem * CastorElectronicsMap::findTByElId ( unsigned long  fElId  )  const [protected]

Definition at line 52 of file CastorElectronicsMap.cc.

References i, CastorElectronicsId::linearIndex(), CastorElectronicsMap::TriggerItem::mElId, and mTItems.

Referenced by lookupTrigger().

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

bool CastorElectronicsMap::lookup ( const CastorElectronicsId  pId,
CastorElectronicsId eid,
HcalTrigTowerDetId did 
) const

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

Definition at line 103 of file CastorElectronicsMap.cc.

References i, CastorElectronicsId::linearIndex(), CastorElectronicsMap::TriggerItem::mElId, mTItems, and CastorElectronicsMap::TriggerItem::mTrigId.

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

bool CastorElectronicsMap::lookup ( const CastorElectronicsId  pId,
CastorElectronicsId eid,
HcalGenericDetId did 
) const

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

Definition at line 94 of file CastorElectronicsMap.cc.

References i, CastorElectronicsId::linearIndex(), CastorElectronicsMap::PrecisionItem::mElId, CastorElectronicsMap::PrecisionItem::mId, and mPItems.

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

const CastorElectronicsId CastorElectronicsMap::lookup ( DetId  fId  )  const

brief lookup the electronics detid associated with the given logical id

Definition at line 79 of file CastorElectronicsMap.cc.

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

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

const DetId CastorElectronicsMap::lookup ( CastorElectronicsId  fId  )  const

lookup the logical detid associated with the given electronics id

Definition at line 74 of file CastorElectronicsMap.cc.

References findPByElId(), CastorElectronicsMap::PrecisionItem::mId, and CastorElectronicsId::rawId().

Referenced by CastorPacker::pack(), and CastorUnpacker::unpack().

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

const CastorElectronicsId CastorElectronicsMap::lookupTrigger ( DetId  fId  )  const

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

Definition at line 89 of file CastorElectronicsMap.cc.

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

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

const DetId CastorElectronicsMap::lookupTrigger ( CastorElectronicsId  fId  )  const

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

Definition at line 84 of file CastorElectronicsMap.cc.

References findTByElId(), CastorElectronicsMap::TriggerItem::mTrigId, and CastorElectronicsId::rawId().

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

bool CastorElectronicsMap::mapEId2chId ( CastorElectronicsId  fElectronicsId,
DetId  fId 
)

Definition at line 174 of file CastorElectronicsMap.cc.

References CastorElectronicsId::linearIndex(), CastorElectronicsMap::PrecisionItem::mElId, CastorElectronicsMap::PrecisionItem::mId, mPItems, CastorElectronicsId::rawId(), DetId::rawId(), and sortedByPId.

Referenced by CastorDbHardcode::makeHardcodeMap().

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

bool CastorElectronicsMap::mapEId2tId ( CastorElectronicsId  fElectronicsId,
HcalTrigTowerDetId  fTriggerId 
)

Definition at line 159 of file CastorElectronicsMap.cc.

References CastorElectronicsId::linearIndex(), CastorElectronicsMap::TriggerItem::mElId, mTItems, CastorElectronicsMap::TriggerItem::mTrigId, CastorElectronicsId::rawId(), DetId::rawId(), and sortedByTId.

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

void CastorElectronicsMap::sort (  )  [inline]

Definition at line 62 of file CastorElectronicsMap.h.

Referenced by CastorDbHardcode::makeHardcodeMap().

00062 {}

void CastorElectronicsMap::sortById (  )  const

Definition at line 190 of file CastorElectronicsMap.cc.

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

Referenced by findById().

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

void CastorElectronicsMap::sortByTriggerId (  )  const

Definition at line 202 of file CastorElectronicsMap.cc.

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

Referenced by findByTrigId().

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


Member Data Documentation

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

Definition at line 86 of file CastorElectronicsMap.h.

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

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

Definition at line 88 of file CastorElectronicsMap.h.

Referenced by findById(), and sortById().

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

Definition at line 87 of file CastorElectronicsMap.h.

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

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

Definition at line 90 of file CastorElectronicsMap.h.

Referenced by findByTrigId(), and sortByTriggerId().

bool CastorElectronicsMap::sortedByPId [mutable, protected]

Definition at line 89 of file CastorElectronicsMap.h.

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

bool CastorElectronicsMap::sortedByTId [mutable, protected]

Definition at line 91 of file CastorElectronicsMap.h.

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


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