CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/DataFormats/L1GlobalCaloTrigger/src/L1GctInternJetData.cc

Go to the documentation of this file.
00001 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctInternJetData.h"
00002 
00003 L1GctInternJetData::L1GctInternJetData() :
00004   capBlock_(0),
00005   capIndex_(0),
00006   bx_(0),
00007   type_(null),
00008   data_(0)
00009 {
00010 
00011 }
00012 
00014 L1GctInternJetData::L1GctInternJetData(L1CaloRegionDetId rgn,
00015                                        uint16_t capBlock,
00016                                        uint16_t capIndex,
00017                                        int16_t bx,
00018                                        uint8_t sgnEta,
00019                                        uint8_t oflow,
00020                                        uint16_t et,
00021                                        uint8_t eta,
00022                                        uint8_t phi,
00023                                        uint8_t tauVeto,
00024                                        uint8_t rank) :
00025   regionId_(rgn),
00026   capBlock_(capBlock),
00027   capIndex_(capIndex),
00028   bx_(bx),
00029   type_(null),
00030   data_(0)
00031 {
00032   setData(sgnEta, oflow, et, eta, phi, tauVeto, rank);
00033 }
00034 
00035 // 'named' constructors to avoid confusion
00036 
00037 // emulator calibrated jet ctor
00038 L1GctInternJetData L1GctInternJetData::fromEmulator(L1CaloRegionDetId rgn,
00039                                                     int16_t bx,
00040                                                     uint16_t et, 
00041                                                     bool oflow,
00042                                                     bool tauVeto,
00043                                                     uint8_t eta,
00044                                                     uint8_t phi,
00045                                                     uint16_t rank) {
00046   L1GctInternJetData d;
00047 
00048   d.setType(emulator);
00049   d.setRegionId(rgn);
00050   d.setData(0, (oflow ? 1 : 0), et, eta, phi, (tauVeto ? 1 : 0), rank);
00051   d.setBx(bx);
00052 
00053   return d;
00054 }
00055 
00057 L1GctInternJetData L1GctInternJetData::fromJetCluster(L1CaloRegionDetId rgn,
00058                                                       uint16_t capBlock,
00059                                                       uint16_t capIndex,
00060                                                       int16_t bx,
00061                                                       uint32_t data) {
00062   L1GctInternJetData d;
00063 
00064   d.setRegionId(rgn);
00065   d.setCapBlock(capBlock);
00066   d.setCapIndex(capIndex);
00067   d.setBx(bx);
00068   d.setType(jet_cluster);
00069   d.setRawData(data&0x1fffffff);
00070 
00071   return d;
00072 }
00073 
00075 L1GctInternJetData L1GctInternJetData::fromJetPreCluster(L1CaloRegionDetId rgn,
00076                                                          uint16_t capBlock,
00077                                                          uint16_t capIndex,
00078                                                          int16_t bx,
00079                                                          uint32_t data) {
00080   L1GctInternJetData d;
00081 
00082   d.setRegionId(rgn);
00083   d.setCapBlock(capBlock);
00084   d.setCapIndex(capIndex);
00085   d.setBx(bx);
00086   d.setType(jet_precluster);
00087   d.setData( 0, (data>>10)&0x1, data&0x3ff, (data>>12)&0xf, 0, (data>>11)&0x1, 0 );
00088 
00089   return d;
00090 }
00091 
00093 L1GctInternJetData L1GctInternJetData::fromJetClusterMinimal(L1CaloRegionDetId rgn,
00094                                                              uint16_t capBlock,
00095                                                              uint16_t capIndex,
00096                                                              int16_t bx,
00097                                                              uint32_t data) {
00098   L1GctInternJetData d;
00099 
00100   d.setRegionId(rgn);
00101   d.setCapBlock(capBlock);
00102   d.setCapIndex(capIndex);
00103   d.setBx(bx);
00104   d.setType(jet_cluster_minimal);
00105   d.setData( 0, (data>>10)&0x1, 0, (data>>6)&0xf, (data>>12)&0x1, (data>>11)&0x1, data&0x3f );
00106 
00107   return d;
00108 }
00109 
00111 L1GctInternJetData L1GctInternJetData::fromGctTrigObject(L1CaloRegionDetId rgn,
00112                                                          uint16_t capBlock,
00113                                                          uint16_t capIndex,
00114                                                          int16_t bx,
00115                                                          uint32_t data) {
00116   L1GctInternJetData d;
00117 
00118   d.setRegionId(rgn);
00119   d.setCapBlock(capBlock);
00120   d.setCapIndex(capIndex);
00121   d.setBx(bx);
00122   d.setType(gct_trig_object);
00123   d.setData( (data>>10)&0x1, 0, 0, (data>>6)&0xf, (data>>11)&0x1f, 0, data&0x3f );
00124 
00125   return d;
00126 }
00127 
00129 L1GctInternJetData::~L1GctInternJetData() {
00130 
00131 }
00132 
00133 
00135 void L1GctInternJetData::setData(uint8_t sgnEta,
00136                                  uint8_t oflow,
00137                                  uint16_t et,
00138                                  uint8_t eta,
00139                                  uint8_t phi,
00140                                  uint8_t tauVeto,
00141                                  uint8_t rank) {
00142   data_ = 0;
00143   data_ = rank & 0x3f;
00144   data_ |= (tauVeto & 0x1) << 6;
00145   data_ |= (phi & 0x1f) << 7;
00146   data_ |= (eta & 0xf) << 12;
00147   data_ |= (et & 0xfff) << 16;
00148   data_ |= (oflow & 0x1) << 28;
00149   data_ |= (sgnEta & 0x1) << 29;
00150 }
00151  
00152 
00154 
00156 bool L1GctInternJetData::operator==(const L1GctInternJetData& c) const {
00157   return (type_ == c.type() && data_ == c.raw() && regionId_ == c.regionId() && bx_ == c.bx());
00158 }
00159 
00161 std::ostream& operator<<(std::ostream& s, const L1GctInternJetData& c) {
00162   s << "L1GctInternJetData :";
00163   if (c.empty()) { 
00164     s << " empty!"; 
00165   }
00166   if (c.type()==L1GctInternJetData::jet_cluster){
00167     s << " type=jet_cluster";
00168     s << " oflow=" << c.oflow();
00169     s << " et=" << c.et();
00170     s << " eta=" << c.eta();
00171     s << " phi=" << c.phi();
00172     s << " tauVeto=" << c.tauVeto();
00173     s << " rank=" << c.rank();
00174   } else if (c.type()==L1GctInternJetData::jet_precluster){
00175     s << " type=jet_precluster";
00176     s << " oflow=" << c.oflow();
00177     s << " et=" << c.et();
00178     s << " eta=" << c.eta();
00179     s << " tauVeto=" << c.tauVeto();
00180   } else if (c.type()==L1GctInternJetData::jet_cluster_minimal){
00181     s << " type=jet_cluster_minimal";
00182     s << " oflow=" << c.oflow();
00183     s << " eta=" << c.eta();
00184     s << " phi=" << c.phi();
00185     s << " tauVeto=" << c.tauVeto();
00186     s << " rank=" << c.rank();
00187   } else if (c.type()==L1GctInternJetData::gct_trig_object){
00188     s << " type=gct_trig_object";
00189     s << " eta=" << c.eta();
00190     s << " phi=" << c.phi();
00191     s << " rank=" << c.rank();
00192   }
00193   s << " cap block=" << std::hex << c.capBlock();
00194   s << " index=" << std::dec << c.capIndex();
00195   s << " BX=" << c.bx();
00196 
00197   return s; 
00198 }