CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/DataFormats/EcalDigi/src/EcalPseudoStripInputDigi.cc

Go to the documentation of this file.
00001 #include "DataFormats/EcalDigi/interface/EcalPseudoStripInputDigi.h"
00002 
00003 
00004 EcalPseudoStripInputDigi::EcalPseudoStripInputDigi() : size_(0), data_(MAXSAMPLES) {
00005 }
00006 
00007 EcalPseudoStripInputDigi::EcalPseudoStripInputDigi(const EcalTriggerElectronicsId& id) : id_(id),
00008                                                                                    size_(0), data_(MAXSAMPLES) {
00009 }
00010 
00011 int EcalPseudoStripInputDigi::sampleOfInterest() const
00012 {
00013   if (size_ == 1)
00014     return 0;
00015   else if (size_ == 5)
00016     return 2;
00017   else
00018     return -1;
00019 } 
00020 
00022 int EcalPseudoStripInputDigi::pseudoStripInput() const 
00023 {
00024   int sample = sampleOfInterest();
00025   if (sample != -1)
00026     return data_[sample].pseudoStripInput();
00027   else
00028     return -1;
00029 }
00030   
00032 bool EcalPseudoStripInputDigi::fineGrain() const 
00033 { 
00034   int sample = sampleOfInterest();
00035   if (sample != -1)
00036     return data_[sample].fineGrain();
00037   else
00038     return false;
00039 }
00040 
00041 bool EcalPseudoStripInputDigi::isDebug() const
00042 {
00043   if (size_ == 1)
00044     return false;
00045   else if (size_ > 1)
00046     return true;
00047   return false;
00048 }
00049 
00050 void EcalPseudoStripInputDigi::setSize(int size) {
00051   if (size<0) size_=0;
00052   else if (size>MAXSAMPLES) size_=MAXSAMPLES;
00053   else size_=size;
00054 }
00055 
00056   
00057 std::ostream& operator<<(std::ostream& s, const EcalPseudoStripInputDigi& digi) {
00058   s << digi.id() << " " << digi.size() << " samples " << std::endl;
00059   for (int i=0; i<digi.size(); i++) 
00060     s << "  " << digi.sample(i) << std::endl;
00061   return s;
00062 }
00063