CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/DataFormats/L1CaloTrigger/interface/L1CaloEmCand.h

Go to the documentation of this file.
00001 #ifndef L1CALOEMCAND_H
00002 #define L1CALOEMCAND_H
00003 
00004 #include <ostream>
00005 
00006 #include "DataFormats/L1CaloTrigger/interface/L1CaloRegionDetId.h"
00007 
00018 class L1CaloEmCand {
00019 public:
00020 
00022   L1CaloEmCand();
00023 
00025   L1CaloEmCand(uint16_t data, unsigned crate, bool iso);
00026 
00029   L1CaloEmCand(uint16_t data, unsigned crate, bool iso, uint16_t index, int16_t bx, bool dummy);
00030 
00032   L1CaloEmCand(unsigned rank, unsigned region, unsigned card, unsigned crate, bool iso);
00033 
00035   L1CaloEmCand(unsigned rank, unsigned region, unsigned card, unsigned crate, bool iso, uint16_t index, int16_t bx);
00036 
00038  ~L1CaloEmCand();
00039  
00041   uint16_t raw() const { return m_data; }
00042   
00044   unsigned rank() const { return m_data & 0x3f; }
00045 
00047   unsigned rctCard() const { return (m_data>>7) & 0x7; }
00048 
00050   unsigned rctRegion() const { return (m_data>>6) & 0x1; }
00051 
00053   unsigned rctCrate() const { return m_rctCrate; }
00054   
00056   bool isolated() const { return m_iso; }
00057 
00059   unsigned index() const { return m_index; }
00060 
00062   int16_t bx() const { return m_bx; }
00063 
00065   L1CaloRegionDetId regionId() const { return L1CaloRegionDetId(rctCrate(),rctCard(),rctRegion()); }
00066 
00068   void setBx(int16_t bx);
00069 
00071   int operator==(const L1CaloEmCand& c) const { return ((m_data==c.raw() && m_iso==c.isolated() && m_rctCrate==c.rctCrate() && this->regionId()==c.regionId()) || (this->empty() && c.empty())); }
00072 
00074   int operator!=(const L1CaloEmCand& c) const { return !(*this == c); }
00075 
00077   bool empty() const { return (rank() == 0); }
00078 
00079 
00080  private:
00081 
00082   // rank, card and region ID are contained in the data on the cable
00083   uint16_t m_data;
00084 
00085   // members to store geographical information (crate/cable)
00086   // these should probably be packed into a single uint16_t (or m_data) ???
00087   uint16_t m_rctCrate;
00088   bool m_iso;
00089   uint16_t m_index;
00090   int16_t m_bx;
00091 
00092  };
00093 
00094 
00095 std::ostream& operator<<(std::ostream& s, const L1CaloEmCand& cand);
00096 
00097 
00098 
00099 #endif