CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10/src/CondFormats/CastorObjects/interface/CastorElectronicsMap.h

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