CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/DataFormats/EcalDigi/interface/EcalTriggerPrimitiveDigi.h

Go to the documentation of this file.
00001 #ifndef ECALTRIGGERPRIMITIVEDIGI_H
00002 #define ECALTRIGGERPRIMITIVEDIGI_H 1
00003 
00004 #include <ostream>
00005 #include <vector>
00006 #include "DataFormats/EcalDetId/interface/EcalTrigTowerDetId.h"
00007 #include "DataFormats/EcalDigi/interface/EcalTriggerPrimitiveSample.h"
00008 
00009 
00010 
00018 class EcalTriggerPrimitiveDigi {
00019  public:
00020   typedef EcalTrigTowerDetId key_type; 
00021 
00022   EcalTriggerPrimitiveDigi(); // for persistence
00023   explicit EcalTriggerPrimitiveDigi(const EcalTrigTowerDetId& id);
00024   
00025 
00026   void swap(EcalTriggerPrimitiveDigi& rh) {
00027     std::swap(id_,rh.id_);
00028     std::swap(size_,rh.size_);
00029     std::swap(data_,rh.data_);
00030   }
00031   
00032   const EcalTrigTowerDetId& id() const { return id_; }
00033   int size() const { return size_; }
00034     
00035   const EcalTriggerPrimitiveSample& operator[](int i) const { return data_[i]; }
00036   const EcalTriggerPrimitiveSample& sample(int i) const { return data_[i]; }
00037     
00038   void setSize(int size);
00039   void setSample(int i, const EcalTriggerPrimitiveSample& sam) { data_[i]=sam; }
00040   void setSampleValue(int i, uint16_t value) { data_[i].setValue(value); }
00041     
00042   static const int MAXSAMPLES = 20;
00043 
00045   int compressedEt() const; 
00046   
00047   
00049   bool fineGrain() const; 
00050   
00052   int ttFlag() const; 
00053 
00057   int sFGVB() const;
00058 
00063   int l1aSpike() const { return sFGVB(); }
00064   
00066   bool isDebug() const;
00067 
00069   int sampleOfInterest() const;
00070 
00071 private:
00072   
00073   EcalTrigTowerDetId id_;
00074   int size_;
00075   std::vector<EcalTriggerPrimitiveSample> data_;
00076 };
00077 
00078 
00079 inline void swap(EcalTriggerPrimitiveDigi& lh, EcalTriggerPrimitiveDigi& rh) {
00080   lh.swap(rh);
00081 }
00082 
00083 std::ostream& operator<<(std::ostream& s, const EcalTriggerPrimitiveDigi& digi);
00084 
00085 
00086 
00087 #endif