Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef DIGIHCAL_HCALDIGICOLLECTION_H
0002 #define DIGIHCAL_HCALDIGICOLLECTION_H
0003 
0004 #include "DataFormats/Common/interface/SortedCollection.h"
0005 #include "DataFormats/HcalDigi/interface/HBHEDataFrame.h"
0006 #include "DataFormats/HcalDigi/interface/HODataFrame.h"
0007 #include "DataFormats/HcalDigi/interface/HFDataFrame.h"
0008 #include "DataFormats/HcalDigi/interface/HcalCalibDataFrame.h"
0009 #include "DataFormats/HcalDigi/interface/HcalTriggerPrimitiveDigi.h"
0010 #include "DataFormats/HcalDigi/interface/HcalHistogramDigi.h"
0011 #include "DataFormats/HcalDigi/interface/ZDCDataFrame.h"
0012 #include "DataFormats/HcalDigi/interface/CastorDataFrame.h"
0013 #include "DataFormats/HcalDigi/interface/CastorTriggerPrimitiveDigi.h"
0014 #include "DataFormats/HcalDigi/interface/HOTriggerPrimitiveDigi.h"
0015 #include "DataFormats/HcalDigi/interface/HcalTTPDigi.h"
0016 
0017 #include "DataFormats/HcalDigi/interface/QIE10DataFrame.h"
0018 #include "DataFormats/HcalDigi/interface/QIE11DataFrame.h"
0019 
0020 typedef edm::SortedCollection<HBHEDataFrame> HBHEDigiCollection;
0021 typedef edm::SortedCollection<HODataFrame> HODigiCollection;
0022 typedef edm::SortedCollection<HFDataFrame> HFDigiCollection;
0023 typedef edm::SortedCollection<HcalCalibDataFrame> HcalCalibDigiCollection;
0024 typedef edm::SortedCollection<HcalTriggerPrimitiveDigi> HcalTrigPrimDigiCollection;
0025 typedef edm::SortedCollection<HcalHistogramDigi> HcalHistogramDigiCollection;
0026 typedef edm::SortedCollection<ZDCDataFrame> ZDCDigiCollection;
0027 typedef edm::SortedCollection<CastorDataFrame> CastorDigiCollection;
0028 typedef edm::SortedCollection<CastorTriggerPrimitiveDigi> CastorTrigPrimDigiCollection;
0029 typedef edm::SortedCollection<HOTriggerPrimitiveDigi> HOTrigPrimDigiCollection;
0030 typedef edm::SortedCollection<HcalTTPDigi> HcalTTPDigiCollection;
0031 
0032 #include "DataFormats/Common/interface/DataFrameContainer.h"
0033 
0034 template <class Digi>
0035 class HcalDataFrameContainer : public edm::DataFrameContainer {
0036 public:
0037   typedef edm::DataFrameContainer::size_type size_type;
0038   static const size_type MAXSAMPLES = 10;
0039   HcalDataFrameContainer(int nsamples_per_digi = MAXSAMPLES, int isubdet = 0)
0040       : edm::DataFrameContainer(nsamples_per_digi * Digi::WORDS_PER_SAMPLE + Digi::HEADER_WORDS + Digi::FLAG_WORDS,
0041                                 isubdet) {}
0042   void swap(DataFrameContainer& other) { this->DataFrameContainer::swap(other); }
0043 
0044   //helpful accessors
0045   using edm::DataFrameContainer::push_back;
0046   Digi backDataFrame() { return Digi(this->back()); }
0047   int samples() const { return int((stride() - Digi::HEADER_WORDS - Digi::FLAG_WORDS) / Digi::WORDS_PER_SAMPLE); }
0048   void addDataFrame(DetId detid, const uint16_t* data) { push_back(detid.rawId(), data); }
0049   void push_back(const Digi& digi) { push_back(digi.id(), digi.begin()); }
0050 };
0051 
0052 typedef HcalDataFrameContainer<QIE10DataFrame> QIE10DigiCollection;
0053 typedef HcalDataFrameContainer<QIE11DataFrame> QIE11DigiCollection;
0054 
0055 #endif