|
18 | 18 | #include "DataFormats/GEMDigi/interface/GEMOHStatusCollection.h" |
19 | 19 | #include "DataFormats/GEMDigi/interface/GEMAMCStatusCollection.h" |
20 | 20 | #include "Geometry/GEMGeometry/interface/GEMGeometry.h" |
21 | | - |
| 21 | +#include "DataFormats/GeometrySurface/interface/TrapezoidalPlaneBounds.h" |
22 | 22 | #include "FWCore/Framework/interface/ConsumesCollector.h" |
23 | 23 | #include "RecoMuon/TrackingTools/interface/MuonServiceProxy.h" |
24 | 24 |
|
25 | | -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" |
26 | | -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" |
27 | | -#include "DataFormats/GeometryCommonDetAlgo/interface/ErrorFrameTransformer.h" |
28 | | - |
29 | 25 | class GEMTnPEfficiencyTask : public BaseTnPEfficiencyTask { |
30 | 26 | public: |
31 | 27 | /// Constructor |
32 | 28 | GEMTnPEfficiencyTask(const edm::ParameterSet& config); |
33 | 29 | uint16_t maskChamberWithError(const GEMDetId& chamber_id, |
34 | 30 | const GEMOHStatusCollection*, |
35 | 31 | 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); |
40 | 33 | /// Destructor |
41 | 34 | ~GEMTnPEfficiencyTask() override; |
42 | 35 |
|
@@ -65,7 +58,8 @@ GEMTnPEfficiencyTask::GEMTnPEfficiencyTask(const edm::ParameterSet& config) |
65 | 58 | m_GEMAMCStatusCollectionToken_( |
66 | 59 | consumes<GEMAMCStatusCollection>(config.getUntrackedParameter<edm::InputTag>("amcStatusTag"))) { |
67 | 60 | 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()); |
69 | 63 | } |
70 | 64 |
|
71 | 65 | GEMTnPEfficiencyTask::~GEMTnPEfficiencyTask() { |
@@ -1295,6 +1289,7 @@ void GEMTnPEfficiencyTask::bookHistograms(DQMStore::IBooker& iBooker, |
1295 | 1289 | m_histos["Cham_x_ME0"] = iBooker.book1D("Cham_x_ME0", "Cham_x;probe x [cm];Events", 100, -10., 10.); |
1296 | 1290 | m_histos["Cham_x_GE1"] = iBooker.book1D("Cham_x_GE1", "Cham_x;probe x [cm];Events", 100, -10., 10.); |
1297 | 1291 | 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.); |
1298 | 1293 | } |
1299 | 1294 |
|
1300 | 1295 | uint16_t GEMTnPEfficiencyTask::maskChamberWithError(const GEMDetId& chamber_id, |
@@ -1329,13 +1324,22 @@ uint16_t GEMTnPEfficiencyTask::maskChamberWithError(const GEMDetId& chamber_id, |
1329 | 1324 | return oh_warning; |
1330 | 1325 | } |
1331 | 1326 |
|
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; |
1339 | 1343 | } |
1340 | 1344 |
|
1341 | 1345 | 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 |
1469 | 1473 | int ieta = 0; |
1470 | 1474 | GEM_stationMatching = GEM_stationMatching | (1 << station); |
1471 | 1475 |
|
1472 | | - //const GeomDet* geomDet = tGeom.idToDet(chId); |
1473 | 1476 | 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 | + |
1483 | 1481 | if (const GEMChamber* gemChamber = dynamic_cast<const GEMChamber*>(geomDet)) { |
1484 | 1482 | 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 | + } |
1489 | 1487 | } |
1490 | | - |
| 1488 | + |
1491 | 1489 | if (station == 1 || station == 2) { |
1492 | 1490 | reco::MuonGEMHitMatch closest_matchedHit; |
1493 | 1491 | double smallestDx = 99999.; |
@@ -1528,12 +1526,12 @@ void GEMTnPEfficiencyTask::analyze(const edm::Event& event, const edm::EventSetu |
1528 | 1526 | probe_GE21_dx.push_back(smallestDx); |
1529 | 1527 | probe_GE21_warnings.push_back(warnings); |
1530 | 1528 | } |
1531 | | - |
1532 | 1529 | if (m_detailedAnalysis && hit_matched) { |
1533 | 1530 | if (station == 1) { |
1534 | 1531 | m_histos.find("GEMhit_dx_GE1")->second->Fill(smallestDx); |
1535 | 1532 | m_histos.find("GEMhit_x_GE1")->second->Fill(matched_GEMHit_x); |
1536 | 1533 | m_histos.find("Cham_x_GE1")->second->Fill(chambMatch.x); |
| 1534 | + m_histos.find("xyErr_GE1")->second->Fill(chambMatch.xErr, chambMatch.yErr); |
1537 | 1535 | } |
1538 | 1536 | if (station == 2) { |
1539 | 1537 | m_histos.find("GEMhit_dx_GE2")->second->Fill(smallestDx); |
|
0 commit comments