Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "DataFormats/HcalDigi/interface/CastorTriggerPrimitiveDigi.h"
0002 
0003 CastorTriggerPrimitiveDigi::CastorTriggerPrimitiveDigi() : size_(0), hcalPresamples_(0) {}
0004 CastorTriggerPrimitiveDigi::CastorTriggerPrimitiveDigi(const HcalCastorDetId& id)
0005     : id_(id), size_(0), hcalPresamples_(0) {}
0006 
0007 void CastorTriggerPrimitiveDigi::setSize(int size) {
0008   if (size < 0)
0009     size_ = 0;
0010   else if (size > MAXSAMPLES)
0011     size_ = MAXSAMPLES;
0012   else
0013     size_ = size;
0014 }
0015 void CastorTriggerPrimitiveDigi::setPresamples(int ps) {
0016   if (ps < 0)
0017     hcalPresamples_ &= 0xFFFFFF0;
0018   //  else if (ps>=size_) hcalPresamples_=size_-1;
0019   else
0020     hcalPresamples_ |= ps & 0xF;
0021 }
0022 
0023 void CastorTriggerPrimitiveDigi::setZSInfo(bool unsuppressed, bool markAndPass) {
0024   if (markAndPass)
0025     hcalPresamples_ |= 0x10;
0026   if (unsuppressed)
0027     hcalPresamples_ |= 0x20;
0028 }
0029 
0030 std::ostream& operator<<(std::ostream& s, const CastorTriggerPrimitiveDigi& digi) {
0031   s << digi.id() << " " << digi.size() << " samples " << digi.presamples() << " presamples";
0032   if (digi.zsUnsuppressed())
0033     s << " zsUS";
0034   if (digi.zsMarkAndPass())
0035     s << " zsM&P";
0036   s << std::endl;
0037   s << " SOI  tpchannel=" << digi.SOI_tpchannel() << " tpdata 0x" << std::hex << digi.SOI_tpdata() << std::dec
0038     << std::endl;
0039   for (int i = 0; i < digi.size(); i++) {
0040     s << "  0x" << std::hex << digi.sample(i).raw() << " tpdata 0x" << digi.tpdata(i) << std::dec
0041       << " channel=" << digi.tpchannel(i);
0042     if (digi.isSOI(i))
0043       s << " SOI";
0044     s << std::endl;
0045   }
0046   return s;
0047 }