Skip to content

Commit da44e44

Browse files
committed
Etapartition finding on DQM side
1 parent 0b0e06a commit da44e44

File tree

6 files changed

+57
-19
lines changed

6 files changed

+57
-19
lines changed

DQMOffline/MuonDPG/BuildFile.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<use name="FWCore/Framework"/>
22
<use name="DQMServices/Core"/>
33
<use name="HLTrigger/HLTcore"/>
4+
<use name="Geometry/GEMGeometry"/>
5+
<use name="RecoMuon/TrackingTools"/>
46
<use name="boost"/>
57
<use name="rootgraphics"/>
68
<export>

DQMOffline/MuonDPG/plugins/GEMTnPEfficiencyTask.cc

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@
1717
#include "DataFormats/GEMDigi/interface/GEMVFATStatusCollection.h"
1818
#include "DataFormats/GEMDigi/interface/GEMOHStatusCollection.h"
1919
#include "DataFormats/GEMDigi/interface/GEMAMCStatusCollection.h"
20+
#include "Geometry/GEMGeometry/interface/GEMGeometry.h"
21+
22+
#include "FWCore/Framework/interface/ConsumesCollector.h"
23+
#include "RecoMuon/TrackingTools/interface/MuonServiceProxy.h"
24+
25+
#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
26+
#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
27+
#include "DataFormats/GeometryCommonDetAlgo/interface/ErrorFrameTransformer.h"
2028

2129
class GEMTnPEfficiencyTask : public BaseTnPEfficiencyTask {
2230
public:
@@ -25,14 +33,18 @@ class GEMTnPEfficiencyTask : public BaseTnPEfficiencyTask {
2533
uint16_t maskChamberWithError(const GEMDetId& chamber_id,
2634
const GEMOHStatusCollection*,
2735
const GEMVFATStatusCollection*);
28-
36+
bool checkBounds(const Plane& plane,
37+
const GlobalPoint& global_point,
38+
const LocalError& local_error,
39+
const float scale);
2940
/// Destructor
3041
~GEMTnPEfficiencyTask() override;
3142

3243
const bool m_maskChamberWithError_;
3344
const edm::EDGetTokenT<GEMOHStatusCollection> m_GEMOHStatusCollectionToken_;
3445
const edm::EDGetTokenT<GEMVFATStatusCollection> m_GEMVFATStatusCollectionToken_;
3546
const edm::EDGetTokenT<GEMAMCStatusCollection> m_GEMAMCStatusCollectionToken_;
47+
std::unique_ptr<MuonServiceProxy> muon_service_;
3648

3749
protected:
3850
std::string topFolder() const override;
@@ -53,6 +65,7 @@ GEMTnPEfficiencyTask::GEMTnPEfficiencyTask(const edm::ParameterSet& config)
5365
m_GEMAMCStatusCollectionToken_(
5466
consumes<GEMAMCStatusCollection>(config.getUntrackedParameter<edm::InputTag>("amcStatusTag"))) {
5567
LogTrace("DQMOffline|MuonDPG|GEMTnPEfficiencyTask") << "[GEMTnPEfficiencyTask]: Constructor" << std::endl;
68+
muon_service_ = std::make_unique<MuonServiceProxy>(config.getParameter<edm::ParameterSet>("ServiceParameters"), consumesCollector());
5669
}
5770

5871
GEMTnPEfficiencyTask::~GEMTnPEfficiencyTask() {
@@ -1316,12 +1329,22 @@ uint16_t GEMTnPEfficiencyTask::maskChamberWithError(const GEMDetId& chamber_id,
13161329
return oh_warning;
13171330
}
13181331

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);
1339+
}
1340+
13191341
void GEMTnPEfficiencyTask::analyze(const edm::Event& event, const edm::EventSetup& context) {
13201342
BaseTnPEfficiencyTask::analyze(event, context);
13211343
GEMOHStatusCollection oh_status;
13221344
GEMVFATStatusCollection vfat_status;
13231345
edm::Handle<GEMOHStatusCollection> oh_status_collection;
13241346
edm::Handle<GEMVFATStatusCollection> vfat_status_collection;
1347+
muon_service_->update(context);
13251348
if (m_maskChamberWithError_) {
13261349
event.getByToken(m_GEMOHStatusCollectionToken_, oh_status_collection);
13271350
//if (oh_status_collem_tion.isValid()) {
@@ -1435,18 +1458,36 @@ void GEMTnPEfficiencyTask::analyze(const edm::Event& event, const edm::EventSetu
14351458

14361459
GEMDetId chId(chambMatch.id.rawId());
14371460
const uint16_t warnings = maskChamberWithError(chId, &oh_status, &vfat_status);
1438-
14391461
const int roll = chId.roll();
14401462
const int region = chId.region();
14411463
const int station = chId.station();
14421464
const int layer = chId.layer();
14431465
const int chamber = chId.chamber();
1444-
const int ieta = chId.ieta();
14451466
const float pt = (*muons).at(i).pt();
14461467
const float eta = (*muons).at(i).eta();
14471468
const float phi = (*muons).at(i).phi();
1469+
int ieta = 0;
14481470
GEM_stationMatching = GEM_stationMatching | (1 << station);
14491471

1472+
//const GeomDet* geomDet = tGeom.idToDet(chId);
1473+
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+
1483+
if (const GEMChamber* gemChamber = dynamic_cast<const GEMChamber*>(geomDet)) {
1484+
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+
}
1489+
}
1490+
14501491
if (station == 1 || station == 2) {
14511492
reco::MuonGEMHitMatch closest_matchedHit;
14521493
double smallestDx = 99999.;

DQMOffline/MuonDPG/python/gemTnPEfficiencyTask_cfi.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import FWCore.ParameterSet.Config as cms
2+
from RecoMuon.TrackingTools.MuonServiceProxy_cff import *
23

34
from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer
45
gemTnPEfficiencyMonitor = DQMEDAnalyzer('GEMTnPEfficiencyTask',
@@ -17,6 +18,7 @@
1718
# CutBasedIdMediumPrompt = 1UL << 2
1819
# CutBasedIdTight = 1UL << 3
1920
maskChamberWithError=cms.untracked.bool(True),
21+
ServiceParameters = MuonServiceProxy.ServiceParameters.clone(),
2022
ohStatusTag=cms.untracked.InputTag("muonGEMDigis", "OHStatus"),
2123
vfatStatusTag=cms.untracked.InputTag("muonGEMDigis","VFATStatus"),
2224
amcStatusTag=cms.untracked.InputTag("muonGEMDigis","AMCStatus"),

RecoMuon/MuonIdentification/plugins/MuonIdProducer.cc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,13 @@ void MuonIdProducer::fillMuonId(edm::Event& iEvent,
11091109
for (const auto& gemRecHit : *gemHitHandle_) {
11101110
reco::MuonGEMHitMatch gemHitMatch;
11111111

1112-
if (gemRecHit.gemId().rawId() != chamber.id.rawId())
1112+
if (GEMDetId(gemRecHit.gemId().region(),
1113+
gemRecHit.gemId().ring(),
1114+
gemRecHit.gemId().station(),
1115+
gemRecHit.gemId().layer(),
1116+
gemRecHit.gemId().chamber(),
1117+
0)
1118+
.rawId() != chamber.id.rawId())
11131119
continue;
11141120

11151121
gemHitMatch.x = gemRecHit.localPosition().x();

TrackingTools/TrackAssociator/plugins/MuonDetIdAssociator.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,8 @@ void MuonDetIdAssociator::getValidDetIds(unsigned int subDectorIndex, std::vecto
9898
if (gem->id().station() == 0)
9999
validIds.push_back(gem->id());
100100
else
101-
for (auto ch : gem->chambers()) {
102-
for (auto eta : ch->etaPartitions())
103-
validIds.push_back(eta->id());
104-
}
101+
for (auto ch : gem->chambers())
102+
validIds.push_back(ch->id());
105103
}
106104
}
107105
}

TrackingTools/TrackAssociator/src/TrackDetectorAssociator.cc

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -682,17 +682,6 @@ void TrackDetectorAssociator::getTAMuonChamberMatches(std::vector<TAMuonChamberM
682682
float halfWidthAtYPrime = 0.5f * narrowWidth + yPrime * tangent;
683683
distanceX = std::abs(localPoint.x()) - halfWidthAtYPrime;
684684
distanceY = std::abs(localPoint.y() - yCOWPOffset) - 0.5f * length;
685-
} else if (dynamic_cast<const GEMEtaPartition*>(geomDet)) {
686-
const TrapezoidalPlaneBounds* bounds = dynamic_cast<const TrapezoidalPlaneBounds*>(&geomDet->surface().bounds());
687-
688-
float wideWidth = bounds->width();
689-
float narrowWidth = 2.f * bounds->widthAtHalfLength() - wideWidth;
690-
float length = bounds->length();
691-
float tangent = (wideWidth - narrowWidth) / (2.f * length);
692-
float halfWidthAtY = tangent * localPoint.y() + 0.25f * (narrowWidth + wideWidth);
693-
694-
distanceX = std::abs(localPoint.x()) - halfWidthAtY;
695-
distanceY = std::abs(localPoint.y()) - 0.5f * length;
696685
} else if (dynamic_cast<const GEMChamber*>(geomDet) || dynamic_cast<const GEMSuperChamber*>(geomDet)) {
697686
const TrapezoidalPlaneBounds* bounds = dynamic_cast<const TrapezoidalPlaneBounds*>(&geomDet->surface().bounds());
698687

0 commit comments

Comments
 (0)