33 #include <type_traits>
57 void endJob()
override;
59 void validateME0ChamberGeometry();
60 void validateME0EtaPartitionGeometry();
61 void validateME0EtaPartitionGeometry2();
63 void compareTransform(
const GlobalPoint&,
const TGeoMatrix*);
64 void compareShape(
const GeomDet*,
const float*);
67 float getDiff(
const float,
const float);
69 void makeHistograms(
const char*);
70 void makeHistograms2(
const char*);
71 void makeHistogram(
const string&, vector<float>&);
74 globalDistances_.clear();
76 bottomWidths_.clear();
105 : tokGeom_{esConsumes<ME0Geometry, MuonGeometryRecord>(
edm::ESInputTag{})},
115 LogTrace(
"ME0Geometry") <<
"Validating ME0 chamber geometry";
130 LogTrace(
"ME0Geometry") <<
"Failed to get matrix of ME0 chamber with detid: " << chId.
rawId();
138 LogTrace(
"ME0Geometry") <<
"Failed to get shape of ME0 chamber with detid: " << chId.
rawId();
155 LogTrace(
"ME0Geometry") <<
"Failed to get matrix of ME0 eta partition 2 with detid: " << chId.
rawId();
163 LogTrace(
"ME0Geometry") <<
"Failed to get shape of ME0 eta partition 2 with detid: " << chId.
rawId();
176 const int n_strips = it->nstrips();
177 const float n_pitch = it->pitch();
184 for (
int istrips = 1; istrips <= n_strips; istrips++) {
185 if (
std::abs(n_pitch - parameters[2]) < 1.0
e-05)
189 if (
std::abs(stripLen - parameters[1]) < 1.0
e-05)
195 LogWarning(
"ME0Geometry") <<
"ATTENTION! nStrips == 0";
202 double local[3] = {0.0, 0.0, 0.0};
205 matrix->LocalToMaster(local, global);
208 if (
abs(distance) < 1.0
e-7)
215 float shapeBottomWidth;
217 float shapeThickness;
220 shapeTopWidth = shape[2];
221 shapeBottomWidth = shape[1];
222 shapeLength = shape[4];
223 shapeThickness = shape[3];
224 }
else if (shape[0] == 2) {
225 shapeTopWidth = shape[1];
226 shapeBottomWidth = shape[1];
227 shapeLength = shape[2];
228 shapeThickness = shape[3];
230 LogTrace(
"ME0Geometry") <<
"Failed to get box or trapezoid from shape";
235 float topWidth, bottomWidth;
240 array<const float, 4>
const& ps = tpbs->parameters();
249 }
else if ((dynamic_cast<const RectangularPlaneBounds*>(bounds))) {
252 bottomWidth = topWidth;
256 LogTrace(
"ME0Geometry") <<
"Failed to get bounds";
267 return sqrt((p1.
x() - p2.
x()) * (p1.
x() - p2.
x()) + (p1.
y() - p2.
y()) * (p1.
y() - p2.
y()) +
268 (p1.
z() - p2.
z()) * (p1.
z() - p2.
z()));
275 return (val1 - val2);
283 string gdn = d +
": distance between points in global coordinates";
286 string twn = d +
": absolute difference between top widths (along X)";
289 string bwn = d +
": absolute difference between bottom widths (along X)";
292 string ln = d +
": absolute difference between lengths (along Y)";
295 string tn = d +
": absolute difference between thicknesses (along Z)";
304 string ns = d +
": absolute difference between nStrips";
307 string pi = d +
": absolute difference between Strips Pitch";
310 string pl = d +
": absolute difference between Strips Length";
318 const auto [minE, maxE] = minmax_element(
begin(data),
end(data));
320 TH1D
hist(name.c_str(), name.c_str(), 100, *minE * (1 + 0.10), *maxE * (1 + 0.10));
322 for (
auto const& it : data)
325 hist.GetXaxis()->SetTitle(
"[cm]");
T getUntrackedParameter(std::string const &, T const &) const
~ME0GeometryValidate() override
Point3DBase< Scalar, LocalTag > LocalPoint
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
const Bounds & bounds() const
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
vector< float > thicknesses_
void analyze(const edm::Event &, const edm::EventSetup &) override
virtual float thickness() const =0
bool getData(T &iHolder) const
const float * getShapePars(unsigned int id) const
virtual float stripLength() const =0
vector< float > globalDistances_
void loadMap(const char *fileName)
const ME0Geometry * me0Geometry_
const edm::ESGetToken< ME0Geometry, MuonGeometryRecord > tokGeom_
const std::vector< const ME0Chamber * > & chambers() const
Return a vector of all ME0 chambers.
Abs< T >::type abs(const T &t)
float getDistance(const GlobalPoint &, const GlobalPoint &)
vector< float > topWidths_
void compareShape(const GeomDet *, const float *)
void compareTransform(const GlobalPoint &, const TGeoMatrix *)
const std::vector< ME0EtaPartition const * > & etaPartitions() const
Return a vector of all ME0 eta partitions.
enable_if<!numeric_limits< T >::is_integer, bool >::type almost_equal(T x, T y, int ulp)
void makeHistograms2(const char *)
char data[epos_bytes_allocation]
void validateME0EtaPartitionGeometry()
void makeHistograms(const char *)
vector< float > stripslen_
vector< float > bottomWidths_
void makeHistogram(const string &, vector< float > &)
Log< level::Warning, false > LogWarning
virtual float width() const =0
ME0GeometryValidate(const ParameterSet &)
void validateME0EtaPartitionGeometry2()
void validateME0ChamberGeometry()