55 #include <TEveGeoNode.h> 56 #include <TGeoVolume.h> 71 virtual void endJob()
override;
74 const char* regionName);
127 globalDistances_.clear();
129 bottomWidths_.clear();
131 thicknesses_.clear();
136 return (globalDistances_.empty() &&
137 topWidths_.empty() &&
138 bottomWidths_.empty() &&
140 thicknesses_.empty());
176 std::cout<<
"Validating RPC -z endcap geometry"<<std::endl;
179 std::cout<<
"Validating RPC +z endcap geometry"<<std::endl;
182 std::cout<<
"Validating RPC barrel geometry"<<std::endl;
193 std::cout<<
"Validating DT chamber geometry"<<std::endl;
196 std::cout<<
"Validating DT layer geometry"<<std::endl;
207 std::cout<<
"Validating CSC -z geometry"<<std::endl;
210 std::cout<<
"Validating CSC +z geometry"<<std::endl;
213 std::cout<<
"Validating CSC layer -z geometry"<<std::endl;
216 std::cout<<
"Validating CSC layer +z geometry"<<std::endl;
229 std::cout<<
"Validating TIB geometry and topology"<<std::endl;
233 std::cout<<
"Validating TOB geometry and topology"<<std::endl;
237 std::cout<<
"Validating TEC geometry and topology"<<std::endl;
241 std::cout<<
"Validating TID geometry and topology"<<std::endl;
245 std::cout<<
"Validating PXB geometry and topology"<<std::endl;
249 std::cout<<
"Validating PXF geometry and topology"<<std::endl;
264 std::cout<<
"Validating EB geometry"<<std::endl;
267 std::cout<<
"Validating EE geometry"<<std::endl;
270 std::cout<<
"Validating ES geometry"<<std::endl;
273 std::cout<<
"Validating HB geometry"<<std::endl;
276 std::cout<<
"Validating HE geometry"<<std::endl;
279 std::cout<<
"Validating HO geometry"<<std::endl;
282 std::cout<<
"Validating HF geometry"<<std::endl;
285 std::cout<<
"Validating Castor geometry"<<std::endl;
288 std::cout<<
"Validating ZDC geometry"<<std::endl;
302 std::vector<double> centers;
306 for (
auto it = rolls.begin(),
316 if ( rpcDetId.
region() == regionNumber )
325 std::cout<<
"Failed to get matrix of RPC with detid: " 326 << rpcDetId.
rawId() <<std::endl;
336 std::cout<<
"Failed to get shape of RPC with detid: " 337 << rpcDetId.
rawId() <<std::endl;
345 if ( parameters == 0 )
347 std::cout<<
"Parameters empty for RPC with detid: " 348 << rpcDetId.
rawId() <<std::endl;
356 assert(nStrips == parameters[0]);
359 assert(stripLength == parameters[1]);
362 assert(pitch == parameters[2]);
364 float offset = -0.5*nStrips*pitch;
371 centers.push_back(centreOfStrip1.
x()-centreOfStrip2.
x());
407 std::cout<<
"Failed to get matrix of DT chamber with detid: " 408 << chId.
rawId() <<std::endl;
418 std::cout<<
"Failed to get shape of DT chamber with detid: " 419 << chId.
rawId() <<std::endl;
436 std::vector<double> wire_positions;
440 for (
auto it =
layers.begin(),
455 std::cout<<
"Failed to get matrix of DT layer with detid: " 456 << layerId.
rawId() <<std::endl;
466 std::cout<<
"Failed to get shape of DT layer with detid: " 467 << layerId.
rawId() <<std::endl;
476 if ( parameters == 0 )
478 std::cout<<
"Parameters empty for DT layer with detid: " 479 << layerId.
rawId() <<std::endl;
484 assert(width == parameters[6]);
487 assert(thickness == parameters[7]);
490 assert(length == parameters[8]);
493 assert(firstChannel == parameters[3]);
497 assert(nChannels == (lastChannel-firstChannel)+1);
499 for (
int wireN = firstChannel; wireN - lastChannel <= 0; ++wireN )
502 double localX2 = (wireN -(firstChannel-1)-0.5)*parameters[0] - nChannels/2.0*parameters[0];
504 wire_positions.push_back(localX1-localX2);
540 std::cout<<
"Failed to get matrix of CSC chamber with detid: " 541 << detId.
rawId() <<std::endl;
551 std::cout<<
"Failed to get shape of CSC chamber with detid: " 552 << detId.
rawId() <<std::endl;
567 std::vector<double> strip_positions;
568 std::vector<double> wire_positions;
570 std::vector<double> me11_wiresLocal;
571 std::vector<double> me12_wiresLocal;
572 std::vector<double> me13_wiresLocal;
573 std::vector<double> me14_wiresLocal;
574 std::vector<double> me21_wiresLocal;
575 std::vector<double> me22_wiresLocal;
576 std::vector<double> me31_wiresLocal;
577 std::vector<double> me32_wiresLocal;
578 std::vector<double> me41_wiresLocal;
579 std::vector<double> me42_wiresLocal;
583 for (
auto it =
layers.begin(),
598 std::cout<<
"Failed to get matrix of CSC layer with detid: " 599 << detId.
rawId() <<std::endl;
609 std::cout<<
"Failed to get shape of CSC layer with detid: " 610 << detId.
rawId() <<std::endl;
625 std::cout<<
"Failed to get trapezoid from shape for CSC layer with detid: " 626 << detId.
rawId() <<std::endl;
632 if ( parameters == 0 )
634 std::cout<<
"Parameters empty for CSC layer with detid: " 635 << detId.
rawId() <<std::endl;
640 assert(yAxisOrientation == parameters[0]);
643 assert(centreToIntersection == parameters[1]);
646 assert(yCentre == parameters[2]);
649 assert(phiOfOneEdge == parameters[3]);
652 assert(stripOffset == parameters[4]);
655 assert(angularWidth == parameters[5]);
662 double stripAngle = phiOfOneEdge + yAxisOrientation*(nStrip-(0.5-stripOffset))*angularWidth;
663 double xOfStrip2 = yAxisOrientation*(centreToIntersection-yCentre)*
tan(stripAngle);
665 strip_positions.push_back(xOfStrip1-xOfStrip2);
672 assert(wireSpacingInGroup == parameters[6]);
674 double wireSpacing = 0.0;
678 double extentOfWirePlane = 0.0;
683 extentOfWirePlane = 174.81;
685 extentOfWirePlane = 323.38;
687 else if ( station == 1 && (ring == 1 || ring == 4))
688 extentOfWirePlane = 150.5;
689 else if ( station == 1 && ring == 3 )
690 extentOfWirePlane = 164.47;
691 else if ( station == 2 && ring == 1 )
692 extentOfWirePlane = 189.97;
693 else if ( station == 3 && ring == 1 )
694 extentOfWirePlane = 170.01;
695 else if ( station == 4 && ring == 1 )
696 extentOfWirePlane = 149.73;
699 assert(wireAngle == parameters[7]);
709 double alignmentPinToFirstWire;
710 double yAlignmentFrame = 3.49;
714 if ( ring == 1 || ring == 4 )
716 alignmentPinToFirstWire = 1.065;
717 yAlignmentFrame = 0.0;
721 alignmentPinToFirstWire = 2.85;
724 else if ( station == 4 && ring == 1 )
725 alignmentPinToFirstWire = 3.04;
727 else if ( station == 3 && ring == 1 )
728 alignmentPinToFirstWire = 2.84;
731 alignmentPinToFirstWire = 2.87;
733 double yOfFirstWire = (yAlignmentFrame-length) + alignmentPinToFirstWire;
736 double E = extentOfWirePlane/nWireGroups;
738 for (
int nWireGroup = 1; nWireGroup <= nWireGroups; ++nWireGroup )
741 double yOfWire1 = centerOfWireGroup.
y();
745 double yOfWire2 = yOfFirstWire + ((nWireGroup-1)*E);
746 yOfWire2 += wireSpacing*0.5;
748 double ydiff_local = yOfWire1 - yOfWire2;
749 wire_positions.push_back(ydiff_local);
768 me11_wiresLocal.push_back(ydiff_local);
770 else if ( ring == 2 )
772 me12_wiresLocal.push_back(ydiff_local);
774 else if ( ring == 3 )
776 me13_wiresLocal.push_back(ydiff_local);
778 else if ( ring == 4 )
780 me14_wiresLocal.push_back(ydiff_local);
783 else if ( station == 2 )
787 me21_wiresLocal.push_back(ydiff_local);
789 else if ( ring == 2 )
791 me22_wiresLocal.push_back(ydiff_local);
794 else if ( station == 3 )
798 me31_wiresLocal.push_back(ydiff_local);
800 else if ( ring == 2 )
802 me32_wiresLocal.push_back(ydiff_local);
805 else if ( station == 4 )
809 me41_wiresLocal.push_back(ydiff_local);
811 else if ( ring == 2 )
813 me42_wiresLocal.push_back(ydiff_local);
849 const std::vector<DetId>& ids = geometry->
getValidDetIds(detector, subdetector);
851 for (
auto it = ids.begin(),
855 unsigned int rawId = (*it).rawId();
861 std::cout <<
"Failed to get points of "<< detname
862 <<
" element with detid: "<< rawId <<std::endl;
869 assert(corners.
size() == 8);
871 for (
unsigned int i = 0,
offset = 0;
i < 8; ++
i )
892 for ( TrackerGeometry::DetContainer::const_iterator it = dets.begin(),
897 unsigned int rawId = (*it)->geographicalId().rawId();
903 std::cout <<
"Failed to get matrix of "<< detname
904 <<
" element with detid: "<< rawId <<std::endl;
914 std::cout<<
"Failed to get shape of "<< detname
915 <<
" element with detid: "<< rawId <<std::endl;
930 std::vector<double> pixelLocalXs;
931 std::vector<double> pixelLocalYs;
933 for ( TrackerGeometry::DetContainer::const_iterator it = dets.begin(),
937 unsigned int rawId = (*it)->geographicalId().rawId();
941 if ( parameters == 0 )
943 std::cout<<
"Parameters empty for "<< detname <<
" element with detid: " 944 << rawId <<std::endl;
953 int nrows = rpt->nrows();
954 int ncolumns = rpt->ncolumns();
956 for (
int row = 1; row <= nrows; ++row )
958 for (
int column = 1; column <= ncolumns; ++column )
969 std::cout<<
"No topology for "<< detname <<
" "<< rawId <<std::endl;
973 std::cout<<
"No geomDetUnit for "<< detname <<
" "<< rawId <<std::endl;
985 std::vector<double> radialStripLocalXs;
986 std::vector<double> rectangularStripLocalXs;
988 for ( TrackerGeometry::DetContainer::const_iterator it = dets.begin(),
992 unsigned int rawId = (*it)->geographicalId().rawId();
996 if ( parameters == 0 )
998 std::cout<<
"Parameters empty for "<< detname <<
" element with detid: " 999 << rawId <<std::endl;
1015 assert(parameters[1] == nstrips);
1018 if(
const RadialStripTopology* rst = dynamic_cast<const RadialStripTopology*>(&(det->specificType().specificTopology())) )
1020 assert(parameters[0] == 1);
1021 assert(parameters[3] == rst->yAxisOrientation());
1022 assert(parameters[4] == rst->originToIntersection());
1023 assert(parameters[5] == rst->phiOfOneEdge());
1024 assert(parameters[6] == rst->angularWidth());
1028 float stripAngle1 = rst->stripAngle(
strip);
1029 float stripAngle2 = parameters[3] * (parameters[5] +
strip*parameters[6]);
1031 assert((stripAngle1-stripAngle2) == 0);
1035 float stripX = parameters[4]*
tan(stripAngle2);
1036 radialStripLocalXs.push_back(stripPosition.
x()-stripX);
1040 else if( dynamic_cast<const RectangularStripTopology*>(&(det->specificType().specificTopology())) )
1042 assert(parameters[0] == 2);
1043 assert(parameters[3] == st->
pitch());
1048 float stripX = -parameters[1]*0.5*parameters[3];
1049 stripX +=
strip*parameters[3];
1050 rectangularStripLocalXs.push_back(stripPosition.
x()-stripX);
1054 else if( dynamic_cast<const TrapezoidalStripTopology*>(&(det->specificType().specificTopology())) )
1056 assert(parameters[0] == 3);
1057 assert(parameters[3] == st->
pitch());
1061 std::cout<<
"Failed to get pitch for "<< detname <<
" "<< rawId <<std::endl;
1065 std::cout<<
"Failed cast to StripTopology for "<< detname <<
" "<< rawId <<std::endl;
1073 makeHistogram(hn+
" radial strip localX", radialStripLocalXs);
1074 makeHistogram(hn+
" rectangular strip localX", rectangularStripLocalXs);
1080 const TGeoMatrix*
matrix)
1089 matrix->LocalToMaster(local, global);
1098 double shape_topWidth;
1099 double shape_bottomWidth;
1100 double shape_length;
1101 double shape_thickness;
1103 if ( shape[0] == 1 )
1105 shape_topWidth = shape[2];
1106 shape_bottomWidth = shape[1];
1107 shape_length = shape[4];
1108 shape_thickness = shape[3];
1111 else if ( shape[0] == 2 )
1113 shape_topWidth = shape[1];
1114 shape_bottomWidth = shape[1];
1115 shape_length = shape[2];
1116 shape_thickness = shape[3];
1121 std::cout<<
"Failed to get box or trapezoid from shape"<<std::endl;
1125 double topWidth, bottomWidth;
1126 double length, thickness;
1132 std::array<const float, 4>
const & ps = tpbs->parameters();
1134 assert(ps.size() == 4);
1136 bottomWidth = ps[0];
1142 else if ( (dynamic_cast<const RectangularPlaneBounds*>(bounds)) )
1146 bottomWidth = topWidth;
1152 std::cout<<
"Failed to get bounds"<<std::endl;
1165 topWidths_.push_back(fabs(shape_topWidth - topWidth));
1166 bottomWidths_.push_back(fabs(shape_bottomWidth - bottomWidth));
1167 lengths_.push_back(fabs(shape_length - length));
1168 thicknesses_.push_back(fabs(shape_thickness - thickness));
1185 return sqrt((p1.
x()-p2.
x())*(p1.
x()-p2.
x())+
1186 (p1.
y()-p2.
y())*(p1.
y()-p2.
y())+
1187 (p1.
z()-p2.
z())*(p1.
z()-p2.
z()));
1198 std::string gdn = d+
": distance between points in global coordinates";
1201 std::string twn = d +
": absolute difference between top widths (along X)";
1204 std::string bwn = d +
": absolute difference between bottom widths (along X)";
1207 std::string ln = d +
": absolute difference between lengths (along Y)";
1210 std::string tn = d +
": absolute difference between thicknesses (along Z)";
1223 std::vector<double>::iterator it;
1225 it = std::min_element(data.begin(), data.end());
1228 it = std::max_element(data.begin(), data.end());
1231 std::vector<double>::iterator itEnd = data.end();
1233 TH1D
hist(name.c_str(), name.c_str(), 100, minE*(1+0.10), maxE*(1+0.10));
1235 for ( it = data.begin(); it != itEnd; ++it )
1238 hist.GetXaxis()->SetTitle(
"[cm]");
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
T getUntrackedParameter(std::string const &, T const &) const
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
virtual float stripLength() const =0
edm::ESHandle< CaloGeometry > caloGeometry_
LocalPoint centreOfStrip(int strip) const
edm::ESHandle< TrackerGeometry > trackerGeometry_
virtual float length() const =0
const std::vector< const DTChamber * > & chambers() const
Return a vector of all Chamber.
Point3DBase< Scalar, LocalTag > LocalPoint
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
const CSCWireTopology * wireTopology() const
virtual void beginJob() override
std::vector< double > topWidths_
void validateTrackerGeometry(const TrackerGeometry::DetContainer &dets, const char *detname)
CSCDetId id() const
Get the (concrete) DetId.
float centreToIntersection() const override
const float * getParameters(unsigned int id) const
#define DEFINE_FWK_MODULE(type)
DTLayerId id() const
Return the DetId of this SL.
const std::vector< const RPCRoll * > & rolls() const
Return a vector of all RPC rolls.
edm::ESHandle< RPCGeometry > rpcGeometry_
std::vector< double > bottomWidths_
Global3DPoint GlobalPoint
void makeHistograms(const char *detector)
const Bounds & bounds() const
int numberOfStrips() const
const ChamberContainer & chambers() const
Return a vector of all chambers.
double wireSpacing() const
const TGeoMatrix * getMatrix(unsigned int id) const
const StripTopology & specificTopology() const
const Plane & surface() const
The nominal surface of the GeomDet.
int numberOfWireGroups() const
void makeHistogram(const std::string &name, std::vector< double > &data)
const GeomDetUnit * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
virtual const std::vector< DetId > & getValidDetIds(DetId::Detector det=DetId::Detector(0), int subdet=0) const
Get a list of valid detector ids (for the given subdetector)
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
int firstChannel() const
Returns the wire number of the first wire.
float xOfStrip(int strip, float y=0.) const
void validateDTChamberGeometry()
uint32_t rawId() const
get the raw id
virtual float width() const =0
const float * getShapePars(unsigned int id) const
int lastChannel() const
Returns the wire number of the last wire.
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
const DTTopology & specificTopology() const
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
const DetContainer & detsTEC() const
float yCentreOfStripPlane() const override
void compareShape(const GeomDet *det, const float *shape)
virtual LocalPoint localPosition(float strip) const =0
void loadMap(const char *fileName)
void validateCaloGeometry(DetId::Detector detector, int subdetector, const char *detname)
DTChamberId id() const
Return the DTChamberId of this chamber.
void validateDTLayerGeometry()
const DetContainer & detsPXB() const
Tan< T >::type tan(const T &t)
edm::ESHandle< DTGeometry > dtGeometry_
DetId geographicalId() const
The label of this GeomDet.
float phiOfOneEdge() const override
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
float pixelLocalX(const double mpx, const float *)
const DetContainer & detsTIB() const
edm::ESHandle< CSCGeometry > cscGeometry_
virtual void endJob() override
float pixelLocalY(const double mpy, const float *)
LocalPoint localCenterOfWireGroup(int wireGroup) const
const CSCStripTopology * topology() const
virtual float stripOffset(void) const
static const int SubdetectorId
float yAxisOrientation() const override
const float * getCorners(unsigned int id) const
double getDistance(const GlobalPoint &point1, const GlobalPoint &point2)
virtual float thickness() const =0
const std::vector< const DTLayer * > & layers() const
Return a vector of all SuperLayer.
virtual int nstrips() const =0
ValidateGeometry(const edm::ParameterSet &)
CornersVec const & getCorners() const
Returns the corner points of this cell's volume.
float angularWidth() const override
char data[epos_bytes_allocation]
std::vector< double > thicknesses_
const DetContainer & detsPXF() const
const TrackerGeomDet * idToDet(DetId) const override
const DetContainer & detsTOB() const
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
virtual float pitch() const =0
void validateCSChamberGeometry(const int endcap, const char *detname)
float wireAngle() const override
void validateStripTopology(const TrackerGeometry::DetContainer &dets, const char *detname)
static char chambers[264][20]
std::vector< double > lengths_
std::vector< GeomDet const * > DetContainer
const CSCLayerGeometry * geometry() const
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
const LayerContainer & layers() const
Return a vector of all layers.
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.