CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/DataFormats/L1GlobalCaloTrigger/interface/L1GctInternEtSum.h

Go to the documentation of this file.
00001 #ifndef L1GCTINTERNETSUM_H
00002 #define L1GCTINTERNETSUM_H
00003 
00004 #include <ostream>
00005 #include <string>
00006 #include <stdint.h>
00007 
00013 
00014 
00015 class L1GctInternEtSum {
00016 
00017  public:
00018 
00020   enum L1GctInternEtSumType { null,
00021                               jet_tot_et,      // from jet_tot_et_and_ht in leaf output
00022                               jet_tot_ht,      // from jet_tot_et_and_ht in leaf output
00023                               jet_miss_et,     // leaf output
00024                               total_et_or_ht,  // conc input, wheel input and output
00025                               miss_etx_or_ety  // conc input, wheel input and output
00026   };
00027 
00028   enum numberOfBits {
00029     kTotEtOrHtNBits   = 12,
00030     kJetMissEtNBits   = 17,
00031     kMissExOrEyNBits  = 20,
00032     kTotEtOrHtOFlowBit  = 1 << kTotEtOrHtNBits,
00033     kJetMissEtOFlowBit  = 1 << kJetMissEtNBits,
00034     kMissExOrEyOFlowBit = 1 << kMissExOrEyNBits,
00035     kTotEtOrHtMaxValue  = kTotEtOrHtOFlowBit  - 1,
00036     kJetMissEtMaxValue  = kJetMissEtOFlowBit  - 1,
00037     kMissExOrEyMaxValue = kMissExOrEyOFlowBit - 1,
00038     kTotEtOrHtRawCtorMask  = kTotEtOrHtOFlowBit  | kTotEtOrHtMaxValue,
00039     kJetMissEtRawCtorMask  = kJetMissEtOFlowBit  | kJetMissEtMaxValue,
00040     kMissExOrEyRawCtorMask = kMissExOrEyOFlowBit | kMissExOrEyMaxValue
00041   };
00042 
00044   L1GctInternEtSum();
00045 
00047   L1GctInternEtSum(uint16_t capBlock,
00048                    uint16_t capIndex,
00049                    int16_t bx,
00050                    uint32_t et,
00051                    uint8_t oflow);
00052 
00054   ~L1GctInternEtSum();
00055 
00056   // named ctors
00057   static L1GctInternEtSum fromJetTotEt(uint16_t capBlock,
00058                                        uint16_t capIndex,
00059                                        int16_t bx,
00060                                        uint32_t data);
00061 
00062   static L1GctInternEtSum fromJetTotHt(uint16_t capBlock,
00063                                        uint16_t capIndex,
00064                                        int16_t bx,
00065                                        uint32_t data);
00066   
00067   static L1GctInternEtSum fromJetMissEt(uint16_t capBlock,
00068                                         uint16_t capIndex,
00069                                         int16_t bx,
00070                                         uint32_t data);
00071   
00072 
00073   static L1GctInternEtSum fromTotalEtOrHt(uint16_t capBlock,
00074                                           uint16_t capIndex,
00075                                           int16_t bx,
00076                                           uint32_t data);
00077 
00078   static L1GctInternEtSum fromMissEtxOrEty(uint16_t capBlock,
00079                                           uint16_t capIndex,
00080                                           int16_t bx,
00081                                           uint32_t data);
00082 
00083   static L1GctInternEtSum fromEmulatorJetTotEt(unsigned totEt, bool overFlow, int16_t bx);
00084 
00085   static L1GctInternEtSum fromEmulatorJetTotHt(unsigned totHt, bool overFlow, int16_t bx);
00086   
00087   static L1GctInternEtSum fromEmulatorJetMissEt(int missEtxOrEty, bool overFlow, int16_t bx);
00088   
00089   static L1GctInternEtSum fromEmulatorTotalEtOrHt(unsigned totEtOrHt, bool overFlow, int16_t bx);
00090 
00091   static L1GctInternEtSum fromEmulatorMissEtxOrEty(int missEtxOrEty, bool overFlow, int16_t bx);
00092 
00094 
00096   L1GctInternEtSum::L1GctInternEtSumType type() const { return type_; }
00097 
00099   uint16_t capBlock() const { return capBlock_; }
00100 
00102   uint16_t capIndex() const { return capIndex_; }
00103 
00105   int16_t bx() const { return bx_; }
00106 
00108   bool empty() const { return (data_ == 0); }
00109 
00110 
00112 
00114   uint32_t raw() const { return data_; }
00115   
00117   uint32_t value() const { return data_ & 0x7fffffff; }
00118 
00120   uint32_t et() const { return value(); }
00121 
00123   uint32_t count() const { return value(); }
00124 
00126   uint8_t oflow() const { return (data_>>31) & 0x1; }
00127 
00128 
00129   // setters
00130 
00132   void setCapBlock(uint16_t capBlock) { capBlock_ = capBlock; }
00133 
00135   void setCapIndex(uint16_t capIndex) { capIndex_ = capIndex; }
00136 
00138   void setBx(uint16_t bx) { bx_ = bx; }
00139 
00141   void setType(L1GctInternEtSumType type) { type_ = type; }
00142 
00144   void setValue(uint32_t val);
00145 
00147   void setEt(uint32_t et);
00148 
00150   void setCount(uint32_t count);
00151 
00153   void setOflow(uint8_t oflow);
00154 
00155 
00157 
00159   bool operator==(const L1GctInternEtSum& c) const;
00160   
00162   bool operator!=(const L1GctInternEtSum& c) const { return !(*this == c); }
00163   
00164 
00165  private:
00166 
00167   // type of data
00168   L1GctInternEtSumType type_;
00169 
00170   // source of the data
00171   uint16_t capBlock_;
00172   uint16_t capIndex_;
00173   int16_t bx_;
00174 
00175   // the captured data
00176   uint32_t data_;
00177 
00178  };
00179 
00180 std::ostream& operator<<(std::ostream& s, const L1GctInternEtSum& c);
00181 
00182 #endif