Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "DataFormats/EcalDigi/interface/EcalTriggerPrimitiveDigi.h"
0002 #include <iostream>
0003 
0004 EcalTriggerPrimitiveDigi::EcalTriggerPrimitiveDigi() : size_(0), data_(MAXSAMPLES) {}
0005 
0006 EcalTriggerPrimitiveDigi::EcalTriggerPrimitiveDigi(const EcalTrigTowerDetId& id)
0007     : id_(id), size_(0), data_(MAXSAMPLES) {}
0008 
0009 int EcalTriggerPrimitiveDigi::sampleOfInterest() const {
0010   if (size_ == 1)
0011     return 0;
0012   else if (size_ == 5)
0013     return 2;
0014   else
0015     return -1;
0016 }
0017 
0018 /// get the encoded/compressed Et of interesting sample
0019 int EcalTriggerPrimitiveDigi::compressedEt() const {
0020   int sample = sampleOfInterest();
0021   if (sample != -1)
0022     return data_[sample].compressedEt();
0023   else
0024     return -1;
0025 }
0026 
0027 /// get the fine-grain bit of interesting sample
0028 bool EcalTriggerPrimitiveDigi::fineGrain() const {
0029   int sample = sampleOfInterest();
0030   if (sample != -1)
0031     return data_[sample].fineGrain();
0032   else
0033     return false;
0034 }
0035 /// get the Trigger tower Flag of interesting sample
0036 int EcalTriggerPrimitiveDigi::ttFlag() const {
0037   int sample = sampleOfInterest();
0038   if (sample != -1)
0039     return data_[sample].ttFlag();
0040   else
0041     return -1;
0042 }
0043 
0044 int EcalTriggerPrimitiveDigi::sFGVB() const {
0045   int sample = sampleOfInterest();
0046   if (sample != -1)
0047     return data_[sample].l1aSpike();
0048   else
0049     return -1;
0050 }
0051 
0052 bool EcalTriggerPrimitiveDigi::isDebug() const {
0053   if (size_ == 1)
0054     return false;
0055   else if (size_ > 1)
0056     return true;
0057   return false;
0058 }
0059 
0060 void EcalTriggerPrimitiveDigi::setSize(int size) {
0061   if (size < 0)
0062     size_ = 0;
0063   else if (size > MAXSAMPLES)
0064     size_ = MAXSAMPLES;
0065   else
0066     size_ = size;
0067 }
0068 
0069 std::ostream& operator<<(std::ostream& s, const EcalTriggerPrimitiveDigi& digi) {
0070   s << digi.id() << " " << digi.size() << " samples " << std::endl;
0071   for (int i = 0; i < digi.size(); i++)
0072     s << "  " << digi.sample(i) << std::endl;
0073   return s;
0074 }