Skip to content

Commit 43ddc5f

Browse files
committed
Etapartition finding on DQMside with flat edge cut
1 parent da44e44 commit 43ddc5f

File tree

1 file changed

+31
-33
lines changed

1 file changed

+31
-33
lines changed

DQMOffline/MuonDPG/plugins/GEMTnPEfficiencyTask.cc

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,18 @@
1818
#include "DataFormats/GEMDigi/interface/GEMOHStatusCollection.h"
1919
#include "DataFormats/GEMDigi/interface/GEMAMCStatusCollection.h"
2020
#include "Geometry/GEMGeometry/interface/GEMGeometry.h"
21-
21+
#include "DataFormats/GeometrySurface/interface/TrapezoidalPlaneBounds.h"
2222
#include "FWCore/Framework/interface/ConsumesCollector.h"
2323
#include "RecoMuon/TrackingTools/interface/MuonServiceProxy.h"
2424

25-
#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
26-
#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
27-
#include "DataFormats/GeometryCommonDetAlgo/interface/ErrorFrameTransformer.h"
28-
2925
class GEMTnPEfficiencyTask : public BaseTnPEfficiencyTask {
3026
public:
3127
/// Constructor
3228
GEMTnPEfficiencyTask(const edm::ParameterSet& config);
3329
uint16_t maskChamberWithError(const GEMDetId& chamber_id,
3430
const GEMOHStatusCollection*,
3531
const GEMVFATStatusCollection*);
36-
bool checkBounds(const Plane& plane,
37-
const GlobalPoint& global_point,
38-
const LocalError& local_error,
39-
const float scale);
32+
bool checkBounds(const GeomDet* geomDet, const GlobalPoint& global_position, const float bordercut);
4033
/// Destructor
4134
~GEMTnPEfficiencyTask() override;
4235

@@ -65,7 +58,8 @@ GEMTnPEfficiencyTask::GEMTnPEfficiencyTask(const edm::ParameterSet& config)
6558
m_GEMAMCStatusCollectionToken_(
6659
consumes<GEMAMCStatusCollection>(config.getUntrackedParameter<edm::InputTag>("amcStatusTag"))) {
6760
LogTrace("DQMOffline|MuonDPG|GEMTnPEfficiencyTask") << "[GEMTnPEfficiencyTask]: Constructor" << std::endl;
68-
muon_service_ = std::make_unique<MuonServiceProxy>(config.getParameter<edm::ParameterSet>("ServiceParameters"), consumesCollector());
61+
muon_service_ = std::make_unique<MuonServiceProxy>(config.getParameter<edm::ParameterSet>("ServiceParameters"),
62+
consumesCollector());
6963
}
7064

7165
GEMTnPEfficiencyTask::~GEMTnPEfficiencyTask() {
@@ -1295,6 +1289,7 @@ void GEMTnPEfficiencyTask::bookHistograms(DQMStore::IBooker& iBooker,
12951289
m_histos["Cham_x_ME0"] = iBooker.book1D("Cham_x_ME0", "Cham_x;probe x [cm];Events", 100, -10., 10.);
12961290
m_histos["Cham_x_GE1"] = iBooker.book1D("Cham_x_GE1", "Cham_x;probe x [cm];Events", 100, -10., 10.);
12971291
m_histos["Cham_x_GE2"] = iBooker.book1D("Cham_x_GE2", "Cham_x;probe x [cm];Events", 100, -10., 10.);
1292+
m_histos["xyErr_GE1"] = iBooker.book2D("xyErr_GE1", "xyErr_GE1", 50, 0., 5., 50, 0., 5.);
12981293
}
12991294

13001295
uint16_t GEMTnPEfficiencyTask::maskChamberWithError(const GEMDetId& chamber_id,
@@ -1329,13 +1324,22 @@ uint16_t GEMTnPEfficiencyTask::maskChamberWithError(const GEMDetId& chamber_id,
13291324
return oh_warning;
13301325
}
13311326

1332-
bool GEMTnPEfficiencyTask::checkBounds(const Plane& plane,
1333-
const GlobalPoint& global_point,
1334-
const LocalError& local_error,
1335-
const float scale) {
1336-
const LocalPoint local_point = plane.toLocal(global_point);
1337-
const LocalPoint local_point_2d{local_point.x(), local_point.y(), 0.0f};
1338-
return plane.bounds().inside(local_point_2d, local_error, scale);
1327+
bool GEMTnPEfficiencyTask::checkBounds(const GeomDet* geomDet,
1328+
const GlobalPoint& global_position,
1329+
const float bordercut) {
1330+
const TrapezoidalPlaneBounds* bounds = dynamic_cast<const TrapezoidalPlaneBounds*>(&geomDet->surface().bounds());
1331+
LocalPoint localPoint = geomDet->surface().toLocal(global_position);
1332+
float wideWidth = bounds->width();
1333+
float narrowWidth = 2.f * bounds->widthAtHalfLength() - wideWidth;
1334+
float length = bounds->length();
1335+
float tangent = (wideWidth - narrowWidth) / (2.f * length);
1336+
float halfWidthAtY = tangent * localPoint.y() + 0.25f * (narrowWidth + wideWidth);
1337+
float distanceY = std::abs(localPoint.y()) - 0.5f * length;
1338+
float distanceX = std::abs(localPoint.x()) - halfWidthAtY;
1339+
if (distanceX < bordercut && distanceY < bordercut) {
1340+
return true;
1341+
}
1342+
return false;
13391343
}
13401344

13411345
void GEMTnPEfficiencyTask::analyze(const edm::Event& event, const edm::EventSetup& context) {
@@ -1469,25 +1473,19 @@ void GEMTnPEfficiencyTask::analyze(const edm::Event& event, const edm::EventSetu
14691473
int ieta = 0;
14701474
GEM_stationMatching = GEM_stationMatching | (1 << station);
14711475

1472-
//const GeomDet* geomDet = tGeom.idToDet(chId);
14731476
const GeomDet* geomDet = muon_service_->trackingGeometry()->idToDet(chId);
1474-
1475-
// edm::ESHandle<GlobalTrackingGeometry> tracking_geom = muon_service_->trackingGeometry();
1476-
// const GeomDet* geomDet = tracking_geom->idToDet(chId);
1477-
1478-
LocalPoint pos(chambMatch.x,chambMatch.y);
1479-
LocalError err(chambMatch.xErr, 0, chambMatch.yErr); // We don't have xy error in ChamberMatch
1480-
1481-
const GlobalPoint& global_point = geomDet->toGlobal(pos);
1482-
1477+
LocalPoint pos(chambMatch.x, chambMatch.y);
1478+
1479+
const GlobalPoint& global_position = geomDet->toGlobal(pos);
1480+
14831481
if (const GEMChamber* gemChamber = dynamic_cast<const GEMChamber*>(geomDet)) {
14841482
for (const GEMEtaPartition* eta_partition : gemChamber->etaPartitions())
1485-
if (checkBounds(eta_partition->surface(), global_point, err, 2)) {
1486-
ieta = eta_partition->id().ieta();
1487-
break;
1488-
}
1483+
if (checkBounds(eta_partition, global_position, m_borderCut)) {
1484+
ieta = eta_partition->id().ieta();
1485+
break;
1486+
}
14891487
}
1490-
1488+
14911489
if (station == 1 || station == 2) {
14921490
reco::MuonGEMHitMatch closest_matchedHit;
14931491
double smallestDx = 99999.;
@@ -1528,12 +1526,12 @@ void GEMTnPEfficiencyTask::analyze(const edm::Event& event, const edm::EventSetu
15281526
probe_GE21_dx.push_back(smallestDx);
15291527
probe_GE21_warnings.push_back(warnings);
15301528
}
1531-
15321529
if (m_detailedAnalysis && hit_matched) {
15331530
if (station == 1) {
15341531
m_histos.find("GEMhit_dx_GE1")->second->Fill(smallestDx);
15351532
m_histos.find("GEMhit_x_GE1")->second->Fill(matched_GEMHit_x);
15361533
m_histos.find("Cham_x_GE1")->second->Fill(chambMatch.x);
1534+
m_histos.find("xyErr_GE1")->second->Fill(chambMatch.xErr, chambMatch.yErr);
15371535
}
15381536
if (station == 2) {
15391537
m_histos.find("GEMhit_dx_GE2")->second->Fill(smallestDx);

0 commit comments

Comments
 (0)