CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/CondFormats/HcalObjects/interface/HcalElectronicsMap.h

Go to the documentation of this file.
00001 #ifndef HcalElectronicsMap_h
00002 #define HcalElectronicsMap_h
00003 
00013 #include <vector>
00014 #include <algorithm>
00015 #include <boost/cstdint.hpp>
00016 
00017 #include "DataFormats/DetId/interface/DetId.h"
00018 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
00019 #include "DataFormats/HcalDetId/interface/HcalCalibDetId.h"
00020 #include "DataFormats/HcalDetId/interface/HcalTrigTowerDetId.h"
00021 #include "DataFormats/HcalDetId/interface/HcalElectronicsId.h"
00022 #include "DataFormats/HcalDetId/interface/HcalGenericDetId.h"
00023 // 
00024 class HcalElectronicsMap {
00025  public:
00026   HcalElectronicsMap();
00027   ~HcalElectronicsMap();
00028 
00030   //return Null item if no such mapping
00031   const DetId lookup(HcalElectronicsId fId) const;
00032 
00034   //return Null item if no such mapping
00035   const HcalElectronicsId lookup(DetId fId) const;
00036 
00038   //return Null item if no such mapping
00039   const DetId lookupTrigger(HcalElectronicsId fId) const;
00040 
00042   //return Null item if no such mapping
00043   const HcalElectronicsId lookupTrigger(DetId fId) const;
00044 
00046   bool lookup(const HcalElectronicsId pId, HcalElectronicsId& eid, HcalGenericDetId& did) const;
00048   bool lookup(const HcalElectronicsId pId, HcalElectronicsId& eid, HcalTrigTowerDetId& did) const;
00049 
00050   std::vector <HcalElectronicsId> allElectronicsId () const;
00051   std::vector <HcalElectronicsId> allElectronicsIdPrecision() const;
00052   std::vector <HcalElectronicsId> allElectronicsIdTrigger() const;
00053   std::vector <HcalGenericDetId> allPrecisionId () const;
00054   std::vector <HcalTrigTowerDetId> allTriggerId () const;
00055 
00056   // map channels
00057   bool mapEId2tId (HcalElectronicsId fElectronicsId, HcalTrigTowerDetId fTriggerId);
00058   bool mapEId2chId (HcalElectronicsId fElectronicsId, DetId fId);
00059   // sorting
00060   void sortById () const;
00061   void sortByTriggerId () const;
00062   void sort() {}
00063 
00064   class PrecisionItem { 
00065   public:
00066     PrecisionItem () {mId = mElId = 0;}
00067     PrecisionItem (uint32_t fId, uint32_t fElId) 
00068       : mId (fId), mElId (fElId) {}
00069     uint32_t mId;
00070     uint32_t mElId;
00071   };
00072   class TriggerItem { 
00073   public:
00074     TriggerItem () {mElId = mTrigId = 0;}
00075     TriggerItem (uint32_t fTrigId, uint32_t fElId) 
00076       : mTrigId (fTrigId), mElId (fElId) { }
00077     uint32_t mTrigId;
00078     uint32_t mElId;
00079   };
00080  protected:
00081   const PrecisionItem* findById (unsigned long fId) const;
00082   const PrecisionItem* findPByElId (unsigned long fElId) const;
00083   const TriggerItem* findTByElId (unsigned long fElId) const;
00084   const TriggerItem* findByTrigId (unsigned long fTrigId) const;
00085   
00086   std::vector<PrecisionItem> mPItems;
00087   std::vector<TriggerItem> mTItems;
00088   mutable std::vector<const PrecisionItem*> mPItemsById;
00089   mutable bool sortedByPId;
00090   mutable std::vector<const TriggerItem*> mTItemsByTrigId;
00091   mutable bool sortedByTId;
00092 };
00093 
00094 #endif