Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef L1GCTINTERNJETDATA_H
0002 #define L1GCTINTERNJETDATA_H
0003 
0004 #include <string>
0005 
0006 #include "DataFormats/L1CaloTrigger/interface/L1CaloRegionDetId.h"
0007 
0008 /// \class L1GctInternJetData
0009 /// \brief L1 GCT internal jet candidate
0010 /// \author Jim Brooke
0011 /// \date June 2006
0012 ///
0013 
0014 class L1GctInternJetData {
0015 public:
0016   enum L1GctInternJetType { null, emulator, jet_cluster, jet_cluster_minimal, jet_precluster, gct_trig_object };
0017 
0018 public:
0019   /// default constructor (for vector initialisation etc.)
0020   L1GctInternJetData();
0021 
0022   /// construct from individual quantities
0023   L1GctInternJetData(L1CaloRegionDetId rgn,
0024                      uint16_t capBlock,
0025                      uint16_t capIndex,
0026                      int16_t bx,
0027                      uint8_t sgnEta,
0028                      uint8_t oflow,
0029                      uint16_t et,
0030                      uint8_t eta,
0031                      uint8_t phi,
0032                      uint8_t tauVeto,
0033                      uint8_t rank);
0034 
0035   // 'named' constructors to avoid confusion
0036 
0037   // emulator calibrated jet ctor
0038   static L1GctInternJetData fromEmulator(L1CaloRegionDetId rgn,
0039                                          int16_t bx,
0040                                          uint16_t et,
0041                                          bool overFlow,
0042                                          bool tauVeto,
0043                                          uint8_t eta,
0044                                          uint8_t phi,
0045                                          uint16_t rank);
0046 
0047   /// construct from "jet_cluster"
0048   static L1GctInternJetData fromJetCluster(
0049       L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data);
0050 
0051   /// construct from "jet_precluster"
0052   static L1GctInternJetData fromJetPreCluster(
0053       L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data);
0054 
0055   /// construct from "jet_cluster_minimal"
0056   static L1GctInternJetData fromJetClusterMinimal(
0057       L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data);
0058 
0059   /// construct from "gct_trig_object"
0060   static L1GctInternJetData fromGctTrigObject(
0061       L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data);
0062 
0063   /// destructor (virtual to prevent compiler warnings)
0064   virtual ~L1GctInternJetData();
0065 
0066   // getters
0067 
0068   /// 'type' of object
0069   L1GctInternJetData::L1GctInternJetType type() const { return type_; }
0070 
0071   /// region associated with the candidate
0072   L1CaloRegionDetId regionId() const { return regionId_; }
0073 
0074   /// was an object really found?
0075   bool empty() const { return (data_ == 0); }
0076 
0077   /// get capture block
0078   uint16_t capBlock() const { return capBlock_; }
0079 
0080   /// get index within capture block
0081   uint16_t capIndex() const { return capIndex_; }
0082 
0083   /// get BX number
0084   int16_t bx() const { return bx_; }
0085 
0086   /// get the raw data
0087   uint32_t raw() const { return data_; }
0088 
0089   /// get rank bits
0090   uint16_t rank() const { return data_ & 0x3f; }
0091 
0092   /// get tau veto
0093   uint16_t tauVeto() const { return (data_ >> 6) & 0x1; }
0094 
0095   /// get phi
0096   uint16_t phi() const { return (data_ >> 7) & 0x1f; }
0097 
0098   /// get eta
0099   uint16_t eta() const { return (data_ >> 12) & 0xf; }
0100 
0101   /// get et
0102   uint16_t et() const { return (data_ >> 16) & 0xfff; }
0103 
0104   /// get oflow
0105   uint16_t oflow() const { return (data_ >> 28) & 0x1; }
0106 
0107   /// get sign of eta
0108   uint16_t sgnEta() const { return (data_ >> 29) & 0x1; }
0109 
0110   // setters
0111 
0112   /// set region
0113   void setRegionId(L1CaloRegionDetId rgn) { regionId_ = rgn; }
0114 
0115   /// set cap block
0116   void setCapBlock(uint16_t capBlock) { capBlock_ = capBlock; }
0117 
0118   /// set cap index
0119   void setCapIndex(uint16_t capIndex) { capIndex_ = capIndex; }
0120 
0121   /// set bx
0122   void setBx(uint16_t bx) { bx_ = bx; }
0123 
0124   /// set type
0125   void setType(L1GctInternJetType type) { type_ = type; }
0126 
0127   /// set data
0128   void setRawData(uint32_t data) { data_ = data; }
0129 
0130   /// construct data word from  components
0131   void setData(uint8_t sgnEta, uint8_t oflow, uint16_t et, uint8_t eta, uint8_t phi, uint8_t tauVeto, uint8_t rank);
0132 
0133   // operators
0134 
0135   /// equality operator
0136   bool operator==(const L1GctInternJetData& c) const;
0137 
0138   /// inequality operator
0139   bool operator!=(const L1GctInternJetData& c) const { return !(*this == c); }
0140 
0141 private:
0142   // location in calorimeter (optionally set by unpacker)
0143   L1CaloRegionDetId regionId_;
0144 
0145   // source of the data
0146   uint16_t capBlock_;
0147   uint16_t capIndex_;
0148   int16_t bx_;
0149 
0150   // type of data
0151   L1GctInternJetType type_;
0152 
0153   // the captured data
0154   uint32_t data_;
0155 };
0156 
0157 std::ostream& operator<<(std::ostream& s, const L1GctInternJetData& cand);
0158 
0159 #endif