32 #include <type_traits> 57 void endJob()
override;
59 void validateGEMChamberGeometry();
60 void validateGEMEtaPartitionGeometry();
62 void compareTransform(
const GlobalPoint&,
const TGeoMatrix*);
63 void compareShape(
const GeomDet*,
const float*);
66 float getDiff(
const float,
const float);
69 void makeHistograms2(
const char*);
70 void makeHistogram(
const string&, vector<float>&);
73 globalDistances_.clear();
75 bottomWidths_.clear();
104 : tokGeom_{esConsumes<GEMGeometry, MuonGeometryRecord>(
edm::ESInputTag{})},
105 infileName_(iConfig.getUntrackedParameter<
string>(
"infileName",
"cmsRecoGeom-2021.root")),
106 outfileName_(iConfig.getUntrackedParameter<
string>(
"outfileName",
"validateGEMGeometry.root")),
107 tolerance_(iConfig.getUntrackedParameter<
int>(
"tolerance", 6)) {
108 fwGeometry_.loadMap(infileName_.c_str());
109 outFile_ = TFile::Open(outfileName_.c_str(),
"RECREATE");
115 LogVerbatim(
"GEMGeometry") <<
"Validating GEM chamber geometry";
132 LogVerbatim(
"GEMGeometry") <<
"Failed to get matrix of GEM chamber with detid: " << chId.
rawId();
140 LogVerbatim(
"GEMGeometry") <<
"Failed to get shape of GEM chamber with detid: " << chId.
rawId();
153 const int n_strips = it->nstrips();
154 const float n_pitch = it->pitch();
161 for (
int istrips = 1; istrips <= n_strips; istrips++) {
167 LogVerbatim(
"GEMGeometry") <<
"ATTENTION! nStrips == 0";
174 double local[3] = {0.0, 0.0, 0.0};
187 float shapeBottomWidth;
189 float shapeThickness;
192 shapeTopWidth = shape[2];
193 shapeBottomWidth = shape[1];
194 shapeLength = shape[4];
195 shapeThickness = shape[3];
196 }
else if (shape[0] == 2) {
197 shapeTopWidth = shape[1];
198 shapeBottomWidth = shape[1];
199 shapeLength = shape[2];
200 shapeThickness = shape[3];
202 LogVerbatim(
"GEMGeometry") <<
"Failed to get box or trapezoid from shape";
207 float topWidth, bottomWidth;
212 array<const float, 4>
const& ps = tpbs->parameters();
220 }
else if ((dynamic_cast<const RectangularPlaneBounds*>(
bounds))) {
223 bottomWidth = topWidth;
226 LogVerbatim(
"GEMGeometry") <<
"Failed to get bounds";
230 topWidths_.push_back(fabs(shapeTopWidth - topWidth));
231 bottomWidths_.push_back(fabs(shapeBottomWidth - bottomWidth));
232 lengths_.push_back(fabs(shapeLength - length));
238 (
p1.z() -
p2.z()) * (
p1.z() -
p2.z()));
245 return (val1 - val2);
253 string gdn =
d +
": distance between points in global coordinates";
256 string twn =
d +
": absolute difference between top widths (along X)";
259 string bwn =
d +
": absolute difference between bottom widths (along X)";
262 string ln =
d +
": absolute difference between lengths (along Y)";
265 string tn =
d +
": absolute difference between thicknesses (along Z)";
274 string ns =
d +
": absolute difference between nStrips";
277 string pi =
d +
": absolute difference between Strips Pitch";
280 string pl =
d +
": absolute difference between Strips Length";
290 TH1D
hist(
name.c_str(),
name.c_str(), 100, *minE * (1 + 0.10), *
maxE * (1 + 0.10));
292 for (
auto const& it :
data)
295 hist.GetXaxis()->SetTitle(
"[cm]");
Log< level::Info, true > LogVerbatim
GEMGeometryValidate(const ParameterSet &)
void validateGEMEtaPartitionGeometry()
Point3DBase< Scalar, LocalTag > LocalPoint
vector< float > stripslen_
virtual float length() const =0
float getDiff(const float, const float)
Global3DPoint GlobalPoint
vector< float > topWidths_
void analyze(const edm::Event &, const edm::EventSetup &) override
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
float getDistance(const GlobalPoint &, const GlobalPoint &)
virtual float thickness() const =0
void compareShape(const GeomDet *, const float *)
const std::vector< const GEMChamber * > & chambers() const
Return a vector of all GEM chambers.
const edm::ESGetToken< GEMGeometry, MuonGeometryRecord > tokGeom_
virtual float stripLength() const =0
const GEMGeometry * gemGeometry_
void makeHistograms(const char *)
Abs< T >::type abs(const T &t)
void makeHistograms2(const char *)
#define DEFINE_FWK_MODULE(type)
void makeHistogram(const string &, vector< float > &)
vector< float > bottomWidths_
const Plane & surface() const
The nominal surface of the GeomDet.
void compareTransform(const GlobalPoint &, const TGeoMatrix *)
vector< float > thicknesses_
constexpr uint32_t rawId() const
get the raw id
const float * getShapePars(unsigned int id) const
char data[epos_bytes_allocation]
const float * getParameters(unsigned int id) const
void validateGEMChamberGeometry()
const TGeoMatrix * getMatrix(unsigned int id) const
enable_if<!numeric_limits< T >::is_integer, bool >::type almost_equal(T x, T y, int ulp)
virtual float width() const =0
vector< float > globalDistances_
~GEMGeometryValidate() override
const Bounds & bounds() const
const std::vector< const GEMEtaPartition * > & etaPartitions() const
Return a vector of all GEM eta partitions.