55 #include <TEveGeoNode.h> 56 #include <TGeoVolume.h> 142 : infileName_(iConfig.getUntrackedParameter<
std::
string>(
"infileName")),
143 outfileName_(iConfig.getUntrackedParameter<
std::
string>(
"outfileName")) {
172 std::cout <<
"Validating RPC -z endcap geometry" << std::endl;
175 std::cout <<
"Validating RPC +z endcap geometry" << std::endl;
178 std::cout <<
"Validating RPC barrel geometry" << std::endl;
186 std::cout <<
"Validating DT chamber geometry" << std::endl;
189 std::cout <<
"Validating DT layer geometry" << std::endl;
197 std::cout <<
"Validating CSC -z geometry" << std::endl;
200 std::cout <<
"Validating CSC +z geometry" << std::endl;
203 std::cout <<
"Validating CSC layer -z geometry" << std::endl;
206 std::cout <<
"Validating CSC layer +z geometry" << std::endl;
216 std::cout <<
"Validating TIB geometry and topology" << std::endl;
220 std::cout <<
"Validating TOB geometry and topology" << std::endl;
224 std::cout <<
"Validating TEC geometry and topology" << std::endl;
228 std::cout <<
"Validating TID geometry and topology" << std::endl;
232 std::cout <<
"Validating PXB geometry and topology" << std::endl;
236 std::cout <<
"Validating PXF geometry and topology" << std::endl;
247 std::cout <<
"Validating EB geometry" << std::endl;
250 std::cout <<
"Validating EE geometry" << std::endl;
253 std::cout <<
"Validating ES geometry" << std::endl;
256 std::cout <<
"Validating HB geometry" << std::endl;
259 std::cout <<
"Validating HE geometry" << std::endl;
262 std::cout <<
"Validating HO geometry" << std::endl;
265 std::cout <<
"Validating HF geometry" << std::endl;
268 std::cout <<
"Validating Castor geometry" << std::endl;
271 std::cout <<
"Validating ZDC geometry" << std::endl;
281 std::vector<double> centers;
285 for (
auto it = rolls.begin(), itEnd = rolls.end(); it != itEnd; ++it) {
291 if (rpcDetId.
region() == regionNumber) {
298 std::cout <<
"Failed to get matrix of RPC with detid: " << rpcDetId.
rawId() << std::endl;
307 std::cout <<
"Failed to get shape of RPC with detid: " << rpcDetId.
rawId() << std::endl;
316 std::cout <<
"Parameters empty for RPC with detid: " << rpcDetId.
rawId() << std::endl;
338 centers.push_back(centreOfStrip1.
x() - centreOfStrip2.
x());
355 for (
auto it =
chambers.begin(), itEnd =
chambers.end(); it != itEnd; ++it) {
365 std::cout <<
"Failed to get matrix of DT chamber with detid: " << chId.
rawId() << std::endl;
374 std::cout <<
"Failed to get shape of DT chamber with detid: " << chId.
rawId() << std::endl;
388 std::vector<double> wire_positions;
392 for (
auto it =
layers.begin(), itEnd =
layers.end(); it != itEnd; ++it) {
402 std::cout <<
"Failed to get matrix of DT layer with detid: " << layerId.
rawId() << std::endl;
411 std::cout <<
"Failed to get shape of DT layer with detid: " << layerId.
rawId() << std::endl;
420 std::cout <<
"Parameters empty for DT layer with detid: " << layerId.
rawId() << std::endl;
424 float width =
layer->surface().bounds().width();
430 float length =
layer->surface().bounds().length();
433 int firstChannel =
layer->specificTopology().firstChannel();
436 int lastChannel =
layer->specificTopology().lastChannel();
440 for (
int wireN = firstChannel; wireN - lastChannel <= 0; ++wireN) {
441 double localX1 =
layer->specificTopology().wirePosition(wireN);
444 wire_positions.push_back(localX1 - localX2);
461 for (
auto it =
chambers.begin(), itEnd =
chambers.end(); it != itEnd; ++it) {
471 std::cout <<
"Failed to get matrix of CSC chamber with detid: " << detId.
rawId() << std::endl;
480 std::cout <<
"Failed to get shape of CSC chamber with detid: " << detId.
rawId() << std::endl;
493 std::vector<double> strip_positions;
494 std::vector<double> wire_positions;
496 std::vector<double> me11_wiresLocal;
497 std::vector<double> me12_wiresLocal;
498 std::vector<double> me13_wiresLocal;
499 std::vector<double> me14_wiresLocal;
500 std::vector<double> me21_wiresLocal;
501 std::vector<double> me22_wiresLocal;
502 std::vector<double> me31_wiresLocal;
503 std::vector<double> me32_wiresLocal;
504 std::vector<double> me41_wiresLocal;
505 std::vector<double> me42_wiresLocal;
509 for (
auto it =
layers.begin(), itEnd =
layers.end(); it != itEnd; ++it) {
519 std::cout <<
"Failed to get matrix of CSC layer with detid: " << detId.
rawId() << std::endl;
528 std::cout <<
"Failed to get shape of CSC layer with detid: " << detId.
rawId() << std::endl;
541 std::cout <<
"Failed to get trapezoid from shape for CSC layer with detid: " << detId.
rawId() << std::endl;
548 std::cout <<
"Parameters empty for CSC layer with detid: " << detId.
rawId() << std::endl;
552 int yAxisOrientation =
layer->geometry()->topology()->yAxisOrientation();
555 float centreToIntersection =
layer->geometry()->topology()->centreToIntersection();
558 float yCentre =
layer->geometry()->topology()->yCentreOfStripPlane();
561 float phiOfOneEdge =
layer->geometry()->topology()->phiOfOneEdge();
564 float stripOffset =
layer->geometry()->topology()->stripOffset();
567 float angularWidth =
layer->geometry()->topology()->angularWidth();
570 for (
int nStrip = 1; nStrip <=
layer->geometry()->numberOfStrips(); ++nStrip) {
571 float xOfStrip1 =
layer->geometry()->xOfStrip(nStrip);
573 double stripAngle = phiOfOneEdge + yAxisOrientation * (nStrip - (0.5 - stripOffset)) * angularWidth;
574 double xOfStrip2 = yAxisOrientation * (centreToIntersection - yCentre) *
tan(stripAngle);
576 strip_positions.push_back(xOfStrip1 - xOfStrip2);
582 double wireSpacingInGroup =
layer->geometry()->wireTopology()->wireSpacing();
585 double wireSpacing = 0.0;
589 double extentOfWirePlane = 0.0;
593 extentOfWirePlane = 174.81;
595 extentOfWirePlane = 323.38;
597 extentOfWirePlane = 150.5;
599 extentOfWirePlane = 164.47;
601 extentOfWirePlane = 189.97;
603 extentOfWirePlane = 170.01;
605 extentOfWirePlane = 149.73;
607 float wireAngle =
layer->geometry()->wireTopology()->wireAngle();
618 double alignmentPinToFirstWire;
619 double yAlignmentFrame = 3.49;
623 alignmentPinToFirstWire = 1.065;
624 yAlignmentFrame = 0.0;
628 alignmentPinToFirstWire = 2.85;
632 alignmentPinToFirstWire = 3.04;
635 alignmentPinToFirstWire = 2.84;
638 alignmentPinToFirstWire = 2.87;
640 double yOfFirstWire = (yAlignmentFrame - length) + alignmentPinToFirstWire;
642 int nWireGroups =
layer->geometry()->numberOfWireGroups();
643 double E = extentOfWirePlane / nWireGroups;
645 for (
int nWireGroup = 1; nWireGroup <= nWireGroups; ++nWireGroup) {
646 LocalPoint centerOfWireGroup =
layer->geometry()->localCenterOfWireGroup(nWireGroup);
647 double yOfWire1 = centerOfWireGroup.
y();
651 double yOfWire2 = yOfFirstWire + ((nWireGroup - 1) * E);
652 yOfWire2 += wireSpacing * 0.5;
654 double ydiff_local = yOfWire1 - yOfWire2;
655 wire_positions.push_back(ydiff_local);
672 me11_wiresLocal.push_back(ydiff_local);
673 }
else if (
ring == 2) {
674 me12_wiresLocal.push_back(ydiff_local);
675 }
else if (
ring == 3) {
676 me13_wiresLocal.push_back(ydiff_local);
677 }
else if (
ring == 4) {
678 me14_wiresLocal.push_back(ydiff_local);
682 me21_wiresLocal.push_back(ydiff_local);
683 }
else if (
ring == 2) {
684 me22_wiresLocal.push_back(ydiff_local);
688 me31_wiresLocal.push_back(ydiff_local);
689 }
else if (
ring == 2) {
690 me32_wiresLocal.push_back(ydiff_local);
694 me41_wiresLocal.push_back(ydiff_local);
695 }
else if (
ring == 2) {
696 me42_wiresLocal.push_back(ydiff_local);
729 for (
auto it = ids.begin(), iEnd = ids.end(); it != iEnd; ++it) {
730 unsigned int rawId = (*it).rawId();
735 std::cout <<
"Failed to get points of " << detname <<
" element with detid: " << rawId << std::endl;
739 auto cellGeometry =
geometry->getGeometry(*it);
744 for (
unsigned int i = 0,
offset = 0;
i < 8; ++
i) {
760 for (TrackerGeometry::DetContainer::const_iterator it = dets.begin(), itEnd = dets.end(); it != itEnd; ++it) {
763 unsigned int rawId = (*it)->geographicalId().rawId();
768 std::cout <<
"Failed to get matrix of " << detname <<
" element with detid: " << rawId << std::endl;
777 std::cout <<
"Failed to get shape of " << detname <<
" element with detid: " << rawId << std::endl;
788 std::vector<double> pixelLocalXs;
789 std::vector<double> pixelLocalYs;
791 for (TrackerGeometry::DetContainer::const_iterator it = dets.begin(), itEnd = dets.end(); it != itEnd; ++it) {
792 unsigned int rawId = (*it)->geographicalId().rawId();
797 std::cout <<
"Parameters empty for " << detname <<
" element with detid: " << rawId << std::endl;
804 int nrows = rpt->nrows();
805 int ncolumns = rpt->ncolumns();
807 for (
int row = 1; row <= nrows; ++row) {
808 for (
int column = 1; column <= ncolumns; ++column) {
818 std::cout <<
"No topology for " << detname <<
" " << rawId << std::endl;
822 std::cout <<
"No geomDetUnit for " << detname <<
" " << rawId << std::endl;
831 std::vector<double> radialStripLocalXs;
832 std::vector<double> rectangularStripLocalXs;
834 for (TrackerGeometry::DetContainer::const_iterator it = dets.begin(), itEnd = dets.end(); it != itEnd; ++it) {
835 unsigned int rawId = (*it)->geographicalId().rawId();
840 std::cout <<
"Parameters empty for " << detname <<
" element with detid: " << rawId << std::endl;
858 dynamic_cast<const RadialStripTopology*>(&(det->specificType().specificTopology()))) {
866 float stripAngle1 = rst->stripAngle(
strip);
869 assert((stripAngle1 - stripAngle2) == 0);
874 radialStripLocalXs.push_back(stripPosition.
x() - stripX);
878 else if (dynamic_cast<const RectangularStripTopology*>(&(det->specificType().specificTopology()))) {
886 rectangularStripLocalXs.push_back(stripPosition.
x() - stripX);
890 else if (dynamic_cast<const TrapezoidalStripTopology*>(&(det->specificType().specificTopology()))) {
896 std::cout <<
"Failed to get pitch for " << detname <<
" " << rawId << std::endl;
900 std::cout <<
"Failed cast to StripTopology for " << detname <<
" " << rawId << std::endl;
908 makeHistogram(hn +
" radial strip localX", radialStripLocalXs);
909 makeHistogram(hn +
" rectangular strip localX", rectangularStripLocalXs);
913 double local[3] = {0.0, 0.0, 0.0};
924 double shape_topWidth;
925 double shape_bottomWidth;
927 double shape_thickness;
930 shape_topWidth = shape[2];
931 shape_bottomWidth = shape[1];
932 shape_length = shape[4];
933 shape_thickness = shape[3];
936 else if (shape[0] == 2) {
937 shape_topWidth = shape[1];
938 shape_bottomWidth = shape[1];
939 shape_length = shape[2];
940 shape_thickness = shape[3];
944 std::cout <<
"Failed to get box or trapezoid from shape" << std::endl;
948 double topWidth, bottomWidth;
954 std::array<const float, 4>
const& ps = tpbs->parameters();
964 else if ((dynamic_cast<const RectangularPlaneBounds*>(
bounds))) {
967 bottomWidth = topWidth;
972 std::cout <<
"Failed to get bounds" << std::endl;
985 topWidths_.push_back(fabs(shape_topWidth - topWidth));
986 bottomWidths_.push_back(fabs(shape_bottomWidth - bottomWidth));
987 lengths_.push_back(fabs(shape_length - length));
1001 (
p1.z() -
p2.z()) * (
p1.z() -
p2.z()));
1009 std::string gdn =
d +
": distance between points in global coordinates";
1012 std::string twn =
d +
": absolute difference between top widths (along X)";
1015 std::string bwn =
d +
": absolute difference between bottom widths (along X)";
1018 std::string ln =
d +
": absolute difference between lengths (along Y)";
1021 std::string tn =
d +
": absolute difference between thicknesses (along Z)";
1031 std::vector<double>::iterator it;
1033 it = std::min_element(
data.begin(),
data.end());
1036 it = std::max_element(
data.begin(),
data.end());
1039 std::vector<double>::iterator itEnd =
data.end();
1041 TH1D
hist(
name.c_str(),
name.c_str(), 100, minE * (1 + 0.10),
maxE * (1 + 0.10));
1043 for (it =
data.begin(); it != itEnd; ++it)
1046 hist.GetXaxis()->SetTitle(
"[cm]");
const DetContainer & detsTIB() const
virtual int nstrips() const =0
edm::ESHandle< CaloGeometry > caloGeometry_
edm::ESHandle< TrackerGeometry > trackerGeometry_
Point3DBase< Scalar, LocalTag > LocalPoint
virtual float length() const =0
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
std::vector< double > topWidths_
void validateTrackerGeometry(const TrackerGeometry::DetContainer &dets, const char *detname)
const DetContainer & detsPXB() const
edm::ESGetToken< CSCGeometry, MuonGeometryRecord > cscGeometryToken_
edm::ESHandle< RPCGeometry > rpcGeometry_
std::vector< double > bottomWidths_
Global3DPoint GlobalPoint
void makeHistograms(const char *detector)
const DetContainer & detsPXF() const
const GeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryToken_
edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeometryToken_
void makeHistogram(const std::string &name, std::vector< double > &data)
nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
constexpr std::array< uint8_t, layerIndexSize > layer
T getUntrackedParameter(std::string const &, T const &) const
void validateDTChamberGeometry()
virtual float thickness() const =0
std::vector< const GeomDet * > DetContainer
edm::ESGetToken< RPCGeometry, MuonGeometryRecord > rpcGeometryToken_
virtual float stripLength() const =0
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
const DetContainer & detsTOB() const
const float * getCorners(unsigned int id) const
void compareShape(const GeomDet *det, const float *shape)
void loadMap(const char *fileName)
void validateCaloGeometry(DetId::Detector detector, int subdetector, const char *detname)
void validateDTLayerGeometry()
Tan< T >::type tan(const T &t)
edm::ESHandle< DTGeometry > dtGeometry_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
#define DEFINE_FWK_MODULE(type)
void validateRPCGeometry(const int regionNumber, const char *regionName)
void validatePixelTopology(const TrackerGeometry::DetContainer &dets, const char *detname)
void validateCSCLayerGeometry(const int endcap, const char *detname)
static const int SubdetectorId
const TrackerGeomDet * idToDet(DetId) const override
float pixelLocalX(const double mpx, const float *)
const StripTopology & specificTopology() const
edm::ESHandle< CSCGeometry > cscGeometry_
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
float pixelLocalY(const double mpy, const float *)
const Plane & surface() const
The nominal surface of the GeomDet.
static const int SubdetectorId
const LayerContainer & layers() const
Return a vector of all layers.
double getDistance(const GlobalPoint &point1, const GlobalPoint &point2)
constexpr uint32_t rawId() const
get the raw id
ValidateGeometry(const edm::ParameterSet &)
const float * getShapePars(unsigned int id) const
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
char data[epos_bytes_allocation]
const float * getParameters(unsigned int id) const
const TGeoMatrix * getMatrix(unsigned int id) const
std::vector< double > thicknesses_
virtual float pitch() const =0
void analyze(const edm::Event &, const edm::EventSetup &) override
const std::vector< const RPCRoll * > & rolls() const
Return a vector of all RPC rolls.
virtual LocalPoint localPosition(float strip) const =0
const std::vector< const DTLayer * > & layers() const
Return a vector of all SuperLayer.
const DetContainer & detsTEC() const
const std::vector< const DTChamber * > & chambers() const
Return a vector of all Chamber.
void validateCSChamberGeometry(const int endcap, const char *detname)
const ChamberContainer & chambers() const
Return a vector of all chambers.
void validateStripTopology(const TrackerGeometry::DetContainer &dets, const char *detname)
static char chambers[264][20]
std::vector< double > lengths_
virtual float width() const =0
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
void compareTransform(const GlobalPoint &point, const TGeoMatrix *matrix)
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
std::vector< double > globalDistances_
const DetContainer & detsTID() const
LocalPoint centreOfStrip(int strip) const
~ValidateGeometry() override
const Bounds & bounds() const