Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MTD geometry and reconstruction: update locaPosition in RectangularMTDTopology and adapt cluster accordingly #40049

Merged
merged 2 commits into from Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions DataFormats/FTLRecHit/interface/FTLCluster.h
Expand Up @@ -118,12 +118,12 @@ class FTLCluster {

// linear average position (barycenter)
inline float x() const {
auto x_pos = [this](unsigned int i) { return this->theHitOffset[i * 2] + minHitRow() + 0.5f; };
auto x_pos = [this](unsigned int i) { return this->theHitOffset[i * 2] + minHitRow(); };
return weighted_mean(this->theHitENERGY, x_pos);
}

inline float y() const {
auto y_pos = [this](unsigned int i) { return this->theHitOffset[i * 2 + 1] + minHitCol() + 0.5f; };
auto y_pos = [this](unsigned int i) { return this->theHitOffset[i * 2 + 1] + minHitCol(); };
return weighted_mean(this->theHitENERGY, y_pos);
}

Expand Down
4 changes: 2 additions & 2 deletions Geometry/MTDGeometryBuilder/src/RectangularMTDTopology.cc
Expand Up @@ -54,14 +54,14 @@ LocalPoint RectangularMTDTopology::localPosition(const MeasurementPoint& mp) con
// measuremet to local transformation for X coordinate
float RectangularMTDTopology::localX(const float mpx) const {
// The final position in local coordinates
float lpX = mpx * m_pitchx + m_xoffset;
float lpX = (mpx + 0.5f) * m_pitchx + m_xoffset;

return lpX;
}

float RectangularMTDTopology::localY(const float mpy) const {
// The final position in local coordinates
float lpY = mpy * m_pitchy + m_yoffset;
float lpY = (mpy + 0.5f) * m_pitchy + m_yoffset;

return lpY;
}
Expand Down
22 changes: 15 additions & 7 deletions Validation/MtdValidation/plugins/BtlLocalRecoValidation.cc
Expand Up @@ -42,6 +42,9 @@

#include "Geometry/MTDCommonData/interface/MTDTopologyMode.h"

#include "RecoLocalFastTime/Records/interface/MTDCPERecord.h"
#include "RecoLocalFastTime/FTLClusterizer/interface/MTDClusterParameterEstimator.h"

#include "MTDHit.h"

class BtlLocalRecoValidation : public DQMEDAnalyzer {
Expand Down Expand Up @@ -72,8 +75,9 @@ class BtlLocalRecoValidation : public DQMEDAnalyzer {
edm::EDGetTokenT<FTLClusterCollection> btlRecCluToken_;
edm::EDGetTokenT<MTDTrackingDetSetVector> mtdTrackingHitToken_;

edm::ESGetToken<MTDGeometry, MTDDigiGeometryRecord> mtdgeoToken_;
edm::ESGetToken<MTDTopology, MTDTopologyRcd> mtdtopoToken_;
const edm::ESGetToken<MTDGeometry, MTDDigiGeometryRecord> mtdgeoToken_;
const edm::ESGetToken<MTDTopology, MTDTopologyRcd> mtdtopoToken_;
const edm::ESGetToken<MTDClusterParameterEstimator, MTDCPERecord> cpeToken_;

// --- histograms declaration

Expand Down Expand Up @@ -183,17 +187,17 @@ BtlLocalRecoValidation::BtlLocalRecoValidation(const edm::ParameterSet& iConfig)
hitMinEnergy_(iConfig.getParameter<double>("HitMinimumEnergy")),
optionalPlots_(iConfig.getParameter<bool>("optionalPlots")),
uncalibRecHitsPlots_(iConfig.getParameter<bool>("UncalibRecHitsPlots")),
hitMinAmplitude_(iConfig.getParameter<double>("HitMinimumAmplitude")) {
hitMinAmplitude_(iConfig.getParameter<double>("HitMinimumAmplitude")),
mtdgeoToken_(esConsumes<MTDGeometry, MTDDigiGeometryRecord>()),
mtdtopoToken_(esConsumes<MTDTopology, MTDTopologyRcd>()),
cpeToken_(esConsumes<MTDClusterParameterEstimator, MTDCPERecord>(edm::ESInputTag("", "MTDCPEBase"))) {
btlRecHitsToken_ = consumes<FTLRecHitCollection>(iConfig.getParameter<edm::InputTag>("recHitsTag"));
if (uncalibRecHitsPlots_)
btlUncalibRecHitsToken_ =
consumes<FTLUncalibratedRecHitCollection>(iConfig.getParameter<edm::InputTag>("uncalibRecHitsTag"));
btlSimHitsToken_ = consumes<CrossingFrame<PSimHit> >(iConfig.getParameter<edm::InputTag>("simHitsTag"));
btlRecCluToken_ = consumes<FTLClusterCollection>(iConfig.getParameter<edm::InputTag>("recCluTag"));
mtdTrackingHitToken_ = consumes<MTDTrackingDetSetVector>(iConfig.getParameter<edm::InputTag>("trkHitTag"));

mtdgeoToken_ = esConsumes<MTDGeometry, MTDDigiGeometryRecord>();
mtdtopoToken_ = esConsumes<MTDTopology, MTDTopologyRcd>();
}

BtlLocalRecoValidation::~BtlLocalRecoValidation() {}
Expand All @@ -210,6 +214,8 @@ void BtlLocalRecoValidation::analyze(const edm::Event& iEvent, const edm::EventS
auto topologyHandle = iSetup.getTransientHandle(mtdtopoToken_);
const MTDTopology* topology = topologyHandle.product();

auto const& cpe = iSetup.getData(cpeToken_);

auto btlRecHitsHandle = makeValid(iEvent.getHandle(btlRecHitsToken_));
auto btlSimHitsHandle = makeValid(iEvent.getHandle(btlSimHitsToken_));
auto btlRecCluHandle = makeValid(iEvent.getHandle(btlRecCluToken_));
Expand Down Expand Up @@ -350,8 +356,10 @@ void BtlLocalRecoValidation::analyze(const edm::Event& iEvent, const edm::EventS
const ProxyMTDTopology& topoproxy = static_cast<const ProxyMTDTopology&>(genericDet->topology());
const RectangularMTDTopology& topo = static_cast<const RectangularMTDTopology&>(topoproxy.specificTopology());

MTDClusterParameterEstimator::ReturnType tuple = cpe.getParameters(cluster, *genericDet);

// --- Cluster position in the module reference frame
Local3DPoint local_point(topo.localX(cluster.x()), topo.localY(cluster.y()), 0.);
LocalPoint local_point(std::get<0>(tuple));
const auto& global_point = genericDet->toGlobal(local_point);

meCluEnergy_->Fill(cluster.energy());
Expand Down
2 changes: 2 additions & 0 deletions Validation/MtdValidation/plugins/BuildFile.xml
@@ -1,6 +1,8 @@
<use name="FWCore/Framework"/>
<use name="FWCore/ParameterSet"/>
<use name="Geometry/MTDGeometryBuilder"/>
<use name="RecoLocalFastTime/Records"/>
<use name="RecoLocalFastTime/FTLClusterizer"/>
<use name="FWCore/MessageLogger"/>
<use name="FWCore/ServiceRegistry"/>
<use name="DataFormats/TrackReco"/>
Expand Down
25 changes: 16 additions & 9 deletions Validation/MtdValidation/plugins/EtlLocalRecoValidation.cc
Expand Up @@ -39,6 +39,9 @@
#include "Geometry/MTDNumberingBuilder/interface/MTDTopology.h"
#include "Geometry/MTDCommonData/interface/MTDTopologyMode.h"

#include "RecoLocalFastTime/Records/interface/MTDCPERecord.h"
#include "RecoLocalFastTime/FTLClusterizer/interface/MTDClusterParameterEstimator.h"

#include "MTDHit.h"

class EtlLocalRecoValidation : public DQMEDAnalyzer {
Expand Down Expand Up @@ -70,8 +73,9 @@ class EtlLocalRecoValidation : public DQMEDAnalyzer {
edm::EDGetTokenT<FTLClusterCollection> etlRecCluToken_;
edm::EDGetTokenT<MTDTrackingDetSetVector> mtdTrackingHitToken_;

edm::ESGetToken<MTDGeometry, MTDDigiGeometryRecord> mtdgeoToken_;
edm::ESGetToken<MTDTopology, MTDTopologyRcd> mtdtopoToken_;
const edm::ESGetToken<MTDGeometry, MTDDigiGeometryRecord> mtdgeoToken_;
const edm::ESGetToken<MTDTopology, MTDTopologyRcd> mtdtopoToken_;
const edm::ESGetToken<MTDClusterParameterEstimator, MTDCPERecord> cpeToken_;

// --- histograms declaration

Expand Down Expand Up @@ -153,17 +157,17 @@ EtlLocalRecoValidation::EtlLocalRecoValidation(const edm::ParameterSet& iConfig)
hitMinEnergy2Dis_(iConfig.getParameter<double>("hitMinimumEnergy2Dis")),
optionalPlots_(iConfig.getParameter<bool>("optionalPlots")),
uncalibRecHitsPlots_(iConfig.getParameter<bool>("UncalibRecHitsPlots")),
hitMinAmplitude_(iConfig.getParameter<double>("HitMinimumAmplitude")) {
hitMinAmplitude_(iConfig.getParameter<double>("HitMinimumAmplitude")),
mtdgeoToken_(esConsumes<MTDGeometry, MTDDigiGeometryRecord>()),
mtdtopoToken_(esConsumes<MTDTopology, MTDTopologyRcd>()),
cpeToken_(esConsumes<MTDClusterParameterEstimator, MTDCPERecord>(edm::ESInputTag("", "MTDCPEBase"))) {
etlRecHitsToken_ = consumes<FTLRecHitCollection>(iConfig.getParameter<edm::InputTag>("recHitsTag"));
if (uncalibRecHitsPlots_)
etlUncalibRecHitsToken_ =
consumes<FTLUncalibratedRecHitCollection>(iConfig.getParameter<edm::InputTag>("uncalibRecHitsTag"));
etlSimHitsToken_ = consumes<CrossingFrame<PSimHit> >(iConfig.getParameter<edm::InputTag>("simHitsTag"));
etlRecCluToken_ = consumes<FTLClusterCollection>(iConfig.getParameter<edm::InputTag>("recCluTag"));
mtdTrackingHitToken_ = consumes<MTDTrackingDetSetVector>(iConfig.getParameter<edm::InputTag>("trkHitTag"));

mtdgeoToken_ = esConsumes<MTDGeometry, MTDDigiGeometryRecord>();
mtdtopoToken_ = esConsumes<MTDTopology, MTDTopologyRcd>();
}

EtlLocalRecoValidation::~EtlLocalRecoValidation() {}
Expand All @@ -180,6 +184,8 @@ void EtlLocalRecoValidation::analyze(const edm::Event& iEvent, const edm::EventS
auto topologyHandle = iSetup.getTransientHandle(mtdtopoToken_);
const MTDTopology* topology = topologyHandle.product();

auto const& cpe = iSetup.getData(cpeToken_);

bool topo1Dis = false;
bool topo2Dis = false;
if (MTDTopologyMode::etlLayoutFromTopoMode(topology->getMTDTopologyMode()) == ETLDetId::EtlLayout::tp) {
Expand Down Expand Up @@ -371,10 +377,11 @@ void EtlLocalRecoValidation::analyze(const edm::Event& iEvent, const edm::EventS
throw cms::Exception("EtlLocalRecoValidation")
<< "GeographicalID: " << std::hex << cluId << " is invalid!" << std::dec << std::endl;
}
const ProxyMTDTopology& topoproxy = static_cast<const ProxyMTDTopology&>(genericDet->topology());
const RectangularMTDTopology& topo = static_cast<const RectangularMTDTopology&>(topoproxy.specificTopology());

Local3DPoint local_point(topo.localX(cluster.x()), topo.localY(cluster.y()), 0.);
MTDClusterParameterEstimator::ReturnType tuple = cpe.getParameters(cluster, *genericDet);

// --- Cluster position in the module reference frame
LocalPoint local_point(std::get<0>(tuple));
const auto& global_point = genericDet->toGlobal(local_point);

int idet = 999;
Expand Down