00001 #include "CalibFormats/CaloObjects/interface/CaloSamples.h" 00002 00003 CaloSamples::CaloSamples() : id_(), size_(0), presamples_(0) { 00004 for (int i=0; i<MAXSAMPLES; i++) data_[i]=0; 00005 } 00006 00007 CaloSamples::CaloSamples(const DetId& id, int size) : id_(id), size_(size), presamples_(0) { 00008 for (int i=0; i<MAXSAMPLES; i++) data_[i]=0; 00009 } 00010 00011 void CaloSamples::setPresamples(int pre) { 00012 presamples_=pre; 00013 } 00014 00015 CaloSamples& CaloSamples::scale(double value) { 00016 for (int i=0; i<MAXSAMPLES; i++) data_[i]*=value; 00017 return (*this); 00018 } 00019 00020 CaloSamples& CaloSamples::operator+=(double value) { 00021 for (int i=0; i<MAXSAMPLES; i++) data_[i]+=value; 00022 return (*this); 00023 } 00024 00025 std::ostream& operator<<(std::ostream& s, const CaloSamples& samples) { 00026 s << "DetId=" << samples.id().rawId(); 00027 s << ", "<< samples.size() << "samples" << std::endl; 00028 for (int i=0; i<samples.size(); i++) 00029 s << i << ":" << samples[i] << std::endl; 00030 return s; 00031 }