CMS 3D CMS Logo

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

Public Member Functions

 ValidateGeometry (const edm::ParameterSet &)
 
 ~ValidateGeometry () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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 selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

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

Private Attributes

std::vector< double > bottomWidths_
 
edm::ESHandle< CaloGeometrycaloGeometry_
 
edm::ESGetToken< CaloGeometry, CaloGeometryRecordcaloGeometryToken_
 
edm::ESHandle< CSCGeometrycscGeometry_
 
edm::ESGetToken< CSCGeometry, MuonGeometryRecordcscGeometryToken_
 
bool doCalo_
 
bool doMuon_
 
bool doTracker_
 
edm::ESHandle< DTGeometrydtGeometry_
 
edm::ESGetToken< DTGeometry, MuonGeometryRecorddtGeometryToken_
 
FWGeometry fwGeometry_
 
std::vector< double > globalDistances_
 
std::string infileName_
 
std::vector< double > lengths_
 
TFile * outFile_
 
std::string outfileName_
 
edm::ESHandle< RPCGeometryrpcGeometry_
 
edm::ESGetToken< RPCGeometry, MuonGeometryRecordrpcGeometryToken_
 
std::vector< double > thicknesses_
 
std::vector< double > topWidths_
 
edm::ESHandle< TrackerGeometrytrackerGeometry_
 
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtrackerGeometryToken_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 62 of file ValidateGeometry.cc.

Constructor & Destructor Documentation

◆ ValidateGeometry()

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

Definition at line 141 of file ValidateGeometry.cc.

References caloGeometryToken_, cscGeometryToken_, doCalo_, doMuon_, doTracker_, dtGeometryToken_, edm::EDConsumerBase::esConsumes(), fwGeometry_, edm::ParameterSet::getUntrackedParameter(), infileName_, FWGeometry::loadMap(), outFile_, outfileName_, rpcGeometryToken_, and trackerGeometryToken_.

142  : infileName_(iConfig.getUntrackedParameter<std::string>("infileName")),
143  outfileName_(iConfig.getUntrackedParameter<std::string>("outfileName")) {
144  doTracker_ = iConfig.getUntrackedParameter<bool>("Tracker", true);
145  doMuon_ = iConfig.getUntrackedParameter<bool>("Muon", true);
146  doCalo_ = iConfig.getUntrackedParameter<bool>("Calo", true);
147 
148  if (doMuon_) {
152  }
153  if (doCalo_) {
155  }
156  if (doTracker_) {
158  }
159 
161 
162  outFile_ = new TFile(outfileName_.c_str(), "RECREATE");
163 }
edm::ESGetToken< CSCGeometry, MuonGeometryRecord > cscGeometryToken_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryToken_
edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeometryToken_
T getUntrackedParameter(std::string const &, T const &) const
edm::ESGetToken< RPCGeometry, MuonGeometryRecord > rpcGeometryToken_
void loadMap(const char *fileName)
Definition: FWGeometry.cc:103
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
std::string infileName_
std::string outfileName_

◆ ~ValidateGeometry()

ValidateGeometry::~ValidateGeometry ( )
override

Definition at line 165 of file ValidateGeometry.cc.

165 {}

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 167 of file ValidateGeometry.cc.

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

167  {
168  if (doMuon_) {
170 
171  if (rpcGeometry_.isValid()) {
172  std::cout << "Validating RPC -z endcap geometry" << std::endl;
173  validateRPCGeometry(-1, "RPC -z endcap");
174 
175  std::cout << "Validating RPC +z endcap geometry" << std::endl;
176  validateRPCGeometry(+1, "RPC +z endcap");
177 
178  std::cout << "Validating RPC barrel geometry" << std::endl;
179  validateRPCGeometry(0, "RPC barrel");
180  } else
181  fwLog(fwlog::kWarning) << "Invalid RPC geometry" << std::endl;
182 
184 
185  if (dtGeometry_.isValid()) {
186  std::cout << "Validating DT chamber geometry" << std::endl;
188 
189  std::cout << "Validating DT layer geometry" << std::endl;
191  } else
192  fwLog(fwlog::kWarning) << "Invalid DT geometry" << std::endl;
193 
195 
196  if (cscGeometry_.isValid()) {
197  std::cout << "Validating CSC -z geometry" << std::endl;
198  validateCSChamberGeometry(-1, "CSC chamber -z endcap");
199 
200  std::cout << "Validating CSC +z geometry" << std::endl;
201  validateCSChamberGeometry(+1, "CSC chamber +z endcap");
202 
203  std::cout << "Validating CSC layer -z geometry" << std::endl;
204  validateCSCLayerGeometry(-1, "CSC layer -z endcap");
205 
206  std::cout << "Validating CSC layer +z geometry" << std::endl;
207  validateCSCLayerGeometry(+1, "CSC layer +z endcap");
208  } else
209  fwLog(fwlog::kWarning) << "Invalid CSC geometry" << std::endl;
210  }
211 
212  if (doTracker_) {
214 
215  if (trackerGeometry_.isValid()) {
216  std::cout << "Validating TIB geometry and topology" << std::endl;
219 
220  std::cout << "Validating TOB geometry and topology" << std::endl;
223 
224  std::cout << "Validating TEC geometry and topology" << std::endl;
227 
228  std::cout << "Validating TID geometry and topology" << std::endl;
231 
232  std::cout << "Validating PXB geometry and topology" << std::endl;
235 
236  std::cout << "Validating PXF geometry and topology" << std::endl;
239  } else
240  fwLog(fwlog::kWarning) << "Invalid Tracker geometry" << std::endl;
241  }
242 
243  if (doCalo_) {
245 
246  if (caloGeometry_.isValid()) {
247  std::cout << "Validating EB geometry" << std::endl;
249 
250  std::cout << "Validating EE geometry" << std::endl;
252 
253  std::cout << "Validating ES geometry" << std::endl;
255 
256  std::cout << "Validating HB geometry" << std::endl;
258 
259  std::cout << "Validating HE geometry" << std::endl;
261 
262  std::cout << "Validating HO geometry" << std::endl;
264 
265  std::cout << "Validating HF geometry" << std::endl;
267 
268  std::cout << "Validating Castor geometry" << std::endl;
270 
271  std::cout << "Validating ZDC geometry" << std::endl;
273  } else
274  fwLog(fwlog::kWarning) << "Invalid Calo geometry" << std::endl;
275  }
276 }
const DetContainer & detsTIB() const
edm::ESHandle< CaloGeometry > caloGeometry_
edm::ESHandle< TrackerGeometry > trackerGeometry_
void validateTrackerGeometry(const TrackerGeometry::DetContainer &dets, const char *detname)
const DetContainer & detsPXB() const
edm::ESGetToken< CSCGeometry, MuonGeometryRecord > cscGeometryToken_
edm::ESHandle< RPCGeometry > rpcGeometry_
const DetContainer & detsPXF() const
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryToken_
edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeometryToken_
void validateDTChamberGeometry()
edm::ESGetToken< RPCGeometry, MuonGeometryRecord > rpcGeometryToken_
const DetContainer & detsTOB() const
void validateCaloGeometry(DetId::Detector detector, int subdetector, const char *detname)
edm::ESHandle< DTGeometry > dtGeometry_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
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_
bool isValid() const
Definition: ESHandle.h:44
static const int SubdetectorId
Definition: HcalZDCDetId.h:25
#define fwLog(_level_)
Definition: fwLog.h:45
const DetContainer & detsTEC() const
void validateCSChamberGeometry(const int endcap, const char *detname)
void validateStripTopology(const TrackerGeometry::DetContainer &dets, const char *detname)
const DetContainer & detsTID() const

◆ beginJob()

void ValidateGeometry::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 1050 of file ValidateGeometry.cc.

References outFile_.

1050 { outFile_->cd(); }

◆ clearData()

void ValidateGeometry::clearData ( )
inlineprivate

Definition at line 123 of file ValidateGeometry.cc.

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

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

123  {
124  globalDistances_.clear();
125  topWidths_.clear();
126  bottomWidths_.clear();
127  lengths_.clear();
128  thicknesses_.clear();
129  }
std::vector< double > topWidths_
std::vector< double > bottomWidths_
std::vector< double > thicknesses_
std::vector< double > lengths_
std::vector< double > globalDistances_

◆ compareShape()

void ValidateGeometry::compareShape ( const GeomDet det,
const float *  shape 
)
private

Definition at line 923 of file ValidateGeometry.cc.

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

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

923  {
924  double shape_topWidth;
925  double shape_bottomWidth;
926  double shape_length;
927  double shape_thickness;
928 
929  if (shape[0] == 1) {
930  shape_topWidth = shape[2];
931  shape_bottomWidth = shape[1];
932  shape_length = shape[4];
933  shape_thickness = shape[3];
934  }
935 
936  else if (shape[0] == 2) {
937  shape_topWidth = shape[1];
938  shape_bottomWidth = shape[1];
939  shape_length = shape[2];
940  shape_thickness = shape[3];
941  }
942 
943  else {
944  std::cout << "Failed to get box or trapezoid from shape" << std::endl;
945  return;
946  }
947 
948  double topWidth, bottomWidth;
949  double length, thickness;
950 
951  const Bounds* bounds = &(det->surface().bounds());
952 
953  if (const TrapezoidalPlaneBounds* tpbs = dynamic_cast<const TrapezoidalPlaneBounds*>(bounds)) {
954  std::array<const float, 4> const& ps = tpbs->parameters();
955 
956  assert(ps.size() == 4);
957 
958  bottomWidth = ps[0];
959  topWidth = ps[1];
960  thickness = ps[2];
961  length = ps[3];
962  }
963 
964  else if ((dynamic_cast<const RectangularPlaneBounds*>(bounds))) {
965  length = det->surface().bounds().length() * 0.5;
966  topWidth = det->surface().bounds().width() * 0.5;
967  bottomWidth = topWidth;
968  thickness = det->surface().bounds().thickness() * 0.5;
969  }
970 
971  else {
972  std::cout << "Failed to get bounds" << std::endl;
973  return;
974  }
975 
976  //assert((tgeotrap && trapezoid) || (tgeobbox && rectangle));
977 
978  /*
979  std::cout<<"topWidth: "<< shape_topWidth <<" "<< topWidth <<std::endl;
980  std::cout<<"bottomWidth: "<< shape_bottomWidth <<" "<< bottomWidth <<std::endl;
981  std::cout<<"length: "<< shape_length <<" "<< length <<std::endl;
982  std::cout<<"thickness: "<< shape_thickness <<" "<< thickness <<std::endl;
983  */
984 
985  topWidths_.push_back(fabs(shape_topWidth - topWidth));
986  bottomWidths_.push_back(fabs(shape_bottomWidth - bottomWidth));
987  lengths_.push_back(fabs(shape_length - length));
988  thicknesses_.push_back(fabs(shape_thickness - thickness));
989 
990  return;
991 }
virtual float length() const =0
std::vector< double > topWidths_
std::vector< double > bottomWidths_
assert(be >=bs)
virtual float thickness() const =0
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
std::vector< double > thicknesses_
Definition: Bounds.h:18
std::vector< double > lengths_
virtual float width() const =0
const Bounds & bounds() const
Definition: Surface.h:87

◆ compareTransform()

void ValidateGeometry::compareTransform ( const GlobalPoint point,
const TGeoMatrix *  matrix 
)
private

Definition at line 912 of file ValidateGeometry.cc.

References HLT_2023v12_cff::distance, getDistance(), globalDistances_, runTauDisplay::gp, DTRecHitClients_cfi::local, and makeMuonMisalignmentScenario::matrix.

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

912  {
913  double local[3] = {0.0, 0.0, 0.0};
914 
915  double global[3];
916 
917  matrix->LocalToMaster(local, global);
918 
919  double distance = getDistance(GlobalPoint(global[0], global[1], global[2]), gp);
920  globalDistances_.push_back(distance);
921 }
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
double getDistance(const GlobalPoint &point1, const GlobalPoint &point2)
std::vector< double > globalDistances_

◆ dataEmpty()

bool ValidateGeometry::dataEmpty ( )
inlineprivate

Definition at line 131 of file ValidateGeometry.cc.

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

131  {
132  return (globalDistances_.empty() && topWidths_.empty() && bottomWidths_.empty() && lengths_.empty() &&
133  thicknesses_.empty());
134  }
std::vector< double > topWidths_
std::vector< double > bottomWidths_
std::vector< double > thicknesses_
std::vector< double > lengths_
std::vector< double > globalDistances_

◆ endJob()

void ValidateGeometry::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 1052 of file ValidateGeometry.cc.

References gather_cfg::cout, outFile_, and outfileName_.

1052  {
1053  std::cout << "Done. " << std::endl;
1054  std::cout << "Results written to " << outfileName_ << std::endl;
1055  outFile_->Close();
1056 }
std::string outfileName_

◆ getDistance()

double ValidateGeometry::getDistance ( const GlobalPoint point1,
const GlobalPoint point2 
)
private

Definition at line 993 of file ValidateGeometry.cc.

References LaserDQM_cfg::p1, SiStripOfflineCRack_cfg::p2, and mathSSE::sqrt().

Referenced by compareTransform(), and validateCaloGeometry().

993  {
994  /*
995  std::cout<<"X: "<< p1.x() <<" "<< p2.x() <<std::endl;
996  std::cout<<"Y: "<< p1.y() <<" "<< p2.y() <<std::endl;
997  std::cout<<"Z: "<< p1.z() <<" "<< p2.z() <<std::endl;
998  */
999 
1000  return sqrt((p1.x() - p2.x()) * (p1.x() - p2.x()) + (p1.y() - p2.y()) * (p1.y() - p2.y()) +
1001  (p1.z() - p2.z()) * (p1.z() - p2.z()));
1002 }
T sqrt(T t)
Definition: SSEVec.h:19

◆ makeHistogram()

void ValidateGeometry::makeHistogram ( const std::string &  name,
std::vector< double > &  data 
)
private

Definition at line 1027 of file ValidateGeometry.cc.

References data, gpuVertexFinder::hist, HLT_2023v12_cff::maxE, and Skims_PA_cff::name.

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

1027  {
1028  if (data.empty())
1029  return;
1030 
1031  std::vector<double>::iterator it;
1032 
1033  it = std::min_element(data.begin(), data.end());
1034  double minE = *it;
1035 
1036  it = std::max_element(data.begin(), data.end());
1037  double maxE = *it;
1038 
1039  std::vector<double>::iterator itEnd = data.end();
1040 
1041  TH1D hist(name.c_str(), name.c_str(), 100, minE * (1 + 0.10), maxE * (1 + 0.10));
1042 
1043  for (it = data.begin(); it != itEnd; ++it)
1044  hist.Fill(*it);
1045 
1046  hist.GetXaxis()->SetTitle("[cm]");
1047  hist.Write();
1048 }
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79

◆ makeHistograms()

void ValidateGeometry::makeHistograms ( const char *  detector)
private

Definition at line 1004 of file ValidateGeometry.cc.

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

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

1004  {
1005  outFile_->cd();
1006 
1008 
1009  std::string gdn = d + ": distance between points in global coordinates";
1011 
1012  std::string twn = d + ": absolute difference between top widths (along X)";
1013  makeHistogram(twn, topWidths_);
1014 
1015  std::string bwn = d + ": absolute difference between bottom widths (along X)";
1017 
1018  std::string ln = d + ": absolute difference between lengths (along Y)";
1019  makeHistogram(ln, lengths_);
1020 
1021  std::string tn = d + ": absolute difference between thicknesses (along Z)";
1023 
1024  return;
1025 }
std::vector< double > topWidths_
std::vector< double > bottomWidths_
void makeHistogram(const std::string &name, std::vector< double > &data)
d
Definition: ztail.py:151
std::vector< double > thicknesses_
std::vector< double > lengths_
std::vector< double > globalDistances_

◆ validateCaloGeometry()

void ValidateGeometry::validateCaloGeometry ( DetId::Detector  detector,
int  subdetector,
const char *  detname 
)
private

Definition at line 722 of file ValidateGeometry.cc.

References cms::cuda::assert(), caloGeometry_, clearData(), gather_cfg::cout, hgcalTestNeighbor_cfi::detector, HLT_2023v12_cff::distance, fwGeometry_, FWGeometry::getCorners(), getDistance(), CaloGeometry::getSubdetectorGeometry(), globalDistances_, mps_fire::i, makeHistograms(), hltrates_dqm_sourceclient-live_cfg::offset, hiPixelPairStep_cff::points, EZArrayFL< T >::size(), subdetector, x, y, and z.

Referenced by analyze().

722  {
723  clearData();
724 
726 
727  const std::vector<DetId>& ids = geometry->getValidDetIds(detector, subdetector);
728 
729  for (auto it = ids.begin(), iEnd = ids.end(); it != iEnd; ++it) {
730  unsigned int rawId = (*it).rawId();
731 
732  const float* points = fwGeometry_.getCorners(rawId);
733 
734  if (points == nullptr) {
735  std::cout << "Failed to get points of " << detname << " element with detid: " << rawId << std::endl;
736  continue;
737  }
738 
739  auto cellGeometry = geometry->getGeometry(*it);
740  const CaloCellGeometry::CornersVec& corners = cellGeometry->getCorners();
741 
742  assert(corners.size() == 8);
743 
744  for (unsigned int i = 0, offset = 0; i < 8; ++i) {
745  offset = 2 * i;
746 
747  double distance = getDistance(GlobalPoint(points[i + offset], points[i + 1 + offset], points[i + 2 + offset]),
748  GlobalPoint(corners[i].x(), corners[i].y(), corners[i].z()));
749 
750  globalDistances_.push_back(distance);
751  }
752  }
753 
754  makeHistograms(detname);
755 }
edm::ESHandle< CaloGeometry > caloGeometry_
size_type size() const
Definition: EZArrayFL.h:67
TString subdetector
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
void makeHistograms(const char *detector)
assert(be >=bs)
const float * getCorners(unsigned int id) const
Definition: FWGeometry.cc:439
double getDistance(const GlobalPoint &point1, const GlobalPoint &point2)
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
std::vector< double > globalDistances_

◆ validateCSChamberGeometry()

void ValidateGeometry::validateCSChamberGeometry ( const int  endcap,
const char *  detname 
)
private

Definition at line 456 of file ValidateGeometry.cc.

References relativeConstraints::chamber, CSCGeometry::chambers(), chambers, clearData(), compareShape(), compareTransform(), gather_cfg::cout, cscGeometry_, makeMuonMisalignmentScenario::endcap, fwGeometry_, FWGeometry::getMatrix(), FWGeometry::getShapePars(), runTauDisplay::gp, makeHistograms(), makeMuonMisalignmentScenario::matrix, DetId::rawId(), and l1trig_cff::shape.

Referenced by analyze().

456  {
457  clearData();
458 
459  auto const& chambers = cscGeometry_->chambers();
460 
461  for (auto it = chambers.begin(), itEnd = chambers.end(); it != itEnd; ++it) {
462  const CSCChamber* chamber = *it;
463 
464  if (chamber && chamber->id().endcap() == endcap) {
465  DetId detId = chamber->geographicalId();
466  GlobalPoint gp = chamber->surface().toGlobal(LocalPoint(0.0, 0.0, 0.0));
467 
468  const TGeoMatrix* matrix = fwGeometry_.getMatrix(detId.rawId());
469 
470  if (!matrix) {
471  std::cout << "Failed to get matrix of CSC chamber with detid: " << detId.rawId() << std::endl;
472  continue;
473  }
474 
476 
477  const float* shape = fwGeometry_.getShapePars(detId.rawId());
478 
479  if (!shape) {
480  std::cout << "Failed to get shape of CSC chamber with detid: " << detId.rawId() << std::endl;
481  continue;
482  }
483 
485  }
486  }
487 
488  makeHistograms(detname);
489 }
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
void makeHistograms(const char *detector)
void compareShape(const GeomDet *det, const float *shape)
edm::ESHandle< CSCGeometry > cscGeometry_
Definition: DetId.h:17
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
const float * getShapePars(unsigned int id) const
Definition: FWGeometry.cc:461
const TGeoMatrix * getMatrix(unsigned int id) const
Definition: FWGeometry.cc:225
const ChamberContainer & chambers() const
Return a vector of all chambers.
Definition: CSCGeometry.cc:96
static char chambers[264][20]
Definition: ReadPGInfo.cc:243
void compareTransform(const GlobalPoint &point, const TGeoMatrix *matrix)

◆ validateCSCLayerGeometry()

void ValidateGeometry::validateCSCLayerGeometry ( const int  endcap,
const char *  detname 
)
private

Definition at line 491 of file ValidateGeometry.cc.

References cms::cuda::assert(), clearData(), compareShape(), compareTransform(), gather_cfg::cout, cscGeometry_, makeMuonMisalignmentScenario::endcap, fwGeometry_, FWGeometry::getMatrix(), FWGeometry::getParameters(), FWGeometry::getShapePars(), runTauDisplay::gp, pixelTopology::layer, hgcalTBTopologyTester_cfi::layers, CSCGeometry::layers(), makeHistogram(), makeHistograms(), makeMuonMisalignmentScenario::matrix, DetId::rawId(), relativeConstraints::ring, l1trig_cff::shape, relativeConstraints::station, AlCaHLTBitMon_QueryRunRegistry::string, funct::tan(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by analyze().

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

◆ validateDTChamberGeometry()

void ValidateGeometry::validateDTChamberGeometry ( )
private

Definition at line 350 of file ValidateGeometry.cc.

References relativeConstraints::chamber, DTGeometry::chambers(), chambers, clearData(), compareShape(), compareTransform(), gather_cfg::cout, dtGeometry_, fwGeometry_, FWGeometry::getMatrix(), FWGeometry::getShapePars(), runTauDisplay::gp, makeHistograms(), makeMuonMisalignmentScenario::matrix, DetId::rawId(), and l1trig_cff::shape.

Referenced by analyze().

350  {
351  clearData();
352 
353  auto const& chambers = dtGeometry_->chambers();
354 
355  for (auto it = chambers.begin(), itEnd = chambers.end(); it != itEnd; ++it) {
356  const DTChamber* chamber = *it;
357 
358  if (chamber) {
359  DTChamberId chId = chamber->id();
360  GlobalPoint gp = chamber->surface().toGlobal(LocalPoint(0.0, 0.0, 0.0));
361 
362  const TGeoMatrix* matrix = fwGeometry_.getMatrix(chId.rawId());
363 
364  if (!matrix) {
365  std::cout << "Failed to get matrix of DT chamber with detid: " << chId.rawId() << std::endl;
366  continue;
367  }
368 
370 
371  const float* shape = fwGeometry_.getShapePars(chId.rawId());
372 
373  if (!shape) {
374  std::cout << "Failed to get shape of DT chamber with detid: " << chId.rawId() << std::endl;
375  continue;
376  }
377 
379  }
380  }
381 
382  makeHistograms("DT chamber");
383 }
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
void makeHistograms(const char *detector)
void compareShape(const GeomDet *det, const float *shape)
edm::ESHandle< DTGeometry > dtGeometry_
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
const float * getShapePars(unsigned int id) const
Definition: FWGeometry.cc:461
const TGeoMatrix * getMatrix(unsigned int id) const
Definition: FWGeometry.cc:225
const std::vector< const DTChamber * > & chambers() const
Return a vector of all Chamber.
Definition: DTGeometry.cc:84
static char chambers[264][20]
Definition: ReadPGInfo.cc:243
void compareTransform(const GlobalPoint &point, const TGeoMatrix *matrix)

◆ validateDTLayerGeometry()

void ValidateGeometry::validateDTLayerGeometry ( )
private

Definition at line 385 of file ValidateGeometry.cc.

References cms::cuda::assert(), clearData(), compareShape(), compareTransform(), gather_cfg::cout, dtGeometry_, fwGeometry_, FWGeometry::getMatrix(), FWGeometry::getParameters(), FWGeometry::getShapePars(), runTauDisplay::gp, pixelTopology::layer, hgcalTBTopologyTester_cfi::layers, DTGeometry::layers(), makeHistogram(), makeHistograms(), makeMuonMisalignmentScenario::matrix, ecaldqm::nChannels, DetId::rawId(), l1trig_cff::shape, Calorimetry_cff::thickness, and ApeEstimator_cff::width.

Referenced by analyze().

385  {
386  clearData();
387 
388  std::vector<double> wire_positions;
389 
390  auto const& layers = dtGeometry_->layers();
391 
392  for (auto it = layers.begin(), itEnd = layers.end(); it != itEnd; ++it) {
393  const DTLayer* layer = *it;
394 
395  if (layer) {
396  DTLayerId layerId = layer->id();
397  GlobalPoint gp = layer->surface().toGlobal(LocalPoint(0.0, 0.0, 0.0));
398 
399  const TGeoMatrix* matrix = fwGeometry_.getMatrix(layerId.rawId());
400 
401  if (!matrix) {
402  std::cout << "Failed to get matrix of DT layer with detid: " << layerId.rawId() << std::endl;
403  continue;
404  }
405 
407 
408  const float* shape = fwGeometry_.getShapePars(layerId.rawId());
409 
410  if (!shape) {
411  std::cout << "Failed to get shape of DT layer with detid: " << layerId.rawId() << std::endl;
412  continue;
413  }
414 
416 
417  const float* parameters = fwGeometry_.getParameters(layerId.rawId());
418 
419  if (parameters == nullptr) {
420  std::cout << "Parameters empty for DT layer with detid: " << layerId.rawId() << std::endl;
421  continue;
422  }
423 
424  float width = layer->surface().bounds().width();
425  assert(width == parameters[6]);
426 
427  float thickness = layer->surface().bounds().thickness();
428  assert(thickness == parameters[7]);
429 
430  float length = layer->surface().bounds().length();
431  assert(length == parameters[8]);
432 
433  int firstChannel = layer->specificTopology().firstChannel();
434  assert(firstChannel == parameters[3]);
435 
436  int lastChannel = layer->specificTopology().lastChannel();
437  int nChannels = parameters[5];
438  assert(nChannels == (lastChannel - firstChannel) + 1);
439 
440  for (int wireN = firstChannel; wireN - lastChannel <= 0; ++wireN) {
441  double localX1 = layer->specificTopology().wirePosition(wireN);
442  double localX2 = (wireN - (firstChannel - 1) - 0.5) * parameters[0] - nChannels / 2.0 * parameters[0];
443 
444  wire_positions.push_back(localX1 - localX2);
445 
446  //std::cout<<"wireN, localXpos: "<< wireN <<" "<< localX1 <<" "<< localX2 <<std::endl;
447  }
448  }
449  }
450 
451  makeHistogram("DT layer wire localX", wire_positions);
452 
453  makeHistograms("DT layer");
454 }
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
void makeHistograms(const char *detector)
assert(be >=bs)
void makeHistogram(const std::string &name, std::vector< double > &data)
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
void compareShape(const GeomDet *det, const float *shape)
edm::ESHandle< DTGeometry > dtGeometry_
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
const float * getShapePars(unsigned int id) const
Definition: FWGeometry.cc:461
const float * getParameters(unsigned int id) const
Definition: FWGeometry.cc:450
const TGeoMatrix * getMatrix(unsigned int id) const
Definition: FWGeometry.cc:225
const std::vector< const DTLayer * > & layers() const
Return a vector of all SuperLayer.
Definition: DTGeometry.cc:88
void compareTransform(const GlobalPoint &point, const TGeoMatrix *matrix)

◆ validatePixelTopology()

void ValidateGeometry::validatePixelTopology ( const TrackerGeometry::DetContainer dets,
const char *  detname 
)
private

Definition at line 787 of file ValidateGeometry.cc.

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

Referenced by analyze().

787  {
788  std::vector<double> pixelLocalXs;
789  std::vector<double> pixelLocalYs;
790 
791  for (TrackerGeometry::DetContainer::const_iterator it = dets.begin(), itEnd = dets.end(); it != itEnd; ++it) {
792  unsigned int rawId = (*it)->geographicalId().rawId();
793 
794  const float* parameters = fwGeometry_.getParameters(rawId);
795 
796  if (parameters == nullptr) {
797  std::cout << "Parameters empty for " << detname << " element with detid: " << rawId << std::endl;
798  continue;
799  }
800 
801  if (const PixelGeomDetUnit* det =
802  dynamic_cast<const PixelGeomDetUnit*>(trackerGeometry_->idToDetUnit((*it)->geographicalId()))) {
803  if (const PixelTopology* rpt = &det->specificTopology()) {
804  int nrows = rpt->nrows();
805  int ncolumns = rpt->ncolumns();
806 
807  for (int row = 1; row <= nrows; ++row) {
808  for (int column = 1; column <= ncolumns; ++column) {
809  LocalPoint localPoint = rpt->localPosition(MeasurementPoint(row, column));
810 
811  pixelLocalXs.push_back(localPoint.x() - fireworks::pixelLocalX(row, parameters));
812  pixelLocalYs.push_back(localPoint.y() - fireworks::pixelLocalY(column, parameters));
813  }
814  }
815  }
816 
817  else
818  std::cout << "No topology for " << detname << " " << rawId << std::endl;
819  }
820 
821  else
822  std::cout << "No geomDetUnit for " << detname << " " << rawId << std::endl;
823  }
824 
825  std::string hn(detname);
826  makeHistogram(hn + " pixelLocalX", pixelLocalXs);
827  makeHistogram(hn + " pixelLocalY", pixelLocalYs);
828 }
edm::ESHandle< TrackerGeometry > trackerGeometry_
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
void makeHistogram(const std::string &name, std::vector< double > &data)
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
float pixelLocalX(const double mpx, const float *)
Definition: TrackUtils.cc:159
float pixelLocalY(const double mpy, const float *)
Definition: TrackUtils.cc:209
const float * getParameters(unsigned int id) const
Definition: FWGeometry.cc:450

◆ validateRPCGeometry()

void ValidateGeometry::validateRPCGeometry ( const int  regionNumber,
const char *  regionName 
)
private

Definition at line 278 of file ValidateGeometry.cc.

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

Referenced by analyze().

278  {
279  clearData();
280 
281  std::vector<double> centers;
282 
283  auto const& rolls = rpcGeometry_->rolls();
284 
285  for (auto it = rolls.begin(), itEnd = rolls.end(); it != itEnd; ++it) {
286  const RPCRoll* roll = *it;
287 
288  if (roll) {
289  RPCDetId rpcDetId = roll->id();
290 
291  if (rpcDetId.region() == regionNumber) {
292  const GeomDetUnit* det = rpcGeometry_->idToDetUnit(rpcDetId);
293  GlobalPoint gp = det->surface().toGlobal(LocalPoint(0.0, 0.0, 0.0));
294 
295  const TGeoMatrix* matrix = fwGeometry_.getMatrix(rpcDetId.rawId());
296 
297  if (!matrix) {
298  std::cout << "Failed to get matrix of RPC with detid: " << rpcDetId.rawId() << std::endl;
299  continue;
300  }
301 
303 
304  const float* shape = fwGeometry_.getShapePars(rpcDetId.rawId());
305 
306  if (!shape) {
307  std::cout << "Failed to get shape of RPC with detid: " << rpcDetId.rawId() << std::endl;
308  continue;
309  }
310 
311  compareShape(det, shape);
312 
313  const float* parameters = fwGeometry_.getParameters(rpcDetId.rawId());
314 
315  if (parameters == nullptr) {
316  std::cout << "Parameters empty for RPC with detid: " << rpcDetId.rawId() << std::endl;
317  continue;
318  }
319 
320  // Yes, I know that below I'm comparing the equivalence
321  // of floating point numbers
322 
323  int nStrips = roll->nstrips();
324  assert(nStrips == parameters[0]);
325 
326  float stripLength = roll->specificTopology().stripLength();
327  assert(stripLength == parameters[1]);
328 
329  float pitch = roll->specificTopology().pitch();
330  assert(pitch == parameters[2]);
331 
332  float offset = -0.5 * nStrips * pitch;
333 
334  for (int strip = 1; strip <= roll->nstrips(); ++strip) {
335  LocalPoint centreOfStrip1 = roll->centreOfStrip(strip);
336  LocalPoint centreOfStrip2 = LocalPoint((strip - 0.5) * pitch + offset, 0.0);
337 
338  centers.push_back(centreOfStrip1.x() - centreOfStrip2.x());
339  }
340  }
341  }
342  }
343 
344  std::string hn(regionName);
345  makeHistogram(hn + ": centreOfStrip", centers);
346 
347  makeHistograms(regionName);
348 }
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
edm::ESHandle< RPCGeometry > rpcGeometry_
void makeHistograms(const char *detector)
const GeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: RPCGeometry.cc:30
int nstrips() const
Definition: RPCRoll.cc:24
assert(be >=bs)
void makeHistogram(const std::string &name, std::vector< double > &data)
nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
T x() const
Definition: PV3DBase.h:59
virtual float stripLength() const =0
void compareShape(const GeomDet *det, const float *shape)
const StripTopology & specificTopology() const
Definition: RPCRoll.cc:49
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
const float * getShapePars(unsigned int id) const
Definition: FWGeometry.cc:461
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:53
const float * getParameters(unsigned int id) const
Definition: FWGeometry.cc:450
const TGeoMatrix * getMatrix(unsigned int id) const
Definition: FWGeometry.cc:225
virtual float pitch() const =0
const std::vector< const RPCRoll * > & rolls() const
Return a vector of all RPC rolls.
Definition: RPCGeometry.cc:44
RPCDetId id() const
Definition: RPCRoll.cc:16
void compareTransform(const GlobalPoint &point, const TGeoMatrix *matrix)
LocalPoint centreOfStrip(int strip) const
Definition: RPCRoll.cc:26

◆ validateStripTopology()

void ValidateGeometry::validateStripTopology ( const TrackerGeometry::DetContainer dets,
const char *  detname 
)
private

Definition at line 830 of file ValidateGeometry.cc.

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

Referenced by analyze().

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

◆ validateTrackerGeometry()

void ValidateGeometry::validateTrackerGeometry ( const TrackerGeometry::DetContainer dets,
const char *  detname 
)
private

Definition at line 757 of file ValidateGeometry.cc.

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

Referenced by analyze().

757  {
758  clearData();
759 
760  for (TrackerGeometry::DetContainer::const_iterator it = dets.begin(), itEnd = dets.end(); it != itEnd; ++it) {
761  GlobalPoint gp =
762  (trackerGeometry_->idToDet((*it)->geographicalId()))->surface().toGlobal(LocalPoint(0.0, 0.0, 0.0));
763  unsigned int rawId = (*it)->geographicalId().rawId();
764 
765  const TGeoMatrix* matrix = fwGeometry_.getMatrix(rawId);
766 
767  if (!matrix) {
768  std::cout << "Failed to get matrix of " << detname << " element with detid: " << rawId << std::endl;
769  continue;
770  }
771 
773 
774  const float* shape = fwGeometry_.getShapePars(rawId);
775 
776  if (!shape) {
777  std::cout << "Failed to get shape of " << detname << " element with detid: " << rawId << std::endl;
778  continue;
779  }
780 
781  compareShape(*it, shape);
782  }
783 
784  makeHistograms(detname);
785 }
edm::ESHandle< TrackerGeometry > trackerGeometry_
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
void makeHistograms(const char *detector)
void compareShape(const GeomDet *det, const float *shape)
const TrackerGeomDet * idToDet(DetId) const override
const float * getShapePars(unsigned int id) const
Definition: FWGeometry.cc:461
const TGeoMatrix * getMatrix(unsigned int id) const
Definition: FWGeometry.cc:225
void compareTransform(const GlobalPoint &point, const TGeoMatrix *matrix)

Member Data Documentation

◆ bottomWidths_

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

Definition at line 119 of file ValidateGeometry.cc.

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

◆ caloGeometry_

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

Definition at line 110 of file ValidateGeometry.cc.

Referenced by analyze(), and validateCaloGeometry().

◆ caloGeometryToken_

edm::ESGetToken<CaloGeometry, CaloGeometryRecord> ValidateGeometry::caloGeometryToken_
private

Definition at line 104 of file ValidateGeometry.cc.

Referenced by analyze(), and ValidateGeometry().

◆ cscGeometry_

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

◆ cscGeometryToken_

edm::ESGetToken<CSCGeometry, MuonGeometryRecord> ValidateGeometry::cscGeometryToken_
private

Definition at line 103 of file ValidateGeometry.cc.

Referenced by analyze(), and ValidateGeometry().

◆ doCalo_

bool ValidateGeometry::doCalo_
private

Definition at line 138 of file ValidateGeometry.cc.

Referenced by analyze(), and ValidateGeometry().

◆ doMuon_

bool ValidateGeometry::doMuon_
private

Definition at line 137 of file ValidateGeometry.cc.

Referenced by analyze(), and ValidateGeometry().

◆ doTracker_

bool ValidateGeometry::doTracker_
private

Definition at line 136 of file ValidateGeometry.cc.

Referenced by analyze(), and ValidateGeometry().

◆ dtGeometry_

edm::ESHandle<DTGeometry> ValidateGeometry::dtGeometry_
private

◆ dtGeometryToken_

edm::ESGetToken<DTGeometry, MuonGeometryRecord> ValidateGeometry::dtGeometryToken_
private

Definition at line 102 of file ValidateGeometry.cc.

Referenced by analyze(), and ValidateGeometry().

◆ fwGeometry_

FWGeometry ValidateGeometry::fwGeometry_
private

◆ globalDistances_

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

◆ infileName_

std::string ValidateGeometry::infileName_
private

Definition at line 98 of file ValidateGeometry.cc.

Referenced by ValidateGeometry().

◆ lengths_

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

Definition at line 120 of file ValidateGeometry.cc.

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

◆ outFile_

TFile* ValidateGeometry::outFile_
private

Definition at line 115 of file ValidateGeometry.cc.

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

◆ outfileName_

std::string ValidateGeometry::outfileName_
private

Definition at line 99 of file ValidateGeometry.cc.

Referenced by endJob(), and ValidateGeometry().

◆ rpcGeometry_

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

Definition at line 107 of file ValidateGeometry.cc.

Referenced by analyze(), and validateRPCGeometry().

◆ rpcGeometryToken_

edm::ESGetToken<RPCGeometry, MuonGeometryRecord> ValidateGeometry::rpcGeometryToken_
private

Definition at line 101 of file ValidateGeometry.cc.

Referenced by analyze(), and ValidateGeometry().

◆ thicknesses_

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

Definition at line 121 of file ValidateGeometry.cc.

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

◆ topWidths_

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

Definition at line 118 of file ValidateGeometry.cc.

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

◆ trackerGeometry_

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

◆ trackerGeometryToken_

edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> ValidateGeometry::trackerGeometryToken_
private

Definition at line 105 of file ValidateGeometry.cc.

Referenced by analyze(), and ValidateGeometry().