CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/DataFormats/HcalDigi/src/CastorTriggerPrimitiveDigi.cc

Go to the documentation of this file.
00001 #include "DataFormats/HcalDigi/interface/CastorTriggerPrimitiveDigi.h"
00002 
00003 
00004 CastorTriggerPrimitiveDigi::CastorTriggerPrimitiveDigi() : size_(0), hcalPresamples_(0) {
00005 }
00006 CastorTriggerPrimitiveDigi::CastorTriggerPrimitiveDigi(const HcalCastorDetId& id) : id_(id),
00007                                                                                    size_(0), hcalPresamples_(0) {
00008 }
00009   
00010 void CastorTriggerPrimitiveDigi::setSize(int size) {
00011   if (size<0) size_=0;
00012   else if (size>MAXSAMPLES) size_=MAXSAMPLES;
00013   else size_=size;
00014 }
00015 void CastorTriggerPrimitiveDigi::setPresamples(int ps) {
00016   if (ps<0) hcalPresamples_&=0xFFFFFF0;
00017   //  else if (ps>=size_) hcalPresamples_=size_-1;
00018   else hcalPresamples_|=ps&0xF;
00019 }
00020 
00021 void CastorTriggerPrimitiveDigi::setZSInfo(bool unsuppressed, bool markAndPass) {
00022   if (markAndPass) hcalPresamples_|=0x10;
00023   if (unsuppressed) hcalPresamples_|=0x20;
00024 }
00025 
00026 std::ostream& operator<<(std::ostream& s, const CastorTriggerPrimitiveDigi& digi) {
00027   s << digi.id() << " " << digi.size() << " samples "<< digi.presamples() << " presamples";
00028   if (digi.zsUnsuppressed()) s << " zsUS";
00029   if (digi.zsMarkAndPass()) s << " zsM&P";
00030   s << std::endl;
00031   s << " SOI  tpchannel="<< digi.SOI_tpchannel() <<" tpdata 0x" << std::hex << digi.SOI_tpdata() << std::dec << std::endl;
00032   for (int i=0; i<digi.size(); i++) {
00033     s << "  0x" << std::hex << digi.sample(i).raw() <<  " tpdata 0x" << digi.tpdata(i) << std::dec << " channel=" << digi.tpchannel(i) ;
00034         if (  digi.isSOI(i) ) s << " SOI" ; 
00035         s << std::endl;
00036   }
00037   return s;
00038 }