CMS 3D CMS Logo

HFDataFrame.cc

Go to the documentation of this file.
00001 #include "DataFormats/HcalDigi/interface/HFDataFrame.h"
00002 
00003 HFDataFrame::HFDataFrame() : id_(0), 
00004                              size_(0),
00005                              hcalPresamples_(0)
00006 {
00007 }
00008 
00009 HFDataFrame::HFDataFrame(const HcalDetId& id) : 
00010   id_(id), 
00011   size_(0),
00012   hcalPresamples_(0)
00013 {
00014   // TODO : test id for HcalForward
00015 }
00016   
00017 void HFDataFrame::setSize(int size) {
00018   if (size>MAXSAMPLES) size_=MAXSAMPLES;
00019   else if (size<=0) size_=0;
00020   else size_=size;
00021 }
00022 void HFDataFrame::setPresamples(int ps) {
00023   hcalPresamples_|=ps&0xF;
00024 }
00025 void HFDataFrame::setReadoutIds(const HcalElectronicsId& eid) {
00026   electronicsId_=eid;
00027 }
00028 
00029 bool HFDataFrame::validate(int firstSample, int nSamples) const {
00030   int capid=-1;
00031   bool ok=true;
00032   for (int i=0; ok && i<nSamples && i+firstSample<size_; i++) {
00033     if (data_[i+firstSample].er() || !data_[i+firstSample].dv()) ok=false;
00034     if (i==0) capid=data_[i+firstSample].capid();
00035     if (capid!=data_[i+firstSample].capid()) ok=false;
00036     capid=(capid+1)%4;
00037   }
00038   return ok;
00039 }
00040 
00041 void HFDataFrame::setZSInfo(bool unsuppressed, bool markAndPass) {
00042   if (markAndPass) hcalPresamples_|=0x10;
00043   if (unsuppressed) hcalPresamples_|=0x20;
00044 }
00045 
00046 std::ostream& operator<<(std::ostream& s, const HFDataFrame& digi) {
00047   s << digi.id() << " " << digi.size() << " samples  " << digi.presamples() << " presamples ";
00048   if (digi.zsUnsuppressed()) s << " zsUS ";
00049   if (digi.zsMarkAndPass()) s << " zsM&P ";
00050   s << std::endl;
00051   for (int i=0; i<digi.size(); i++) 
00052     s << "  " << digi.sample(i) << std::endl;
00053   return s;
00054 }
00055   
00056 

Generated on Tue Jun 9 17:31:00 2009 for CMSSW by  doxygen 1.5.4