CMS 3D CMS Logo

EcalTimeDigiProducer.cc
Go to the documentation of this file.
13 
14 //#define EDM_ML_DEBUG
15 
17  edm::ProducesCollector producesCollector,
20  m_EBdigiCollection(params.getParameter<std::string>("EBtimeDigiCollection")),
21  m_hitsProducerTagEB(params.getParameter<edm::InputTag>("hitsProducerEB")),
22  m_hitsProducerTokenEB(sumes.consumes<std::vector<PCaloHit>>(m_hitsProducerTagEB)),
23  m_geometryToken(sumes.esConsumes()),
24  m_timeLayerEB(params.getParameter<int>("timeLayerBarrel")),
25  m_Geometry(nullptr) {
27 
29 
30 #ifdef EDM_ML_DEBUG
31  edm::LogVerbatim("TimeDigiInfo") << "[EcalTimeDigiProducer]::Create EB " << m_EBdigiCollection
32  << " collection and digitizer";
33 #endif
34 
36 }
37 
39 
42  // checkCalibrations( event, eventSetup );
43  // here the methods to clean the maps
45 }
46 
47 void EcalTimeDigiProducer::accumulateCaloHits(HitsHandle const &ebHandle, int bunchCrossing) {
48  // accumulate the simHits and do the averages in a given layer per bunch
49  // crossing
50  if (ebHandle.isValid()) {
51  m_BarrelDigitizer->add(*ebHandle.product(), bunchCrossing);
52  }
53 }
54 
56  // Step A: Get Inputs
57  const edm::Handle<std::vector<PCaloHit>> &ebHandle = e.getHandle(m_hitsProducerTokenEB);
58 
59 #ifdef EDM_ML_DEBUG
60  edm::LogVerbatim("TimeDigiInfo") << "[EcalTimeDigiProducer]::Accumulate Hits HS event";
61 #endif
62 
63  accumulateCaloHits(ebHandle, 0);
64 }
65 
68  edm::StreamID const &) {
70  e.getByLabel(m_hitsProducerTagEB, ebHandle);
71 
72 #ifdef EDM_ML_DEBUG
73  edm::LogVerbatim("TimeDigiInfo") << "[EcalTimeDigiProducer]::Accumulate Hits for BC " << e.bunchCrossing();
74 #endif
75  accumulateCaloHits(ebHandle, e.bunchCrossing());
76 }
77 
79  std::unique_ptr<EcalTimeDigiCollection> barrelResult = std::make_unique<EcalTimeDigiCollection>();
80 
81 #ifdef EDM_ML_DEBUG
82  edm::LogVerbatim("TimeDigiInfo") << "[EcalTimeDigiProducer]::finalizeEvent";
83 #endif
84 
85  // here basically just put everything in the final collections
86  m_BarrelDigitizer->run(*barrelResult);
87 
88 #ifdef EDM_ML_DEBUG
89  edm::LogVerbatim("TimeDigiInfo") << "[EcalTimeDigiProducer]::EB Digi size " << barrelResult->size();
90 #endif
91 
92  edm::LogInfo("TimeDigiInfo") << "EB time Digis: " << barrelResult->size();
93 
94 #ifdef EDM_ML_DEBUG
95  edm::LogVerbatim("TimeDigiInfo") << "[EcalTimeDigiProducer]::putting EcalTimeDigiCollection into the event ";
96 #endif
97 
98  event.put(std::move(barrelResult), m_EBdigiCollection);
99 }
100 
104  updateGeometry();
105  }
106 }
107 
110 }
void initializeEvent(edm::Event const &e, edm::EventSetup const &c) override
Log< level::Info, true > LogVerbatim
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
void finalizeEvent(edm::Event &e, edm::EventSetup const &c) override
void run(EcalTimeDigiCollection &output)
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > m_geometryToken
T const * product() const
Definition: Handle.h:70
EcalTimeDigiProducer(const edm::ParameterSet &params, edm::ProducesCollector, edm::ConsumesCollector &)
void setGeometry(const CaloSubdetectorGeometry *geometry)
edm::ESWatcher< CaloGeometryRecord > m_geometryWatcher
void setTimeLayerId(const int &layerId)
const edm::EDGetTokenT< std::vector< PCaloHit > > m_hitsProducerTokenEB
const edm::InputTag m_hitsProducerTagEB
void accumulate(edm::Event const &e, edm::EventSetup const &c) override
Log< level::Info, false > LogInfo
EcalTimeMapDigitizer * m_BarrelDigitizer
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
bool isValid() const
Definition: HandleBase.h:70
void add(const std::vector< PCaloHit > &hits, int bunchCrossing)
HLT enums.
const CaloGeometry * m_Geometry
void accumulateCaloHits(HitsHandle const &ebHandle, int bunchCrossing)
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
def move(src, dest)
Definition: eostools.py:511
void checkGeometry(const edm::EventSetup &eventSetup)
Definition: event.py:1
const std::string m_EBdigiCollection