CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
ValidateGeometry Class Reference
Inheritance diagram for ValidateGeometry:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 ValidateGeometry (const edm::ParameterSet &)
 
 ~ValidateGeometry () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void clearData ()
 
void compareShape (const GeomDet *det, const float *shape)
 
void compareTransform (const GlobalPoint &point, const TGeoMatrix *matrix)
 
bool dataEmpty ()
 
void endJob () override
 
double getDistance (const GlobalPoint &point1, const GlobalPoint &point2)
 
void makeHistogram (const std::string &name, std::vector< double > &data)
 
void makeHistograms (const char *detector)
 
void validateCaloGeometry (DetId::Detector detector, int subdetector, const char *detname)
 
void validateCSChamberGeometry (const int endcap, const char *detname)
 
void validateCSCLayerGeometry (const int endcap, const char *detname)
 
void validateDTChamberGeometry ()
 
void validateDTLayerGeometry ()
 
void validatePixelTopology (const TrackerGeometry::DetContainer &dets, const char *detname)
 
void validateRPCGeometry (const int regionNumber, const char *regionName)
 
void validateStripTopology (const TrackerGeometry::DetContainer &dets, const char *detname)
 
void validateTrackerGeometry (const TrackerGeometry::DetContainer &dets, const char *detname)
 

Private Attributes

std::vector< double > bottomWidths_
 
edm::ESHandle< CaloGeometrycaloGeometry_
 
edm::ESHandle< CSCGeometrycscGeometry_
 
bool doCalo_
 
bool doMuon_
 
bool doTracker_
 
edm::ESHandle< DTGeometrydtGeometry_
 
FWGeometry fwGeometry_
 
std::vector< double > globalDistances_
 
std::string infileName_
 
std::vector< double > lengths_
 
TFile * outFile_
 
std::string outfileName_
 
edm::ESHandle< RPCGeometryrpcGeometry_
 
std::vector< double > thicknesses_
 
std::vector< double > topWidths_
 
edm::ESHandle< TrackerGeometrytrackerGeometry_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 62 of file ValidateGeometry.cc.

Constructor & Destructor Documentation

ValidateGeometry::ValidateGeometry ( const edm::ParameterSet iConfig)
explicit

Definition at line 135 of file ValidateGeometry.cc.

References doCalo_, doMuon_, doTracker_, fwGeometry_, edm::ParameterSet::getUntrackedParameter(), infileName_, FWGeometry::loadMap(), outFile_, and outfileName_.

136  : infileName_(iConfig.getUntrackedParameter<std::string>("infileName")),
137  outfileName_(iConfig.getUntrackedParameter<std::string>("outfileName")) {
138  doTracker_ = iConfig.getUntrackedParameter<bool>("Tracker", true);
139  doMuon_ = iConfig.getUntrackedParameter<bool>("Muon", true);
140  doCalo_ = iConfig.getUntrackedParameter<bool>("Calo", true);
141 
143 
144  outFile_ = new TFile(outfileName_.c_str(), "RECREATE");
145 }
T getUntrackedParameter(std::string const &, T const &) const
void loadMap(const char *fileName)
Definition: FWGeometry.cc:99
std::string infileName_
std::string outfileName_
ValidateGeometry::~ValidateGeometry ( )
override

Definition at line 147 of file ValidateGeometry.cc.

147 {}

Member Function Documentation

void ValidateGeometry::analyze ( const edm::Event event,
const edm::EventSetup eventSetup 
)
overrideprivate

Definition at line 149 of file ValidateGeometry.cc.

References DetId::Calo, caloGeometry_, gather_cfg::cout, cscGeometry_, TrackerGeometry::detsPXB(), TrackerGeometry::detsPXF(), TrackerGeometry::detsTEC(), TrackerGeometry::detsTIB(), TrackerGeometry::detsTID(), TrackerGeometry::detsTOB(), doCalo_, doMuon_, doTracker_, dtGeometry_, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, fwLog, edm::EventSetup::get(), DetId::Hcal, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, edm::ESHandleBase::isValid(), fwlog::kWarning, rpcGeometry_, HcalZDCDetId::SubdetectorId, HcalCastorDetId::SubdetectorId, trackerGeometry_, validateCaloGeometry(), validateCSChamberGeometry(), validateCSCLayerGeometry(), validateDTChamberGeometry(), validateDTLayerGeometry(), validatePixelTopology(), validateRPCGeometry(), validateStripTopology(), and validateTrackerGeometry().

149  {
150  if (doMuon_) {
151  eventSetup.get<MuonGeometryRecord>().get(rpcGeometry_);
152 
153  if (rpcGeometry_.isValid()) {
154  std::cout << "Validating RPC -z endcap geometry" << std::endl;
155  validateRPCGeometry(-1, "RPC -z endcap");
156 
157  std::cout << "Validating RPC +z endcap geometry" << std::endl;
158  validateRPCGeometry(+1, "RPC +z endcap");
159 
160  std::cout << "Validating RPC barrel geometry" << std::endl;
161  validateRPCGeometry(0, "RPC barrel");
162  } else
163  fwLog(fwlog::kWarning) << "Invalid RPC geometry" << std::endl;
164 
165  eventSetup.get<MuonGeometryRecord>().get(dtGeometry_);
166 
167  if (dtGeometry_.isValid()) {
168  std::cout << "Validating DT chamber geometry" << std::endl;
170 
171  std::cout << "Validating DT layer geometry" << std::endl;
173  } else
174  fwLog(fwlog::kWarning) << "Invalid DT geometry" << std::endl;
175 
176  eventSetup.get<MuonGeometryRecord>().get(cscGeometry_);
177 
178  if (cscGeometry_.isValid()) {
179  std::cout << "Validating CSC -z geometry" << std::endl;
180  validateCSChamberGeometry(-1, "CSC chamber -z endcap");
181 
182  std::cout << "Validating CSC +z geometry" << std::endl;
183  validateCSChamberGeometry(+1, "CSC chamber +z endcap");
184 
185  std::cout << "Validating CSC layer -z geometry" << std::endl;
186  validateCSCLayerGeometry(-1, "CSC layer -z endcap");
187 
188  std::cout << "Validating CSC layer +z geometry" << std::endl;
189  validateCSCLayerGeometry(+1, "CSC layer +z endcap");
190  } else
191  fwLog(fwlog::kWarning) << "Invalid CSC geometry" << std::endl;
192  }
193 
194  if (doTracker_) {
196 
197  if (trackerGeometry_.isValid()) {
198  std::cout << "Validating TIB geometry and topology" << std::endl;
201 
202  std::cout << "Validating TOB geometry and topology" << std::endl;
205 
206  std::cout << "Validating TEC geometry and topology" << std::endl;
209 
210  std::cout << "Validating TID geometry and topology" << std::endl;
213 
214  std::cout << "Validating PXB geometry and topology" << std::endl;
217 
218  std::cout << "Validating PXF geometry and topology" << std::endl;
221  } else
222  fwLog(fwlog::kWarning) << "Invalid Tracker geometry" << std::endl;
223  }
224 
225  if (doCalo_) {
226  eventSetup.get<CaloGeometryRecord>().get(caloGeometry_);
227 
228  if (caloGeometry_.isValid()) {
229  std::cout << "Validating EB geometry" << std::endl;
231 
232  std::cout << "Validating EE geometry" << std::endl;
234 
235  std::cout << "Validating ES geometry" << std::endl;
237 
238  std::cout << "Validating HB geometry" << std::endl;
240 
241  std::cout << "Validating HE geometry" << std::endl;
243 
244  std::cout << "Validating HO geometry" << std::endl;
246 
247  std::cout << "Validating HF geometry" << std::endl;
249 
250  std::cout << "Validating Castor geometry" << std::endl;
252 
253  std::cout << "Validating ZDC geometry" << std::endl;
255  } else
256  fwLog(fwlog::kWarning) << "Invalid Calo geometry" << std::endl;
257  }
258 }
edm::ESHandle< CaloGeometry > caloGeometry_
edm::ESHandle< TrackerGeometry > trackerGeometry_
void validateTrackerGeometry(const TrackerGeometry::DetContainer &dets, const char *detname)
edm::ESHandle< RPCGeometry > rpcGeometry_
void validateDTChamberGeometry()
const DetContainer & detsTEC() const
void validateCaloGeometry(DetId::Detector detector, int subdetector, const char *detname)
const DetContainer & detsPXB() const
edm::ESHandle< DTGeometry > dtGeometry_
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 DetContainer & detsTIB() const
edm::ESHandle< CSCGeometry > cscGeometry_
static const int SubdetectorId
Definition: HcalZDCDetId.h:25
#define fwLog(_level_)
Definition: fwLog.h:45
T get() const
Definition: EventSetup.h:73
const DetContainer & detsPXF() const
const DetContainer & detsTOB() const
void validateCSChamberGeometry(const int endcap, const char *detname)
void validateStripTopology(const TrackerGeometry::DetContainer &dets, const char *detname)
bool isValid() const
Definition: ESHandle.h:44
const DetContainer & detsTID() const
void ValidateGeometry::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 1032 of file ValidateGeometry.cc.

References outFile_.

1032 { outFile_->cd(); }
void ValidateGeometry::clearData ( )
inlineprivate

Definition at line 117 of file ValidateGeometry.cc.

Referenced by validateCaloGeometry(), validateCSChamberGeometry(), validateCSCLayerGeometry(), validateDTChamberGeometry(), validateDTLayerGeometry(), validateRPCGeometry(), and validateTrackerGeometry().

117  {
118  globalDistances_.clear();
119  topWidths_.clear();
120  bottomWidths_.clear();
121  lengths_.clear();
122  thicknesses_.clear();
123  }
std::vector< double > topWidths_
std::vector< double > bottomWidths_
std::vector< double > thicknesses_
std::vector< double > lengths_
std::vector< double > globalDistances_
void ValidateGeometry::compareShape ( const GeomDet det,
const float *  shape 
)
private

Definition at line 905 of file ValidateGeometry.cc.

References bottomWidths_, Surface::bounds(), gather_cfg::cout, Bounds::length(), lengths_, GeomDet::surface(), Bounds::thickness(), Calorimetry_cff::thickness, thicknesses_, topWidths_, and Bounds::width().

Referenced by validateCSChamberGeometry(), validateCSCLayerGeometry(), validateDTChamberGeometry(), validateDTLayerGeometry(), validateRPCGeometry(), and validateTrackerGeometry().

905  {
906  double shape_topWidth;
907  double shape_bottomWidth;
908  double shape_length;
909  double shape_thickness;
910 
911  if (shape[0] == 1) {
912  shape_topWidth = shape[2];
913  shape_bottomWidth = shape[1];
914  shape_length = shape[4];
915  shape_thickness = shape[3];
916  }
917 
918  else if (shape[0] == 2) {
919  shape_topWidth = shape[1];
920  shape_bottomWidth = shape[1];
921  shape_length = shape[2];
922  shape_thickness = shape[3];
923  }
924 
925  else {
926  std::cout << "Failed to get box or trapezoid from shape" << std::endl;
927  return;
928  }
929 
930  double topWidth, bottomWidth;
931  double length, thickness;
932 
933  const Bounds* bounds = &(det->surface().bounds());
934 
935  if (const TrapezoidalPlaneBounds* tpbs = dynamic_cast<const TrapezoidalPlaneBounds*>(bounds)) {
936  std::array<const float, 4> const& ps = tpbs->parameters();
937 
938  assert(ps.size() == 4);
939 
940  bottomWidth = ps[0];
941  topWidth = ps[1];
942  thickness = ps[2];
943  length = ps[3];
944  }
945 
946  else if ((dynamic_cast<const RectangularPlaneBounds*>(bounds))) {
947  length = det->surface().bounds().length() * 0.5;
948  topWidth = det->surface().bounds().width() * 0.5;
949  bottomWidth = topWidth;
950  thickness = det->surface().bounds().thickness() * 0.5;
951  }
952 
953  else {
954  std::cout << "Failed to get bounds" << std::endl;
955  return;
956  }
957 
958  //assert((tgeotrap && trapezoid) || (tgeobbox && rectangle));
959 
960  /*
961  std::cout<<"topWidth: "<< shape_topWidth <<" "<< topWidth <<std::endl;
962  std::cout<<"bottomWidth: "<< shape_bottomWidth <<" "<< bottomWidth <<std::endl;
963  std::cout<<"length: "<< shape_length <<" "<< length <<std::endl;
964  std::cout<<"thickness: "<< shape_thickness <<" "<< thickness <<std::endl;
965  */
966 
967  topWidths_.push_back(fabs(shape_topWidth - topWidth));
968  bottomWidths_.push_back(fabs(shape_bottomWidth - bottomWidth));
969  lengths_.push_back(fabs(shape_length - length));
970  thicknesses_.push_back(fabs(shape_thickness - thickness));
971 
972  return;
973 }
virtual float length() const =0
std::vector< double > topWidths_
std::vector< double > bottomWidths_
const Bounds & bounds() const
Definition: Surface.h:89
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
virtual float width() const =0
virtual float thickness() const =0
std::vector< double > thicknesses_
Definition: Bounds.h:20
std::vector< double > lengths_
void ValidateGeometry::compareTransform ( const GlobalPoint point,
const TGeoMatrix *  matrix 
)
private

Definition at line 894 of file ValidateGeometry.cc.

References HLT_2018_cff::distance, getDistance(), globalDistances_, and DTRecHitClients_cfi::local.

Referenced by validateCSChamberGeometry(), validateCSCLayerGeometry(), validateDTChamberGeometry(), validateDTLayerGeometry(), validateRPCGeometry(), and validateTrackerGeometry().

894  {
895  double local[3] = {0.0, 0.0, 0.0};
896 
897  double global[3];
898 
899  matrix->LocalToMaster(local, global);
900 
901  double distance = getDistance(GlobalPoint(global[0], global[1], global[2]), gp);
902  globalDistances_.push_back(distance);
903 }
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
double getDistance(const GlobalPoint &point1, const GlobalPoint &point2)
std::vector< double > globalDistances_
bool ValidateGeometry::dataEmpty ( )
inlineprivate

Definition at line 125 of file ValidateGeometry.cc.

125  {
126  return (globalDistances_.empty() && topWidths_.empty() && bottomWidths_.empty() && lengths_.empty() &&
127  thicknesses_.empty());
128  }
std::vector< double > topWidths_
std::vector< double > bottomWidths_
std::vector< double > thicknesses_
std::vector< double > lengths_
std::vector< double > globalDistances_
void ValidateGeometry::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 1034 of file ValidateGeometry.cc.

References gather_cfg::cout, DEFINE_FWK_MODULE, outFile_, and outfileName_.

1034  {
1035  std::cout << "Done. " << std::endl;
1036  std::cout << "Results written to " << outfileName_ << std::endl;
1037  outFile_->Close();
1038 }
std::string outfileName_
double ValidateGeometry::getDistance ( const GlobalPoint point1,
const GlobalPoint point2 
)
private

Definition at line 975 of file ValidateGeometry.cc.

References mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by Vispa.Gui.VispaWidget.VispaWidget::_initTextField(), Vispa.Gui.VispaWidget.VispaWidget::_initTitleField(), Vispa.Gui.ConnectableWidget.ConnectableWidget::arrangePorts(), Vispa.Gui.WidgetContainer.WidgetContainer::autolayoutChildren(), Vispa.Views.LineDecayView.LineDecayContainer::autolayoutThreadFinished(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Gui.ConnectableWidget.ConnectableWidget::centerSinglePortVertically(), Vispa.Views.LineDecayView.LineDecayContainer::childrenRect(), compareTransform(), Vispa.Gui.VispaWidget.VispaWidget::contentRect(), Vispa.Gui.WidgetContainer.WidgetContainer::contentStartX(), Vispa.Gui.WidgetContainer.WidgetContainer::contentStartY(), Vispa.Gui.VispaWidget.VispaWidget::defineArrowBackgroundShape(), Vispa.Gui.VispaWidget.VispaWidget::defineRectBackgroundShape(), Vispa.Gui.VispaWidget.VispaWidget::defineRoundRectBackgroundShape(), Vispa.Gui.VispaWidget.VispaWidget::drawHeaderBackground(), Vispa.Gui.MenuWidget.MenuWidget::drawMenuEntries(), Vispa.Gui.ConnectableWidget.ConnectableWidget::drawPortLines(), Vispa.Gui.ConnectableWidget.ConnectableWidget::drawPortNames(), Vispa.Gui.VispaWidget.VispaWidget::drawTextField(), Vispa.Gui.VispaWidget.VispaWidget::drawTitle(), Vispa.Gui.ConnectableWidget.ConnectableWidget::dropArea(), Vispa.Gui.VispaWidget.VispaWidget::height(), Vispa.Gui.VispaWidget.VispaWidget::imageRectF(), Vispa.Gui.VispaWidget.VispaWidget::isTitlePoint(), Vispa.Gui.WidgetContainer.WidgetContainer::mouseDoubleClickEvent(), Vispa.Gui.WidgetContainer.WidgetContainer::mouseMoveEvent(), Vispa.Gui.VispaWidget.VispaWidget::paint(), Vispa.Gui.VispaWidget.VispaWidget::rearangeContent(), Vispa.Gui.WidgetContainer.WidgetContainer::sizeHint(), Vispa.Gui.ConnectableWidget.ConnectableWidget::sizeHint(), Vispa.Gui.VispaWidget.VispaWidget::sizeHint(), validateCaloGeometry(), and Vispa.Gui.VispaWidget.VispaWidget::width().

975  {
976  /*
977  std::cout<<"X: "<< p1.x() <<" "<< p2.x() <<std::endl;
978  std::cout<<"Y: "<< p1.y() <<" "<< p2.y() <<std::endl;
979  std::cout<<"Z: "<< p1.z() <<" "<< p2.z() <<std::endl;
980  */
981 
982  return sqrt((p1.x() - p2.x()) * (p1.x() - p2.x()) + (p1.y() - p2.y()) * (p1.y() - p2.y()) +
983  (p1.z() - p2.z()) * (p1.z() - p2.z()));
984 }
T sqrt(T t)
Definition: SSEVec.h:19
double p2[4]
Definition: TauolaWrapper.h:90
double p1[4]
Definition: TauolaWrapper.h:89
void ValidateGeometry::makeHistogram ( const std::string &  name,
std::vector< double > &  data 
)
private

Definition at line 1009 of file ValidateGeometry.cc.

References compare::hist, and HLT_2018_cff::maxE.

Referenced by makeHistograms(), validateCSCLayerGeometry(), validateDTLayerGeometry(), validatePixelTopology(), validateRPCGeometry(), and validateStripTopology().

1009  {
1010  if (data.empty())
1011  return;
1012 
1013  std::vector<double>::iterator it;
1014 
1015  it = std::min_element(data.begin(), data.end());
1016  double minE = *it;
1017 
1018  it = std::max_element(data.begin(), data.end());
1019  double maxE = *it;
1020 
1021  std::vector<double>::iterator itEnd = data.end();
1022 
1023  TH1D hist(name.c_str(), name.c_str(), 100, minE * (1 + 0.10), maxE * (1 + 0.10));
1024 
1025  for (it = data.begin(); it != itEnd; ++it)
1026  hist.Fill(*it);
1027 
1028  hist.GetXaxis()->SetTitle("[cm]");
1029  hist.Write();
1030 }
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
void ValidateGeometry::makeHistograms ( const char *  detector)
private

Definition at line 986 of file ValidateGeometry.cc.

References bottomWidths_, ztail::d, globalDistances_, lengths_, makeHistogram(), outFile_, AlCaHLTBitMon_QueryRunRegistry::string, thicknesses_, and topWidths_.

Referenced by validateCaloGeometry(), validateCSChamberGeometry(), validateCSCLayerGeometry(), validateDTChamberGeometry(), validateDTLayerGeometry(), validateRPCGeometry(), and validateTrackerGeometry().

986  {
987  outFile_->cd();
988 
990 
991  std::string gdn = d + ": distance between points in global coordinates";
993 
994  std::string twn = d + ": absolute difference between top widths (along X)";
996 
997  std::string bwn = d + ": absolute difference between bottom widths (along X)";
999 
1000  std::string ln = d + ": absolute difference between lengths (along Y)";
1001  makeHistogram(ln, lengths_);
1002 
1003  std::string tn = d + ": absolute difference between thicknesses (along Z)";
1005 
1006  return;
1007 }
std::vector< double > topWidths_
std::vector< double > bottomWidths_
void makeHistogram(const std::string &name, std::vector< double > &data)
d
Definition: ztail.py:151
std::vector< double > thicknesses_
std::vector< double > lengths_
std::vector< double > globalDistances_
void ValidateGeometry::validateCaloGeometry ( DetId::Detector  detector,
int  subdetector,
const char *  detname 
)
private

Definition at line 704 of file ValidateGeometry.cc.

References caloGeometry_, clearData(), gather_cfg::cout, HLT_2018_cff::distance, fwGeometry_, FWGeometry::getCorners(), getDistance(), CaloSubdetectorGeometry::getGeometry(), CaloGeometry::getSubdetectorGeometry(), CaloSubdetectorGeometry::getValidDetIds(), globalDistances_, mps_fire::i, photons_cff::ids, makeHistograms(), hltrates_dqm_sourceclient-live_cfg::offset, HLT_2018_cff::points, EZArrayFL< T >::size(), x, y, and z.

Referenced by analyze().

704  {
705  clearData();
706 
708 
709  const std::vector<DetId>& ids = geometry->getValidDetIds(detector, subdetector);
710 
711  for (auto it = ids.begin(), iEnd = ids.end(); it != iEnd; ++it) {
712  unsigned int rawId = (*it).rawId();
713 
714  const float* points = fwGeometry_.getCorners(rawId);
715 
716  if (points == nullptr) {
717  std::cout << "Failed to get points of " << detname << " element with detid: " << rawId << std::endl;
718  continue;
719  }
720 
721  auto cellGeometry = geometry->getGeometry(*it);
722  const CaloCellGeometry::CornersVec& corners = cellGeometry->getCorners();
723 
724  assert(corners.size() == 8);
725 
726  for (unsigned int i = 0, offset = 0; i < 8; ++i) {
727  offset = 2 * i;
728 
729  double distance = getDistance(GlobalPoint(points[i + offset], points[i + 1 + offset], points[i + 2 + offset]),
730  GlobalPoint(corners[i].x(), corners[i].y(), corners[i].z()));
731 
732  globalDistances_.push_back(distance);
733  }
734  }
735 
736  makeHistograms(detname);
737 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
edm::ESHandle< CaloGeometry > caloGeometry_
TString subdetector
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
void makeHistograms(const char *detector)
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)
size_type size() const
Definition: EZArrayFL.h:67
const float * getCorners(unsigned int id) const
Definition: FWGeometry.cc:463
double getDistance(const GlobalPoint &point1, const GlobalPoint &point2)
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
std::vector< double > globalDistances_
void ValidateGeometry::validateCSChamberGeometry ( const int  endcap,
const char *  detname 
)
private

Definition at line 438 of file ValidateGeometry.cc.

References relativeConstraints::chamber, CSCGeometry::chambers(), chambers, clearData(), compareShape(), compareTransform(), gather_cfg::cout, cscGeometry_, CSCDetId::endcap(), makeMuonMisalignmentScenario::endcap, fwGeometry_, GeomDet::geographicalId(), FWGeometry::getMatrix(), FWGeometry::getShapePars(), runTauDisplay::gp, CSCChamber::id(), makeHistograms(), makeMuonMisalignmentScenario::matrix, DetId::rawId(), GeomDet::surface(), and Surface::toGlobal().

Referenced by analyze().

438  {
439  clearData();
440 
441  auto const& chambers = cscGeometry_->chambers();
442 
443  for (auto it = chambers.begin(), itEnd = chambers.end(); it != itEnd; ++it) {
444  const CSCChamber* chamber = *it;
445 
446  if (chamber && chamber->id().endcap() == endcap) {
447  DetId detId = chamber->geographicalId();
448  GlobalPoint gp = chamber->surface().toGlobal(LocalPoint(0.0, 0.0, 0.0));
449 
450  const TGeoMatrix* matrix = fwGeometry_.getMatrix(detId.rawId());
451 
452  if (!matrix) {
453  std::cout << "Failed to get matrix of CSC chamber with detid: " << detId.rawId() << std::endl;
454  continue;
455  }
456 
457  compareTransform(gp, matrix);
458 
459  const float* shape = fwGeometry_.getShapePars(detId.rawId());
460 
461  if (!shape) {
462  std::cout << "Failed to get shape of CSC chamber with detid: " << detId.rawId() << std::endl;
463  continue;
464  }
465 
466  compareShape(chamber, shape);
467  }
468  }
469 
470  makeHistograms(detname);
471 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:81
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
CSCDetId id() const
Get the (concrete) DetId.
Definition: CSCChamber.h:34
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
void makeHistograms(const char *detector)
const ChamberContainer & chambers() const
Return a vector of all chambers.
Definition: CSCGeometry.cc:96
const TGeoMatrix * getMatrix(unsigned int id) const
Definition: FWGeometry.cc:221
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
int endcap() const
Definition: CSCDetId.h:85
const float * getShapePars(unsigned int id) const
Definition: FWGeometry.cc:485
void compareShape(const GeomDet *det, const float *shape)
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
edm::ESHandle< CSCGeometry > cscGeometry_
Definition: DetId.h:17
static char chambers[264][20]
Definition: ReadPGInfo.cc:243
void compareTransform(const GlobalPoint &point, const TGeoMatrix *matrix)
void ValidateGeometry::validateCSCLayerGeometry ( const int  endcap,
const char *  detname 
)
private

Definition at line 473 of file ValidateGeometry.cc.

References CSCRadialStripTopology::angularWidth(), CSCRadialStripTopology::centreToIntersection(), clearData(), compareShape(), compareTransform(), gather_cfg::cout, cscGeometry_, CSCDetId::endcap(), makeMuonMisalignmentScenario::endcap, fwGeometry_, GeomDet::geographicalId(), CSCLayer::geometry(), FWGeometry::getMatrix(), FWGeometry::getParameters(), FWGeometry::getShapePars(), runTauDisplay::gp, CSCLayer::id(), hgcalTopologyTester_cfi::layers, CSCGeometry::layers(), CSCLayerGeometry::localCenterOfWireGroup(), makeHistogram(), makeHistograms(), makeMuonMisalignmentScenario::matrix, CSCLayerGeometry::numberOfStrips(), CSCLayerGeometry::numberOfWireGroups(), CSCRadialStripTopology::phiOfOneEdge(), DetId::rawId(), relativeConstraints::ring, CSCDetId::ring(), relativeConstraints::station, CSCDetId::station(), AlCaHLTBitMon_QueryRunRegistry::string, OffsetRadialStripTopology::stripOffset(), GeomDet::surface(), funct::tan(), Surface::toGlobal(), CSCLayerGeometry::topology(), CSCWireTopology::wireAngle(), CSCWireTopology::wireSpacing(), CSCLayerGeometry::wireTopology(), CSCLayerGeometry::xOfStrip(), PV3DBase< T, PVType, FrameType >::y(), CSCRadialStripTopology::yAxisOrientation(), and CSCRadialStripTopology::yCentreOfStripPlane().

Referenced by analyze().

473  {
474  clearData();
475  std::vector<double> strip_positions;
476  std::vector<double> wire_positions;
477 
478  std::vector<double> me11_wiresLocal;
479  std::vector<double> me12_wiresLocal;
480  std::vector<double> me13_wiresLocal;
481  std::vector<double> me14_wiresLocal;
482  std::vector<double> me21_wiresLocal;
483  std::vector<double> me22_wiresLocal;
484  std::vector<double> me31_wiresLocal;
485  std::vector<double> me32_wiresLocal;
486  std::vector<double> me41_wiresLocal;
487  std::vector<double> me42_wiresLocal;
488 
489  auto const& layers = cscGeometry_->layers();
490 
491  for (auto it = layers.begin(), itEnd = layers.end(); it != itEnd; ++it) {
492  const CSCLayer* layer = *it;
493 
494  if (layer && layer->id().endcap() == endcap) {
495  DetId detId = layer->geographicalId();
496  GlobalPoint gp = layer->surface().toGlobal(LocalPoint(0.0, 0.0, 0.0));
497 
498  const TGeoMatrix* matrix = fwGeometry_.getMatrix(detId.rawId());
499 
500  if (!matrix) {
501  std::cout << "Failed to get matrix of CSC layer with detid: " << detId.rawId() << std::endl;
502  continue;
503  }
504 
505  compareTransform(gp, matrix);
506 
507  const float* shape = fwGeometry_.getShapePars(detId.rawId());
508 
509  if (!shape) {
510  std::cout << "Failed to get shape of CSC layer with detid: " << detId.rawId() << std::endl;
511  continue;
512  }
513 
514  compareShape(layer, shape);
515 
516  double length;
517 
518  if (shape[0] == 1) {
519  length = shape[4];
520  }
521 
522  else {
523  std::cout << "Failed to get trapezoid from shape for CSC layer with detid: " << detId.rawId() << std::endl;
524  continue;
525  }
526 
527  const float* parameters = fwGeometry_.getParameters(detId.rawId());
528 
529  if (parameters == nullptr) {
530  std::cout << "Parameters empty for CSC layer with detid: " << detId.rawId() << std::endl;
531  continue;
532  }
533 
534  int yAxisOrientation = layer->geometry()->topology()->yAxisOrientation();
535  assert(yAxisOrientation == parameters[0]);
536 
537  float centreToIntersection = layer->geometry()->topology()->centreToIntersection();
538  assert(centreToIntersection == parameters[1]);
539 
540  float yCentre = layer->geometry()->topology()->yCentreOfStripPlane();
541  assert(yCentre == parameters[2]);
542 
543  float phiOfOneEdge = layer->geometry()->topology()->phiOfOneEdge();
544  assert(phiOfOneEdge == parameters[3]);
545 
546  float stripOffset = layer->geometry()->topology()->stripOffset();
547  assert(stripOffset == parameters[4]);
548 
549  float angularWidth = layer->geometry()->topology()->angularWidth();
550  assert(angularWidth == parameters[5]);
551 
552  for (int nStrip = 1; nStrip <= layer->geometry()->numberOfStrips(); ++nStrip) {
553  float xOfStrip1 = layer->geometry()->xOfStrip(nStrip);
554 
555  double stripAngle = phiOfOneEdge + yAxisOrientation * (nStrip - (0.5 - stripOffset)) * angularWidth;
556  double xOfStrip2 = yAxisOrientation * (centreToIntersection - yCentre) * tan(stripAngle);
557 
558  strip_positions.push_back(xOfStrip1 - xOfStrip2);
559  }
560 
561  int station = layer->id().station();
562  int ring = layer->id().ring();
563 
564  double wireSpacingInGroup = layer->geometry()->wireTopology()->wireSpacing();
565  assert(wireSpacingInGroup == parameters[6]);
566 
567  double wireSpacing = 0.0;
568  // we calculate an average wire group
569  // spacing from radialExtentOfTheWirePlane / numOfWireGroups
570 
571  double extentOfWirePlane = 0.0;
572 
573  if (ring == 2) {
574  if (station == 1)
575  extentOfWirePlane = 174.81; //wireSpacing = 174.81/64;
576  else
577  extentOfWirePlane = 323.38; //wireSpacing = 323.38/64;
578  } else if (station == 1 && (ring == 1 || ring == 4))
579  extentOfWirePlane = 150.5; //wireSpacing = 150.5/48;
580  else if (station == 1 && ring == 3)
581  extentOfWirePlane = 164.47; //wireSpacing = 164.47/32;
582  else if (station == 2 && ring == 1)
583  extentOfWirePlane = 189.97; //wireSpacing = 189.97/112;
584  else if (station == 3 && ring == 1)
585  extentOfWirePlane = 170.01; //wireSpacing = 170.01/96;
586  else if (station == 4 && ring == 1)
587  extentOfWirePlane = 149.73; //wireSpacing = 149.73/96;
588 
589  float wireAngle = layer->geometry()->wireTopology()->wireAngle();
590  assert(wireAngle == parameters[7]);
591 
592  //float cosWireAngle = cos(wireAngle);
593 
594  /* NOTE
595  Some parameters don't seem available in a public interface
596  so have to perhaps hard-code. This may not be too bad as there
597  seems to be a lot of degeneracy.
598  */
599 
600  double alignmentPinToFirstWire;
601  double yAlignmentFrame = 3.49;
602 
603  if (station == 1) {
604  if (ring == 1 || ring == 4) {
605  alignmentPinToFirstWire = 1.065;
606  yAlignmentFrame = 0.0;
607  }
608 
609  else // ME12, ME 13
610  alignmentPinToFirstWire = 2.85;
611  }
612 
613  else if (station == 4 && ring == 1)
614  alignmentPinToFirstWire = 3.04;
615 
616  else if (station == 3 && ring == 1)
617  alignmentPinToFirstWire = 2.84;
618 
619  else // ME21, ME22, ME32, ME42
620  alignmentPinToFirstWire = 2.87;
621 
622  double yOfFirstWire = (yAlignmentFrame - length) + alignmentPinToFirstWire;
623 
624  int nWireGroups = layer->geometry()->numberOfWireGroups();
625  double E = extentOfWirePlane / nWireGroups;
626 
627  for (int nWireGroup = 1; nWireGroup <= nWireGroups; ++nWireGroup) {
628  LocalPoint centerOfWireGroup = layer->geometry()->localCenterOfWireGroup(nWireGroup);
629  double yOfWire1 = centerOfWireGroup.y();
630 
631  //double yOfWire2 = (-0.5 - (nWireGroups*0.5 - 1) + (nWireGroup-1))*E;
632  //yOfWire2 += 0.5*E;
633  double yOfWire2 = yOfFirstWire + ((nWireGroup - 1) * E);
634  yOfWire2 += wireSpacing * 0.5;
635 
636  double ydiff_local = yOfWire1 - yOfWire2;
637  wire_positions.push_back(ydiff_local);
638 
639  //GlobalPoint globalPoint = layer->surface().toGlobal(LocalPoint(0.0,yOfWire1,0.0));
640 
641  /*
642  float fwLocalPoint[3] =
643  {
644  0.0, yOfWire2, 0.0
645  };
646 
647  float fwGlobalPoint[3];
648  fwGeometry_.localToGlobal(detId.rawId(), fwLocalPoint, fwGlobalPoint);
649  double ydiff_global = globalPoint.y() - fwGlobalPoint[1];
650  */
651 
652  if (station == 1) {
653  if (ring == 1) {
654  me11_wiresLocal.push_back(ydiff_local);
655  } else if (ring == 2) {
656  me12_wiresLocal.push_back(ydiff_local);
657  } else if (ring == 3) {
658  me13_wiresLocal.push_back(ydiff_local);
659  } else if (ring == 4) {
660  me14_wiresLocal.push_back(ydiff_local);
661  }
662  } else if (station == 2) {
663  if (ring == 1) {
664  me21_wiresLocal.push_back(ydiff_local);
665  } else if (ring == 2) {
666  me22_wiresLocal.push_back(ydiff_local);
667  }
668  } else if (station == 3) {
669  if (ring == 1) {
670  me31_wiresLocal.push_back(ydiff_local);
671  } else if (ring == 2) {
672  me32_wiresLocal.push_back(ydiff_local);
673  }
674  } else if (station == 4) {
675  if (ring == 1) {
676  me41_wiresLocal.push_back(ydiff_local);
677  } else if (ring == 2) {
678  me42_wiresLocal.push_back(ydiff_local);
679  }
680  }
681  }
682  }
683  }
684 
685  std::string hn(detname);
686  makeHistogram(hn + ": xOfStrip", strip_positions);
687 
688  makeHistogram(hn + ": local yOfWire", wire_positions);
689 
690  makeHistogram("ME11: local yOfWire", me11_wiresLocal);
691  makeHistogram("ME12: local yOfWire", me12_wiresLocal);
692  makeHistogram("ME13: local yOfWire", me13_wiresLocal);
693  makeHistogram("ME14: local yOfWire", me14_wiresLocal);
694  makeHistogram("ME21: local yOfWire", me21_wiresLocal);
695  makeHistogram("ME22: local yOfWire", me22_wiresLocal);
696  makeHistogram("ME31: local yOfWire", me31_wiresLocal);
697  makeHistogram("ME32: local yOfWire", me32_wiresLocal);
698  makeHistogram("ME41: local yOfWire", me41_wiresLocal);
699  makeHistogram("ME42: local yOfWire", me42_wiresLocal);
700 
701  makeHistograms(detname);
702 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:81
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
const CSCWireTopology * wireTopology() const
float centreToIntersection() const override
const float * getParameters(unsigned int id) const
Definition: FWGeometry.cc:474
CSCDetId id() const
Definition: CSCLayer.h:39
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
void makeHistograms(const char *detector)
T y() const
Definition: PV3DBase.h:60
int numberOfStrips() const
double wireSpacing() const
const TGeoMatrix * getMatrix(unsigned int id) const
Definition: FWGeometry.cc:221
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
int numberOfWireGroups() const
void makeHistogram(const std::string &name, std::vector< double > &data)
float xOfStrip(int strip, float y=0.) const
int endcap() const
Definition: CSCDetId.h:85
const float * getShapePars(unsigned int id) const
Definition: FWGeometry.cc:485
float yCentreOfStripPlane() const override
void compareShape(const GeomDet *det, const float *shape)
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
float phiOfOneEdge() const override
edm::ESHandle< CSCGeometry > cscGeometry_
LocalPoint localCenterOfWireGroup(int wireGroup) const
int ring() const
Definition: CSCDetId.h:68
Definition: DetId.h:17
const CSCStripTopology * topology() const
virtual float stripOffset(void) const
float yAxisOrientation() const override
float angularWidth() const override
int station() const
Definition: CSCDetId.h:79
float wireAngle() const override
const CSCLayerGeometry * geometry() const
Definition: CSCLayer.h:44
void compareTransform(const GlobalPoint &point, const TGeoMatrix *matrix)
const LayerContainer & layers() const
Return a vector of all layers.
Definition: CSCGeometry.cc:98
void ValidateGeometry::validateDTChamberGeometry ( )
private

Definition at line 332 of file ValidateGeometry.cc.

References relativeConstraints::chamber, DTGeometry::chambers(), chambers, clearData(), compareShape(), compareTransform(), gather_cfg::cout, dtGeometry_, fwGeometry_, FWGeometry::getMatrix(), FWGeometry::getShapePars(), runTauDisplay::gp, DTChamber::id(), makeHistograms(), makeMuonMisalignmentScenario::matrix, DetId::rawId(), GeomDet::surface(), and Surface::toGlobal().

Referenced by analyze().

332  {
333  clearData();
334 
335  auto const& chambers = dtGeometry_->chambers();
336 
337  for (auto it = chambers.begin(), itEnd = chambers.end(); it != itEnd; ++it) {
338  const DTChamber* chamber = *it;
339 
340  if (chamber) {
341  DTChamberId chId = chamber->id();
342  GlobalPoint gp = chamber->surface().toGlobal(LocalPoint(0.0, 0.0, 0.0));
343 
344  const TGeoMatrix* matrix = fwGeometry_.getMatrix(chId.rawId());
345 
346  if (!matrix) {
347  std::cout << "Failed to get matrix of DT chamber with detid: " << chId.rawId() << std::endl;
348  continue;
349  }
350 
351  compareTransform(gp, matrix);
352 
353  const float* shape = fwGeometry_.getShapePars(chId.rawId());
354 
355  if (!shape) {
356  std::cout << "Failed to get shape of DT chamber with detid: " << chId.rawId() << std::endl;
357  continue;
358  }
359 
360  compareShape(chamber, shape);
361  }
362  }
363 
364  makeHistograms("DT chamber");
365 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:81
const std::vector< const DTChamber * > & chambers() const
Return a vector of all Chamber.
Definition: DTGeometry.cc:84
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
void makeHistograms(const char *detector)
const TGeoMatrix * getMatrix(unsigned int id) const
Definition: FWGeometry.cc:221
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
const float * getShapePars(unsigned int id) const
Definition: FWGeometry.cc:485
void compareShape(const GeomDet *det, const float *shape)
DTChamberId id() const
Return the DTChamberId of this chamber.
Definition: DTChamber.cc:32
edm::ESHandle< DTGeometry > dtGeometry_
static char chambers[264][20]
Definition: ReadPGInfo.cc:243
void compareTransform(const GlobalPoint &point, const TGeoMatrix *matrix)
void ValidateGeometry::validateDTLayerGeometry ( )
private

Definition at line 367 of file ValidateGeometry.cc.

References Surface::bounds(), clearData(), compareShape(), compareTransform(), gather_cfg::cout, dtGeometry_, DTTopology::firstChannel(), fwGeometry_, FWGeometry::getMatrix(), FWGeometry::getParameters(), FWGeometry::getShapePars(), runTauDisplay::gp, DTLayer::id(), DTTopology::lastChannel(), hgcalTopologyTester_cfi::layers, DTGeometry::layers(), Bounds::length(), makeHistogram(), makeHistograms(), makeMuonMisalignmentScenario::matrix, ecaldqm::nChannels, DetId::rawId(), DTLayer::specificTopology(), GeomDet::surface(), Bounds::thickness(), Calorimetry_cff::thickness, Surface::toGlobal(), ApeEstimator_cff::width, Bounds::width(), and DTTopology::wirePosition().

Referenced by analyze().

367  {
368  clearData();
369 
370  std::vector<double> wire_positions;
371 
372  auto const& layers = dtGeometry_->layers();
373 
374  for (auto it = layers.begin(), itEnd = layers.end(); it != itEnd; ++it) {
375  const DTLayer* layer = *it;
376 
377  if (layer) {
378  DTLayerId layerId = layer->id();
379  GlobalPoint gp = layer->surface().toGlobal(LocalPoint(0.0, 0.0, 0.0));
380 
381  const TGeoMatrix* matrix = fwGeometry_.getMatrix(layerId.rawId());
382 
383  if (!matrix) {
384  std::cout << "Failed to get matrix of DT layer with detid: " << layerId.rawId() << std::endl;
385  continue;
386  }
387 
388  compareTransform(gp, matrix);
389 
390  const float* shape = fwGeometry_.getShapePars(layerId.rawId());
391 
392  if (!shape) {
393  std::cout << "Failed to get shape of DT layer with detid: " << layerId.rawId() << std::endl;
394  continue;
395  }
396 
397  compareShape(layer, shape);
398 
399  const float* parameters = fwGeometry_.getParameters(layerId.rawId());
400 
401  if (parameters == nullptr) {
402  std::cout << "Parameters empty for DT layer with detid: " << layerId.rawId() << std::endl;
403  continue;
404  }
405 
406  float width = layer->surface().bounds().width();
407  assert(width == parameters[6]);
408 
409  float thickness = layer->surface().bounds().thickness();
410  assert(thickness == parameters[7]);
411 
412  float length = layer->surface().bounds().length();
413  assert(length == parameters[8]);
414 
415  int firstChannel = layer->specificTopology().firstChannel();
416  assert(firstChannel == parameters[3]);
417 
418  int lastChannel = layer->specificTopology().lastChannel();
419  int nChannels = parameters[5];
420  assert(nChannels == (lastChannel - firstChannel) + 1);
421 
422  for (int wireN = firstChannel; wireN - lastChannel <= 0; ++wireN) {
423  double localX1 = layer->specificTopology().wirePosition(wireN);
424  double localX2 = (wireN - (firstChannel - 1) - 0.5) * parameters[0] - nChannels / 2.0 * parameters[0];
425 
426  wire_positions.push_back(localX1 - localX2);
427 
428  //std::cout<<"wireN, localXpos: "<< wireN <<" "<< localX1 <<" "<< localX2 <<std::endl;
429  }
430  }
431  }
432 
433  makeHistogram("DT layer wire localX", wire_positions);
434 
435  makeHistograms("DT layer");
436 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:81
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:59
virtual float length() const =0
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
const float * getParameters(unsigned int id) const
Definition: FWGeometry.cc:474
DTLayerId id() const
Return the DetId of this SL.
Definition: DTLayer.cc:39
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
void makeHistograms(const char *detector)
const Bounds & bounds() const
Definition: Surface.h:89
const TGeoMatrix * getMatrix(unsigned int id) const
Definition: FWGeometry.cc:221
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
void makeHistogram(const std::string &name, std::vector< double > &data)
int firstChannel() const
Returns the wire number of the first wire.
Definition: DTTopology.h:79
virtual float width() const =0
const float * getShapePars(unsigned int id) const
Definition: FWGeometry.cc:485
int lastChannel() const
Returns the wire number of the last wire.
Definition: DTTopology.h:81
const DTTopology & specificTopology() const
Definition: DTLayer.cc:37
void compareShape(const GeomDet *det, const float *shape)
edm::ESHandle< DTGeometry > dtGeometry_
virtual float thickness() const =0
const std::vector< const DTLayer * > & layers() const
Return a vector of all SuperLayer.
Definition: DTGeometry.cc:88
void compareTransform(const GlobalPoint &point, const TGeoMatrix *matrix)
void ValidateGeometry::validatePixelTopology ( const TrackerGeometry::DetContainer dets,
const char *  detname 
)
private

Definition at line 769 of file ValidateGeometry.cc.

References gather_cfg::cout, fwGeometry_, FWGeometry::getParameters(), TrackerGeometry::idToDetUnit(), makeHistogram(), fireworks::pixelLocalX(), fireworks::pixelLocalY(), AlCaHLTBitMon_QueryRunRegistry::string, trackerGeometry_, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by analyze().

769  {
770  std::vector<double> pixelLocalXs;
771  std::vector<double> pixelLocalYs;
772 
773  for (TrackerGeometry::DetContainer::const_iterator it = dets.begin(), itEnd = dets.end(); it != itEnd; ++it) {
774  unsigned int rawId = (*it)->geographicalId().rawId();
775 
776  const float* parameters = fwGeometry_.getParameters(rawId);
777 
778  if (parameters == nullptr) {
779  std::cout << "Parameters empty for " << detname << " element with detid: " << rawId << std::endl;
780  continue;
781  }
782 
783  if (const PixelGeomDetUnit* det =
784  dynamic_cast<const PixelGeomDetUnit*>(trackerGeometry_->idToDetUnit((*it)->geographicalId()))) {
785  if (const PixelTopology* rpt = &det->specificTopology()) {
786  int nrows = rpt->nrows();
787  int ncolumns = rpt->ncolumns();
788 
789  for (int row = 1; row <= nrows; ++row) {
790  for (int column = 1; column <= ncolumns; ++column) {
791  LocalPoint localPoint = rpt->localPosition(MeasurementPoint(row, column));
792 
793  pixelLocalXs.push_back(localPoint.x() - fireworks::pixelLocalX(row, parameters));
794  pixelLocalYs.push_back(localPoint.y() - fireworks::pixelLocalY(column, parameters));
795  }
796  }
797  }
798 
799  else
800  std::cout << "No topology for " << detname << " " << rawId << std::endl;
801  }
802 
803  else
804  std::cout << "No geomDetUnit for " << detname << " " << rawId << std::endl;
805  }
806 
807  std::string hn(detname);
808  makeHistogram(hn + " pixelLocalX", pixelLocalXs);
809  makeHistogram(hn + " pixelLocalY", pixelLocalYs);
810 }
edm::ESHandle< TrackerGeometry > trackerGeometry_
const float * getParameters(unsigned int id) const
Definition: FWGeometry.cc:474
T y() const
Definition: PV3DBase.h:60
void makeHistogram(const std::string &name, std::vector< double > &data)
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
float pixelLocalX(const double mpx, const float *)
Definition: TrackUtils.cc:159
float pixelLocalY(const double mpy, const float *)
Definition: TrackUtils.cc:209
T x() const
Definition: PV3DBase.h:59
void ValidateGeometry::validateRPCGeometry ( const int  regionNumber,
const char *  regionName 
)
private

Definition at line 260 of file ValidateGeometry.cc.

References RPCRoll::centreOfStrip(), clearData(), compareShape(), compareTransform(), gather_cfg::cout, fwGeometry_, FWGeometry::getMatrix(), FWGeometry::getParameters(), FWGeometry::getShapePars(), runTauDisplay::gp, RPCRoll::id(), RPCGeometry::idToDetUnit(), makeHistogram(), makeHistograms(), makeMuonMisalignmentScenario::matrix, RPCRoll::nstrips(), me0TriggerPseudoDigis_cff::nStrips, hltrates_dqm_sourceclient-live_cfg::offset, StripTopology::pitch(), DetId::rawId(), RPCDetId::region(), RPCGeometry::rolls(), rpcGeometry_, RPCRoll::specificTopology(), AlCaHLTBitMon_QueryRunRegistry::string, digitizers_cfi::strip, StripTopology::stripLength(), GeomDet::surface(), Surface::toGlobal(), and PV3DBase< T, PVType, FrameType >::x().

Referenced by analyze().

260  {
261  clearData();
262 
263  std::vector<double> centers;
264 
265  auto const& rolls = rpcGeometry_->rolls();
266 
267  for (auto it = rolls.begin(), itEnd = rolls.end(); it != itEnd; ++it) {
268  const RPCRoll* roll = *it;
269 
270  if (roll) {
271  RPCDetId rpcDetId = roll->id();
272 
273  if (rpcDetId.region() == regionNumber) {
274  const GeomDetUnit* det = rpcGeometry_->idToDetUnit(rpcDetId);
275  GlobalPoint gp = det->surface().toGlobal(LocalPoint(0.0, 0.0, 0.0));
276 
277  const TGeoMatrix* matrix = fwGeometry_.getMatrix(rpcDetId.rawId());
278 
279  if (!matrix) {
280  std::cout << "Failed to get matrix of RPC with detid: " << rpcDetId.rawId() << std::endl;
281  continue;
282  }
283 
284  compareTransform(gp, matrix);
285 
286  const float* shape = fwGeometry_.getShapePars(rpcDetId.rawId());
287 
288  if (!shape) {
289  std::cout << "Failed to get shape of RPC with detid: " << rpcDetId.rawId() << std::endl;
290  continue;
291  }
292 
293  compareShape(det, shape);
294 
295  const float* parameters = fwGeometry_.getParameters(rpcDetId.rawId());
296 
297  if (parameters == nullptr) {
298  std::cout << "Parameters empty for RPC with detid: " << rpcDetId.rawId() << std::endl;
299  continue;
300  }
301 
302  // Yes, I know that below I'm comparing the equivalence
303  // of floating point numbers
304 
305  int nStrips = roll->nstrips();
306  assert(nStrips == parameters[0]);
307 
308  float stripLength = roll->specificTopology().stripLength();
309  assert(stripLength == parameters[1]);
310 
311  float pitch = roll->specificTopology().pitch();
312  assert(pitch == parameters[2]);
313 
314  float offset = -0.5 * nStrips * pitch;
315 
316  for (int strip = 1; strip <= roll->nstrips(); ++strip) {
317  LocalPoint centreOfStrip1 = roll->centreOfStrip(strip);
318  LocalPoint centreOfStrip2 = LocalPoint((strip - 0.5) * pitch + offset, 0.0);
319 
320  centers.push_back(centreOfStrip1.x() - centreOfStrip2.x());
321  }
322  }
323  }
324  }
325 
326  std::string hn(regionName);
327  makeHistogram(hn + ": centreOfStrip", centers);
328 
329  makeHistograms(regionName);
330 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:81
virtual float stripLength() const =0
LocalPoint centreOfStrip(int strip) const
Definition: RPCRoll.cc:26
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
const GeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: RPCGeometry.cc:30
const float * getParameters(unsigned int id) const
Definition: FWGeometry.cc:474
const std::vector< const RPCRoll * > & rolls() const
Return a vector of all RPC rolls.
Definition: RPCGeometry.cc:44
edm::ESHandle< RPCGeometry > rpcGeometry_
int nstrips() const
Definition: RPCRoll.cc:24
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
void makeHistograms(const char *detector)
const TGeoMatrix * getMatrix(unsigned int id) const
Definition: FWGeometry.cc:221
const StripTopology & specificTopology() const
Definition: RPCRoll.cc:49
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
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...
const float * getShapePars(unsigned int id) const
Definition: FWGeometry.cc:485
RPCDetId id() const
Definition: RPCRoll.cc:16
void compareShape(const GeomDet *det, const float *shape)
virtual float pitch() const =0
T x() const
Definition: PV3DBase.h:59
void compareTransform(const GlobalPoint &point, const TGeoMatrix *matrix)
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:53
void ValidateGeometry::validateStripTopology ( const TrackerGeometry::DetContainer dets,
const char *  detname 
)
private

Definition at line 812 of file ValidateGeometry.cc.

References gather_cfg::cout, fwGeometry_, FWGeometry::getParameters(), TrackerGeometry::idToDet(), StripTopology::localPosition(), makeHistogram(), StripTopology::nstrips(), StripTopology::pitch(), AlCaHLTBitMon_QueryRunRegistry::string, digitizers_cfi::strip, StripTopology::stripLength(), funct::tan(), trackerGeometry_, and PV3DBase< T, PVType, FrameType >::x().

Referenced by analyze().

812  {
813  std::vector<double> radialStripLocalXs;
814  std::vector<double> rectangularStripLocalXs;
815 
816  for (TrackerGeometry::DetContainer::const_iterator it = dets.begin(), itEnd = dets.end(); it != itEnd; ++it) {
817  unsigned int rawId = (*it)->geographicalId().rawId();
818 
819  const float* parameters = fwGeometry_.getParameters(rawId);
820 
821  if (parameters == nullptr) {
822  std::cout << "Parameters empty for " << detname << " element with detid: " << rawId << std::endl;
823  continue;
824  }
825 
826  if (const StripGeomDetUnit* det =
827  dynamic_cast<const StripGeomDetUnit*>(trackerGeometry_->idToDet((*it)->geographicalId()))) {
828  // NOTE: why the difference in dets vs. units between these and pixels? The dynamic cast above
829  // fails for many of the detids...
830 
831  const StripTopology* st = dynamic_cast<const StripTopology*>(&det->specificTopology());
832 
833  if (st) {
834  //assert(parameters[0] == 0);
835  int nstrips = st->nstrips();
836  assert(parameters[1] == nstrips);
837  assert(parameters[2] == st->stripLength());
838 
839  if (const RadialStripTopology* rst =
840  dynamic_cast<const RadialStripTopology*>(&(det->specificType().specificTopology()))) {
841  assert(parameters[0] == 1);
842  assert(parameters[3] == rst->yAxisOrientation());
843  assert(parameters[4] == rst->originToIntersection());
844  assert(parameters[5] == rst->phiOfOneEdge());
845  assert(parameters[6] == rst->angularWidth());
846 
847  for (uint16_t strip = 1; strip <= nstrips; ++strip) {
848  float stripAngle1 = rst->stripAngle(strip);
849  float stripAngle2 = parameters[3] * (parameters[5] + strip * parameters[6]);
850 
851  assert((stripAngle1 - stripAngle2) == 0);
852 
853  LocalPoint stripPosition = st->localPosition(strip);
854 
855  float stripX = parameters[4] * tan(stripAngle2);
856  radialStripLocalXs.push_back(stripPosition.x() - stripX);
857  }
858  }
859 
860  else if (dynamic_cast<const RectangularStripTopology*>(&(det->specificType().specificTopology()))) {
861  assert(parameters[0] == 2);
862  assert(parameters[3] == st->pitch());
863 
864  for (uint16_t strip = 1; strip <= nstrips; ++strip) {
865  LocalPoint stripPosition = st->localPosition(strip);
866  float stripX = -parameters[1] * 0.5 * parameters[3];
867  stripX += strip * parameters[3];
868  rectangularStripLocalXs.push_back(stripPosition.x() - stripX);
869  }
870  }
871 
872  else if (dynamic_cast<const TrapezoidalStripTopology*>(&(det->specificType().specificTopology()))) {
873  assert(parameters[0] == 3);
874  assert(parameters[3] == st->pitch());
875  }
876 
877  else
878  std::cout << "Failed to get pitch for " << detname << " " << rawId << std::endl;
879  }
880 
881  else
882  std::cout << "Failed cast to StripTopology for " << detname << " " << rawId << std::endl;
883  }
884 
885  //else
886  // std::cout<<"Failed cast to StripGeomDetUnit for "<< detname <<" "<< rawId <<std::endl;
887  }
888 
889  std::string hn(detname);
890  makeHistogram(hn + " radial strip localX", radialStripLocalXs);
891  makeHistogram(hn + " rectangular strip localX", rectangularStripLocalXs);
892 }
virtual float stripLength() const =0
edm::ESHandle< TrackerGeometry > trackerGeometry_
const float * getParameters(unsigned int id) const
Definition: FWGeometry.cc:474
void makeHistogram(const std::string &name, std::vector< double > &data)
virtual LocalPoint localPosition(float strip) const =0
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
virtual int nstrips() const =0
const TrackerGeomDet * idToDet(DetId) const override
virtual float pitch() const =0
T x() const
Definition: PV3DBase.h:59
void ValidateGeometry::validateTrackerGeometry ( const TrackerGeometry::DetContainer dets,
const char *  detname 
)
private

Definition at line 739 of file ValidateGeometry.cc.

References clearData(), compareShape(), compareTransform(), gather_cfg::cout, fwGeometry_, FWGeometry::getMatrix(), FWGeometry::getShapePars(), runTauDisplay::gp, TrackerGeometry::idToDet(), makeHistograms(), makeMuonMisalignmentScenario::matrix, and trackerGeometry_.

Referenced by analyze().

739  {
740  clearData();
741 
742  for (TrackerGeometry::DetContainer::const_iterator it = dets.begin(), itEnd = dets.end(); it != itEnd; ++it) {
743  GlobalPoint gp =
744  (trackerGeometry_->idToDet((*it)->geographicalId()))->surface().toGlobal(LocalPoint(0.0, 0.0, 0.0));
745  unsigned int rawId = (*it)->geographicalId().rawId();
746 
747  const TGeoMatrix* matrix = fwGeometry_.getMatrix(rawId);
748 
749  if (!matrix) {
750  std::cout << "Failed to get matrix of " << detname << " element with detid: " << rawId << std::endl;
751  continue;
752  }
753 
754  compareTransform(gp, matrix);
755 
756  const float* shape = fwGeometry_.getShapePars(rawId);
757 
758  if (!shape) {
759  std::cout << "Failed to get shape of " << detname << " element with detid: " << rawId << std::endl;
760  continue;
761  }
762 
763  compareShape(*it, shape);
764  }
765 
766  makeHistograms(detname);
767 }
edm::ESHandle< TrackerGeometry > trackerGeometry_
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
void makeHistograms(const char *detector)
const TGeoMatrix * getMatrix(unsigned int id) const
Definition: FWGeometry.cc:221
const float * getShapePars(unsigned int id) const
Definition: FWGeometry.cc:485
void compareShape(const GeomDet *det, const float *shape)
const TrackerGeomDet * idToDet(DetId) const override
void compareTransform(const GlobalPoint &point, const TGeoMatrix *matrix)

Member Data Documentation

std::vector<double> ValidateGeometry::bottomWidths_
private

Definition at line 113 of file ValidateGeometry.cc.

Referenced by compareShape(), and makeHistograms().

edm::ESHandle<CaloGeometry> ValidateGeometry::caloGeometry_
private

Definition at line 104 of file ValidateGeometry.cc.

Referenced by analyze(), and validateCaloGeometry().

edm::ESHandle<CSCGeometry> ValidateGeometry::cscGeometry_
private
bool ValidateGeometry::doCalo_
private

Definition at line 132 of file ValidateGeometry.cc.

Referenced by analyze(), and ValidateGeometry().

bool ValidateGeometry::doMuon_
private

Definition at line 131 of file ValidateGeometry.cc.

Referenced by analyze(), and ValidateGeometry().

bool ValidateGeometry::doTracker_
private

Definition at line 130 of file ValidateGeometry.cc.

Referenced by analyze(), and ValidateGeometry().

edm::ESHandle<DTGeometry> ValidateGeometry::dtGeometry_
private
FWGeometry ValidateGeometry::fwGeometry_
private
std::vector<double> ValidateGeometry::globalDistances_
private

Definition at line 111 of file ValidateGeometry.cc.

Referenced by compareTransform(), makeHistograms(), and validateCaloGeometry().

std::string ValidateGeometry::infileName_
private

Definition at line 98 of file ValidateGeometry.cc.

Referenced by ValidateGeometry().

std::vector<double> ValidateGeometry::lengths_
private

Definition at line 114 of file ValidateGeometry.cc.

Referenced by compareShape(), and makeHistograms().

TFile* ValidateGeometry::outFile_
private

Definition at line 109 of file ValidateGeometry.cc.

Referenced by beginJob(), endJob(), makeHistograms(), and ValidateGeometry().

std::string ValidateGeometry::outfileName_
private

Definition at line 99 of file ValidateGeometry.cc.

Referenced by endJob(), and ValidateGeometry().

edm::ESHandle<RPCGeometry> ValidateGeometry::rpcGeometry_
private

Definition at line 101 of file ValidateGeometry.cc.

Referenced by analyze(), and validateRPCGeometry().

std::vector<double> ValidateGeometry::thicknesses_
private

Definition at line 115 of file ValidateGeometry.cc.

Referenced by compareShape(), and makeHistograms().

std::vector<double> ValidateGeometry::topWidths_
private

Definition at line 112 of file ValidateGeometry.cc.

Referenced by compareShape(), and makeHistograms().

edm::ESHandle<TrackerGeometry> ValidateGeometry::trackerGeometry_
private