34 #include <type_traits> 58 void endJob()
override;
60 void validateRPCChamberGeometry();
61 void validateRPCStripsGeometry();
63 void compareTransform(
const GlobalPoint&,
const TGeoMatrix*);
64 void compareShape(
const GeomDet*,
const float*);
67 float getDiff(
const float,
const float);
70 void makeHistograms2(
const char*);
71 void makeHistogram(
const string&, vector<float>&);
74 globalDistances_.clear();
76 bottomWidths_.clear();
104 : infileName_(iConfig.getUntrackedParameter<
string>(
"infileName",
"cmsGeom10.root")),
105 outfileName_(iConfig.getUntrackedParameter<
string>(
"outfileName",
"validateRPCGeometry.root")),
106 tolerance_(iConfig.getUntrackedParameter<
int>(
"tolerance", 6)) {
114 LogVerbatim(
"RPCGeometry") <<
"Validating RPC chamber geometry";
118 LogVerbatim(
"RPCGeometry") <<
"Invalid RPC geometry";
131 LogVerbatim(
"RPCGeometry") <<
"Failed to get matrix of RPC chamber with detid: " << chId.
rawId();
139 LogVerbatim(
"RPCGeometry") <<
"Failed to get shape of RPC chamber with detid: " << chId.
rawId();
152 const int n_strips = it->nstrips();
153 const float n_pitch = it->pitch();
159 for (
int istrips = 1; istrips <= n_strips; istrips++) {
160 nstrips_.push_back(fabs(n_strips - parameters[0]));
161 pitch_.push_back(fabs(n_pitch - parameters[2]));
162 stripslen_.push_back(fabs(stripLen - parameters[1]));
165 LogVerbatim(
"RPCGeometry") <<
"ATTENTION! nStrips == 0";
172 double local[3] = {0.0, 0.0, 0.0};
175 matrix->LocalToMaster(local, global);
178 if ((distance >= 0.0) && (distance < 1.0
e-7))
185 float shapeBottomWidth;
187 float shapeThickness;
190 shapeTopWidth = shape[2];
191 shapeBottomWidth = shape[1];
192 shapeLength = shape[4];
193 shapeThickness = shape[3];
194 }
else if (shape[0] == 2) {
195 shapeTopWidth = shape[1];
196 shapeBottomWidth = shape[1];
197 shapeLength = shape[2];
198 shapeThickness = shape[3];
200 LogVerbatim(
"RPCGeometry") <<
"Failed to get box or trapezoid from shape";
205 float topWidth, bottomWidth;
210 array<const float, 4>
const& ps = tpbs->parameters();
212 assert(ps.size() == 4);
218 }
else if ((dynamic_cast<const RectangularPlaneBounds*>(bounds))) {
221 bottomWidth = topWidth;
224 LogVerbatim(
"RPCGeometry") <<
"Failed to get bounds";
228 topWidths_.push_back(fabs(shapeTopWidth - topWidth));
229 bottomWidths_.push_back(fabs(shapeBottomWidth - bottomWidth));
230 lengths_.push_back(fabs(shapeLength - length));
231 thicknesses_.push_back(fabs(shapeThickness - thickness));
235 return sqrt((p1.
x() - p2.
x()) * (p1.
x() - p2.
x()) + (p1.
y() - p2.
y()) * (p1.
y() - p2.
y()) +
236 (p1.
z() - p2.
z()) * (p1.
z() - p2.
z()));
243 return (val1 - val2);
251 string gdn = d +
": distance between points in global coordinates";
254 string twn = d +
": absolute difference between top widths (along X)";
257 string bwn = d +
": absolute difference between bottom widths (along X)";
260 string ln = d +
": absolute difference between lengths (along Y)";
263 string tn = d +
": absolute difference between thicknesses (along Z)";
272 string ns = d +
": absolute difference between nStrips";
275 string pi = d +
": absolute difference between Strips Pitch";
278 string pl = d +
": absolute difference between Strips Length";
286 const auto [minE,
maxE] = minmax_element(
begin(data),
end(data));
288 TH1D
hist(name.c_str(), name.c_str(), 100, *minE * (1 + 0.10), *
maxE * (1 + 0.10));
290 for (
auto const& it : data)
293 hist.GetXaxis()->SetTitle(
"[cm]");
vector< float > bottomWidths_
virtual float stripLength() const =0
virtual float length() const =0
Point3DBase< Scalar, LocalTag > LocalPoint
const float * getParameters(unsigned int id) const
const std::vector< const RPCRoll * > & rolls() const
Return a vector of all RPC rolls.
Global3DPoint GlobalPoint
constexpr uint32_t rawId() const
get the raw id
const Bounds & bounds() const
void makeHistograms(const char *)
enable_if<!numeric_limits< T >::is_integer, bool >::type almost_equal(T x, T y, int ulp)
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 > stripslen_
vector< float > topWidths_
virtual float width() const =0
const float * getShapePars(unsigned int id) const
#define DEFINE_FWK_MODULE(type)
~RPCGeometryValidate() override
void loadMap(const char *fileName)
float getDistance(const GlobalPoint &, const GlobalPoint &)
vector< float > thicknesses_
void makeHistogram(const string &, vector< float > &)
Abs< T >::type abs(const T &t)
void validateRPCStripsGeometry()
void compareTransform(const GlobalPoint &, const TGeoMatrix *)
RPCGeometryValidate(const ParameterSet &)
vector< float > globalDistances_
virtual float thickness() const =0
float getDiff(const float, const float)
char data[epos_bytes_allocation]
edm::ESHandle< RPCGeometry > rpcGeometry_
void makeHistograms2(const char *)
void analyze(const edm::Event &, const edm::EventSetup &) override
void compareShape(const GeomDet *, const float *)
void validateRPCChamberGeometry()