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);
68 void makeHistograms(
const char*);
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{})},
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++) {
162 pitch_.push_back(fabs(n_pitch - parameters[2]));
164 stripslen_.push_back(fabs(stripLen - parameters[1]));
167 LogVerbatim(
"GEMGeometry") <<
"ATTENTION! nStrips == 0";
174 double local[3] = {0.0, 0.0, 0.0};
177 matrix->LocalToMaster(local, global);
180 if (
abs(distance) < 1.0
e-7)
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));
233 thicknesses_.push_back(fabs(shapeThickness - thickness));
237 return sqrt((p1.
x() - p2.
x()) * (p1.
x() - p2.
x()) + (p1.
y() - p2.
y()) * (p1.
y() - p2.
y()) +
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";
288 const auto [minE, maxE] = minmax_element(
begin(data),
end(data));
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
T getUntrackedParameter(std::string const &, T const &) const
GEMGeometryValidate(const ParameterSet &)
void validateGEMEtaPartitionGeometry()
Point3DBase< Scalar, LocalTag > LocalPoint
vector< float > stripslen_
virtual float length() const =0
const float * getParameters(unsigned int id) const
#define DEFINE_FWK_MODULE(type)
float getDiff(const float, const float)
Global3DPoint GlobalPoint
constexpr uint32_t rawId() const
get the raw id
vector< float > topWidths_
const Bounds & bounds() const
void analyze(const edm::Event &, const edm::EventSetup &) override
const TGeoMatrix * getMatrix(unsigned int id) const
const Plane & surface() const
The nominal surface of the GeomDet.
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
float getDistance(const GlobalPoint &, const GlobalPoint &)
virtual float thickness() const =0
bool getData(T &iHolder) const
void compareShape(const GeomDet *, const float *)
const float * getShapePars(unsigned int id) const
const edm::ESGetToken< GEMGeometry, MuonGeometryRecord > tokGeom_
virtual float stripLength() const =0
const GEMGeometry * gemGeometry_
void loadMap(const char *fileName)
void makeHistograms(const char *)
Abs< T >::type abs(const T &t)
const std::vector< const GEMEtaPartition * > & etaPartitions() const
Return a vector of all GEM eta partitions.
void makeHistograms2(const char *)
void makeHistogram(const string &, vector< float > &)
vector< float > bottomWidths_
enable_if<!numeric_limits< T >::is_integer, bool >::type almost_equal(T x, T y, int ulp)
void compareTransform(const GlobalPoint &, const TGeoMatrix *)
vector< float > thicknesses_
const std::vector< const GEMChamber * > & chambers() const
Return a vector of all GEM chambers.
char data[epos_bytes_allocation]
void validateGEMChamberGeometry()
virtual float width() const =0
vector< float > globalDistances_
~GEMGeometryValidate() override