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
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

Implements edm::EDAnalyzer.

Definition at line 168 of file ValidateGeometry.cc.

References DetId::Calo, caloGeometry_, gather_cfg::cout, cscGeometry_, 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;
230  validateTrackerGeometry(trackerGeometry_->detsTIB(), "TIB");
231  validateStripTopology(trackerGeometry_->detsTIB(), "TIB");
232 
233  std::cout<<"Validating TOB geometry and topology"<<std::endl;
234  validateTrackerGeometry(trackerGeometry_->detsTOB(), "TOB");
235  validateStripTopology(trackerGeometry_->detsTOB(), "TOB");
236 
237  std::cout<<"Validating TEC geometry and topology"<<std::endl;
238  validateTrackerGeometry(trackerGeometry_->detsTEC(), "TEC");
239  validateStripTopology(trackerGeometry_->detsTEC(), "TEC");
240 
241  std::cout<<"Validating TID geometry and topology"<<std::endl;
242  validateTrackerGeometry(trackerGeometry_->detsTID(), "TID");
243  validateStripTopology(trackerGeometry_->detsTID(), "TID");
244 
245  std::cout<<"Validating PXB geometry and topology"<<std::endl;
246  validateTrackerGeometry(trackerGeometry_->detsPXB(), "PXB");
247  validatePixelTopology(trackerGeometry_->detsPXB(), "PXB");
248 
249  std::cout<<"Validating PXF geometry and topology"<<std::endl;
250  validateTrackerGeometry(trackerGeometry_->detsPXF(), "PXF");
251  validatePixelTopology(trackerGeometry_->detsPXF(), "PXF");
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()
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:25
#define fwLog(_level_)
Definition: fwLog.h:50
const T & get() const
Definition: EventSetup.h:56
tuple cout
Definition: gather_cfg.py:145
void validateCSChamberGeometry(const int endcap, const char *detname)
void validateStripTopology(const TrackerGeometry::DetContainer &dets, const char *detname)
bool isValid() const
Definition: ESHandle.h:47
void ValidateGeometry::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 1246 of file ValidateGeometry.cc.

References outFile_.

1247 {
1248  outFile_->cd();
1249 }
void ValidateGeometry::clearData ( )
inlineprivate

Definition at line 125 of file ValidateGeometry.cc.

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

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 1099 of file ValidateGeometry.cc.

References assert(), 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().

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

References HLT_FULL_cff::distance, getDistance(), and globalDistances_.

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

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

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

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 1253 of file ValidateGeometry.cc.

References gather_cfg::cout, outFile_, and outfileName_.

1254 {
1255  std::cout<<"Done. "<<std::endl;
1256  std::cout<<"Results written to "<< outfileName_ <<std::endl;
1257  outFile_->Close();
1258 }
tuple cout
Definition: gather_cfg.py:145
std::string outfileName_
double ValidateGeometry::getDistance ( const GlobalPoint point1,
const GlobalPoint point2 
)
private

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

1181 {
1182  /*
1183  std::cout<<"X: "<< p1.x() <<" "<< p2.x() <<std::endl;
1184  std::cout<<"Y: "<< p1.y() <<" "<< p2.y() <<std::endl;
1185  std::cout<<"Z: "<< p1.z() <<" "<< p2.z() <<std::endl;
1186  */
1187 
1188  return sqrt((p1.x()-p2.x())*(p1.x()-p2.x())+
1189  (p1.y()-p2.y())*(p1.y()-p2.y())+
1190  (p1.z()-p2.z())*(p1.z()-p2.z()));
1191 }
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 1221 of file ValidateGeometry.cc.

References estimatePileup::hist.

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

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

Definition at line 1195 of file ValidateGeometry.cc.

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

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

1196 {
1197  outFile_->cd();
1198 
1199  std::string d(detector);
1200 
1201  std::string gdn = d+": distance between points in global coordinates";
1203 
1204  std::string twn = d + ": absolute difference between top widths (along X)";
1205  makeHistogram(twn, topWidths_);
1206 
1207  std::string bwn = d + ": absolute difference between bottom widths (along X)";
1209 
1210  std::string ln = d + ": absolute difference between lengths (along Y)";
1211  makeHistogram(ln, lengths_);
1212 
1213  std::string tn = d + ": absolute difference between thicknesses (along Z)";
1215 
1216  return;
1217 }
std::vector< double > topWidths_
std::vector< double > bottomWidths_
void makeHistogram(const std::string &name, std::vector< double > &data)
tuple d
Definition: ztail.py:151
std::vector< double > thicknesses_
std::vector< double > lengths_
std::vector< double > globalDistances_
void ValidateGeometry::validateCaloGeometry ( DetId::Detector  detector,
int  subdetector,
const char *  detname 
)
private

Definition at line 840 of file ValidateGeometry.cc.

References assert(), caloGeometry_, clearData(), gather_cfg::cout, HLT_FULL_cff::distance, fwGeometry_, geometry, CaloCellGeometry::getCorners(), FWGeometry::getCorners(), getDistance(), CaloSubdetectorGeometry::getGeometry(), CaloSubdetectorGeometry::getValidDetIds(), globalDistances_, i, makeHistograms(), hltrates_dqm_sourceclient-live_cfg::offset, EZArrayFL< T >::size(), x, y, and z.

Referenced by analyze().

843 {
844  clearData();
845 
847  caloGeometry_->getSubdetectorGeometry(detector, subdetector);
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 }
int i
Definition: DBlmapReader.cc:9
edm::ESHandle< CaloGeometry > caloGeometry_
TString subdetector
assert(m_qm.get())
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:280
double getDistance(const GlobalPoint &point1, const GlobalPoint &point2)
CornersVec const & getCorners() const
Returns the corner points of this cell&#39;s volume.
ESHandle< TrackerGeometry > geometry
tuple cout
Definition: gather_cfg.py:145
std::vector< double > globalDistances_
void ValidateGeometry::validateCSChamberGeometry ( const int  endcap,
const char *  detname 
)
private

Definition at line 519 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(), 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
CSCDetId id() const
Get the (concrete) DetId.
Definition: CSCChamber.h:37
void makeHistograms(const char *detector)
const TGeoMatrix * getMatrix(unsigned int id) const
Definition: FWGeometry.cc:169
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:312
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
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
tuple cout
Definition: gather_cfg.py:145
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(), assert(), 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(), runTauDisplay::gp, CSCLayer::id(), LayerTriplets::layers(), CSCLayerGeometry::localCenterOfWireGroup(), makeHistogram(), makeHistograms(), makeMuonMisalignmentScenario::matrix, CSCLayerGeometry::numberOfStrips(), CSCLayerGeometry::numberOfWireGroups(), HLT_FULL_cff::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
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:296
CSCDetId id() const
Definition: CSCLayer.h:42
assert(m_qm.get())
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:169
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:312
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
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
int station() const
Definition: CSCDetId.h:86
tuple cout
Definition: gather_cfg.py:145
const CSCLayerGeometry * geometry() const
Definition: CSCLayer.h:47
void compareTransform(const GlobalPoint &point, const TGeoMatrix *matrix)
void ValidateGeometry::validateDTChamberGeometry ( )
private

Definition at line 386 of file ValidateGeometry.cc.

References 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
void makeHistograms(const char *detector)
const TGeoMatrix * getMatrix(unsigned int id) const
Definition: FWGeometry.cc:169
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:312
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:145
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 assert(), 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(), Bounds::length(), makeHistogram(), makeHistograms(), makeMuonMisalignmentScenario::matrix, ecaldqm::nChannels, HLT_FULL_cff::parameters, DetId::rawId(), DTLayer::specificTopology(), GeomDet::surface(), Bounds::thickness(), Surface::toGlobal(), Bounds::width(), create_public_lumi_plots::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
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:296
DTLayerId id() const
Return the DetId of this SL.
Definition: DTLayer.cc:46
assert(m_qm.get())
void makeHistograms(const char *detector)
const Bounds & bounds() const
Definition: Surface.h:120
const TGeoMatrix * getMatrix(unsigned int id) const
Definition: FWGeometry.cc:169
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 thickness() const =0
const float * getShapePars(unsigned int id) const
Definition: FWGeometry.cc:312
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:145
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 927 of file ValidateGeometry.cc.

References assert(), gather_cfg::cout, fwGeometry_, FWGeometry::getParameters(), makeHistogram(), HLT_FULL_cff::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  assert(parameters[0] == nrows);
957  assert(parameters[1] == ncolumns);
958 
959  for ( int row = 1; row <= nrows; ++row )
960  {
961  for ( int column = 1; column <= ncolumns; ++column )
962  {
963  LocalPoint localPoint = rpt->localPosition(MeasurementPoint(row, column));
964 
965  pixelLocalXs.push_back(localPoint.x() - fireworks::pixelLocalX(row, nrows));
966  pixelLocalYs.push_back(localPoint.y() - fireworks::pixelLocalY(column, ncolumns));
967  }
968  }
969  }
970 
971  else
972  std::cout<<"No topology for "<< detname <<" "<< rawId <<std::endl;
973  }
974 
975  else
976  std::cout<<"No geomDetUnit for "<< detname <<" "<< rawId <<std::endl;
977  }
978 
979  std::string hn(detname);
980  makeHistogram(hn+" pixelLocalX", pixelLocalXs);
981  makeHistogram(hn+" pixelLocalY", pixelLocalYs);
982 }
edm::ESHandle< TrackerGeometry > trackerGeometry_
float pixelLocalY(const double mpy, const int m_ncols)
Definition: TrackUtils.cc:203
const float * getParameters(unsigned int id) const
Definition: FWGeometry.cc:296
assert(m_qm.get())
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.
tuple cout
Definition: gather_cfg.py:145
T x() const
Definition: PV3DBase.h:62
float pixelLocalX(const double mpx, const int m_nrows)
Definition: TrackUtils.cc:170
void ValidateGeometry::validateRPCGeometry ( const int  regionNumber,
const char *  regionName 
)
private

Definition at line 298 of file ValidateGeometry.cc.

References assert(), RPCRoll::centreOfStrip(), clearData(), compareShape(), compareTransform(), gather_cfg::cout, fwGeometry_, FWGeometry::getMatrix(), FWGeometry::getParameters(), FWGeometry::getShapePars(), runTauDisplay::gp, RPCRoll::id(), makeHistogram(), makeHistograms(), makeMuonMisalignmentScenario::matrix, RPCRoll::nstrips(), hltrates_dqm_sourceclient-live_cfg::offset, HLT_FULL_cff::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().

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
LocalPoint centreOfStrip(int strip) const
Definition: RPCRoll.cc:52
const float * getParameters(unsigned int id) const
Definition: FWGeometry.cc:296
edm::ESHandle< RPCGeometry > rpcGeometry_
assert(m_qm.get())
int nstrips() const
Definition: RPCRoll.cc:46
void makeHistograms(const char *detector)
const TGeoMatrix * getMatrix(unsigned int id) const
Definition: FWGeometry.cc:169
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)
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
const float * getShapePars(unsigned int id) const
Definition: FWGeometry.cc:312
virtual float stripLength() const =0
RPCDetId id() const
Definition: RPCRoll.cc:24
void compareShape(const GeomDet *det, const float *shape)
virtual float pitch() const =0
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
tuple cout
Definition: gather_cfg.py:145
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 985 of file ValidateGeometry.cc.

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

Referenced by analyze().

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

Member Data Documentation

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

Definition at line 121 of file ValidateGeometry.cc.

Referenced by clearData(), compareShape(), dataEmpty(), 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
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 clearData(), compareShape(), dataEmpty(), 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 clearData(), compareShape(), dataEmpty(), and makeHistograms().

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

Definition at line 120 of file ValidateGeometry.cc.

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

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