33 #include <type_traits>
57 void endJob()
override;
59 void validateRPCChamberGeometry();
60 void validateRPCStripsGeometry();
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 : tokRPC_{esConsumes<RPCGeometry, MuonGeometryRecord>(
edm::ESInputTag{})},
114 LogVerbatim(
"RPCGeometry") <<
"Validating RPC chamber geometry";
129 LogVerbatim(
"RPCGeometry") <<
"Failed to get matrix of RPC chamber with detid: " << chId.
rawId();
137 LogVerbatim(
"RPCGeometry") <<
"Failed to get shape of RPC chamber with detid: " << chId.
rawId();
150 const int n_strips = it->nstrips();
151 const float n_pitch = it->pitch();
157 for (
int istrips = 1; istrips <= n_strips; istrips++) {
158 nstrips_.push_back(fabs(n_strips - parameters[0]));
159 pitch_.push_back(fabs(n_pitch - parameters[2]));
160 stripslen_.push_back(fabs(stripLen - parameters[1]));
163 LogVerbatim(
"RPCGeometry") <<
"ATTENTION! nStrips == 0";
170 double local[3] = {0.0, 0.0, 0.0};
173 matrix->LocalToMaster(local, global);
176 if ((distance >= 0.0) && (distance < 1.0
e-7))
183 float shapeBottomWidth;
185 float shapeThickness;
188 shapeTopWidth = shape[2];
189 shapeBottomWidth = shape[1];
190 shapeLength = shape[4];
191 shapeThickness = shape[3];
192 }
else if (shape[0] == 2) {
193 shapeTopWidth = shape[1];
194 shapeBottomWidth = shape[1];
195 shapeLength = shape[2];
196 shapeThickness = shape[3];
198 LogVerbatim(
"RPCGeometry") <<
"Failed to get box or trapezoid from shape";
203 float topWidth, bottomWidth;
208 array<const float, 4>
const& ps = tpbs->parameters();
216 }
else if ((dynamic_cast<const RectangularPlaneBounds*>(bounds))) {
219 bottomWidth = topWidth;
222 LogVerbatim(
"RPCGeometry") <<
"Failed to get bounds";
226 topWidths_.push_back(fabs(shapeTopWidth - topWidth));
227 bottomWidths_.push_back(fabs(shapeBottomWidth - bottomWidth));
228 lengths_.push_back(fabs(shapeLength - length));
229 thicknesses_.push_back(fabs(shapeThickness - thickness));
233 return sqrt((p1.
x() - p2.
x()) * (p1.
x() - p2.
x()) + (p1.
y() - p2.
y()) * (p1.
y() - p2.
y()) +
234 (p1.
z() - p2.
z()) * (p1.
z() - p2.
z()));
241 return (val1 - val2);
249 string gdn = d +
": distance between points in global coordinates";
252 string twn = d +
": absolute difference between top widths (along X)";
255 string bwn = d +
": absolute difference between bottom widths (along X)";
258 string ln = d +
": absolute difference between lengths (along Y)";
261 string tn = d +
": absolute difference between thicknesses (along Z)";
270 string ns = d +
": absolute difference between nStrips";
273 string pi = d +
": absolute difference between Strips Pitch";
276 string pl = d +
": absolute difference between Strips Length";
284 const auto [minE, maxE] = minmax_element(
begin(data),
end(data));
286 TH1D
hist(name.c_str(), name.c_str(), 100, *minE * (1 + 0.10), *maxE * (1 + 0.10));
288 for (
auto const& it : data)
291 hist.GetXaxis()->SetTitle(
"[cm]");
Log< level::Info, true > LogVerbatim
vector< float > bottomWidths_
T getUntrackedParameter(std::string const &, T const &) const
Point3DBase< Scalar, LocalTag > LocalPoint
virtual float length() const =0
const float * getParameters(unsigned int id) const
#define DEFINE_FWK_MODULE(type)
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 *)
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 thickness() const =0
bool getData(T &iHolder) const
const float * getShapePars(unsigned int id) const
virtual float stripLength() const =0
~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_
enable_if<!numeric_limits< T >::is_integer, bool >::type almost_equal(T x, T y, int ulp)
const edm::ESGetToken< RPCGeometry, MuonGeometryRecord > tokRPC_
float getDiff(const float, const float)
const RPCGeometry * rpcGeometry_
char data[epos_bytes_allocation]
void makeHistograms2(const char *)
virtual float width() const =0
void analyze(const edm::Event &, const edm::EventSetup &) override
void compareShape(const GeomDet *, const float *)
void validateRPCChamberGeometry()