Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "DataFormats/EcalDigi/interface/EcalPseudoStripInputDigi.h"
0002 
0003 EcalPseudoStripInputDigi::EcalPseudoStripInputDigi() : size_(0), data_(MAXSAMPLES) {}
0004 
0005 EcalPseudoStripInputDigi::EcalPseudoStripInputDigi(const EcalTriggerElectronicsId& id)
0006     : id_(id), size_(0), data_(MAXSAMPLES) {}
0007 
0008 int EcalPseudoStripInputDigi::sampleOfInterest() const {
0009   if (size_ == 1)
0010     return 0;
0011   else if (size_ == 5)
0012     return 2;
0013   else
0014     return -1;
0015 }
0016 
0017 /// get the pseudoStrip input of interesting sample
0018 int EcalPseudoStripInputDigi::pseudoStripInput() const {
0019   int sample = sampleOfInterest();
0020   if (sample != -1)
0021     return data_[sample].pseudoStripInput();
0022   else
0023     return -1;
0024 }
0025 
0026 /// get the fine-grain bit of interesting sample
0027 bool EcalPseudoStripInputDigi::fineGrain() const {
0028   int sample = sampleOfInterest();
0029   if (sample != -1)
0030     return data_[sample].fineGrain();
0031   else
0032     return false;
0033 }
0034 
0035 bool EcalPseudoStripInputDigi::isDebug() const {
0036   if (size_ == 1)
0037     return false;
0038   else if (size_ > 1)
0039     return true;
0040   return false;
0041 }
0042 
0043 void EcalPseudoStripInputDigi::setSize(int size) {
0044   if (size < 0)
0045     size_ = 0;
0046   else if (size > MAXSAMPLES)
0047     size_ = MAXSAMPLES;
0048   else
0049     size_ = size;
0050 }
0051 
0052 std::ostream& operator<<(std::ostream& s, const EcalPseudoStripInputDigi& digi) {
0053   s << digi.id() << " " << digi.size() << " samples " << std::endl;
0054   for (int i = 0; i < digi.size(); i++)
0055     s << "  " << digi.sample(i) << std::endl;
0056   return s;
0057 }