Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef L1GCTJETCAND_H
0002 #define L1GCTJETCAND_H
0003 
0004 #include <ostream>
0005 #include <string>
0006 
0007 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctCand.h"
0008 
0009 #include "DataFormats/L1CaloTrigger/interface/L1CaloRegionDetId.h"
0010 
0011 /// \class L1GctJetCand
0012 /// \brief Level-1 Trigger jet candidate
0013 /// \author Jim Brooke
0014 /// \date June 2006
0015 ///
0016 
0017 class L1GctJetCand : public L1GctCand {
0018 public:
0019   /// default constructor (for vector initialisation etc.)
0020   L1GctJetCand();
0021 
0022   /// construct from raw data - used in GT
0023   L1GctJetCand(uint16_t rawData, bool isTau, bool isFor);
0024 
0025   /// construct from raw data with source - uesd in GCT unpacker
0026   L1GctJetCand(uint16_t rawData, bool isTau, bool isFor, uint16_t block, uint16_t index, int16_t bx);
0027 
0028   /// construct from rank, eta, phi, isolation - used in GCT emulator
0029   /// NB - eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z
0030   L1GctJetCand(unsigned rank, unsigned phi, unsigned eta, bool isTau, bool isFor);
0031 
0032   /// construct from rank, eta, phi, isolation - will be used in GCT emulator?
0033   /// NB - eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z
0034   L1GctJetCand(
0035       unsigned rank, unsigned phi, unsigned eta, bool isTau, bool isFor, uint16_t block, uint16_t index, int16_t bx);
0036 
0037   /// destructor (virtual to prevent compiler warnings)
0038   ~L1GctJetCand() override;
0039 
0040   /// region associated with the candidate
0041   L1CaloRegionDetId regionId() const override;
0042 
0043   /// name of object
0044   std::string name() const;
0045 
0046   /// was an object really found?
0047   bool empty() const override { return (rank() == 0); }
0048 
0049   /// get the raw data
0050   uint16_t raw() const { return m_data; }
0051 
0052   /// get rank bits
0053   unsigned rank() const override { return m_data & 0x3f; }
0054 
0055   /// get eta index (bit 3 is sign, 1 for -ve Z, 0 for +ve Z)
0056   unsigned etaIndex() const override { return (m_data >> 6) & 0xf; }
0057 
0058   /// get eta sign bit (1 for -ve Z, 0 for +ve Z)
0059   unsigned etaSign() const override { return (m_data >> 9) & 0x1; }
0060 
0061   /// get phi index (0-17)
0062   unsigned phiIndex() const override { return (m_data >> 10) & 0x1f; }
0063 
0064   /// check if this is a central jet
0065   bool isCentral() const { return (!m_isTau) && (!m_isFor); }
0066 
0067   /// check if this is a tau
0068   bool isTau() const { return m_isTau; }
0069 
0070   /// check if this is a forward jet
0071   bool isForward() const { return m_isFor; }
0072 
0073   /// which capture block did this come from
0074   unsigned capBlock() const { return m_captureBlock; }
0075 
0076   /// what index within capture block
0077   unsigned capIndex() const { return m_captureIndex; }
0078 
0079   /// get bunch-crossing index
0080   int16_t bx() const { return m_bx; }
0081 
0082   /// equality operator
0083   int operator==(const L1GctJetCand& c) const {
0084     return ((m_data == c.raw() && m_isTau == c.isTau() && m_isFor == c.isForward()) || (this->empty() && c.empty()));
0085   }
0086 
0087   /// inequality operator
0088   int operator!=(const L1GctJetCand& c) const { return !(*this == c); }
0089 
0090 private:
0091   uint16_t m_data;
0092   bool m_isTau;
0093   bool m_isFor;
0094   uint16_t m_captureBlock;
0095   uint8_t m_captureIndex;
0096   int16_t m_bx;
0097 };
0098 
0099 std::ostream& operator<<(std::ostream& s, const L1GctJetCand& cand);
0100 
0101 #endif