Skip to content

Modify RPC isFront function to match criteria with will be modified RPC geometries for Run, Run 3 and Run 4 #47138

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 130 additions & 8 deletions RecoMuon/DetLayers/src/MuRingForwardDoubleLayer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include <RecoMuon/DetLayers/interface/MuRingForwardDoubleLayer.h>
#include <RecoMuon/DetLayers/interface/MuDetRing.h>
#include <Geometry/CommonDetUnit/interface/GeomDet.h>
#include <DataFormats/MuonDetId/interface/MuonSubdetId.h>
#include <DataFormats/MuonDetId/interface/RPCDetId.h>
#include <DataFormats/GeometrySurface/interface/SimpleDiskBounds.h>
#include <TrackingTools/GeomPropagators/interface/Propagator.h>
#include <TrackingTools/DetLayers/interface/MeasurementEstimator.h>
Expand Down Expand Up @@ -182,18 +184,138 @@ bool MuRingForwardDoubleLayer::isCrack(const GlobalPoint& gp) const {
}

void MuRingForwardDoubleLayer::selfTest() const {
const std::string metname = "Muon|RecoMuon|RecoMuonDetLayers|MuRingForwardDoubleLayer";

const std::vector<const GeomDet*>& frontDets = theFrontLayer.basicComponents();
const std::vector<const GeomDet*>& backDets = theBackLayer.basicComponents();

std::vector<const GeomDet*>::const_iterator frontItr = frontDets.begin(), lastFront = frontDets.end(),
backItr = backDets.begin(), lastBack = backDets.end();
// Collect front/back chambers by sub-detectors
std::vector<const GeomDet*> frontCSCs, backCSCs;
std::vector<const GeomDet*> frontRPCs, backRPCs;
std::vector<const GeomDet*> frontGEMs, backGEMs;
std::vector<const GeomDet*> frontIRPCs, backIRPCs;
std::vector<const GeomDet*> frontME0s, backME0s;

for (const GeomDet* frontDet : frontDets) {
const int subdetId = frontDet->geographicalId().subdetId();
if (subdetId == MuonSubdetId::CSC) {
frontCSCs.push_back(frontDet);
} else if (subdetId == MuonSubdetId::GEM) {
frontGEMs.push_back(frontDet);
} else if (subdetId == MuonSubdetId::ME0) {
frontME0s.push_back(frontDet);
} else if (subdetId == MuonSubdetId::RPC) {
// RPC has to split existing RPC and iRPC
const RPCDetId rpcId(frontDet->geographicalId());
const int ring = rpcId.ring();
if (ring == 1) {
frontIRPCs.push_back(frontDet);
} else {
frontRPCs.push_back(frontDet);
}
}
}

// test that each front z is less than each back z
for (; frontItr != lastFront; ++frontItr) {
float frontz = fabs((**frontItr).surface().position().z());
for (; backItr != lastBack; ++backItr) {
float backz = fabs((**backItr).surface().position().z());
assert(frontz < backz);
for (const GeomDet* backDet : backDets) {
const int subdetId = backDet->geographicalId().subdetId();
if (subdetId == MuonSubdetId::CSC) {
backCSCs.push_back(backDet);
} else if (subdetId == MuonSubdetId::GEM) {
backGEMs.push_back(backDet);
} else if (subdetId == MuonSubdetId::ME0) {
backME0s.push_back(backDet);
} else if (subdetId == MuonSubdetId::RPC) {
// RPC has to split existing RPC and iRPC
const RPCDetId rpcId(backDet->geographicalId());
const int ring = rpcId.ring();
if (ring == 1) {
backIRPCs.push_back(backDet);
} else {
backRPCs.push_back(backDet);
}
}
}

// Perform test for each subsystems, that front-z is less than back-z
// In other word, maximum of front-z must be less than minimum of back-z

// Check the CSC ordering
double maxZFrontCSC = 0, minZBackCSC = 1e9;
for (auto frontCSC : frontCSCs) {
const double z = std::abs(frontCSC->surface().position().z());
if (maxZFrontCSC < z)
maxZFrontCSC = z;
}
for (auto backCSC : backCSCs) {
const double z = std::abs(backCSC->surface().position().z());
if (minZBackCSC > z)
minZBackCSC = z;
}
if (frontCSCs.size() + backCSCs.size() != 0)
LogTrace(metname) << "CSC " << maxZFrontCSC << '<' << minZBackCSC << endl;
assert(maxZFrontCSC < minZBackCSC);

// Check the RPC ordering
double maxZFrontRPC = 0, minZBackRPC = 1e9;
for (auto frontRPC : frontRPCs) {
const double z = std::abs(frontRPC->surface().position().z());
if (maxZFrontRPC < z)
maxZFrontRPC = z;
}
for (auto backRPC : backRPCs) {
const double z = std::abs(backRPC->surface().position().z());
if (minZBackRPC > z)
minZBackRPC = z;
}
if (frontRPCs.size() + backRPCs.size() != 0)
LogTrace(metname) << "RPC " << maxZFrontRPC << '<' << minZBackRPC << endl;
assert(maxZFrontRPC < minZBackRPC);

// Check the GEM ordering
double maxZFrontGEM = 0, minZBackGEM = 1e9;
for (auto frontGEM : frontGEMs) {
const double z = std::abs(frontGEM->surface().position().z());
if (maxZFrontGEM < z)
maxZFrontGEM = z;
}
for (auto backGEM : backGEMs) {
const double z = std::abs(backGEM->surface().position().z());
if (minZBackGEM > z)
minZBackGEM = z;
}
if (frontGEMs.size() + backGEMs.size() != 0)
LogTrace(metname) << "GEM " << maxZFrontGEM << '<' << minZBackGEM << endl;
assert(maxZFrontGEM < minZBackGEM);

// Check the IRPC ordering
double maxZFrontIRPC = 0, minZBackIRPC = 1e9;
for (auto frontIRPC : frontIRPCs) {
const double z = std::abs(frontIRPC->surface().position().z());
if (maxZFrontIRPC < z)
maxZFrontIRPC = z;
}
for (auto backIRPC : backIRPCs) {
const double z = std::abs(backIRPC->surface().position().z());
if (minZBackIRPC > z)
minZBackIRPC = z;
}
if (frontIRPCs.size() + backIRPCs.size() != 0)
LogTrace(metname) << "IRPC " << maxZFrontIRPC << '<' << minZBackIRPC << endl;
assert(maxZFrontIRPC < minZBackIRPC);

// Check the ME0 ordering
double maxZFrontME0 = 0, minZBackME0 = 1e9;
for (auto frontME0 : frontME0s) {
const double z = std::abs(frontME0->surface().position().z());
if (maxZFrontME0 < z)
maxZFrontME0 = z;
}
for (auto backME0 : backME0s) {
const double z = std::abs(backME0->surface().position().z());
if (minZBackME0 > z)
minZBackME0 = z;
}
if (frontME0s.size() + backME0s.size() != 0)
LogTrace(metname) << "ME0 " << maxZFrontME0 << '<' << minZBackME0 << endl;
assert(maxZFrontME0 < minZBackME0);
}
38 changes: 13 additions & 25 deletions RecoMuon/DetLayers/src/MuonRPCDetLayerGeometryBuilder.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <RecoMuon/DetLayers/src/MuonRPCDetLayerGeometryBuilder.h>

#include <DataFormats/MuonDetId/interface/RPCDetId.h>
#include <Geometry/RPCGeometry/interface/RPCGeomServ.h>
#include <Geometry/CommonDetUnit/interface/GeomDet.h>
#include <RecoMuon/DetLayers/interface/MuRingForwardDoubleLayer.h>
#include <RecoMuon/DetLayers/interface/MuRodBarrelLayer.h>
Expand Down Expand Up @@ -297,31 +298,18 @@ void MuonRPCDetLayerGeometryBuilder::makeBarrelRods(vector<const GeomDet*>& geom
}

bool MuonRPCDetLayerGeometryBuilder::isFront(const RPCDetId& rpcId) {
// ME1/2 is always in back
// if(rpcId.station() == 1 && rpcId.ring() == 2) return false;

bool result = false;
int ring = rpcId.ring();
int station = rpcId.station();
// 20 degree rings are a little weird! not anymore from 17x
if (ring == 1 && station > 1) {
// RE2/1 RE3/1 Upscope Geometry
/* goes (sector) (subsector) 1/3
1 1 back // front
1 2 front // back
1 3 front // front
2 1 front // back
2 2 back // from
2 3 back // back

*/
result = (rpcId.subsector() != 2);
if (rpcId.sector() % 2 == 0)
result = !result;
return result;
const int station = rpcId.station();
const int ring = rpcId.ring();
const int sector = RPCGeomServ(rpcId).segment();

// The front/back or off-yoke/on-yoke rule is different for the iRPC, RE+-1, and the others.
if (ring == 1) {
return (sector % 2 != 0);
} else if (station == 1) {
// For RE+-1, even chambers are closer to the IP
return (sector % 2 == 0);
} else {
// 10 degree rings have odd subsectors in front
result = (rpcId.subsector() % 2 == 0);
// For the others, odd chambers are closer to the IP
return (sector % 2 != 0);
}
return result;
}