Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctInternJetData.h"
0002 
0003 L1GctInternJetData::L1GctInternJetData() : capBlock_(0), capIndex_(0), bx_(0), type_(null), data_(0) {}
0004 
0005 /// construct from individual quantities
0006 L1GctInternJetData::L1GctInternJetData(L1CaloRegionDetId rgn,
0007                                        uint16_t capBlock,
0008                                        uint16_t capIndex,
0009                                        int16_t bx,
0010                                        uint8_t sgnEta,
0011                                        uint8_t oflow,
0012                                        uint16_t et,
0013                                        uint8_t eta,
0014                                        uint8_t phi,
0015                                        uint8_t tauVeto,
0016                                        uint8_t rank)
0017     : regionId_(rgn), capBlock_(capBlock), capIndex_(capIndex), bx_(bx), type_(null), data_(0) {
0018   setData(sgnEta, oflow, et, eta, phi, tauVeto, rank);
0019 }
0020 
0021 // 'named' constructors to avoid confusion
0022 
0023 // emulator calibrated jet ctor
0024 L1GctInternJetData L1GctInternJetData::fromEmulator(
0025     L1CaloRegionDetId rgn, int16_t bx, uint16_t et, bool oflow, bool tauVeto, uint8_t eta, uint8_t phi, uint16_t rank) {
0026   L1GctInternJetData d;
0027 
0028   d.setType(emulator);
0029   d.setRegionId(rgn);
0030   d.setData(0, (oflow ? 1 : 0), et, eta, phi, (tauVeto ? 1 : 0), rank);
0031   d.setBx(bx);
0032 
0033   return d;
0034 }
0035 
0036 /// construct from "jet_cluster"
0037 L1GctInternJetData L1GctInternJetData::fromJetCluster(
0038     L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data) {
0039   L1GctInternJetData d;
0040 
0041   d.setRegionId(rgn);
0042   d.setCapBlock(capBlock);
0043   d.setCapIndex(capIndex);
0044   d.setBx(bx);
0045   d.setType(jet_cluster);
0046   d.setRawData(data & 0x1fffffff);
0047 
0048   return d;
0049 }
0050 
0051 /// construct from "jet_precluster"
0052 L1GctInternJetData L1GctInternJetData::fromJetPreCluster(
0053     L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data) {
0054   L1GctInternJetData d;
0055 
0056   d.setRegionId(rgn);
0057   d.setCapBlock(capBlock);
0058   d.setCapIndex(capIndex);
0059   d.setBx(bx);
0060   d.setType(jet_precluster);
0061   d.setData(0, (data >> 10) & 0x1, data & 0x3ff, (data >> 12) & 0xf, 0, (data >> 11) & 0x1, 0);
0062 
0063   return d;
0064 }
0065 
0066 /// construct from "jet_cluster_minimal"
0067 L1GctInternJetData L1GctInternJetData::fromJetClusterMinimal(
0068     L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data) {
0069   L1GctInternJetData d;
0070 
0071   d.setRegionId(rgn);
0072   d.setCapBlock(capBlock);
0073   d.setCapIndex(capIndex);
0074   d.setBx(bx);
0075   d.setType(jet_cluster_minimal);
0076   d.setData(0, (data >> 10) & 0x1, 0, (data >> 6) & 0xf, (data >> 12) & 0x1, (data >> 11) & 0x1, data & 0x3f);
0077 
0078   return d;
0079 }
0080 
0081 /// construct from "gct_trig_object"
0082 L1GctInternJetData L1GctInternJetData::fromGctTrigObject(
0083     L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data) {
0084   L1GctInternJetData d;
0085 
0086   d.setRegionId(rgn);
0087   d.setCapBlock(capBlock);
0088   d.setCapIndex(capIndex);
0089   d.setBx(bx);
0090   d.setType(gct_trig_object);
0091   d.setData((data >> 10) & 0x1, 0, 0, (data >> 6) & 0xf, (data >> 11) & 0x1f, 0, data & 0x3f);
0092 
0093   return d;
0094 }
0095 
0096 /// destructor (virtual to prevent compiler warnings)
0097 L1GctInternJetData::~L1GctInternJetData() {}
0098 
0099 /// construct
0100 void L1GctInternJetData::setData(
0101     uint8_t sgnEta, uint8_t oflow, uint16_t et, uint8_t eta, uint8_t phi, uint8_t tauVeto, uint8_t rank) {
0102   data_ = 0;
0103   data_ = rank & 0x3f;
0104   data_ |= (tauVeto & 0x1) << 6;
0105   data_ |= (phi & 0x1f) << 7;
0106   data_ |= (eta & 0xf) << 12;
0107   data_ |= (et & 0xfff) << 16;
0108   data_ |= (oflow & 0x1) << 28;
0109   data_ |= (sgnEta & 0x1) << 29;
0110 }
0111 
0112 /// operators
0113 
0114 /// equality operator
0115 bool L1GctInternJetData::operator==(const L1GctInternJetData& c) const {
0116   return (type_ == c.type() && data_ == c.raw() && regionId_ == c.regionId() && bx_ == c.bx());
0117 }
0118 
0119 /// pretty print
0120 std::ostream& operator<<(std::ostream& s, const L1GctInternJetData& c) {
0121   s << "L1GctInternJetData :";
0122   if (c.empty()) {
0123     s << " empty!";
0124   }
0125   if (c.type() == L1GctInternJetData::jet_cluster) {
0126     s << " type=jet_cluster";
0127     s << " oflow=" << c.oflow();
0128     s << " et=" << c.et();
0129     s << " eta=" << c.eta();
0130     s << " phi=" << c.phi();
0131     s << " tauVeto=" << c.tauVeto();
0132     s << " rank=" << c.rank();
0133   } else if (c.type() == L1GctInternJetData::jet_precluster) {
0134     s << " type=jet_precluster";
0135     s << " oflow=" << c.oflow();
0136     s << " et=" << c.et();
0137     s << " eta=" << c.eta();
0138     s << " tauVeto=" << c.tauVeto();
0139   } else if (c.type() == L1GctInternJetData::jet_cluster_minimal) {
0140     s << " type=jet_cluster_minimal";
0141     s << " oflow=" << c.oflow();
0142     s << " eta=" << c.eta();
0143     s << " phi=" << c.phi();
0144     s << " tauVeto=" << c.tauVeto();
0145     s << " rank=" << c.rank();
0146   } else if (c.type() == L1GctInternJetData::gct_trig_object) {
0147     s << " type=gct_trig_object";
0148     s << " eta=" << c.eta();
0149     s << " phi=" << c.phi();
0150     s << " rank=" << c.rank();
0151   }
0152   s << " cap block=" << std::hex << c.capBlock();
0153   s << " index=" << std::dec << c.capIndex();
0154   s << " BX=" << c.bx();
0155 
0156   return s;
0157 }