36 #include <type_traits> 60 void endJob()
override;
62 void validateCSCChamberGeometry();
63 void validateCSCLayerGeometry();
65 void compareTransform(
const GlobalPoint&,
const TGeoMatrix*);
66 void compareShape(
const GeomDet*,
const float*);
69 float getDiff(
const float,
const float);
72 void makeHistograms2(
const char*);
73 void makeHistogram(
const string&, vector<float>&);
76 globalDistances_.clear();
78 bottomWidths_.clear();
84 yAxisOrientation_.clear();
86 yCentreOfStripPlane_.clear();
87 angularWidth_.clear();
88 centreToIntersection_.clear();
89 phiOfOneEdge_.clear();
121 : tokCSC_{esConsumes<CSCGeometry, MuonGeometryRecord>(
edm::ESInputTag{})},
122 infileName_(iConfig.getUntrackedParameter<
string>(
"infileName",
"cmsGeom10.root")),
123 outfileName_(iConfig.getUntrackedParameter<
string>(
"outfileName",
"validateCSCGeometry.root")),
124 tolerance_(iConfig.getUntrackedParameter<
int>(
"tolerance", 6)) {
125 fwGeometry_.loadMap(infileName_.c_str());
126 outFile_ = TFile::Open(outfileName_.c_str(),
"RECREATE");
131 LogVerbatim(
"CSCGeometry") <<
"Validating CSC chamber geometry";
146 LogVerbatim(
"CSCGeometry") <<
"Failed to get matrix of CSC chamber with detid: " << chId.
rawId();
154 LogVerbatim(
"CSCGeometry") <<
"Failed to get shape of CSC chamber with detid: " << chId.
rawId();
179 const double wire_spacing = wiretopo->
wireSpacing();
180 const float wire_angle = wiretopo->
wireAngle();
183 for (
int istrips = 1; istrips <= n_strips; istrips++) {
192 LogVerbatim(
"CSCGeometry") <<
"ATTENTION! nStrips == 0";
196 for (
int iwires = 1; iwires <= n_wire; iwires++) {
201 LogVerbatim(
"CSCGeometry") <<
"ATTENTION! nWires == 0";
208 double local[3] = {0.0, 0.0, 0.0};
221 float shapeBottomWidth;
223 float shapeThickness;
226 shapeTopWidth = shape[2];
227 shapeBottomWidth = shape[1];
228 shapeLength = shape[4];
229 shapeThickness = shape[3];
230 }
else if (shape[0] == 2) {
231 shapeTopWidth = shape[1];
232 shapeBottomWidth = shape[1];
233 shapeLength = shape[2];
234 shapeThickness = shape[3];
236 LogVerbatim(
"CSCGeometry") <<
"Failed to get box or trapezoid from shape";
241 float topWidth, bottomWidth;
246 array<const float, 4>
const& ps = tpbs->parameters();
254 }
else if ((dynamic_cast<const RectangularPlaneBounds*>(
bounds))) {
257 bottomWidth = topWidth;
260 LogVerbatim(
"CSCGeometry") <<
"Failed to get bounds";
264 topWidths_.push_back(fabs(shapeTopWidth - topWidth));
265 bottomWidths_.push_back(fabs(shapeBottomWidth - bottomWidth));
266 lengths_.push_back(fabs(shapeLength - length));
272 (
p1.z() -
p2.z()) * (
p1.z() -
p2.z()));
279 return (val1 - val2);
287 string gdn =
d +
": distance between points in global coordinates";
290 string twn =
d +
": absolute difference between top widths (along X)";
293 string bwn =
d +
": absolute difference between bottom widths (along X)";
296 string ln =
d +
": absolute difference between lengths (along Y)";
299 string tn =
d +
": absolute difference between thicknesses (along Z)";
308 string ns =
d +
": absolute difference between Y Axis Orientation of the Strips";
311 string pi =
d +
": absolute difference between Strips Offset";
314 string pl =
d +
": absolute difference between 'Y centre' of the Strips Planes";
317 string aw =
d +
": absolute difference between 'angular width' of the Strips ";
320 string ci =
d +
": absolute difference between 'centre to intersection' of the Strips ";
323 string po =
d +
": absolute difference between 'phi of one edge' of the Strips ";
326 string ws =
d +
": absolute difference between 'wire spacing' of the Wires ";
329 string wa =
d +
": absolute difference between 'wire angle' of the Wires ";
339 TH1D
hist(
name.c_str(),
name.c_str(), 100, *minE * (1 + 0.10), *
maxE * (1 + 0.10));
341 for (
auto const& it :
data)
344 hist.GetXaxis()->SetTitle(
"[cm]");
Log< level::Info, true > LogVerbatim
float centreToIntersection() const override
void validateCSCChamberGeometry()
Point3DBase< Scalar, LocalTag > LocalPoint
virtual float length() const =0
vector< float > phiOfOneEdge_
const CSCWireTopology * wireTopology() const
float stripOffset(void) const
void compareTransform(const GlobalPoint &, const TGeoMatrix *)
vector< float > yAxisOrientation_
vector< float > bottomWidths_
float phiOfOneEdge() const override
Global3DPoint GlobalPoint
float getDiff(const float, const float)
vector< float > wireAngle_
void compareShape(const GeomDet *, const float *)
void analyze(const edm::Event &, const edm::EventSetup &) override
vector< float > centreToIntersection_
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
float yAxisOrientation() const override
void makeHistograms2(const char *)
virtual float thickness() const =0
float wireAngle() const override
vector< float > angularWidth_
vector< float > topWidths_
int numberOfStrips() const
Abs< T >::type abs(const T &t)
void validateCSCLayerGeometry()
float angularWidth() const override
#define DEFINE_FWK_MODULE(type)
double wireSpacing() const
const CSCGeometry * cscGeometry_
int numberOfWires() const
vector< float > yCentreOfStripPlane_
const edm::ESGetToken< CSCGeometry, MuonGeometryRecord > tokCSC_
enable_if<!numeric_limits< T >::is_integer, bool >::type almost_equal(T x, T y, int ulp)
const Plane & surface() const
The nominal surface of the GeomDet.
float yCentreOfStripPlane() const override
const LayerContainer & layers() const
Return a vector of all layers.
constexpr uint32_t rawId() const
get the raw id
const float * getShapePars(unsigned int id) const
void makeHistogram(const string &, vector< float > &)
~CSCGeometryValidate() override
char data[epos_bytes_allocation]
const float * getParameters(unsigned int id) const
const TGeoMatrix * getMatrix(unsigned int id) const
void makeHistograms(const char *)
vector< float > globalDistances_
vector< float > thicknesses_
CSCGeometryValidate(const ParameterSet &)
float getDistance(const GlobalPoint &, const GlobalPoint &)
const CSCStripTopology * topology() const
vector< float > wireSpacing_
const ChamberContainer & chambers() const
Return a vector of all chambers.
virtual float width() const =0
const Bounds & bounds() const