Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "DataFormats/HcalDigi/interface/HcalTriggerPrimitiveDigi.h"
0002 
0003 HcalTriggerPrimitiveDigi::HcalTriggerPrimitiveDigi() : size_(0), hcalPresamples_(0) {}
0004 HcalTriggerPrimitiveDigi::HcalTriggerPrimitiveDigi(const HcalTrigTowerDetId& id)
0005     : id_(id), size_(0), hcalPresamples_(0) {}
0006 
0007 void HcalTriggerPrimitiveDigi::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 HcalTriggerPrimitiveDigi::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 HcalTriggerPrimitiveDigi::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 HcalTriggerPrimitiveDigi& 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   for (int i = 0; i < digi.size(); i++)
0038     s << "  " << digi.sample(i) << std::endl;
0039   return s;
0040 }