Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:26:02

0001 #ifndef CaloLayer1Collections_h
0002 #define CaloLayer1Collections_h
0003 
0004 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
0005 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
0006 #include "DataFormats/L1CaloTrigger/interface/L1CaloCollections.h"
0007 #include "EventFilter/L1TRawToDigi/interface/UnpackerCollections.h"
0008 #include "L1TObjectCollections.h"
0009 
0010 namespace l1t {
0011   namespace stage2 {
0012     class CaloLayer1Collections : public L1TObjectCollections {
0013     public:
0014       CaloLayer1Collections(edm::Event& e)
0015           : L1TObjectCollections(e),
0016             ecalDigis_(new EcalTrigPrimDigiCollection()),
0017             hcalDigis_(new HcalTrigPrimDigiCollection()),
0018             caloRegions_(new L1CaloRegionCollection()) {
0019         // Pre-allocate:
0020         //  72 iPhi values
0021         //  28 iEta values in Ecal, 28 + 12 iEta values in Hcal + HF
0022         //  2 hemispheres
0023         ecalDigis_->reserve(72 * 28 * 2);
0024         hcalDigis_->reserve(72 * 40 * 2);
0025         // 7 regions * 18 cards * 2 hemispheres
0026         caloRegions_->reserve(7 * 18 * 2);
0027         std::generate(
0028             ecalDigisBx_.begin(), ecalDigisBx_.end(), [] { return std::make_unique<EcalTrigPrimDigiCollection>(); });
0029       };
0030 
0031       ~CaloLayer1Collections() override;
0032 
0033       inline EcalTrigPrimDigiCollection* getEcalDigis() { return ecalDigis_.get(); };
0034       inline HcalTrigPrimDigiCollection* getHcalDigis() { return hcalDigis_.get(); };
0035       inline L1CaloRegionCollection* getRegions() { return caloRegions_.get(); };
0036 
0037       inline EcalTrigPrimDigiCollection* getEcalDigisBx(const unsigned int copy) override {
0038         return ecalDigisBx_[copy].get();
0039       };
0040 
0041     private:
0042       std::unique_ptr<EcalTrigPrimDigiCollection> ecalDigis_;
0043       std::unique_ptr<HcalTrigPrimDigiCollection> hcalDigis_;
0044       std::unique_ptr<L1CaloRegionCollection> caloRegions_;
0045 
0046       std::array<std::unique_ptr<EcalTrigPrimDigiCollection>, 5> ecalDigisBx_;
0047     };
0048   }  // namespace stage2
0049 }  // namespace l1t
0050 
0051 #endif