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);
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{})},
105 infileName_(iConfig.getUntrackedParameter<
string>(
"infileName",
"cmsGeom10.root")),
106 outfileName_(iConfig.getUntrackedParameter<
string>(
"outfileName",
"validateRPCGeometry.root")),
107 tolerance_(iConfig.getUntrackedParameter<
int>(
"tolerance", 6)) {
108 fwGeometry_.loadMap(infileName_.c_str());
109 outFile_ =
new TFile(outfileName_.c_str(),
"RECREATE");
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++) {
163 LogVerbatim(
"RPCGeometry") <<
"ATTENTION! nStrips == 0";
170 double local[3] = {0.0, 0.0, 0.0};
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));
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";
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_
Point3DBase< Scalar, LocalTag > LocalPoint
virtual float length() const =0
Global3DPoint GlobalPoint
void makeHistograms(const char *)
enable_if<!numeric_limits< T >::is_integer, bool >::type almost_equal(T x, T y, int ulp)
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
vector< float > stripslen_
vector< float > topWidths_
virtual float thickness() const =0
virtual float stripLength() const =0
~RPCGeometryValidate() override
float getDistance(const GlobalPoint &, const GlobalPoint &)
vector< float > thicknesses_
void makeHistogram(const string &, vector< float > &)
Abs< T >::type abs(const T &t)
#define DEFINE_FWK_MODULE(type)
void validateRPCStripsGeometry()
void compareTransform(const GlobalPoint &, const TGeoMatrix *)
RPCGeometryValidate(const ParameterSet &)
vector< float > globalDistances_
const Plane & surface() const
The nominal surface of the GeomDet.
constexpr uint32_t rawId() const
get the raw id
const edm::ESGetToken< RPCGeometry, MuonGeometryRecord > tokRPC_
const float * getShapePars(unsigned int id) const
float getDiff(const float, const float)
const RPCGeometry * rpcGeometry_
char data[epos_bytes_allocation]
const float * getParameters(unsigned int id) const
const TGeoMatrix * getMatrix(unsigned int id) const
const std::vector< const RPCRoll * > & rolls() const
Return a vector of all RPC rolls.
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()
const Bounds & bounds() const