Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:26

0001 #ifndef L1GCTEMCAND_H
0002 #define L1GCTEMCAND_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 #include "DataFormats/L1CaloTrigger/interface/L1CaloEmCand.h"
0011 
0012 /*! \class L1GctEmCand
0013  * \brief Level-1 Trigger EM candidate at output of GCT
0014  *
0015  */
0016 
0017 /*! \author Jim Brooke
0018  *  \date June 2006
0019  */
0020 
0021 class L1GctEmCand : public L1GctCand {
0022 public:
0023   /// default constructor (for vector initialisation etc.)
0024   L1GctEmCand();
0025 
0026   /// construct from raw data, no source - used in GT
0027   L1GctEmCand(uint16_t rawData, bool iso);
0028 
0029   /// construct from raw data with source - used in GCT unpacker
0030   L1GctEmCand(uint16_t rawData, bool iso, uint16_t block, uint16_t index, int16_t bx);
0031 
0032   /// construct from rank, eta, phi, isolation - used in GCT emulator
0033   /// eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z
0034   L1GctEmCand(unsigned rank, unsigned phi, unsigned eta, bool iso);
0035 
0036   /// construct from rank, eta, phi, isolation - could be used in GCT emulator?
0037   /// eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z
0038   L1GctEmCand(unsigned rank, unsigned phi, unsigned eta, bool iso, uint16_t block, uint16_t index, int16_t bx);
0039 
0040   /// construct from RCT output candidate
0041   L1GctEmCand(L1CaloEmCand& c);
0042 
0043   /// destructor (virtual to prevent compiler warnings)
0044   ~L1GctEmCand() override;
0045 
0046   /// region associated with the candidate
0047   L1CaloRegionDetId regionId() const override;
0048 
0049   /// name of object
0050   std::string name() const;
0051 
0052   /// was an object really found?
0053   bool empty() const override { return (rank() == 0); }
0054 
0055   /// get the raw data
0056   uint16_t raw() const { return m_data; }
0057 
0058   /// get rank bits
0059   unsigned rank() const override { return m_data & 0x3f; }
0060 
0061   /// get eta index -6 to -0, +0 to +6 (bit 3 is sign, 1 for -ve Z, 0 for +ve Z)
0062   unsigned etaIndex() const override { return (m_data >> 6) & 0xf; }
0063 
0064   /// get eta sign (1 for -ve Z, 0 for +ve Z)
0065   unsigned etaSign() const override { return (m_data >> 9) & 0x1; }
0066 
0067   /// get phi index (0-17)
0068   unsigned phiIndex() const override { return (m_data >> 10) & 0x1f; }
0069 
0070   /// which stream did this come from
0071   bool isolated() const { return m_iso; }
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 L1GctEmCand& c) const {
0084     return ((m_data == c.raw() && m_iso == c.isolated()) || (this->empty() && c.empty()));
0085   }
0086 
0087   /// inequality operator
0088   int operator!=(const L1GctEmCand& c) const { return !(*this == c); }
0089 
0090 private:
0091   // set internal data from rank and region ieta, iphi
0092   void construct(unsigned rank, unsigned eta, unsigned phi);
0093 
0094 private:
0095   uint16_t m_data;
0096   bool m_iso;
0097   uint16_t m_captureBlock;
0098   uint8_t m_captureIndex;
0099   int16_t m_bx;
0100 };
0101 
0102 std::ostream& operator<<(std::ostream& s, const L1GctEmCand& cand);
0103 
0104 #endif