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 ()
 
- 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
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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 & itemsToGetFromEvent () 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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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)
 

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 &)
 
- 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 149 of file ValidateGeometry.cc.

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

150  : infileName_(iConfig.getUntrackedParameter<std::string>("infileName")),
151  outfileName_(iConfig.getUntrackedParameter<std::string>("outfileName"))
152 {
153  doTracker_ = iConfig.getUntrackedParameter<bool>( "Tracker", true );
154  doMuon_ = iConfig.getUntrackedParameter<bool>( "Muon", true );
155  doCalo_ = iConfig.getUntrackedParameter<bool>( "Calo", true );
156 
158 
159  outFile_ = new TFile(outfileName_.c_str(), "RECREATE");
160 }
T getUntrackedParameter(std::string const &, T const &) const
void loadMap(const char *fileName)
Definition: FWGeometry.cc:52
std::string infileName_
std::string outfileName_
ValidateGeometry::~ValidateGeometry ( )

Definition at line 163 of file ValidateGeometry.cc.

164 {}

Member Function Documentation

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

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

169 {
170  if( doMuon_ )
171  {
172  eventSetup.get<MuonGeometryRecord>().get(rpcGeometry_);
173 
174  if ( rpcGeometry_.isValid() )
175  {
176  std::cout<<"Validating RPC -z endcap geometry"<<std::endl;
177  validateRPCGeometry(-1, "RPC -z endcap");
178 
179  std::cout<<"Validating RPC +z endcap geometry"<<std::endl;
180  validateRPCGeometry(+1, "RPC +z endcap");
181 
182  std::cout<<"Validating RPC barrel geometry"<<std::endl;
183  validateRPCGeometry(0, "RPC barrel");
184  }
185  else
186  fwLog(fwlog::kWarning)<<"Invalid RPC geometry"<<std::endl;
187 
188 
189  eventSetup.get<MuonGeometryRecord>().get(dtGeometry_);
190 
191  if ( dtGeometry_.isValid() )
192  {
193  std::cout<<"Validating DT chamber geometry"<<std::endl;
195 
196  std::cout<<"Validating DT layer geometry"<<std::endl;
198  }
199  else
200  fwLog(fwlog::kWarning)<<"Invalid DT geometry"<<std::endl;
201 
202 
203  eventSetup.get<MuonGeometryRecord>().get(cscGeometry_);
204 
205  if ( cscGeometry_.isValid() )
206  {
207  std::cout<<"Validating CSC -z geometry"<<std::endl;
208  validateCSChamberGeometry(-1, "CSC chamber -z endcap");
209 
210  std::cout<<"Validating CSC +z geometry"<<std::endl;
211  validateCSChamberGeometry(+1, "CSC chamber +z endcap");
212 
213  std::cout<<"Validating CSC layer -z geometry"<<std::endl;
214  validateCSCLayerGeometry(-1, "CSC layer -z endcap");
215 
216  std::cout<<"Validating CSC layer +z geometry"<<std::endl;
217  validateCSCLayerGeometry(+1, "CSC layer +z endcap");
218  }
219  else
220  fwLog(fwlog::kWarning)<<"Invalid CSC geometry"<<std::endl;
221  }
222 
223  if( doTracker_ )
224  {
226 
227  if ( trackerGeometry_.isValid() )
228  {
229  std::cout<<"Validating TIB geometry and topology"<<std::endl;
232 
233  std::cout<<"Validating TOB geometry and topology"<<std::endl;
236 
237  std::cout<<"Validating TEC geometry and topology"<<std::endl;
240 
241  std::cout<<"Validating TID geometry and topology"<<std::endl;
244 
245  std::cout<<"Validating PXB geometry and topology"<<std::endl;
248 
249  std::cout<<"Validating PXF geometry and topology"<<std::endl;
252  }
253  else
254  fwLog(fwlog::kWarning)<<"Invalid Tracker geometry"<<std::endl;
255  }
256 
257  if( doCalo_ )
258  {
259  eventSetup.get<CaloGeometryRecord>().get(caloGeometry_);
260 
261 
262  if ( caloGeometry_.isValid() )
263  {
264  std::cout<<"Validating EB geometry"<<std::endl;
266 
267  std::cout<<"Validating EE geometry"<<std::endl;
269 
270  std::cout<<"Validating ES geometry"<<std::endl;
272 
273  std::cout<<"Validating HB geometry"<<std::endl;
275 
276  std::cout<<"Validating HE geometry"<<std::endl;
278 
279  std::cout<<"Validating HO geometry"<<std::endl;
281 
282  std::cout<<"Validating HF geometry"<<std::endl;
284 
285  std::cout<<"Validating Castor geometry"<<std::endl;
287 
288  std::cout<<"Validating ZDC geometry"<<std::endl;
290  }
291  else
292  fwLog(fwlog::kWarning)<<"Invalid Calo geometry"<<std::endl;
293  }
294 }
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:50
const T & get() const
Definition: EventSetup.h:56
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:47
const DetContainer & detsTID() const
void ValidateGeometry::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 1243 of file ValidateGeometry.cc.

References outFile_.

1244 {
1245  outFile_->cd();
1246 }
void ValidateGeometry::clearData ( )
inlineprivate

Definition at line 125 of file ValidateGeometry.cc.

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

126  {
127  globalDistances_.clear();
128  topWidths_.clear();
129  bottomWidths_.clear();
130  lengths_.clear();
131  thicknesses_.clear();
132  }
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 1096 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().

1097 {
1098  double shape_topWidth;
1099  double shape_bottomWidth;
1100  double shape_length;
1101  double shape_thickness;
1102 
1103  if ( shape[0] == 1 )
1104  {
1105  shape_topWidth = shape[2];
1106  shape_bottomWidth = shape[1];
1107  shape_length = shape[4];
1108  shape_thickness = shape[3];
1109  }
1110 
1111  else if ( shape[0] == 2 )
1112  {
1113  shape_topWidth = shape[1];
1114  shape_bottomWidth = shape[1];
1115  shape_length = shape[2];
1116  shape_thickness = shape[3];
1117  }
1118 
1119  else
1120  {
1121  std::cout<<"Failed to get box or trapezoid from shape"<<std::endl;
1122  return;
1123  }
1124 
1125  double topWidth, bottomWidth;
1126  double length, thickness;
1127 
1128  const Bounds* bounds = &(det->surface().bounds());
1129 
1130  if ( const TrapezoidalPlaneBounds* tpbs = dynamic_cast<const TrapezoidalPlaneBounds*>(bounds) )
1131  {
1132  std::array<const float, 4> const & ps = tpbs->parameters();
1133 
1134  assert(ps.size() == 4);
1135 
1136  bottomWidth = ps[0];
1137  topWidth = ps[1];
1138  thickness = ps[2];
1139  length = ps[3];
1140  }
1141 
1142  else if ( (dynamic_cast<const RectangularPlaneBounds*>(bounds)) )
1143  {
1144  length = det->surface().bounds().length()*0.5;
1145  topWidth = det->surface().bounds().width()*0.5;
1146  bottomWidth = topWidth;
1147  thickness = det->surface().bounds().thickness()*0.5;
1148  }
1149 
1150  else
1151  {
1152  std::cout<<"Failed to get bounds"<<std::endl;
1153  return;
1154  }
1155 
1156  //assert((tgeotrap && trapezoid) || (tgeobbox && rectangle));
1157 
1158  /*
1159  std::cout<<"topWidth: "<< shape_topWidth <<" "<< topWidth <<std::endl;
1160  std::cout<<"bottomWidth: "<< shape_bottomWidth <<" "<< bottomWidth <<std::endl;
1161  std::cout<<"length: "<< shape_length <<" "<< length <<std::endl;
1162  std::cout<<"thickness: "<< shape_thickness <<" "<< thickness <<std::endl;
1163  */
1164 
1165  topWidths_.push_back(fabs(shape_topWidth - topWidth));
1166  bottomWidths_.push_back(fabs(shape_bottomWidth - bottomWidth));
1167  lengths_.push_back(fabs(shape_length - length));
1168  thicknesses_.push_back(fabs(shape_thickness - thickness));
1169 
1170  return;
1171 }
virtual float length() const =0
std::vector< double > topWidths_
std::vector< double > bottomWidths_
const Bounds & bounds() const
Definition: Surface.h:120
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
virtual float width() const =0
virtual float thickness() const =0
std::vector< double > thicknesses_
Definition: Bounds.h:22
std::vector< double > lengths_
void ValidateGeometry::compareTransform ( const GlobalPoint point,
const TGeoMatrix *  matrix 
)
private

Definition at line 1079 of file ValidateGeometry.cc.

References SoftLeptonByDistance_cfi::distance, getDistance(), globalDistances_, and DTRecHitQuality_cfi::local.

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

1081 {
1082  double local[3] =
1083  {
1084  0.0, 0.0, 0.0
1085  };
1086 
1087  double global[3];
1088 
1089  matrix->LocalToMaster(local, global);
1090 
1091  double distance = getDistance(GlobalPoint(global[0], global[1], global[2]), gp);
1092  globalDistances_.push_back(distance);
1093 }
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 134 of file ValidateGeometry.cc.

135  {
136  return (globalDistances_.empty() &&
137  topWidths_.empty() &&
138  bottomWidths_.empty() &&
139  lengths_.empty() &&
140  thicknesses_.empty());
141  }
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 1250 of file ValidateGeometry.cc.

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

1251 {
1252  std::cout<<"Done. "<<std::endl;
1253  std::cout<<"Results written to "<< outfileName_ <<std::endl;
1254  outFile_->Close();
1255 }
std::string outfileName_
double ValidateGeometry::getDistance ( const GlobalPoint point1,
const GlobalPoint point2 
)
private

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

1178 {
1179  /*
1180  std::cout<<"X: "<< p1.x() <<" "<< p2.x() <<std::endl;
1181  std::cout<<"Y: "<< p1.y() <<" "<< p2.y() <<std::endl;
1182  std::cout<<"Z: "<< p1.z() <<" "<< p2.z() <<std::endl;
1183  */
1184 
1185  return sqrt((p1.x()-p2.x())*(p1.x()-p2.x())+
1186  (p1.y()-p2.y())*(p1.y()-p2.y())+
1187  (p1.z()-p2.z())*(p1.z()-p2.z()));
1188 }
T sqrt(T t)
Definition: SSEVec.h:18
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 1218 of file ValidateGeometry.cc.

References create_public_lumi_plots::hist, and particleFlow_cfi::maxE.

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

1219 {
1220  if ( data.empty() )
1221  return;
1222 
1223  std::vector<double>::iterator it;
1224 
1225  it = std::min_element(data.begin(), data.end());
1226  double minE = *it;
1227 
1228  it = std::max_element(data.begin(), data.end());
1229  double maxE = *it;
1230 
1231  std::vector<double>::iterator itEnd = data.end();
1232 
1233  TH1D hist(name.c_str(), name.c_str(), 100, minE*(1+0.10), maxE*(1+0.10));
1234 
1235  for ( it = data.begin(); it != itEnd; ++it )
1236  hist.Fill(*it);
1237 
1238  hist.GetXaxis()->SetTitle("[cm]");
1239  hist.Write();
1240 }
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void ValidateGeometry::makeHistograms ( const char *  detector)
private

Definition at line 1192 of file ValidateGeometry.cc.

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

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

1193 {
1194  outFile_->cd();
1195 
1197 
1198  std::string gdn = d+": distance between points in global coordinates";
1200 
1201  std::string twn = d + ": absolute difference between top widths (along X)";
1202  makeHistogram(twn, topWidths_);
1203 
1204  std::string bwn = d + ": absolute difference between bottom widths (along X)";
1206 
1207  std::string ln = d + ": absolute difference between lengths (along Y)";
1208  makeHistogram(ln, lengths_);
1209 
1210  std::string tn = d + ": absolute difference between thicknesses (along Z)";
1212 
1213  return;
1214 }
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 840 of file ValidateGeometry.cc.

References caloGeometry_, clearData(), gather_cfg::cout, SoftLeptonByDistance_cfi::distance, fwGeometry_, CaloCellGeometry::getCorners(), FWGeometry::getCorners(), getDistance(), CaloSubdetectorGeometry::getGeometry(), CaloGeometry::getSubdetectorGeometry(), CaloSubdetectorGeometry::getValidDetIds(), globalDistances_, mps_fire::i, makeHistograms(), PFRecoTauDiscriminationByIsolation_cfi::offset, EZArrayFL< T >::size(), x, y, and z.

Referenced by analyze().

843 {
844  clearData();
845 
848 
849  const std::vector<DetId>& ids = geometry->getValidDetIds(detector, subdetector);
850 
851  for (auto it = ids.begin(),
852  iEnd = ids.end();
853  it != iEnd; ++it)
854  {
855  unsigned int rawId = (*it).rawId();
856 
857  const float* points = fwGeometry_.getCorners(rawId);
858 
859  if ( points == 0 )
860  {
861  std::cout <<"Failed to get points of "<< detname
862  <<" element with detid: "<< rawId <<std::endl;
863  continue;
864  }
865 
866  const CaloCellGeometry* cellGeometry = geometry->getGeometry(*it);
867  const CaloCellGeometry::CornersVec& corners = cellGeometry->getCorners();
868 
869  assert(corners.size() == 8);
870 
871  for ( unsigned int i = 0, offset = 0; i < 8; ++i )
872  {
873  offset = 2*i;
874 
875  double distance = getDistance(GlobalPoint(points[i+offset], points[i+1+offset], points[i+2+offset]),
876  GlobalPoint(corners[i].x(), corners[i].y(), corners[i].z()));
877 
878  globalDistances_.push_back(distance);
879  }
880  }
881 
882  makeHistograms(detname);
883 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:45
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)
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
size_type size() const
Definition: EZArrayFL.h:81
const float * getCorners(unsigned int id) const
Definition: FWGeometry.cc:286
double getDistance(const GlobalPoint &point1, const GlobalPoint &point2)
CornersVec const & 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 519 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().

520 {
521  clearData();
522 
523  auto const& chambers = cscGeometry_->chambers();
524 
525  for ( auto it = chambers.begin(),
526  itEnd = chambers.end();
527  it != itEnd; ++it )
528  {
529  const CSCChamber* chamber = *it;
530 
531  if ( chamber && chamber->id().endcap() == endcap )
532  {
533  DetId detId = chamber->geographicalId();
534  GlobalPoint gp = chamber->surface().toGlobal(LocalPoint(0.0,0.0,0.0));
535 
536  const TGeoMatrix* matrix = fwGeometry_.getMatrix(detId.rawId());
537 
538  if ( ! matrix )
539  {
540  std::cout<<"Failed to get matrix of CSC chamber with detid: "
541  << detId.rawId() <<std::endl;
542  continue;
543  }
544 
545  compareTransform(gp, matrix);
546 
547  const float* shape = fwGeometry_.getShapePars(detId.rawId());
548 
549  if ( ! shape )
550  {
551  std::cout<<"Failed to get shape of CSC chamber with detid: "
552  << detId.rawId() <<std::endl;
553  continue;
554  }
555 
556  compareShape(chamber, shape);
557  }
558  }
559 
560  makeHistograms(detname);
561 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:106
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:32
CSCDetId id() const
Get the (concrete) DetId.
Definition: CSCChamber.h:37
void makeHistograms(const char *detector)
const ChamberContainer & chambers() const
Return a vector of all chambers.
Definition: CSCGeometry.cc:106
const TGeoMatrix * getMatrix(unsigned int id) const
Definition: FWGeometry.cc:175
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
int endcap() const
Definition: CSCDetId.h:93
const float * getShapePars(unsigned int id) const
Definition: FWGeometry.cc:318
void compareShape(const GeomDet *det, const float *shape)
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:79
edm::ESHandle< CSCGeometry > cscGeometry_
Definition: DetId.h:18
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 564 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(), LayerTriplets::layers(), CSCGeometry::layers(), CSCLayerGeometry::localCenterOfWireGroup(), makeHistogram(), makeHistograms(), makeMuonMisalignmentScenario::matrix, CSCLayerGeometry::numberOfStrips(), CSCLayerGeometry::numberOfWireGroups(), metProducer_cfi::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().

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

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

387 {
388  clearData();
389 
390  auto const& chambers = dtGeometry_->chambers();
391 
392  for ( auto it = chambers.begin(),
393  itEnd = chambers.end();
394  it != itEnd; ++it)
395  {
396  const DTChamber* chamber = *it;
397 
398  if ( chamber )
399  {
400  DTChamberId chId = chamber->id();
401  GlobalPoint gp = chamber->surface().toGlobal(LocalPoint(0.0, 0.0, 0.0));
402 
403  const TGeoMatrix* matrix = fwGeometry_.getMatrix(chId.rawId());
404 
405  if ( ! matrix )
406  {
407  std::cout<<"Failed to get matrix of DT chamber with detid: "
408  << chId.rawId() <<std::endl;
409  continue;
410  }
411 
412  compareTransform(gp, matrix);
413 
414  const float* shape = fwGeometry_.getShapePars(chId.rawId());
415 
416  if ( ! shape )
417  {
418  std::cout<<"Failed to get shape of DT chamber with detid: "
419  << chId.rawId() <<std::endl;
420  continue;
421  }
422 
423  compareShape(chamber, shape);
424  }
425  }
426 
427  makeHistograms("DT chamber");
428 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:106
const std::vector< const DTChamber * > & chambers() const
Return a vector of all Chamber.
Definition: DTGeometry.cc:85
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:32
void makeHistograms(const char *detector)
const TGeoMatrix * getMatrix(unsigned int id) const
Definition: FWGeometry.cc:175
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
const float * getShapePars(unsigned int id) const
Definition: FWGeometry.cc:318
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_
static char chambers[264][20]
Definition: ReadPGInfo.cc:243
void compareTransform(const GlobalPoint &point, const TGeoMatrix *matrix)
void ValidateGeometry::validateDTLayerGeometry ( )
private

Definition at line 432 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(), LayerTriplets::layers(), DTGeometry::layers(), Bounds::length(), makeHistogram(), makeHistograms(), makeMuonMisalignmentScenario::matrix, ecaldqm::nChannels, metProducer_cfi::parameters, DetId::rawId(), DTLayer::specificTopology(), GeomDet::surface(), Bounds::thickness(), Surface::toGlobal(), ApeEstimator_cff::width, Bounds::width(), and DTTopology::wirePosition().

Referenced by analyze().

433 {
434  clearData();
435 
436  std::vector<double> wire_positions;
437 
438  auto const& layers = dtGeometry_->layers();
439 
440  for ( auto it = layers.begin(),
441  itEnd = layers.end();
442  it != itEnd; ++it)
443  {
444  const DTLayer* layer = *it;
445 
446  if ( layer )
447  {
448  DTLayerId layerId = layer->id();
449  GlobalPoint gp = layer->surface().toGlobal(LocalPoint(0.0, 0.0, 0.0));
450 
451  const TGeoMatrix* matrix = fwGeometry_.getMatrix(layerId.rawId());
452 
453  if ( ! matrix )
454  {
455  std::cout<<"Failed to get matrix of DT layer with detid: "
456  << layerId.rawId() <<std::endl;
457  continue;
458  }
459 
460  compareTransform(gp, matrix);
461 
462  const float* shape = fwGeometry_.getShapePars(layerId.rawId());
463 
464  if ( ! shape )
465  {
466  std::cout<<"Failed to get shape of DT layer with detid: "
467  << layerId.rawId() <<std::endl;
468  continue;
469  }
470 
471  compareShape(layer, shape);
472 
473 
474  const float* parameters = fwGeometry_.getParameters(layerId.rawId());
475 
476  if ( parameters == 0 )
477  {
478  std::cout<<"Parameters empty for DT layer with detid: "
479  << layerId.rawId() <<std::endl;
480  continue;
481  }
482 
483  float width = layer->surface().bounds().width();
484  assert(width == parameters[6]);
485 
486  float thickness = layer->surface().bounds().thickness();
487  assert(thickness == parameters[7]);
488 
489  float length = layer->surface().bounds().length();
490  assert(length == parameters[8]);
491 
492  int firstChannel = layer->specificTopology().firstChannel();
493  assert(firstChannel == parameters[3]);
494 
495  int lastChannel = layer->specificTopology().lastChannel();
496  int nChannels = parameters[5];
497  assert(nChannels == (lastChannel-firstChannel)+1);
498 
499  for ( int wireN = firstChannel; wireN - lastChannel <= 0; ++wireN )
500  {
501  double localX1 = layer->specificTopology().wirePosition(wireN);
502  double localX2 = (wireN -(firstChannel-1)-0.5)*parameters[0] - nChannels/2.0*parameters[0];
503 
504  wire_positions.push_back(localX1-localX2);
505 
506  //std::cout<<"wireN, localXpos: "<< wireN <<" "<< localX1 <<" "<< localX2 <<std::endl;
507 
508  }
509  }
510  }
511 
512  makeHistogram("DT layer wire localX", wire_positions);
513 
514  makeHistograms("DT layer");
515 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:106
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:86
virtual float length() const =0
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:32
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
const float * getParameters(unsigned int id) const
Definition: FWGeometry.cc:302
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:120
const TGeoMatrix * getMatrix(unsigned int id) const
Definition: FWGeometry.cc:175
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
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 width() const =0
const float * getShapePars(unsigned int id) const
Definition: FWGeometry.cc:318
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_
virtual float thickness() const =0
const std::vector< const DTLayer * > & layers() const
Return a vector of all SuperLayer.
Definition: DTGeometry.cc:95
void compareTransform(const GlobalPoint &point, const TGeoMatrix *matrix)
void ValidateGeometry::validatePixelTopology ( const TrackerGeometry::DetContainer dets,
const char *  detname 
)
private

Definition at line 927 of file ValidateGeometry.cc.

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

Referenced by analyze().

929 {
930  std::vector<double> pixelLocalXs;
931  std::vector<double> pixelLocalYs;
932 
933  for ( TrackerGeometry::DetContainer::const_iterator it = dets.begin(),
934  itEnd = dets.end();
935  it != itEnd; ++it )
936  {
937  unsigned int rawId = (*it)->geographicalId().rawId();
938 
939  const float* parameters = fwGeometry_.getParameters(rawId);
940 
941  if ( parameters == 0 )
942  {
943  std::cout<<"Parameters empty for "<< detname <<" element with detid: "
944  << rawId <<std::endl;
945  continue;
946  }
947 
948  if ( const PixelGeomDetUnit* det =
949  dynamic_cast<const PixelGeomDetUnit*>(trackerGeometry_->idToDetUnit((*it)->geographicalId())) )
950  {
951  if ( const PixelTopology* rpt = &det->specificTopology() )
952  {
953  int nrows = rpt->nrows();
954  int ncolumns = rpt->ncolumns();
955 
956  for ( int row = 1; row <= nrows; ++row )
957  {
958  for ( int column = 1; column <= ncolumns; ++column )
959  {
960  LocalPoint localPoint = rpt->localPosition(MeasurementPoint(row, column));
961 
962  pixelLocalXs.push_back(localPoint.x() - fireworks::pixelLocalX(row, parameters));
963  pixelLocalYs.push_back(localPoint.y() - fireworks::pixelLocalY(column, parameters));
964  }
965  }
966  }
967 
968  else
969  std::cout<<"No topology for "<< detname <<" "<< rawId <<std::endl;
970  }
971 
972  else
973  std::cout<<"No geomDetUnit for "<< detname <<" "<< rawId <<std::endl;
974  }
975 
976  std::string hn(detname);
977  makeHistogram(hn+" pixelLocalX", pixelLocalXs);
978  makeHistogram(hn+" pixelLocalY", pixelLocalYs);
979 }
const TrackerGeomDet * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
edm::ESHandle< TrackerGeometry > trackerGeometry_
const float * getParameters(unsigned int id) const
Definition: FWGeometry.cc:302
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.
float pixelLocalX(const double mpx, const float *)
Definition: TrackUtils.cc:166
float pixelLocalY(const double mpy, const float *)
Definition: TrackUtils.cc:222
T x() const
Definition: PV3DBase.h:62
void ValidateGeometry::validateRPCGeometry ( const int  regionNumber,
const char *  regionName 
)
private

Definition at line 298 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(), PFRecoTauDiscriminationByIsolation_cfi::offset, metProducer_cfi::parameters, StripTopology::pitch(), DetId::rawId(), RPCDetId::region(), RPCGeometry::rolls(), rpcGeometry_, RPCRoll::specificTopology(), AlCaHLTBitMon_QueryRunRegistry::string, digi_MixPreMix_cfi::strip, StripTopology::stripLength(), GeomDet::surface(), Surface::toGlobal(), and PV3DBase< T, PVType, FrameType >::x().

Referenced by analyze().

299 {
300  clearData();
301 
302  std::vector<double> centers;
303 
304  auto const& rolls = rpcGeometry_->rolls();
305 
306  for ( auto it = rolls.begin(),
307  itEnd = rolls.end();
308  it != itEnd; ++it )
309  {
310  const RPCRoll* roll = *it;
311 
312  if ( roll )
313  {
314  RPCDetId rpcDetId = roll->id();
315 
316  if ( rpcDetId.region() == regionNumber )
317  {
318  const GeomDetUnit* det = rpcGeometry_->idToDetUnit(rpcDetId);
319  GlobalPoint gp = det->surface().toGlobal(LocalPoint(0.0, 0.0, 0.0));
320 
321  const TGeoMatrix* matrix = fwGeometry_.getMatrix(rpcDetId.rawId());
322 
323  if ( ! matrix )
324  {
325  std::cout<<"Failed to get matrix of RPC with detid: "
326  << rpcDetId.rawId() <<std::endl;
327  continue;
328  }
329 
330  compareTransform(gp, matrix);
331 
332  const float* shape = fwGeometry_.getShapePars(rpcDetId.rawId());
333 
334  if ( ! shape )
335  {
336  std::cout<<"Failed to get shape of RPC with detid: "
337  << rpcDetId.rawId() <<std::endl;
338  continue;
339  }
340 
341  compareShape(det, shape);
342 
343  const float* parameters = fwGeometry_.getParameters(rpcDetId.rawId());
344 
345  if ( parameters == 0 )
346  {
347  std::cout<<"Parameters empty for RPC with detid: "
348  << rpcDetId.rawId() <<std::endl;
349  continue;
350  }
351 
352  // Yes, I know that below I'm comparing the equivalence
353  // of floating point numbers
354 
355  int nStrips = roll->nstrips();
356  assert(nStrips == parameters[0]);
357 
358  float stripLength = roll->specificTopology().stripLength();
359  assert(stripLength == parameters[1]);
360 
361  float pitch = roll->specificTopology().pitch();
362  assert(pitch == parameters[2]);
363 
364  float offset = -0.5*nStrips*pitch;
365 
366  for ( int strip = 1; strip <= roll->nstrips(); ++strip )
367  {
368  LocalPoint centreOfStrip1 = roll->centreOfStrip(strip);
369  LocalPoint centreOfStrip2 = LocalPoint((strip-0.5)*pitch + offset, 0.0);
370 
371  centers.push_back(centreOfStrip1.x()-centreOfStrip2.x());
372  }
373  }
374  }
375  }
376 
377  std::string hn(regionName);
378  makeHistogram(hn+": centreOfStrip", centers);
379 
380 
381  makeHistograms(regionName);
382 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:106
virtual float stripLength() const =0
LocalPoint centreOfStrip(int strip) const
Definition: RPCRoll.cc:52
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:32
const float * getParameters(unsigned int id) const
Definition: FWGeometry.cc:302
const std::vector< const RPCRoll * > & rolls() const
Return a vector of all RPC rolls.
Definition: RPCGeometry.cc:67
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:175
const StripTopology & specificTopology() const
Definition: RPCRoll.cc:107
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
void makeHistogram(const std::string &name, std::vector< double > &data)
virtual const GeomDetUnit * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: RPCGeometry.cc:48
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
const float * getShapePars(unsigned int id) const
Definition: FWGeometry.cc:318
RPCDetId id() const
Definition: RPCRoll.cc:24
void compareShape(const GeomDet *det, const float *shape)
virtual float pitch() const =0
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 982 of file ValidateGeometry.cc.

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

Referenced by analyze().

984 {
985  std::vector<double> radialStripLocalXs;
986  std::vector<double> rectangularStripLocalXs;
987 
988  for ( TrackerGeometry::DetContainer::const_iterator it = dets.begin(),
989  itEnd = dets.end();
990  it != itEnd; ++it )
991  {
992  unsigned int rawId = (*it)->geographicalId().rawId();
993 
994  const float* parameters = fwGeometry_.getParameters(rawId);
995 
996  if ( parameters == 0 )
997  {
998  std::cout<<"Parameters empty for "<< detname <<" element with detid: "
999  << rawId <<std::endl;
1000  continue;
1001  }
1002 
1003  if ( const StripGeomDetUnit* det =
1004  dynamic_cast<const StripGeomDetUnit*>(trackerGeometry_->idToDet((*it)->geographicalId())) )
1005  {
1006  // NOTE: why the difference in dets vs. units between these and pixels? The dynamic cast above
1007  // fails for many of the detids...
1008 
1009  const StripTopology* st = dynamic_cast<const StripTopology*>(&det->specificTopology());
1010 
1011  if ( st )
1012  {
1013  //assert(parameters[0] == 0);
1014  int nstrips = st->nstrips();
1015  assert(parameters[1] == nstrips);
1016  assert(parameters[2] == st->stripLength());
1017 
1018  if( const RadialStripTopology* rst = dynamic_cast<const RadialStripTopology*>(&(det->specificType().specificTopology())) )
1019  {
1020  assert(parameters[0] == 1);
1021  assert(parameters[3] == rst->yAxisOrientation());
1022  assert(parameters[4] == rst->originToIntersection());
1023  assert(parameters[5] == rst->phiOfOneEdge());
1024  assert(parameters[6] == rst->angularWidth());
1025 
1026  for ( uint16_t strip = 1; strip <= nstrips; ++strip )
1027  {
1028  float stripAngle1 = rst->stripAngle(strip);
1029  float stripAngle2 = parameters[3] * (parameters[5] + strip*parameters[6]);
1030 
1031  assert((stripAngle1-stripAngle2) == 0);
1032 
1033  LocalPoint stripPosition = st->localPosition(strip);
1034 
1035  float stripX = parameters[4]*tan(stripAngle2);
1036  radialStripLocalXs.push_back(stripPosition.x()-stripX);
1037  }
1038  }
1039 
1040  else if( dynamic_cast<const RectangularStripTopology*>(&(det->specificType().specificTopology())) )
1041  {
1042  assert(parameters[0] == 2);
1043  assert(parameters[3] == st->pitch());
1044 
1045  for ( uint16_t strip = 1; strip <= nstrips; ++strip )
1046  {
1047  LocalPoint stripPosition = st->localPosition(strip);
1048  float stripX = -parameters[1]*0.5*parameters[3];
1049  stripX += strip*parameters[3];
1050  rectangularStripLocalXs.push_back(stripPosition.x()-stripX);
1051  }
1052  }
1053 
1054  else if( dynamic_cast<const TrapezoidalStripTopology*>(&(det->specificType().specificTopology())) )
1055  {
1056  assert(parameters[0] == 3);
1057  assert(parameters[3] == st->pitch());
1058  }
1059 
1060  else
1061  std::cout<<"Failed to get pitch for "<< detname <<" "<< rawId <<std::endl;
1062  }
1063 
1064  else
1065  std::cout<<"Failed cast to StripTopology for "<< detname <<" "<< rawId <<std::endl;
1066  }
1067 
1068  //else
1069  // std::cout<<"Failed cast to StripGeomDetUnit for "<< detname <<" "<< rawId <<std::endl;
1070  }
1071 
1072  std::string hn(detname);
1073  makeHistogram(hn+" radial strip localX", radialStripLocalXs);
1074  makeHistogram(hn+" rectangular strip localX", rectangularStripLocalXs);
1075 }
virtual float stripLength() const =0
edm::ESHandle< TrackerGeometry > trackerGeometry_
const float * getParameters(unsigned int id) const
Definition: FWGeometry.cc:302
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
virtual float pitch() const =0
T x() const
Definition: PV3DBase.h:62
const TrackerGeomDet * idToDet(DetId) const
void ValidateGeometry::validateTrackerGeometry ( const TrackerGeometry::DetContainer dets,
const char *  detname 
)
private

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

889 {
890  clearData();
891 
892  for ( TrackerGeometry::DetContainer::const_iterator it = dets.begin(),
893  itEnd = dets.end();
894  it != itEnd; ++it )
895  {
896  GlobalPoint gp = (trackerGeometry_->idToDet((*it)->geographicalId()))->surface().toGlobal(LocalPoint(0.0,0.0,0.0));
897  unsigned int rawId = (*it)->geographicalId().rawId();
898 
899  const TGeoMatrix* matrix = fwGeometry_.getMatrix(rawId);
900 
901  if ( ! matrix )
902  {
903  std::cout <<"Failed to get matrix of "<< detname
904  <<" element with detid: "<< rawId <<std::endl;
905  continue;
906  }
907 
908  compareTransform(gp, matrix);
909 
910  const float* shape = fwGeometry_.getShapePars(rawId);
911 
912  if ( ! shape )
913  {
914  std::cout<<"Failed to get shape of "<< detname
915  <<" element with detid: "<< rawId <<std::endl;
916  continue;
917  }
918 
919  compareShape(*it, shape);
920  }
921 
922  makeHistograms(detname);
923 }
edm::ESHandle< TrackerGeometry > trackerGeometry_
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:32
void makeHistograms(const char *detector)
const TGeoMatrix * getMatrix(unsigned int id) const
Definition: FWGeometry.cc:175
const float * getShapePars(unsigned int id) const
Definition: FWGeometry.cc:318
void compareShape(const GeomDet *det, const float *shape)
void compareTransform(const GlobalPoint &point, const TGeoMatrix *matrix)
const TrackerGeomDet * idToDet(DetId) const

Member Data Documentation

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

Definition at line 121 of file ValidateGeometry.cc.

Referenced by compareShape(), and makeHistograms().

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

Definition at line 112 of file ValidateGeometry.cc.

Referenced by analyze(), and validateCaloGeometry().

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

Definition at line 145 of file ValidateGeometry.cc.

Referenced by analyze(), and ValidateGeometry().

bool ValidateGeometry::doMuon_
private

Definition at line 144 of file ValidateGeometry.cc.

Referenced by analyze(), and ValidateGeometry().

bool ValidateGeometry::doTracker_
private

Definition at line 143 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 119 of file ValidateGeometry.cc.

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

std::string ValidateGeometry::infileName_
private

Definition at line 106 of file ValidateGeometry.cc.

Referenced by ValidateGeometry().

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

Definition at line 122 of file ValidateGeometry.cc.

Referenced by compareShape(), and makeHistograms().

TFile* ValidateGeometry::outFile_
private

Definition at line 117 of file ValidateGeometry.cc.

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

std::string ValidateGeometry::outfileName_
private

Definition at line 107 of file ValidateGeometry.cc.

Referenced by endJob(), and ValidateGeometry().

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

Definition at line 109 of file ValidateGeometry.cc.

Referenced by analyze(), and validateRPCGeometry().

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

Definition at line 123 of file ValidateGeometry.cc.

Referenced by compareShape(), and makeHistograms().

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

Definition at line 120 of file ValidateGeometry.cc.

Referenced by compareShape(), and makeHistograms().

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