CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &) override
 
virtual void beginJob () override
 
void clearData ()
 
void compareShape (const GeomDet *det, const float *shape)
 
void compareTransform (const GlobalPoint &point, const TGeoMatrix *matrix)
 
bool dataEmpty ()
 
virtual 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)
 
void validateTrackerGeometry (const TrackerGeometry::DetUnitContainer &dets, const char *detname)
 

Private Attributes

std::vector< double > bottomWidths_
 
edm::ESHandle< CaloGeometrycaloGeometry_
 
edm::ESHandle< CSCGeometrycscGeometry_
 
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
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- 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 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 148 of file ValidateGeometry.cc.

References fwGeometry_, infileName_, FWGeometry::loadMap(), outFile_, and outfileName_.

149  : infileName_(iConfig.getUntrackedParameter<std::string>("infileName")),
150  outfileName_(iConfig.getUntrackedParameter<std::string>("outfileName"))
151 {
153 
154  outFile_ = new TFile(outfileName_.c_str(), "RECREATE");
155 }
T getUntrackedParameter(std::string const &, T const &) const
void loadMap(const char *fileName)
Definition: FWGeometry.cc:49
std::string infileName_
std::string outfileName_
ValidateGeometry::~ValidateGeometry ( )

Definition at line 158 of file ValidateGeometry.cc.

159 {}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 163 of file ValidateGeometry.cc.

References DetId::Calo, caloGeometry_, gather_cfg::cout, cscGeometry_, 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().

164 {
165  eventSetup.get<MuonGeometryRecord>().get(rpcGeometry_);
166 
167  if ( rpcGeometry_.isValid() )
168  {
169  std::cout<<"Validating RPC -z endcap geometry"<<std::endl;
170  validateRPCGeometry(-1, "RPC -z endcap");
171 
172  std::cout<<"Validating RPC +z endcap geometry"<<std::endl;
173  validateRPCGeometry(+1, "RPC +z endcap");
174 
175  std::cout<<"Validating RPC barrel geometry"<<std::endl;
176  validateRPCGeometry(0, "RPC barrel");
177  }
178  else
179  fwLog(fwlog::kWarning)<<"Invalid RPC geometry"<<std::endl;
180 
181 
182  eventSetup.get<MuonGeometryRecord>().get(dtGeometry_);
183 
184  if ( dtGeometry_.isValid() )
185  {
186  std::cout<<"Validating DT chamber geometry"<<std::endl;
188 
189  std::cout<<"Validating DT layer geometry"<<std::endl;
191  }
192  else
193  fwLog(fwlog::kWarning)<<"Invalid DT geometry"<<std::endl;
194 
195 
196  eventSetup.get<MuonGeometryRecord>().get(cscGeometry_);
197 
198  if ( cscGeometry_.isValid() )
199  {
200  std::cout<<"Validating CSC -z geometry"<<std::endl;
201  validateCSChamberGeometry(-1, "CSC chamber -z endcap");
202 
203  std::cout<<"Validating CSC +z geometry"<<std::endl;
204  validateCSChamberGeometry(+1, "CSC chamber +z endcap");
205 
206  std::cout<<"Validating CSC layer -z geometry"<<std::endl;
207  validateCSCLayerGeometry(-1, "CSC layer -z endcap");
208 
209  std::cout<<"Validating CSC layer +z geometry"<<std::endl;
210  validateCSCLayerGeometry(+1, "CSC layer +z endcap");
211  }
212  else
213  fwLog(fwlog::kWarning)<<"Invalid CSC geometry"<<std::endl;
214 
215 
217 
218  if ( trackerGeometry_.isValid() )
219  {
220  std::cout<<"Validating TIB geometry and topology"<<std::endl;
221  validateTrackerGeometry(trackerGeometry_->detsTIB(), "TIB");
222  validateStripTopology(trackerGeometry_->detsTIB(), "TIB");
223 
224  std::cout<<"Validating TOB geometry and topology"<<std::endl;
225  validateTrackerGeometry(trackerGeometry_->detsTOB(), "TOB");
226  validateStripTopology(trackerGeometry_->detsTOB(), "TOB");
227 
228  std::cout<<"Validating TEC geometry and topology"<<std::endl;
229  validateTrackerGeometry(trackerGeometry_->detsTEC(), "TEC");
230  validateStripTopology(trackerGeometry_->detsTEC(), "TEC");
231 
232  std::cout<<"Validating TID geometry and topology"<<std::endl;
233  validateTrackerGeometry(trackerGeometry_->detsTID(), "TID");
234  validateStripTopology(trackerGeometry_->detsTID(), "TID");
235 
236  std::cout<<"Validating PXB geometry and topology"<<std::endl;
237  validateTrackerGeometry(trackerGeometry_->detsPXB(), "PXB");
238  validatePixelTopology(trackerGeometry_->detsPXB(), "PXB");
239 
240  std::cout<<"Validating PXF geometry and topology"<<std::endl;
241  validateTrackerGeometry(trackerGeometry_->detsPXF(), "PXF");
242  validatePixelTopology(trackerGeometry_->detsPXF(), "PXF");
243  }
244  else
245  fwLog(fwlog::kWarning)<<"Invalid Tracker geometry"<<std::endl;
246 
247  eventSetup.get<CaloGeometryRecord>().get(caloGeometry_);
248 
249 
250  if ( caloGeometry_.isValid() )
251  {
252  std::cout<<"Validating EB geometry"<<std::endl;
254 
255  std::cout<<"Validating EE geometry"<<std::endl;
257 
258  std::cout<<"Validating ES geometry"<<std::endl;
260 
261  std::cout<<"Validating HB geometry"<<std::endl;
263 
264  std::cout<<"Validating HE geometry"<<std::endl;
266 
267  std::cout<<"Validating HO geometry"<<std::endl;
269 
270  std::cout<<"Validating HF geometry"<<std::endl;
272 
273  std::cout<<"Validating Castor geometry"<<std::endl;
275 
276  std::cout<<"Validating ZDC geometry"<<std::endl;
278  }
279  else
280  fwLog(fwlog::kWarning)<<"Invalid Calo geometry"<<std::endl;
281 
282 }
edm::ESHandle< CaloGeometry > caloGeometry_
edm::ESHandle< TrackerGeometry > trackerGeometry_
void validateTrackerGeometry(const TrackerGeometry::DetContainer &dets, const char *detname)
edm::ESHandle< RPCGeometry > rpcGeometry_
void validateDTChamberGeometry()
void validateCaloGeometry(DetId::Detector detector, int subdetector, const char *detname)
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
edm::ESHandle< CSCGeometry > cscGeometry_
static const int SubdetectorId
Definition: HcalZDCDetId.h:20
#define fwLog(_level_)
Definition: fwLog.h:50
const T & get() const
Definition: EventSetup.h:55
tuple cout
Definition: gather_cfg.py:121
void validateCSChamberGeometry(const int endcap, const char *detname)
void validateStripTopology(const TrackerGeometry::DetContainer &dets, const char *detname)
bool isValid() const
Definition: ESHandle.h:37
void ValidateGeometry::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 1274 of file ValidateGeometry.cc.

References outFile_.

1275 {
1276  outFile_->cd();
1277 }
void ValidateGeometry::clearData ( void  )
inlineprivate

Definition at line 128 of file ValidateGeometry.cc.

References bottomWidths_, globalDistances_, lengths_, thicknesses_, and topWidths_.

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

129  {
130  globalDistances_.clear();
131  topWidths_.clear();
132  bottomWidths_.clear();
133  lengths_.clear();
134  thicknesses_.clear();
135  }
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 1127 of file ValidateGeometry.cc.

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

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

1128 {
1129  double shape_topWidth;
1130  double shape_bottomWidth;
1131  double shape_length;
1132  double shape_thickness;
1133 
1134  if ( shape[0] == 1 )
1135  {
1136  shape_topWidth = shape[2];
1137  shape_bottomWidth = shape[1];
1138  shape_length = shape[4];
1139  shape_thickness = shape[3];
1140  }
1141 
1142  else if ( shape[0] == 2 )
1143  {
1144  shape_topWidth = shape[1];
1145  shape_bottomWidth = shape[1];
1146  shape_length = shape[2];
1147  shape_thickness = shape[3];
1148  }
1149 
1150  else
1151  {
1152  std::cout<<"Failed to get box or trapezoid from shape"<<std::endl;
1153  return;
1154  }
1155 
1156  double topWidth, bottomWidth;
1157  double length, thickness;
1158 
1159  const Bounds* bounds = &(det->surface().bounds());
1160 
1161  if ( const TrapezoidalPlaneBounds* tpbs = dynamic_cast<const TrapezoidalPlaneBounds*>(bounds) )
1162  {
1163  std::array<const float, 4> const & ps = tpbs->parameters();
1164 
1165  assert(ps.size() == 4);
1166 
1167  bottomWidth = ps[0];
1168  topWidth = ps[1];
1169  thickness = ps[2];
1170  length = ps[3];
1171  }
1172 
1173  else if ( (dynamic_cast<const RectangularPlaneBounds*>(bounds)) )
1174  {
1175  length = det->surface().bounds().length()*0.5;
1176  topWidth = det->surface().bounds().width()*0.5;
1177  bottomWidth = topWidth;
1178  thickness = det->surface().bounds().thickness()*0.5;
1179  }
1180 
1181  else
1182  {
1183  std::cout<<"Failed to get bounds"<<std::endl;
1184  return;
1185  }
1186 
1187  //assert((tgeotrap && trapezoid) || (tgeobbox && rectangle));
1188 
1189  /*
1190  std::cout<<"topWidth: "<< shape_topWidth <<" "<< topWidth <<std::endl;
1191  std::cout<<"bottomWidth: "<< shape_bottomWidth <<" "<< bottomWidth <<std::endl;
1192  std::cout<<"length: "<< shape_length <<" "<< length <<std::endl;
1193  std::cout<<"thickness: "<< shape_thickness <<" "<< thickness <<std::endl;
1194  */
1195 
1196  topWidths_.push_back(fabs(shape_topWidth - topWidth));
1197  bottomWidths_.push_back(fabs(shape_bottomWidth - bottomWidth));
1198  lengths_.push_back(fabs(shape_length - length));
1199  thicknesses_.push_back(fabs(shape_thickness - thickness));
1200 
1201  return;
1202 }
virtual float length() const =0
std::vector< double > topWidths_
std::vector< double > bottomWidths_
const Bounds & bounds() const
Definition: Surface.h:128
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
virtual float thickness() const =0
std::vector< double > thicknesses_
tuple cout
Definition: gather_cfg.py:121
Definition: Bounds.h:22
std::vector< double > lengths_
virtual float width() const =0
void ValidateGeometry::compareTransform ( const GlobalPoint point,
const TGeoMatrix *  matrix 
)
private

Definition at line 1110 of file ValidateGeometry.cc.

References getDistance(), and globalDistances_.

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

1112 {
1113  double local[3] =
1114  {
1115  0.0, 0.0, 0.0
1116  };
1117 
1118  double global[3];
1119 
1120  matrix->LocalToMaster(local, global);
1121 
1122  double distance = getDistance(GlobalPoint(global[0], global[1], global[2]), gp);
1123  globalDistances_.push_back(distance);
1124 }
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 137 of file ValidateGeometry.cc.

References bottomWidths_, globalDistances_, lengths_, thicknesses_, and topWidths_.

138  {
139  return (globalDistances_.empty() &&
140  topWidths_.empty() &&
141  bottomWidths_.empty() &&
142  lengths_.empty() &&
143  thicknesses_.empty());
144  }
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 1281 of file ValidateGeometry.cc.

References gather_cfg::cout, outFile_, and outfileName_.

1282 {
1283  std::cout<<"Done. "<<std::endl;
1284  std::cout<<"Results written to "<< outfileName_ <<std::endl;
1285  outFile_->Close();
1286 }
tuple cout
Definition: gather_cfg.py:121
std::string outfileName_
double ValidateGeometry::getDistance ( const GlobalPoint point1,
const GlobalPoint point2 
)
private

Definition at line 1208 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::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().

1209 {
1210  /*
1211  std::cout<<"X: "<< p1.x() <<" "<< p2.x() <<std::endl;
1212  std::cout<<"Y: "<< p1.y() <<" "<< p2.y() <<std::endl;
1213  std::cout<<"Z: "<< p1.z() <<" "<< p2.z() <<std::endl;
1214  */
1215 
1216  return sqrt((p1.x()-p2.x())*(p1.x()-p2.x())+
1217  (p1.y()-p2.y())*(p1.y()-p2.y())+
1218  (p1.z()-p2.z())*(p1.z()-p2.z()));
1219 }
T sqrt(T t)
Definition: SSEVec.h:48
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 1249 of file ValidateGeometry.cc.

References estimatePileup::hist.

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

1250 {
1251  if ( data.empty() )
1252  return;
1253 
1254  std::vector<double>::iterator it;
1255 
1256  it = std::min_element(data.begin(), data.end());
1257  double minE = *it;
1258 
1259  it = std::max_element(data.begin(), data.end());
1260  double maxE = *it;
1261 
1262  std::vector<double>::iterator itEnd = data.end();
1263 
1264  TH1D hist(name.c_str(), name.c_str(), 100, minE*(1+0.10), maxE*(1+0.10));
1265 
1266  for ( it = data.begin(); it != itEnd; ++it )
1267  hist.Fill(*it);
1268 
1269  hist.GetXaxis()->SetTitle("[cm]");
1270  hist.Write();
1271 }
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void ValidateGeometry::makeHistograms ( const char *  detector)
private

Definition at line 1223 of file ValidateGeometry.cc.

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

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

1224 {
1225  outFile_->cd();
1226 
1227  std::string d(detector);
1228 
1229  std::string gdn = d+": distance between points in global coordinates";
1231 
1232  std::string twn = d + ": absolute difference between top widths (along X)";
1233  makeHistogram(twn, topWidths_);
1234 
1235  std::string bwn = d + ": absolute difference between bottom widths (along X)";
1237 
1238  std::string ln = d + ": absolute difference between lengths (along Y)";
1239  makeHistogram(ln, lengths_);
1240 
1241  std::string tn = d + ": absolute difference between thicknesses (along Z)";
1243 
1244  return;
1245 }
std::vector< double > topWidths_
std::vector< double > bottomWidths_
void makeHistogram(const std::string &name, std::vector< double > &data)
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 828 of file ValidateGeometry.cc.

References caloGeometry_, clearData(), gather_cfg::cout, fwGeometry_, geometry, CaloCellGeometry::getCorners(), FWGeometry::getCorners(), getDistance(), CaloSubdetectorGeometry::getGeometry(), CaloSubdetectorGeometry::getValidDetIds(), globalDistances_, i, makeHistograms(), evf::evtn::offset(), EZArrayFL< T >::size(), x, detailsBasic3DVector::y, and detailsBasic3DVector::z.

Referenced by analyze().

831 {
832  clearData();
833 
835  caloGeometry_->getSubdetectorGeometry(detector, subdetector);
836 
837  const std::vector<DetId>& ids = geometry->getValidDetIds(detector, subdetector);
838 
839  for (auto it = ids.begin(),
840  iEnd = ids.end();
841  it != iEnd; ++it)
842  {
843  unsigned int rawId = (*it).rawId();
844 
845  const float* points = fwGeometry_.getCorners(rawId);
846 
847  if ( points == 0 )
848  {
849  std::cout <<"Failed to get points of "<< detname
850  <<" element with detid: "<< rawId <<std::endl;
851  continue;
852  }
853 
854  const CaloCellGeometry* cellGeometry = geometry->getGeometry(*it);
855  const CaloCellGeometry::CornersVec& corners = cellGeometry->getCorners();
856 
857  assert(corners.size() == 8);
858 
859  for ( unsigned int i = 0, offset = 0; i < 8; ++i )
860  {
861  offset = 2*i;
862 
863  double distance = getDistance(GlobalPoint(points[i+offset], points[i+1+offset], points[i+2+offset]),
864  GlobalPoint(corners[i].x(), corners[i].y(), corners[i].z()));
865 
866  globalDistances_.push_back(distance);
867  }
868  }
869 
870  makeHistograms(detname);
871 }
int i
Definition: DBlmapReader.cc:9
edm::ESHandle< CaloGeometry > caloGeometry_
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
void makeHistograms(const char *detector)
float float float z
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.
unsigned int offset(bool)
size_type size() const
Definition: EZArrayFL.h:81
const float * getCorners(unsigned int id) const
Definition: FWGeometry.cc:277
double getDistance(const GlobalPoint &point1, const GlobalPoint &point2)
ESHandle< TrackerGeometry > geometry
tuple cout
Definition: gather_cfg.py:121
Definition: DDAxes.h:10
const CornersVec & getCorners() const
Returns the corner points of this cell&#39;s volume.
std::vector< double > globalDistances_
void ValidateGeometry::validateCSChamberGeometry ( const int  endcap,
const char *  detname 
)
private

Definition at line 507 of file ValidateGeometry.cc.

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

Referenced by analyze().

508 {
509  clearData();
510 
511  auto const& chambers = cscGeometry_->chambers();
512 
513  for ( auto it = chambers.begin(),
514  itEnd = chambers.end();
515  it != itEnd; ++it )
516  {
517  const CSCChamber* chamber = *it;
518 
519  if ( chamber && chamber->id().endcap() == endcap )
520  {
521  DetId detId = chamber->geographicalId();
522  GlobalPoint gp = chamber->surface().toGlobal(LocalPoint(0.0,0.0,0.0));
523 
524  const TGeoMatrix* matrix = fwGeometry_.getMatrix(detId.rawId());
525 
526  if ( ! matrix )
527  {
528  std::cout<<"Failed to get matrix of CSC chamber with detid: "
529  << detId.rawId() <<std::endl;
530  continue;
531  }
532 
533  compareTransform(gp, matrix);
534 
535  const float* shape = fwGeometry_.getShapePars(detId.rawId());
536 
537  if ( ! shape )
538  {
539  std::cout<<"Failed to get shape of CSC chamber with detid: "
540  << detId.rawId() <<std::endl;
541  continue;
542  }
543 
544  compareShape(chamber, shape);
545  }
546  }
547 
548  makeHistograms(detname);
549 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:114
CSCDetId id() const
Get the (concrete) DetId.
Definition: CSCChamber.h:37
void makeHistograms(const char *detector)
static char chambers[TOTALCHAMBERS][20]
Definition: ReadPGInfo.cc:243
const TGeoMatrix * getMatrix(unsigned int id) const
Definition: FWGeometry.cc:166
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
int endcap() const
Definition: CSCDetId.h:106
const float * getShapePars(unsigned int id) const
Definition: FWGeometry.cc:309
void compareShape(const GeomDet *det, const float *shape)
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:72
edm::ESHandle< CSCGeometry > cscGeometry_
Definition: DetId.h:18
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
tuple cout
Definition: gather_cfg.py:121
void compareTransform(const GlobalPoint &point, const TGeoMatrix *matrix)
void ValidateGeometry::validateCSCLayerGeometry ( const int  endcap,
const char *  detname 
)
private

Definition at line 552 of file ValidateGeometry.cc.

References CSCRadialStripTopology::angularWidth(), CSCRadialStripTopology::centreToIntersection(), clearData(), compareShape(), compareTransform(), gather_cfg::cout, cscGeometry_, Reference_intrackfit_cff::endcap, CSCDetId::endcap(), fwGeometry_, GeomDet::geographicalId(), CSCLayer::geometry(), FWGeometry::getMatrix(), FWGeometry::getParameters(), FWGeometry::getShapePars(), CSCLayer::id(), LayerTriplets::layers(), CSCLayerGeometry::localCenterOfWireGroup(), makeHistogram(), makeHistograms(), makeMuonMisalignmentScenario::matrix, CSCLayerGeometry::numberOfStrips(), CSCLayerGeometry::numberOfWireGroups(), Parameters::parameters, 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().

553 {
554  clearData();
555  std::vector<double> strip_positions;
556  std::vector<double> wire_positions;
557 
558  std::vector<double> me11_wiresLocal;
559  std::vector<double> me12_wiresLocal;
560  std::vector<double> me13_wiresLocal;
561  std::vector<double> me14_wiresLocal;
562  std::vector<double> me21_wiresLocal;
563  std::vector<double> me22_wiresLocal;
564  std::vector<double> me31_wiresLocal;
565  std::vector<double> me32_wiresLocal;
566  std::vector<double> me41_wiresLocal;
567  std::vector<double> me42_wiresLocal;
568 
569  auto const& layers = cscGeometry_->layers();
570 
571  for ( auto it = layers.begin(),
572  itEnd = layers.end();
573  it != itEnd; ++it )
574  {
575  const CSCLayer* layer = *it;
576 
577  if ( layer && layer->id().endcap() == endcap )
578  {
579  DetId detId = layer->geographicalId();
580  GlobalPoint gp = layer->surface().toGlobal(LocalPoint(0.0,0.0,0.0));
581 
582  const TGeoMatrix* matrix = fwGeometry_.getMatrix(detId.rawId());
583 
584  if ( ! matrix )
585  {
586  std::cout<<"Failed to get matrix of CSC layer with detid: "
587  << detId.rawId() <<std::endl;
588  continue;
589  }
590 
591  compareTransform(gp, matrix);
592 
593  const float* shape = fwGeometry_.getShapePars(detId.rawId());
594 
595  if ( ! shape )
596  {
597  std::cout<<"Failed to get shape of CSC layer with detid: "
598  << detId.rawId() <<std::endl;
599  continue;
600  }
601 
602  compareShape(layer, shape);
603 
604  double length;
605 
606  if ( shape[0] == 1 )
607  {
608  length = shape[4];
609  }
610 
611  else
612  {
613  std::cout<<"Failed to get trapezoid from shape for CSC layer with detid: "
614  << detId.rawId() <<std::endl;
615  continue;
616  }
617 
618  const float* parameters = fwGeometry_.getParameters(detId.rawId());
619 
620  if ( parameters == 0 )
621  {
622  std::cout<<"Parameters empty for CSC layer with detid: "
623  << detId.rawId() <<std::endl;
624  continue;
625  }
626 
627  int yAxisOrientation = layer->geometry()->topology()->yAxisOrientation();
628  assert(yAxisOrientation == parameters[0]);
629 
630  float centreToIntersection = layer->geometry()->topology()->centreToIntersection();
631  assert(centreToIntersection == parameters[1]);
632 
633  float yCentre = layer->geometry()->topology()->yCentreOfStripPlane();
634  assert(yCentre == parameters[2]);
635 
636  float phiOfOneEdge = layer->geometry()->topology()->phiOfOneEdge();
637  assert(phiOfOneEdge == parameters[3]);
638 
639  float stripOffset = layer->geometry()->topology()->stripOffset();
640  assert(stripOffset == parameters[4]);
641 
642  float angularWidth = layer->geometry()->topology()->angularWidth();
643  assert(angularWidth == parameters[5]);
644 
645  for ( int nStrip = 1; nStrip <= layer->geometry()->numberOfStrips();
646  ++nStrip )
647  {
648  float xOfStrip1 = layer->geometry()->xOfStrip(nStrip);
649 
650  double stripAngle = phiOfOneEdge + yAxisOrientation*(nStrip-(0.5-stripOffset))*angularWidth;
651  double xOfStrip2 = yAxisOrientation*(centreToIntersection-yCentre)*tan(stripAngle);
652 
653  strip_positions.push_back(xOfStrip1-xOfStrip2);
654  }
655 
656  int station = layer->id().station();
657  int ring = layer->id().ring();
658 
659  double wireSpacingInGroup = layer->geometry()->wireTopology()->wireSpacing();
660  assert(wireSpacingInGroup == parameters[6]);
661 
662  double wireSpacing = 0.0;
663  // we calculate an average wire group
664  // spacing from radialExtentOfTheWirePlane / numOfWireGroups
665 
666  double extentOfWirePlane = 0.0;
667 
668  if ( ring == 2 )
669  {
670  if ( station == 1 )
671  extentOfWirePlane = 174.81; //wireSpacing = 174.81/64;
672  else
673  extentOfWirePlane = 323.38; //wireSpacing = 323.38/64;
674  }
675  else if ( station == 1 && (ring == 1 || ring == 4))
676  extentOfWirePlane = 150.5; //wireSpacing = 150.5/48;
677  else if ( station == 1 && ring == 3 )
678  extentOfWirePlane = 164.47; //wireSpacing = 164.47/32;
679  else if ( station == 2 && ring == 1 )
680  extentOfWirePlane = 189.97; //wireSpacing = 189.97/112;
681  else if ( station == 3 && ring == 1 )
682  extentOfWirePlane = 170.01; //wireSpacing = 170.01/96;
683  else if ( station == 4 && ring == 1 )
684  extentOfWirePlane = 149.73; //wireSpacing = 149.73/96;
685 
686  float wireAngle = layer->geometry()->wireTopology()->wireAngle();
687  assert(wireAngle == parameters[7]);
688 
689  //float cosWireAngle = cos(wireAngle);
690 
691  /* NOTE
692  Some parameters don't seem available in a public interface
693  so have to perhaps hard-code. This may not be too bad as there
694  seems to be a lot of degeneracy.
695  */
696 
697  double alignmentPinToFirstWire;
698  double yAlignmentFrame = 3.49;
699 
700  if ( station == 1 )
701  {
702  if ( ring == 1 || ring == 4 )
703  {
704  alignmentPinToFirstWire = 1.065;
705  yAlignmentFrame = 0.0;
706  }
707 
708  else // ME12, ME 13
709  alignmentPinToFirstWire = 2.85;
710  }
711 
712  else if ( station == 4 && ring == 1 )
713  alignmentPinToFirstWire = 3.04;
714 
715  else if ( station == 3 && ring == 1 )
716  alignmentPinToFirstWire = 2.84;
717 
718  else // ME21, ME22, ME32, ME42
719  alignmentPinToFirstWire = 2.87;
720 
721  double yOfFirstWire = (yAlignmentFrame-length) + alignmentPinToFirstWire;
722 
723  int nWireGroups = layer->geometry()->numberOfWireGroups();
724  double E = extentOfWirePlane/nWireGroups;
725 
726  for ( int nWireGroup = 1; nWireGroup <= nWireGroups; ++nWireGroup )
727  {
728  LocalPoint centerOfWireGroup = layer->geometry()->localCenterOfWireGroup(nWireGroup);
729  double yOfWire1 = centerOfWireGroup.y();
730 
731  //double yOfWire2 = (-0.5 - (nWireGroups*0.5 - 1) + (nWireGroup-1))*E;
732  //yOfWire2 += 0.5*E;
733  double yOfWire2 = yOfFirstWire + ((nWireGroup-1)*E);
734  yOfWire2 += wireSpacing*0.5;
735 
736  double ydiff_local = yOfWire1 - yOfWire2;
737  wire_positions.push_back(ydiff_local);
738 
739  //GlobalPoint globalPoint = layer->surface().toGlobal(LocalPoint(0.0,yOfWire1,0.0));
740 
741  /*
742  float fwLocalPoint[3] =
743  {
744  0.0, yOfWire2, 0.0
745  };
746 
747  float fwGlobalPoint[3];
748  fwGeometry_.localToGlobal(detId.rawId(), fwLocalPoint, fwGlobalPoint);
749  double ydiff_global = globalPoint.y() - fwGlobalPoint[1];
750  */
751 
752  if ( station == 1 )
753  {
754  if ( ring == 1 )
755  {
756  me11_wiresLocal.push_back(ydiff_local);
757  }
758  else if ( ring == 2 )
759  {
760  me12_wiresLocal.push_back(ydiff_local);
761  }
762  else if ( ring == 3 )
763  {
764  me13_wiresLocal.push_back(ydiff_local);
765  }
766  else if ( ring == 4 )
767  {
768  me14_wiresLocal.push_back(ydiff_local);
769  }
770  }
771  else if ( station == 2 )
772  {
773  if ( ring == 1 )
774  {
775  me21_wiresLocal.push_back(ydiff_local);
776  }
777  else if ( ring == 2 )
778  {
779  me22_wiresLocal.push_back(ydiff_local);
780  }
781  }
782  else if ( station == 3 )
783  {
784  if ( ring == 1 )
785  {
786  me31_wiresLocal.push_back(ydiff_local);
787  }
788  else if ( ring == 2 )
789  {
790  me32_wiresLocal.push_back(ydiff_local);
791  }
792  }
793  else if ( station == 4 )
794  {
795  if ( ring == 1 )
796  {
797  me41_wiresLocal.push_back(ydiff_local);
798  }
799  else if ( ring == 2 )
800  {
801  me42_wiresLocal.push_back(ydiff_local);
802  }
803  }
804  }
805  }
806  }
807 
808  std::string hn(detname);
809  makeHistogram(hn+": xOfStrip", strip_positions);
810 
811  makeHistogram(hn+": local yOfWire", wire_positions);
812 
813  makeHistogram("ME11: local yOfWire", me11_wiresLocal);
814  makeHistogram("ME12: local yOfWire", me12_wiresLocal);
815  makeHistogram("ME13: local yOfWire", me13_wiresLocal);
816  makeHistogram("ME14: local yOfWire", me14_wiresLocal);
817  makeHistogram("ME21: local yOfWire", me21_wiresLocal);
818  makeHistogram("ME22: local yOfWire", me22_wiresLocal);
819  makeHistogram("ME31: local yOfWire", me31_wiresLocal);
820  makeHistogram("ME32: local yOfWire", me32_wiresLocal);
821  makeHistogram("ME41: local yOfWire", me41_wiresLocal);
822  makeHistogram("ME42: local yOfWire", me42_wiresLocal);
823 
824  makeHistograms(detname);
825 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:114
dictionary parameters
Definition: Parameters.py:2
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
const CSCWireTopology * wireTopology() const
const float * getParameters(unsigned int id) const
Definition: FWGeometry.cc:293
CSCDetId id() const
Definition: CSCLayer.h:42
void makeHistograms(const char *detector)
T y() const
Definition: PV3DBase.h:63
int numberOfStrips() const
double wireSpacing() const
const TGeoMatrix * getMatrix(unsigned int id) const
Definition: FWGeometry.cc:166
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
int numberOfWireGroups() const
void makeHistogram(const std::string &name, std::vector< double > &data)
float xOfStrip(int strip, float y=0.) const
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
int endcap() const
Definition: CSCDetId.h:106
const float * getShapePars(unsigned int id) const
Definition: FWGeometry.cc:309
float wireAngle() const
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:72
edm::ESHandle< CSCGeometry > cscGeometry_
LocalPoint localCenterOfWireGroup(int wireGroup) const
int ring() const
Definition: CSCDetId.h:88
Definition: DetId.h:18
const CSCStripTopology * topology() const
virtual float stripOffset(void) const
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
int station() const
Definition: CSCDetId.h:99
tuple cout
Definition: gather_cfg.py:121
const CSCLayerGeometry * geometry() const
Definition: CSCLayer.h:47
void compareTransform(const GlobalPoint &point, const TGeoMatrix *matrix)
void ValidateGeometry::validateDTChamberGeometry ( )
private

Definition at line 374 of file ValidateGeometry.cc.

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

Referenced by analyze().

375 {
376  clearData();
377 
378  auto const& chambers = dtGeometry_->chambers();
379 
380  for ( auto it = chambers.begin(),
381  itEnd = chambers.end();
382  it != itEnd; ++it)
383  {
384  const DTChamber* chamber = *it;
385 
386  if ( chamber )
387  {
388  DTChamberId chId = chamber->id();
389  GlobalPoint gp = chamber->surface().toGlobal(LocalPoint(0.0, 0.0, 0.0));
390 
391  const TGeoMatrix* matrix = fwGeometry_.getMatrix(chId.rawId());
392 
393  if ( ! matrix )
394  {
395  std::cout<<"Failed to get matrix of DT chamber with detid: "
396  << chId.rawId() <<std::endl;
397  continue;
398  }
399 
400  compareTransform(gp, matrix);
401 
402  const float* shape = fwGeometry_.getShapePars(chId.rawId());
403 
404  if ( ! shape )
405  {
406  std::cout<<"Failed to get shape of DT chamber with detid: "
407  << chId.rawId() <<std::endl;
408  continue;
409  }
410 
411  compareShape(chamber, shape);
412  }
413  }
414 
415  makeHistograms("DT chamber");
416 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:114
void makeHistograms(const char *detector)
static char chambers[TOTALCHAMBERS][20]
Definition: ReadPGInfo.cc:243
const TGeoMatrix * getMatrix(unsigned int id) const
Definition: FWGeometry.cc:166
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
const float * getShapePars(unsigned int id) const
Definition: FWGeometry.cc:309
void compareShape(const GeomDet *det, const float *shape)
DTChamberId id() const
Return the DTChamberId of this chamber.
Definition: DTChamber.cc:33
edm::ESHandle< DTGeometry > dtGeometry_
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
tuple cout
Definition: gather_cfg.py:121
void compareTransform(const GlobalPoint &point, const TGeoMatrix *matrix)
void ValidateGeometry::validateDTLayerGeometry ( )
private

Definition at line 420 of file ValidateGeometry.cc.

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

Referenced by analyze().

421 {
422  clearData();
423 
424  std::vector<double> wire_positions;
425 
426  auto const& layers = dtGeometry_->layers();
427 
428  for ( auto it = layers.begin(),
429  itEnd = layers.end();
430  it != itEnd; ++it)
431  {
432  const DTLayer* layer = *it;
433 
434  if ( layer )
435  {
436  DTLayerId layerId = layer->id();
437  GlobalPoint gp = layer->surface().toGlobal(LocalPoint(0.0, 0.0, 0.0));
438 
439  const TGeoMatrix* matrix = fwGeometry_.getMatrix(layerId.rawId());
440 
441  if ( ! matrix )
442  {
443  std::cout<<"Failed to get matrix of DT layer with detid: "
444  << layerId.rawId() <<std::endl;
445  continue;
446  }
447 
448  compareTransform(gp, matrix);
449 
450  const float* shape = fwGeometry_.getShapePars(layerId.rawId());
451 
452  if ( ! shape )
453  {
454  std::cout<<"Failed to get shape of DT layer with detid: "
455  << layerId.rawId() <<std::endl;
456  continue;
457  }
458 
459  compareShape(layer, shape);
460 
461 
462  const float* parameters = fwGeometry_.getParameters(layerId.rawId());
463 
464  if ( parameters == 0 )
465  {
466  std::cout<<"Parameters empty for DT layer with detid: "
467  << layerId.rawId() <<std::endl;
468  continue;
469  }
470 
471  float width = layer->surface().bounds().width();
472  assert(width == parameters[6]);
473 
474  float thickness = layer->surface().bounds().thickness();
475  assert(thickness == parameters[7]);
476 
477  float length = layer->surface().bounds().length();
478  assert(length == parameters[8]);
479 
480  int firstChannel = layer->specificTopology().firstChannel();
481  assert(firstChannel == parameters[3]);
482 
483  int lastChannel = layer->specificTopology().lastChannel();
484  int nChannels = parameters[5];
485  assert(nChannels == (lastChannel-firstChannel)+1);
486 
487  for ( int wireN = firstChannel; wireN - lastChannel <= 0; ++wireN )
488  {
489  double localX1 = layer->specificTopology().wirePosition(wireN);
490  double localX2 = (wireN -(firstChannel-1)-0.5)*parameters[0] - nChannels/2.0*parameters[0];
491 
492  wire_positions.push_back(localX1-localX2);
493 
494  //std::cout<<"wireN, localXpos: "<< wireN <<" "<< localX1 <<" "<< localX2 <<std::endl;
495 
496  }
497  }
498  }
499 
500  makeHistogram("DT layer wire localX", wire_positions);
501 
502  makeHistograms("DT layer");
503 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:114
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:86
dictionary parameters
Definition: Parameters.py:2
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
virtual float length() const =0
const float * getParameters(unsigned int id) const
Definition: FWGeometry.cc:293
DTLayerId id() const
Return the DetId of this SL.
Definition: DTLayer.cc:46
void makeHistograms(const char *detector)
const Bounds & bounds() const
Definition: Surface.h:128
const TGeoMatrix * getMatrix(unsigned int id) const
Definition: FWGeometry.cc:166
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
void makeHistogram(const std::string &name, std::vector< double > &data)
int firstChannel() const
Returns the wire number of the first wire.
Definition: DTTopology.h:78
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
virtual float thickness() const =0
const float * getShapePars(unsigned int id) const
Definition: FWGeometry.cc:309
int lastChannel() const
Returns the wire number of the last wire.
Definition: DTTopology.h:80
const DTTopology & specificTopology() const
Definition: DTLayer.cc:42
void compareShape(const GeomDet *det, const float *shape)
edm::ESHandle< DTGeometry > dtGeometry_
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
tuple cout
Definition: gather_cfg.py:121
virtual float width() const =0
void compareTransform(const GlobalPoint &point, const TGeoMatrix *matrix)
void ValidateGeometry::validatePixelTopology ( const TrackerGeometry::DetContainer dets,
const char *  detname 
)
private

Definition at line 955 of file ValidateGeometry.cc.

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

Referenced by analyze().

957 {
958  std::vector<double> pixelLocalXs;
959  std::vector<double> pixelLocalYs;
960 
961  for ( TrackerGeometry::DetContainer::const_iterator it = dets.begin(),
962  itEnd = dets.end();
963  it != itEnd; ++it )
964  {
965  unsigned int rawId = (*it)->geographicalId().rawId();
966 
967  const float* parameters = fwGeometry_.getParameters(rawId);
968 
969  if ( parameters == 0 )
970  {
971  std::cout<<"Parameters empty for "<< detname <<" element with detid: "
972  << rawId <<std::endl;
973  continue;
974  }
975 
976  if ( const PixelGeomDetUnit* det =
977  dynamic_cast<const PixelGeomDetUnit*>(trackerGeometry_->idToDetUnit((*it)->geographicalId())) )
978  {
979  if ( const PixelTopology* rpt = &det->specificTopology() )
980  {
981  int nrows = rpt->nrows();
982  int ncolumns = rpt->ncolumns();
983 
984  assert(parameters[0] == nrows);
985  assert(parameters[1] == ncolumns);
986 
987  for ( int row = 1; row <= nrows; ++row )
988  {
989  for ( int column = 1; column <= ncolumns; ++column )
990  {
991  LocalPoint localPoint = rpt->localPosition(MeasurementPoint(row, column));
992 
993  pixelLocalXs.push_back(localPoint.x() - fireworks::pixelLocalX(row, nrows));
994  pixelLocalYs.push_back(localPoint.y() - fireworks::pixelLocalY(column, ncolumns));
995  }
996  }
997  }
998 
999  else
1000  std::cout<<"No topology for "<< detname <<" "<< rawId <<std::endl;
1001  }
1002 
1003  else
1004  std::cout<<"No geomDetUnit for "<< detname <<" "<< rawId <<std::endl;
1005  }
1006 
1007  std::string hn(detname);
1008  makeHistogram(hn+" pixelLocalX", pixelLocalXs);
1009  makeHistogram(hn+" pixelLocalY", pixelLocalYs);
1010 }
dictionary parameters
Definition: Parameters.py:2
edm::ESHandle< TrackerGeometry > trackerGeometry_
float pixelLocalY(const double mpy, const int m_ncols)
Definition: TrackUtils.cc:197
const float * getParameters(unsigned int id) const
Definition: FWGeometry.cc:293
T y() const
Definition: PV3DBase.h:63
void makeHistogram(const std::string &name, std::vector< double > &data)
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
#define column(...)
Definition: DbCore.h:74
tuple cout
Definition: gather_cfg.py:121
T x() const
Definition: PV3DBase.h:62
float pixelLocalX(const double mpx, const int m_nrows)
Definition: TrackUtils.cc:164
void ValidateGeometry::validateRPCGeometry ( const int  regionNumber,
const char *  regionName 
)
private

Definition at line 286 of file ValidateGeometry.cc.

References RPCRoll::centreOfStrip(), clearData(), compareShape(), compareTransform(), gather_cfg::cout, fwGeometry_, FWGeometry::getMatrix(), FWGeometry::getParameters(), FWGeometry::getShapePars(), RPCRoll::id(), makeHistogram(), makeHistograms(), makeMuonMisalignmentScenario::matrix, RPCRoll::nstrips(), evf::evtn::offset(), Parameters::parameters, StripTopology::pitch(), DetId::rawId(), RPCDetId::region(), rpcGeometry_, RPCRoll::specificTopology(), AlCaHLTBitMon_QueryRunRegistry::string, StripTopology::stripLength(), GeomDet::surface(), Surface::toGlobal(), and PV3DBase< T, PVType, FrameType >::x().

Referenced by analyze().

287 {
288  clearData();
289 
290  std::vector<double> centers;
291 
292  auto const& rolls = rpcGeometry_->rolls();
293 
294  for ( auto it = rolls.begin(),
295  itEnd = rolls.end();
296  it != itEnd; ++it )
297  {
298  const RPCRoll* roll = *it;
299 
300  if ( roll )
301  {
302  RPCDetId rpcDetId = roll->id();
303 
304  if ( rpcDetId.region() == regionNumber )
305  {
306  const GeomDetUnit* det = rpcGeometry_->idToDetUnit(rpcDetId);
307  GlobalPoint gp = det->surface().toGlobal(LocalPoint(0.0, 0.0, 0.0));
308 
309  const TGeoMatrix* matrix = fwGeometry_.getMatrix(rpcDetId.rawId());
310 
311  if ( ! matrix )
312  {
313  std::cout<<"Failed to get matrix of RPC with detid: "
314  << rpcDetId.rawId() <<std::endl;
315  continue;
316  }
317 
318  compareTransform(gp, matrix);
319 
320  const float* shape = fwGeometry_.getShapePars(rpcDetId.rawId());
321 
322  if ( ! shape )
323  {
324  std::cout<<"Failed to get shape of RPC with detid: "
325  << rpcDetId.rawId() <<std::endl;
326  continue;
327  }
328 
329  compareShape(det, shape);
330 
331  const float* parameters = fwGeometry_.getParameters(rpcDetId.rawId());
332 
333  if ( parameters == 0 )
334  {
335  std::cout<<"Parameters empty for RPC with detid: "
336  << rpcDetId.rawId() <<std::endl;
337  continue;
338  }
339 
340  // Yes, I know that below I'm comparing the equivalence
341  // of floating point numbers
342 
343  int nStrips = roll->nstrips();
344  assert(nStrips == parameters[0]);
345 
346  float stripLength = roll->specificTopology().stripLength();
347  assert(stripLength == parameters[1]);
348 
349  float pitch = roll->specificTopology().pitch();
350  assert(pitch == parameters[2]);
351 
352  float offset = -0.5*nStrips*pitch;
353 
354  for ( int strip = 1; strip <= roll->nstrips(); ++strip )
355  {
356  LocalPoint centreOfStrip1 = roll->centreOfStrip(strip);
357  LocalPoint centreOfStrip2 = LocalPoint((strip-0.5)*pitch + offset, 0.0);
358 
359  centers.push_back(centreOfStrip1.x()-centreOfStrip2.x());
360  }
361  }
362  }
363  }
364 
365  std::string hn(regionName);
366  makeHistogram(hn+": centreOfStrip", centers);
367 
368 
369  makeHistograms(regionName);
370 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:114
dictionary parameters
Definition: Parameters.py:2
LocalPoint centreOfStrip(int strip) const
Definition: RPCRoll.cc:52
const float * getParameters(unsigned int id) const
Definition: FWGeometry.cc:293
edm::ESHandle< RPCGeometry > rpcGeometry_
int nstrips() const
Definition: RPCRoll.cc:46
void makeHistograms(const char *detector)
const TGeoMatrix * getMatrix(unsigned int id) const
Definition: FWGeometry.cc:166
const StripTopology & specificTopology() const
Definition: RPCRoll.cc:107
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
void makeHistogram(const std::string &name, std::vector< double > &data)
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
const float * getShapePars(unsigned int id) const
Definition: FWGeometry.cc:309
virtual float stripLength() const =0
RPCDetId id() const
Definition: RPCRoll.cc:24
void compareShape(const GeomDet *det, const float *shape)
unsigned int offset(bool)
virtual float pitch() const =0
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
tuple cout
Definition: gather_cfg.py:121
T x() const
Definition: PV3DBase.h:62
void compareTransform(const GlobalPoint &point, const TGeoMatrix *matrix)
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:63
void ValidateGeometry::validateStripTopology ( const TrackerGeometry::DetContainer dets,
const char *  detname 
)
private

Definition at line 1013 of file ValidateGeometry.cc.

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

Referenced by analyze().

1015 {
1016  std::vector<double> radialStripLocalXs;
1017  std::vector<double> rectangularStripLocalXs;
1018 
1019  for ( TrackerGeometry::DetContainer::const_iterator it = dets.begin(),
1020  itEnd = dets.end();
1021  it != itEnd; ++it )
1022  {
1023  unsigned int rawId = (*it)->geographicalId().rawId();
1024 
1025  const float* parameters = fwGeometry_.getParameters(rawId);
1026 
1027  if ( parameters == 0 )
1028  {
1029  std::cout<<"Parameters empty for "<< detname <<" element with detid: "
1030  << rawId <<std::endl;
1031  continue;
1032  }
1033 
1034  if ( const StripGeomDetUnit* det =
1035  dynamic_cast<const StripGeomDetUnit*>(trackerGeometry_->idToDet((*it)->geographicalId())) )
1036  {
1037  // NOTE: why the difference in dets vs. units between these and pixels? The dynamic cast above
1038  // fails for many of the detids...
1039 
1040  const StripTopology* st = dynamic_cast<const StripTopology*>(&det->specificTopology());
1041 
1042  if ( st )
1043  {
1044  //assert(parameters[0] == 0);
1045  int nstrips = st->nstrips();
1046  assert(parameters[1] == nstrips);
1047  assert(parameters[2] == st->stripLength());
1048 
1049  if( const RadialStripTopology* rst = dynamic_cast<const RadialStripTopology*>(&(det->specificType().specificTopology())) )
1050  {
1051  assert(parameters[0] == 1);
1052  assert(parameters[3] == rst->yAxisOrientation());
1053  assert(parameters[4] == rst->originToIntersection());
1054  assert(parameters[5] == rst->phiOfOneEdge());
1055  assert(parameters[6] == rst->angularWidth());
1056 
1057  for ( uint16_t strip = 1; strip <= nstrips; ++strip )
1058  {
1059  float stripAngle1 = rst->stripAngle(strip);
1060  float stripAngle2 = parameters[3] * (parameters[5] + strip*parameters[6]);
1061 
1062  assert((stripAngle1-stripAngle2) == 0);
1063 
1064  LocalPoint stripPosition = st->localPosition(strip);
1065 
1066  float stripX = parameters[4]*tan(stripAngle2);
1067  radialStripLocalXs.push_back(stripPosition.x()-stripX);
1068  }
1069  }
1070 
1071  else if( dynamic_cast<const RectangularStripTopology*>(&(det->specificType().specificTopology())) )
1072  {
1073  assert(parameters[0] == 2);
1074  assert(parameters[3] == st->pitch());
1075 
1076  for ( uint16_t strip = 1; strip <= nstrips; ++strip )
1077  {
1078  LocalPoint stripPosition = st->localPosition(strip);
1079  float stripX = -parameters[1]*0.5*parameters[3];
1080  stripX += strip*parameters[3];
1081  rectangularStripLocalXs.push_back(stripPosition.x()-stripX);
1082  }
1083  }
1084 
1085  else if( dynamic_cast<const TrapezoidalStripTopology*>(&(det->specificType().specificTopology())) )
1086  {
1087  assert(parameters[0] == 3);
1088  assert(parameters[3] == st->pitch());
1089  }
1090 
1091  else
1092  std::cout<<"Failed to get pitch for "<< detname <<" "<< rawId <<std::endl;
1093  }
1094 
1095  else
1096  std::cout<<"Failed cast to StripTopology for "<< detname <<" "<< rawId <<std::endl;
1097  }
1098 
1099  //else
1100  // std::cout<<"Failed cast to StripGeomDetUnit for "<< detname <<" "<< rawId <<std::endl;
1101  }
1102 
1103  std::string hn(detname);
1104  makeHistogram(hn+" radial strip localX", radialStripLocalXs);
1105  makeHistogram(hn+" rectangular strip localX", rectangularStripLocalXs);
1106 }
virtual int nstrips() const =0
dictionary parameters
Definition: Parameters.py:2
edm::ESHandle< TrackerGeometry > trackerGeometry_
const float * getParameters(unsigned int id) const
Definition: FWGeometry.cc:293
void makeHistogram(const std::string &name, std::vector< double > &data)
virtual float stripLength() const =0
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
virtual float pitch() const =0
virtual LocalPoint localPosition(float strip) const =0
tuple cout
Definition: gather_cfg.py:121
T x() const
Definition: PV3DBase.h:62
void ValidateGeometry::validateTrackerGeometry ( const TrackerGeometry::DetContainer dets,
const char *  detname 
)
private

Definition at line 875 of file ValidateGeometry.cc.

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

Referenced by analyze().

877 {
878  clearData();
879 
880  for ( TrackerGeometry::DetContainer::const_iterator it = dets.begin(),
881  itEnd = dets.end();
882  it != itEnd; ++it )
883  {
884  GlobalPoint gp = (trackerGeometry_->idToDet((*it)->geographicalId()))->surface().toGlobal(LocalPoint(0.0,0.0,0.0));
885  unsigned int rawId = (*it)->geographicalId().rawId();
886 
887  const TGeoMatrix* matrix = fwGeometry_.getMatrix(rawId);
888 
889  if ( ! matrix )
890  {
891  std::cout <<"Failed to get matrix of "<< detname
892  <<" element with detid: "<< rawId <<std::endl;
893  continue;
894  }
895 
896  compareTransform(gp, matrix);
897 
898  const float* shape = fwGeometry_.getShapePars(rawId);
899 
900  if ( ! shape )
901  {
902  std::cout<<"Failed to get shape of "<< detname
903  <<" element with detid: "<< rawId <<std::endl;
904  continue;
905  }
906 
907  compareShape(*it, shape);
908  }
909 
910  makeHistograms(detname);
911 }
edm::ESHandle< TrackerGeometry > trackerGeometry_
void makeHistograms(const char *detector)
const TGeoMatrix * getMatrix(unsigned int id) const
Definition: FWGeometry.cc:166
const float * getShapePars(unsigned int id) const
Definition: FWGeometry.cc:309
void compareShape(const GeomDet *det, const float *shape)
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
tuple cout
Definition: gather_cfg.py:121
void compareTransform(const GlobalPoint &point, const TGeoMatrix *matrix)
void ValidateGeometry::validateTrackerGeometry ( const TrackerGeometry::DetUnitContainer dets,
const char *  detname 
)
private

Definition at line 915 of file ValidateGeometry.cc.

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

917 {
918  clearData();
919 
920  for ( TrackerGeometry::DetUnitContainer::const_iterator it = dets.begin(),
921  itEnd = dets.end();
922  it != itEnd; ++it )
923  {
924  GlobalPoint gp = (trackerGeometry_->idToDet((*it)->geographicalId()))->surface().toGlobal(LocalPoint(0.0,0.0,0.0));
925  unsigned int rawId = (*it)->geographicalId().rawId();
926 
927  const TGeoMatrix* matrix = fwGeometry_.getMatrix(rawId);
928 
929  if ( ! matrix )
930  {
931  std::cout<< "Failed to get matrix of "<< detname
932  <<" element with detid: "<< rawId <<std::endl;
933  continue;
934  }
935 
936  compareTransform(gp, matrix);
937 
938 
939  const float* shape = fwGeometry_.getShapePars(rawId);
940 
941  if ( ! shape )
942  {
943  std::cout<<"Failed to get shape of "<< detname
944  <<" element with detid: "<< rawId <<std::endl;
945  continue;
946  }
947 
948  compareShape(*it, shape);
949  }
950 
951  makeHistograms(detname);
952 }
edm::ESHandle< TrackerGeometry > trackerGeometry_
void makeHistograms(const char *detector)
const TGeoMatrix * getMatrix(unsigned int id) const
Definition: FWGeometry.cc:166
const float * getShapePars(unsigned int id) const
Definition: FWGeometry.cc:309
void compareShape(const GeomDet *det, const float *shape)
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
tuple cout
Definition: gather_cfg.py:121
void compareTransform(const GlobalPoint &point, const TGeoMatrix *matrix)

Member Data Documentation

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

Definition at line 124 of file ValidateGeometry.cc.

Referenced by clearData(), compareShape(), dataEmpty(), and makeHistograms().

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

Definition at line 115 of file ValidateGeometry.cc.

Referenced by analyze(), and validateCaloGeometry().

edm::ESHandle<CSCGeometry> ValidateGeometry::cscGeometry_
private
edm::ESHandle<DTGeometry> ValidateGeometry::dtGeometry_
private
FWGeometry ValidateGeometry::fwGeometry_
private
std::vector<double> ValidateGeometry::globalDistances_
private
std::string ValidateGeometry::infileName_
private

Definition at line 109 of file ValidateGeometry.cc.

Referenced by ValidateGeometry().

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

Definition at line 125 of file ValidateGeometry.cc.

Referenced by clearData(), compareShape(), dataEmpty(), and makeHistograms().

TFile* ValidateGeometry::outFile_
private

Definition at line 120 of file ValidateGeometry.cc.

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

std::string ValidateGeometry::outfileName_
private

Definition at line 110 of file ValidateGeometry.cc.

Referenced by endJob(), and ValidateGeometry().

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

Definition at line 112 of file ValidateGeometry.cc.

Referenced by analyze(), and validateRPCGeometry().

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

Definition at line 126 of file ValidateGeometry.cc.

Referenced by clearData(), compareShape(), dataEmpty(), and makeHistograms().

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

Definition at line 123 of file ValidateGeometry.cc.

Referenced by clearData(), compareShape(), dataEmpty(), and makeHistograms().

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