Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:46

0001 #ifndef L1GCTINTERNEMCAND_H
0002 #define L1GCTINTERNEMCAND_H
0003 
0004 #include <ostream>
0005 #include <string>
0006 
0007 #include "DataFormats/L1CaloTrigger/interface/L1CaloEmCand.h"
0008 
0009 /*! \class L1GctEmCand
0010  * \brief Level-1 Trigger EM candidate within GCT processing
0011  *
0012  */
0013 
0014 /*! \author Jim Brooke
0015  *  \date June 2006
0016  */
0017 
0018 class L1GctInternEmCand {  //: public L1GctCand {
0019 public:
0020   /// default constructor (for vector initialisation etc.)
0021   L1GctInternEmCand();
0022 
0023   /// construct from raw data
0024   L1GctInternEmCand(uint16_t data, bool iso, unsigned block, unsigned index, int16_t bx);
0025 
0026   // construct from eta, phi etc
0027   L1GctInternEmCand(
0028       unsigned rank, unsigned eta, unsigned etaSgn, unsigned phi, bool iso, unsigned block, unsigned index, int16_t bx);
0029 
0030   /// destructor (virtual to prevent compiler warnings)
0031   virtual ~L1GctInternEmCand();
0032 
0033   /// region associated with the candidate
0034   L1CaloRegionDetId regionId() const;
0035 
0036   /// name of object
0037   std::string name() const;
0038 
0039   /// was an object really found?
0040   bool empty() const;
0041 
0042   /// get the raw data
0043   uint16_t raw() const { return m_data; }
0044 
0045   /// get rank bits
0046   unsigned rank() const { return m_data & 0x3f; }
0047 
0048   /// get eta index -  Barrel 1:4, Endcap  5:7, HF  8:11
0049   unsigned etaIndex() const { return (m_data >> 6) & 0x1f; }
0050 
0051   /// get eta sign (1 for -ve Z, 0 for +ve Z)
0052   unsigned etaSign() const { return (m_data >> 10) & 0x1; }
0053 
0054   /// get phi index (0-17)
0055   unsigned phiIndex() const { return (m_data >> 11) & 0x1f; }
0056 
0057   /// which stream did this come from
0058   bool isolated() const { return m_iso; }
0059 
0060   /// which capture block did this come from
0061   unsigned capBlock() const { return m_captureBlock; }
0062 
0063   /// what index within capture block
0064   unsigned capIndex() const { return m_captureIndex; }
0065 
0066   /// get bunch-crossing index
0067   int16_t bx() const { return m_bx; }
0068 
0069   /// equality operator
0070   int operator==(const L1GctInternEmCand& c) const {
0071     return ((m_data == c.raw() && m_iso == c.isolated()) || (this->empty() && c.empty()));
0072   }
0073 
0074   /// inequality operator
0075   int operator!=(const L1GctInternEmCand& c) const {
0076     return ((m_data != c.raw() || m_iso != c.isolated()) && (!this->empty() || !c.empty()));
0077   }
0078 
0079 private:
0080   // set internal data from rank and region ieta, iphi
0081   void construct(unsigned rank, unsigned eta, unsigned etaSgn, unsigned phi);
0082 
0083 private:
0084   uint16_t m_data;
0085   uint16_t m_captureBlock;
0086   uint8_t m_captureIndex;
0087   bool m_iso;
0088   int16_t m_bx;
0089 };
0090 
0091 std::ostream& operator<<(std::ostream& s, const L1GctInternEmCand& cand);
0092 
0093 #endif