CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/DataFormats/EcalDigi/src/EcalTriggerPrimitiveDigi.cc

Go to the documentation of this file.
00001 #include "DataFormats/EcalDigi/interface/EcalTriggerPrimitiveDigi.h"
00002 
00003 
00004 
00005 EcalTriggerPrimitiveDigi::EcalTriggerPrimitiveDigi() : size_(0), data_(MAXSAMPLES) {
00006 }
00007 EcalTriggerPrimitiveDigi::EcalTriggerPrimitiveDigi(const EcalTrigTowerDetId& id) : id_(id),
00008                                                                                    size_(0), data_(MAXSAMPLES) {
00009 }
00010 
00011 int EcalTriggerPrimitiveDigi::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 EcalTriggerPrimitiveDigi::compressedEt() const 
00023 {
00024   int sample = sampleOfInterest();
00025   if (sample != -1)
00026     return data_[sample].compressedEt();
00027   else
00028     return -1;
00029 }
00030   
00032 bool EcalTriggerPrimitiveDigi::fineGrain() const 
00033 { 
00034   int sample = sampleOfInterest();
00035   if (sample != -1)
00036     return data_[sample].fineGrain();
00037   else
00038     return false;
00039 }
00041 int EcalTriggerPrimitiveDigi::ttFlag() const 
00042 { 
00043   int sample = sampleOfInterest();
00044   if (sample != -1)
00045     return data_[sample].ttFlag();
00046   else
00047     return -1;
00048 } 
00049 
00050 int EcalTriggerPrimitiveDigi::sFGVB() const
00051 {
00052   int sample = sampleOfInterest();
00053   if (sample != -1)
00054     return data_[sample].l1aSpike();
00055   else
00056     return -1;
00057 }
00058 
00059 bool EcalTriggerPrimitiveDigi::isDebug() const
00060 {
00061   if (size_ == 1)
00062     return false;
00063   else if (size_ > 1)
00064     return true;
00065   return false;
00066 }
00067 
00068 void EcalTriggerPrimitiveDigi::setSize(int size) {
00069   if (size<0) size_=0;
00070   else if (size>MAXSAMPLES) size_=MAXSAMPLES;
00071   else size_=size;
00072 }
00073 
00074   
00075 std::ostream& operator<<(std::ostream& s, const EcalTriggerPrimitiveDigi& digi) {
00076   s << digi.id() << " " << digi.size() << " samples " << std::endl;
00077   for (int i=0; i<digi.size(); i++) 
00078     s << "  " << digi.sample(i) << std::endl;
00079   return s;
00080 }
00081