39 #include "CLHEP/Units/GlobalPhysicalConstants.h"
40 #include "CLHEP/Units/GlobalSystemOfUnits.h"
49 caloGeometry_ = esConsumes<CaloGeometry, CaloGeometryRecord>();
56 if (correctForVertexZPosition_) {
57 if (not useMCTruthVertex_) {
88 if (pEBRecHits.isValid()) {
91 LogDebug(
"EcalRecHitDebug") <<
"total # EB rechits to be re-calibrated: " <<
EBRecHits->size();
96 if (pEERecHits.isValid()) {
99 LogDebug(
"EcalRecHitDebug") <<
"total # EE uncalibrated rechits to be re-calibrated: " <<
EERecHits->size();
111 if (pEBTimeDigis.isValid()) {
112 ebTimeDigis = pEBTimeDigis.product();
113 edm::LogInfo(
"EcalDetailedTimeRecHitInfo") <<
"total # ebTimeDigis: " << ebTimeDigis->size();
118 if (pEETimeDigis.isValid()) {
119 eeTimeDigis = pEETimeDigis.product();
120 edm::LogInfo(
"EcalDetailedTimeRecHitInfo") <<
"total # eeTimeDigis: " << eeTimeDigis->size();
126 std::unique_ptr<GlobalPoint> vertex;
137 if (!(*VertexHandle).empty())
140 vertex = std::make_unique<GlobalPoint>(myVertex->
x(), myVertex->
y(), myVertex->
z());
149 if (!(*VertexHandle).empty())
151 assert((*VertexHandle)[0].vertexId() == 0);
152 const SimVertex* myVertex = &(*VertexHandle)[0];
153 vertex = std::make_unique<GlobalPoint>(
165 if (timeDigi != ebTimeDigis->end()) {
166 if (timeDigi->sampleOfInterest() >= 0) {
167 float myTime = (*timeDigi)[timeDigi->sampleOfInterest()];
177 EBDetailedTimeRecHits->push_back(aHit);
186 if (timeDigi != eeTimeDigis->end()) {
187 if (timeDigi->sampleOfInterest() >= 0) {
188 float myTime = (*timeDigi)[timeDigi->sampleOfInterest()];
197 EEDetailedTimeRecHits->push_back(aHit);
201 LogInfo(
"EcalDetailedTimeRecHitInfo") <<
"total # EB rechits: " << EBDetailedTimeRecHits->size();
202 LogInfo(
"EcalDetailedTimeRecHitInfo") <<
"total # EE rechits: " << EEDetailedTimeRecHits->size();
210 assert(
nullptr != cellGeometry);
212 cellGeometry->getPosition(
double(layer) + 0.5);
214 return (layerPos.
mag() * cm - tofVector.
mag() * cm) / (
float)c_light;
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
double y() const
y coordinate
edm::EDGetTokenT< EcalTimeDigiCollection > eeTimeDigiCollection_
std::vector< EcalRecHit >::const_iterator const_iterator
edm::EDGetTokenT< EcalTimeDigiCollection > ebTimeDigiCollection_
constexpr std::array< uint8_t, layerIndexSize > layer
edm::EDGetTokenT< reco::VertexCollection > recoVertex_
double z() const
z coordinate
const math::XYZTLorentzVectorD & position() const
~EcalDetailedTimeRecHitProducer() override
Log< level::Info, false > LogInfo
EcalDetailedTimeRecHitProducer(const edm::ParameterSet &ps)
double x() const
x coordinate
bool correctForVertexZPosition_
T getParameter(std::string const &) const
std::string EEDetailedTimeRecHitCollection_
edm::EDGetTokenT< EBRecHitCollection > EBRecHitCollection_
double deltaTimeOfFlight(GlobalPoint &vertex, const DetId &detId, int layer) const
const CaloGeometry * m_geometry
std::string EBDetailedTimeRecHitCollection_
edm::EDGetTokenT< edm::SimVertexContainer > simVertex_
std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id.
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
edm::EDGetTokenT< EERecHitCollection > EERecHitCollection_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometry_
void produce(edm::Event &evt, const edm::EventSetup &es) override