CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
MkFitGeometryESProducer Class Reference
Inheritance diagram for MkFitGeometryESProducer:
edm::ESProducer edm::ESProductResolverFactoryProducer edm::eventsetup::ESProductResolverProvider

Classes

struct  GapCollector
 
struct  MatHistBin
 
struct  ModuleShape_hash
 

Public Member Functions

 MkFitGeometryESProducer (const edm::ParameterSet &iConfig)
 
std::unique_ptr< MkFitGeometryproduce (const TrackerRecoGeometryRecord &iRecord)
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
 ESProducer (ESProducer &&)=delete
 
ESResolverIndex const * getTokenIndices (unsigned int iIndex) const
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProduceroperator= (const ESProducer &)=delete
 
ESProduceroperator= (ESProducer &&)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector< ESResolverIndex > > updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProductResolverFactoryProducer
 ESProductResolverFactoryProducer ()
 
 ESProductResolverFactoryProducer (const ESProductResolverFactoryProducer &)=delete
 
const ESProductResolverFactoryProduceroperator= (const ESProductResolverFactoryProducer &)=delete
 
 ~ESProductResolverFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::ESProductResolverProvider
void createKeyedResolvers (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
const ComponentDescriptiondescription () const
 
 ESProductResolverProvider ()
 
 ESProductResolverProvider (const ESProductResolverProvider &)=delete
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedResolverskeyedResolvers (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const ESProductResolverProvideroperator= (const ESProductResolverProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~ESProductResolverProvider () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::eventsetup::ESProductResolverProvider
static void prevalidate (ConfigurationDescriptions &)
 

Private Types

using layer_gap_map_t = std::unordered_map< int, GapCollector >
 
using layer_module_shape_vec_t = std::vector< module_shape_hmap_t >
 
using MaterialHistogram = mkfit::rectvec< MatHistBin >
 
using module_shape_hmap_t = std::unordered_map< mkfit::ModuleShape, unsigned short, ModuleShape_hash >
 

Private Member Functions

void addPixBGeometry (mkfit::TrackerInfo &trk_info, MaterialHistogram &material_histogram)
 
void addPixEGeometry (mkfit::TrackerInfo &trk_info, MaterialHistogram &material_histogram)
 
void addTECGeometry (mkfit::TrackerInfo &trk_info, MaterialHistogram &material_histogram)
 
void addTIBGeometry (mkfit::TrackerInfo &trk_info, MaterialHistogram &material_histogram)
 
void addTIDGeometry (mkfit::TrackerInfo &trk_info, MaterialHistogram &material_histogram)
 
void addTOBGeometry (mkfit::TrackerInfo &trk_info, MaterialHistogram &material_histogram)
 
void aggregateMaterialInfo (mkfit::TrackerInfo &trk_info, MaterialHistogram &material_histogram)
 
void considerPoint (const GlobalPoint &gp, mkfit::LayerInfo &lay_info)
 
void fillLayers (mkfit::TrackerInfo &trk_info)
 
void fillShapeAndPlacement (const GeomDet *det, mkfit::TrackerInfo &trk_info, MaterialHistogram &material_histogram, layer_gap_map_t *lgc_map=nullptr)
 
void findRZBox (const GlobalPoint &gp, float &rmin, float &rmax, float &zmin, float &zmax)
 

Private Attributes

edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordgeomToken_
 
layer_module_shape_vec_t layerModuleShapeVec_
 
mkfit::LayerNumberConverter layerNrConv_ = {mkfit::TkLayout::phase1}
 
const TrackerGeometrytrackerGeom_ = nullptr
 
edm::ESGetToken< GeometricSearchTracker, TrackerRecoGeometryRecordtrackerToken_
 
const TrackerTopologytrackerTopo_ = nullptr
 
edm::ESGetToken< TrackerTopology, TrackerTopologyRcdttopoToken_
 

Additional Inherited Members

- Protected Types inherited from edm::ESProductResolverFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::ESProductResolverProvider
using KeyedResolversVector = std::vector< std::pair< DataKey, std::shared_ptr< ESProductResolver > >>
 
- Protected Member Functions inherited from edm::ESProducer
ESConsumesInfoconsumesInfoPushBackNew ()
 
unsigned int consumesInfoSize () const
 
template<typename CallbackT , typename TList , typename TRecord >
void registerProducts (std::shared_ptr< std::pair< unsigned int, std::shared_ptr< CallbackT >>> iCallback, const TList *, const TRecord *iRecord, const es::Label &iLabel)
 
template<typename CallbackT , typename TRecord >
void registerProducts (std::shared_ptr< std::pair< unsigned int, std::shared_ptr< CallbackT >>>, const eventsetup::produce::Null *, const TRecord *, const es::Label &)
 
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &iLabel={})
 
template<typename T >
auto setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
auto setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord >
auto setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord , typename TDecorator >
auto setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename TFunc >
auto setWhatProduced (TFunc &&func, const es::Label &iLabel={})
 
template<typename TReturn , typename TRecord , typename TFunc , typename TDecorator >
ESConsumesCollectorT< TRecord > setWhatProduced (TFunc &&func, TDecorator &&iDec, const es::Label &iLabel={})
 
void usesResources (std::vector< std::string > const &)
 
- Protected Member Functions inherited from edm::ESProductResolverFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ESProductResolverFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedResolversVector registerResolvers (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::ESProductResolverProvider
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &key)
 

Detailed Description

Definition at line 33 of file MkFitGeometryESProducer.cc.

Member Typedef Documentation

◆ layer_gap_map_t

using MkFitGeometryESProducer::layer_gap_map_t = std::unordered_map<int, GapCollector>
private

Definition at line 63 of file MkFitGeometryESProducer.cc.

◆ layer_module_shape_vec_t

Definition at line 71 of file MkFitGeometryESProducer.cc.

◆ MaterialHistogram

Definition at line 81 of file MkFitGeometryESProducer.cc.

◆ module_shape_hmap_t

using MkFitGeometryESProducer::module_shape_hmap_t = std::unordered_map<mkfit::ModuleShape, unsigned short, ModuleShape_hash>
private

Definition at line 70 of file MkFitGeometryESProducer.cc.

Constructor & Destructor Documentation

◆ MkFitGeometryESProducer()

MkFitGeometryESProducer::MkFitGeometryESProducer ( const edm::ParameterSet iConfig)

Definition at line 109 of file MkFitGeometryESProducer.cc.

References gpuPixelDoublets::cc, geomToken_, edm::ESProducer::setWhatProduced(), trackerToken_, and ttopoToken_.

109  {
110  auto cc = setWhatProduced(this);
111  geomToken_ = cc.consumes();
112  ttopoToken_ = cc.consumes();
113  trackerToken_ = cc.consumes();
114 }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:166
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
edm::ESGetToken< GeometricSearchTracker, TrackerRecoGeometryRecord > trackerToken_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > ttopoToken_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_

Member Function Documentation

◆ addPixBGeometry()

void MkFitGeometryESProducer::addPixBGeometry ( mkfit::TrackerInfo trk_info,
MaterialHistogram material_histogram 
)
private

Definition at line 374 of file MkFitGeometryESProducer.cc.

References TrackerGeometry::detsPXB(), fillShapeAndPlacement(), and trackerGeom_.

Referenced by produce().

374  {
375 #ifdef DUMP_MKF_GEO
376  printf("\n*** addPixBGeometry\n\n");
377 #endif
378  for (auto &det : trackerGeom_->detsPXB()) {
379  fillShapeAndPlacement(det, trk_info, material_histogram);
380  }
381 }
const DetContainer & detsPXB() const
const TrackerGeometry * trackerGeom_
void fillShapeAndPlacement(const GeomDet *det, mkfit::TrackerInfo &trk_info, MaterialHistogram &material_histogram, layer_gap_map_t *lgc_map=nullptr)

◆ addPixEGeometry()

void MkFitGeometryESProducer::addPixEGeometry ( mkfit::TrackerInfo trk_info,
MaterialHistogram material_histogram 
)
private

Definition at line 383 of file MkFitGeometryESProducer.cc.

References TrackerGeometry::detsPXF(), fillShapeAndPlacement(), and trackerGeom_.

Referenced by produce().

383  {
384 #ifdef DUMP_MKF_GEO
385  printf("\n*** addPixEGeometry\n\n");
386 #endif
387  for (auto &det : trackerGeom_->detsPXF()) {
388  fillShapeAndPlacement(det, trk_info, material_histogram);
389  }
390 }
const DetContainer & detsPXF() const
const TrackerGeometry * trackerGeom_
void fillShapeAndPlacement(const GeomDet *det, mkfit::TrackerInfo &trk_info, MaterialHistogram &material_histogram, layer_gap_map_t *lgc_map=nullptr)

◆ addTECGeometry()

void MkFitGeometryESProducer::addTECGeometry ( mkfit::TrackerInfo trk_info,
MaterialHistogram material_histogram 
)
private

Definition at line 419 of file MkFitGeometryESProducer.cc.

References TrackerGeometry::detsTEC(), fillShapeAndPlacement(), nano_mu_digi_cff::layer, mkfit::TrackerInfo::layer_nc(), mkfit::LayerInfo::set_r_hole_range(), trackerGeom_, MkFitGeometryESProducer::GapCollector::Interval::x, and MkFitGeometryESProducer::GapCollector::Interval::y.

Referenced by produce().

419  {
420 #ifdef DUMP_MKF_GEO
421  printf("\n*** addTECGeometry\n\n");
422 #endif
423  // For TEC we also need to discover hole in radial extents.
424  layer_gap_map_t lgc_map;
425  for (auto &det : trackerGeom_->detsTEC()) {
426  fillShapeAndPlacement(det, trk_info, material_histogram, &lgc_map);
427  }
428  // Now loop over the GapCollectors and see if there is a coverage gap.
429  std::ostringstream ostr;
430  ostr << "addTECGeometry() gap report:\n";
431  GapCollector::Interval itvl;
432  for (auto &[layer, gcol] : lgc_map) {
433  gcol.sqrt_elements();
434  if (gcol.find_gap(itvl, 0.5)) {
435  ostr << " layer: " << layer << ", gap: " << itvl.x << " -> " << itvl.y << " width = " << itvl.y - itvl.x << "\n";
436  ostr << " all gaps: ";
437  gcol.print_gaps(ostr);
438  ostr << "\n";
439  trk_info.layer_nc(layer).set_r_hole_range(itvl.x, itvl.y);
440  }
441  }
442  edm::LogVerbatim("MkFitGeometryESProducer") << ostr.str();
443 }
Log< level::Info, true > LogVerbatim
void set_r_hole_range(float rh1, float rh2)
Definition: TrackerInfo.cc:49
LayerInfo & layer_nc(int l)
Definition: TrackerInfo.h:242
const TrackerGeometry * trackerGeom_
void fillShapeAndPlacement(const GeomDet *det, mkfit::TrackerInfo &trk_info, MaterialHistogram &material_histogram, layer_gap_map_t *lgc_map=nullptr)
std::unordered_map< int, GapCollector > layer_gap_map_t
const DetContainer & detsTEC() const

◆ addTIBGeometry()

void MkFitGeometryESProducer::addTIBGeometry ( mkfit::TrackerInfo trk_info,
MaterialHistogram material_histogram 
)
private

Definition at line 392 of file MkFitGeometryESProducer.cc.

References TrackerGeometry::detsTIB(), fillShapeAndPlacement(), and trackerGeom_.

Referenced by produce().

392  {
393 #ifdef DUMP_MKF_GEO
394  printf("\n*** addTIBGeometry\n\n");
395 #endif
396  for (auto &det : trackerGeom_->detsTIB()) {
397  fillShapeAndPlacement(det, trk_info, material_histogram);
398  }
399 }
const DetContainer & detsTIB() const
const TrackerGeometry * trackerGeom_
void fillShapeAndPlacement(const GeomDet *det, mkfit::TrackerInfo &trk_info, MaterialHistogram &material_histogram, layer_gap_map_t *lgc_map=nullptr)

◆ addTIDGeometry()

void MkFitGeometryESProducer::addTIDGeometry ( mkfit::TrackerInfo trk_info,
MaterialHistogram material_histogram 
)
private

Definition at line 410 of file MkFitGeometryESProducer.cc.

References TrackerGeometry::detsTID(), fillShapeAndPlacement(), and trackerGeom_.

Referenced by produce().

410  {
411 #ifdef DUMP_MKF_GEO
412  printf("\n*** addTIDGeometry\n\n");
413 #endif
414  for (auto &det : trackerGeom_->detsTID()) {
415  fillShapeAndPlacement(det, trk_info, material_histogram);
416  }
417 }
const TrackerGeometry * trackerGeom_
void fillShapeAndPlacement(const GeomDet *det, mkfit::TrackerInfo &trk_info, MaterialHistogram &material_histogram, layer_gap_map_t *lgc_map=nullptr)
const DetContainer & detsTID() const

◆ addTOBGeometry()

void MkFitGeometryESProducer::addTOBGeometry ( mkfit::TrackerInfo trk_info,
MaterialHistogram material_histogram 
)
private

Definition at line 401 of file MkFitGeometryESProducer.cc.

References TrackerGeometry::detsTOB(), fillShapeAndPlacement(), and trackerGeom_.

Referenced by produce().

401  {
402 #ifdef DUMP_MKF_GEO
403  printf("\n*** addTOBGeometry\n\n");
404 #endif
405  for (auto &det : trackerGeom_->detsTOB()) {
406  fillShapeAndPlacement(det, trk_info, material_histogram);
407  }
408 }
const DetContainer & detsTOB() const
const TrackerGeometry * trackerGeom_
void fillShapeAndPlacement(const GeomDet *det, mkfit::TrackerInfo &trk_info, MaterialHistogram &material_histogram, layer_gap_map_t *lgc_map=nullptr)

◆ aggregateMaterialInfo()

void MkFitGeometryESProducer::aggregateMaterialInfo ( mkfit::TrackerInfo trk_info,
MaterialHistogram material_histogram 
)
private

Definition at line 453 of file MkFitGeometryESProducer.cc.

References mps_fire::i, dqmiolumiharvest::j, mkfit::TrackerInfo::mat_nbins_r(), mkfit::TrackerInfo::mat_nbins_z(), mkfit::TrackerInfo::material_bbxi(), mkfit::TrackerInfo::material_radl(), MkFitGeometryESProducer::MatHistBin::rl, MkFitGeometryESProducer::MatHistBin::weight, and MkFitGeometryESProducer::MatHistBin::xi.

Referenced by produce().

454  {
455  //from histogram (vector of tuples) to grid
456  for (int i = 0; i < trk_info.mat_nbins_z(); i++) {
457  for (int j = 0; j < trk_info.mat_nbins_r(); j++) {
458  const MatHistBin &mhb = material_histogram(i, j);
459  if (mhb.weight > 0) {
460  trk_info.material_bbxi(i, j) = mhb.xi / mhb.weight;
461  trk_info.material_radl(i, j) = mhb.rl / mhb.weight;
462  }
463  }
464  }
465 }
int mat_nbins_r() const
Definition: TrackerInfo.h:263
float material_radl(int binZ, int binR) const
Definition: TrackerInfo.h:271
float material_bbxi(int binZ, int binR) const
Definition: TrackerInfo.h:270
int mat_nbins_z() const
Definition: TrackerInfo.h:262

◆ considerPoint()

void MkFitGeometryESProducer::considerPoint ( const GlobalPoint gp,
mkfit::LayerInfo lay_info 
)
private

Definition at line 200 of file MkFitGeometryESProducer.cc.

References mkfit::LayerInfo::extend_limits(), runTauDisplay::gp, alignCSCRings::r, and z.

Referenced by fillShapeAndPlacement().

200  {
201  // Use radius squared during bounding-region search.
202  float r = gp.perp2(), z = gp.z();
203  li.extend_limits(r, z);
204 }

◆ fillDescriptions()

void MkFitGeometryESProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

◆ fillLayers()

void MkFitGeometryESProducer::fillLayers ( mkfit::TrackerInfo trk_info)
private

Definition at line 467 of file MkFitGeometryESProducer.cc.

References funct::abs(), mps_fire::i, testProducerWithPsetDescEmpty_cfi::i2, mkfit::LayerInfo::is_barrel(), dqmiolumiharvest::j, mkfit::TrackerInfo::layer(), mkfit::TrackerInfo::mat_bin_r(), mkfit::TrackerInfo::mat_bin_z(), mkfit::TrackerInfo::mat_nbins_r(), mkfit::TrackerInfo::mat_nbins_z(), mkfit::TrackerInfo::material_bbxi(), mkfit::TrackerInfo::material_radl(), WZElectronSkims53X_cff::max, mkfit::TrackerInfo::n_layers(), mkfit::LayerInfo::rin(), mkfit::LayerInfo::rout(), mkfit::LayerInfo::zmax(), SiStripMonitorCluster_cfi::zmax, mkfit::LayerInfo::zmin(), and SiStripMonitorCluster_cfi::zmin.

Referenced by produce().

467  {
468  mkfit::rectvec<int> rneighbor_map(trk_info.mat_nbins_z(), trk_info.mat_nbins_r());
469  mkfit::rectvec<int> zneighbor_map(trk_info.mat_nbins_z(), trk_info.mat_nbins_r());
470 
471  for (int im = 0; im < trk_info.n_layers(); ++im) {
472  const mkfit::LayerInfo &li = trk_info.layer(im);
473  if (!li.is_barrel() && li.zmax() < 0)
474  continue; // neg endcap covered by pos
475  int rin, rout, zmin, zmax;
476  rin = trk_info.mat_bin_r(li.rin());
477  rout = trk_info.mat_bin_r(li.rout()) + 1;
478  if (li.is_barrel()) {
479  zmin = 0;
480  zmax = trk_info.mat_bin_z(std::max(std::abs(li.zmax()), std::abs(li.zmin()))) + 1;
481  } else {
482  zmin = trk_info.mat_bin_z(li.zmin());
483  zmax = trk_info.mat_bin_z(li.zmax()) + 1;
484  }
485  for (int i = zmin; i < zmax; i++) {
486  for (int j = rin; j < rout; j++) {
487  if (trk_info.material_bbxi(i, j) == 0) {
488  float distancesqmin = 100000;
489  for (int i2 = zmin; i2 < zmax; i2++) {
490  for (int j2 = rin; j2 < rout; j2++) {
491  if (j == j2 && i == i2)
492  continue;
493  auto mydistsq = (i - i2) * (i - i2) + (j - j2) * (j - j2);
494  if (mydistsq < distancesqmin && trk_info.material_radl(i2, j2) > 0) {
495  distancesqmin = mydistsq;
496  zneighbor_map(i, j) = i2;
497  rneighbor_map(i, j) = j2;
498  }
499  }
500  } // can work on speedup here
501  }
502  }
503  }
504  for (int i = zmin; i < zmax; i++) {
505  for (int j = rin; j < rout; j++) {
506  if (trk_info.material_bbxi(i, j) == 0) {
507  int iN = zneighbor_map(i, j);
508  int jN = rneighbor_map(i, j);
509  trk_info.material_bbxi(i, j) = trk_info.material_bbxi(iN, jN);
510  trk_info.material_radl(i, j) = trk_info.material_radl(iN, jN);
511  }
512  }
513  }
514  } //module loop
515 }
float rin() const
Definition: TrackerInfo.h:95
float zmax() const
Definition: TrackerInfo.h:99
int mat_nbins_r() const
Definition: TrackerInfo.h:263
float zmin() const
Definition: TrackerInfo.h:98
float material_radl(int binZ, int binR) const
Definition: TrackerInfo.h:271
int n_layers() const
Definition: TrackerInfo.h:240
int mat_bin_z(float z) const
Definition: TrackerInfo.h:266
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int mat_bin_r(float r) const
Definition: TrackerInfo.h:267
const LayerInfo & layer(int l) const
Definition: TrackerInfo.h:241
float material_bbxi(int binZ, int binR) const
Definition: TrackerInfo.h:270
float rout() const
Definition: TrackerInfo.h:96
int mat_nbins_z() const
Definition: TrackerInfo.h:262
bool is_barrel() const
Definition: TrackerInfo.h:105

◆ fillShapeAndPlacement()

void MkFitGeometryESProducer::fillShapeAndPlacement ( const GeomDet det,
mkfit::TrackerInfo trk_info,
MaterialHistogram material_histogram,
layer_gap_map_t lgc_map = nullptr 
)
private

Definition at line 206 of file MkFitGeometryESProducer.cc.

References b, b2, reco::ceil(), considerPoint(), mkfit::LayerNumberConverter::convertLayerNumber(), ALCARECOPPSCalTrackBasedSel_cff::detid, PVValHelper::dx, PVValHelper::dy, PVValHelper::dz, Exception, f, findRZBox(), dqmdumpme::first, GeomDet::geographicalId(), mps_fire::i, mkfit::LayerNumberConverter::isPhase2(), TrackerTopology::isStereo(), dqmiolumiharvest::j, TrackerTopology::layer(), mkfit::TrackerInfo::layer_nc(), layerModuleShapeVec_, layerNrConv_, mkfit::TrackerInfo::mat_nbins_r(), mkfit::TrackerInfo::mat_nbins_z(), mkfit::TrackerInfo::mat_range_r(), mkfit::TrackerInfo::mat_range_z(), WZElectronSkims53X_cff::max, Surface::mediumProperties(), SiStripPI::min, hltL1SingleMuFiltered5_cfi::overlap, AlCaHLTBitMon_ParallelJobs::p, PV3DBase< T, PVType, FrameType >::perp2(), PosEndcap, GeomDet::position(), MediumProperties::radLen(), GeomDet::rotation(), mkfit::ModuleShape::round_assign(), TrackerTopology::side(), GeomDet::surface(), SiStripSubdetector::TEC, TrackerTopology::tecIsDoubleSide(), SiStripSubdetector::TIB, TrackerTopology::tibIsDoubleSide(), SiStripSubdetector::TID, TrackerTopology::tidIsDoubleSide(), SiStripSubdetector::TOB, TrackerTopology::tobIsDoubleSide(), Surface::toGlobal(), trackerTopo_, useMatched, x, TkRotation< T >::x(), MediumProperties::xi(), geometryCSVtoXML::xy, z, and TkRotation< T >::z().

Referenced by addPixBGeometry(), addPixEGeometry(), addTECGeometry(), addTIBGeometry(), addTIDGeometry(), and addTOBGeometry().

209  {
210  const DetId detid = det->geographicalId();
211 
212  bool doubleSide = false; //double modules have double material
213  if (detid.subdetId() == SiStripSubdetector::TIB)
214  doubleSide = trackerTopo_->tibIsDoubleSide(detid);
215  else if (detid.subdetId() == SiStripSubdetector::TID)
216  doubleSide = trackerTopo_->tidIsDoubleSide(detid);
217  else if (detid.subdetId() == SiStripSubdetector::TOB)
218  doubleSide = trackerTopo_->tobIsDoubleSide(detid);
219  else if (detid.subdetId() == SiStripSubdetector::TEC)
220  doubleSide = trackerTopo_->tecIsDoubleSide(detid);
221 
222  float xy[4][2];
223  float dz;
224  const Bounds *b = &((det->surface()).bounds());
226 
227  if (const TrapezoidalPlaneBounds *b2 = dynamic_cast<const TrapezoidalPlaneBounds *>(b)) {
228  // See sec. "TrapezoidalPlaneBounds parameters" in doc/reco-geom-notes.txt
229  std::array<const float, 4> const &par = b2->parameters();
230  xy[0][0] = -par[0];
231  xy[0][1] = -par[3];
232  xy[1][0] = -par[1];
233  xy[1][1] = par[3];
234  xy[2][0] = par[1];
235  xy[2][1] = par[3];
236  xy[3][0] = par[0];
237  xy[3][1] = -par[3];
238  dz = par[2];
239  ms.round_assign(par[0], par[1], par[3], par[2]);
240 
241 #ifdef DUMP_MKF_GEO
242  printf("TRAP 0x%x %f %f %f %f ", detid.rawId(), par[0], par[1], par[2], par[3]);
243 #endif
244  } else if (const RectangularPlaneBounds *b2 = dynamic_cast<const RectangularPlaneBounds *>(b)) {
245  // Rectangular
246  float dx = b2->width() * 0.5; // half width
247  float dy = b2->length() * 0.5; // half length
248  xy[0][0] = -dx;
249  xy[0][1] = -dy;
250  xy[1][0] = -dx;
251  xy[1][1] = dy;
252  xy[2][0] = dx;
253  xy[2][1] = dy;
254  xy[3][0] = dx;
255  xy[3][1] = -dy;
256  dz = b2->thickness() * 0.5; // half thickness
257  ms.round_assign(dx, 0.0f, dy, dz);
258 
259 #ifdef DUMP_MKF_GEO
260  printf("RECT 0x%x %f %f %f ", detid.rawId(), dx, dy, dz);
261 #endif
262  } else {
263  throw cms::Exception("UnimplementedFeature") << "unsupported Bounds class";
264  }
265 
266  const bool useMatched = false;
267  int lay =
270  useMatched,
272  trackerTopo_->side(detid) == static_cast<unsigned>(TrackerDetSide::PosEndcap));
273 
274  unsigned short shape_id = 9999;
275  if (!doubleSide) {
277  auto bhmi = bhm.find(ms);
278  if (bhmi == bhm.end()) {
279  bhmi = bhm.insert({ms, (unsigned short)bhm.size()}).first;
280  }
281  shape_id = bhmi->second;
282  }
283 
284 #ifdef DUMP_MKF_GEO
285  printf(" subdet=%d layer=%d side=%d is_stereo=%d is_double_side=%d --> mkflayer=%d; unique shape id=%hu\n",
286  detid.subdetId(),
290  doubleSide,
291  lay,
292  shape_id);
293 #endif
294 
295  mkfit::LayerInfo &layer_info = trk_info.layer_nc(lay);
296  if (lgc_map) {
297  (*lgc_map)[lay].reset_current();
298  }
299  float zbox_min = 1000, zbox_max = 0, rbox_min = 1000, rbox_max = 0;
300  for (int i = 0; i < 4; ++i) {
301  Local3DPoint lp1(xy[i][0], xy[i][1], -dz);
302  Local3DPoint lp2(xy[i][0], xy[i][1], dz);
303  GlobalPoint gp1 = det->surface().toGlobal(lp1);
304  GlobalPoint gp2 = det->surface().toGlobal(lp2);
305  considerPoint(gp1, layer_info);
306  considerPoint(gp2, layer_info);
307  findRZBox(gp1, rbox_min, rbox_max, zbox_min, zbox_max);
308  findRZBox(gp2, rbox_min, rbox_max, zbox_min, zbox_max);
309  if (lgc_map) {
310  (*lgc_map)[lay].extend_current(gp1.perp2());
311  (*lgc_map)[lay].extend_current(gp2.perp2());
312  }
313  }
314  if (lgc_map) {
315  (*lgc_map)[lay].add_current();
316  }
317 
318  // Double-sided module (join of two modules) information is not used in mkFit and
319  // also not needed for the material calculation.
320  // NOTE: This check should actually be performed even before the bounding box calculation
321  // as double-side module bounding box is a box-shaped union of bounding shapes of the
322  // constituent modules -- thus extending the layer bounding box unnecessarily.
323  // The 'if' is here as mkFit layer hit/miss logic has been tuned with this extended
324  // bounding boxes. To be moved higher up once this detection is improved through usage of
325  // the thin-thick layer concept (expected towards the end of 2024).
326  if (doubleSide)
327  return;
328 
329  // Module information
330  const auto &p = det->position();
331  auto z = det->rotation().z();
332  auto x = det->rotation().x();
333  layer_info.register_module(
334  {{p.x(), p.y(), p.z()}, {z.x(), z.y(), z.z()}, {x.x(), x.y(), x.z()}, detid.rawId(), shape_id});
335  // Set some layer parameters (repeatedly, would require hard-coding otherwise)
336  layer_info.set_subdet(detid.subdetId());
337  layer_info.set_is_pixel(detid.subdetId() <= 2);
338  layer_info.set_is_stereo(trackerTopo_->isStereo(detid));
339  if (layerNrConv_.isPhase2() && !layer_info.is_pixel())
340  layer_info.set_has_charge(false);
341 
342  // Fill material
343  {
344  // module material
345  const float bbxi = det->surface().mediumProperties().xi();
346  const float radL = det->surface().mediumProperties().radLen();
347  // loop over bins to fill histogram with bbxi, radL and their weight, which the overlap surface in r-z with the cmsquare of a bin
348  const float iBin = trk_info.mat_range_z() / trk_info.mat_nbins_z();
349  const float jBin = trk_info.mat_range_r() / trk_info.mat_nbins_r();
350  for (int i = std::floor(zbox_min / iBin); i < std::ceil(zbox_max / iBin); i++) {
351  for (int j = std::floor(rbox_min / jBin); j < std::ceil(rbox_max / jBin); j++) {
352  const float iF = i * iBin;
353  const float jF = j * jBin;
354  float overlap = std::max(0.f, std::min(jF + jBin, rbox_max) - std::max(jF, rbox_min)) *
355  std::max(0.f, std::min(iF + iBin, zbox_max) - std::max(iF, zbox_min));
356  if (overlap > 0)
357  material_histogram(i, j).add(overlap, bbxi, radL);
358  }
359  }
360  }
361 }
constexpr int32_t ceil(float num)
bool tibIsDoubleSide(const DetId &id) const
bool tecIsDoubleSide(const DetId &id) const
bool tidIsDoubleSide(const DetId &id) const
layer_module_shape_vec_t layerModuleShapeVec_
bool isStereo(const DetId &id) const
const TrackerTopology * trackerTopo_
unsigned int side(const DetId &id) const
LayerInfo & layer_nc(int l)
Definition: TrackerInfo.h:242
bool tobIsDoubleSide(const DetId &id) const
constexpr bool useMatched
unsigned int layer(const DetId &id) const
int mat_nbins_r() const
Definition: TrackerInfo.h:263
const Surface::RotationType & rotation() const
The rotation defining the local R.F.
Definition: GeomDet.h:46
Basic3DVector< T > x() const
std::unordered_map< mkfit::ModuleShape, unsigned short, ModuleShape_hash > module_shape_hmap_t
float radLen() const
float mat_range_z() const
Definition: TrackerInfo.h:264
Basic3DVector< T > z() const
void considerPoint(const GlobalPoint &gp, mkfit::LayerInfo &lay_info)
double f[11][100]
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
float mat_range_r() const
Definition: TrackerInfo.h:265
bias2_t b2[25]
Definition: b2.h:9
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
Definition: DetId.h:17
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
double b
Definition: hdecay.h:120
void findRZBox(const GlobalPoint &gp, float &rmin, float &rmax, float &zmin, float &zmax)
T perp2() const
Definition: PV3DBase.h:68
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
mkfit::LayerNumberConverter layerNrConv_
Definition: Bounds.h:18
const MediumProperties & mediumProperties() const
Definition: Surface.h:83
int convertLayerNumber(int det, int lay, bool useMatched, int isStereo, bool posZ) const
float xi() const
int mat_nbins_z() const
Definition: TrackerInfo.h:262
void round_assign(float x1, float x2, float y, float z)
Definition: TrackerInfo.h:39

◆ findRZBox()

void MkFitGeometryESProducer::findRZBox ( const GlobalPoint gp,
float &  rmin,
float &  rmax,
float &  zmin,
float &  zmax 
)
private

◆ produce()

std::unique_ptr< MkFitGeometry > MkFitGeometryESProducer::produce ( const TrackerRecoGeometryRecord iRecord)

Definition at line 541 of file MkFitGeometryESProducer.cc.

References addPixBGeometry(), addPixEGeometry(), addTECGeometry(), addTIBGeometry(), addTIDGeometry(), addTOBGeometry(), aggregateMaterialInfo(), mkfit::PropagationConfig::apply_tracker_info(), cms::cuda::assert(), mkfit::PropagationConfig::backward_fit_pflags, mkfit::PropagationConfig::backward_fit_to_pca, Exception, f, fillLayers(), mkfit::PropagationConfig::finding_inter_layer_pflags, mkfit::PropagationConfig::finding_intra_layer_pflags, mkfit::PropagationConfig::finding_requires_propagation_to_hit_pos, mkfit::PropagationConfig::forward_fit_pflags, geomToken_, edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), mps_fire::i, TrackerGeometry::isThere(), layerModuleShapeVec_, layerNrConv_, WZElectronSkims53X_cff::max, eostools::move(), GeomDetEnumerators::P1PXB, GeomDetEnumerators::P1PXEC, GeomDetEnumerators::P2OTB, GeomDetEnumerators::P2OTEC, GeomDetEnumerators::P2PXB, GeomDetEnumerators::P2PXEC, mkfit::PropagationConfig::pca_prop_pflags, mkfit::PF_apply_material, mkfit::PF_none, mkfit::PF_use_param_b_field, mkfit::phase2, mkfit::LayerNumberConverter::reset(), mkfit::PropagationConfig::seed_fit_pflags, l1trig_cff::shape, mathSSE::sqrt(), trackerGeom_, trackerToken_, trackerTopo_, ttopoToken_, mkfit::Config::usePropToPlane, and mkfit::Config::usePtMultScat.

541  {
542  auto trackerInfo = std::make_unique<mkfit::TrackerInfo>();
543 
544  trackerGeom_ = &iRecord.get(geomToken_);
545  trackerTopo_ = &iRecord.get(ttopoToken_);
546 
547  const float *qBinDefaults = nullptr;
548 
549  // std::string path = "Geometry/TrackerCommonData/data/";
551  edm::LogInfo("MkFitGeometryESProducer") << "Extracting PhaseI geometry";
552  trackerInfo->create_layers(18, 27, 27);
553  qBinDefaults = phase1QBins;
554  trackerInfo->create_material(300, 300.0f, 120, 120.0f);
557  edm::LogInfo("MkFitGeometryESProducer") << "Extracting PhaseII geometry";
558 #if !defined(MKFIT_PHASE2CUSTOMFLAGS)
559  // In Phase2, by default use prop-to-plane and pT-dependent MS.
560  // Option is kept to use custom flags, for R&D/test purposes.
561  using namespace mkfit;
562  Config::usePropToPlane = true;
563  Config::usePtMultScat = true;
564 #endif
566  trackerInfo->create_layers(16, 22, 22);
567  qBinDefaults = phase2QBins;
568  trackerInfo->create_material(300, 300.0f, 120, 120.0f);
569  } else {
570  throw cms::Exception("UnimplementedFeature") << "unsupported / unknowen geometry version";
571  }
572 
573  // Prepare layer boundaries for bounding-rz-box search
574  for (int i = 0; i < trackerInfo->n_layers(); ++i) {
575  auto &li = trackerInfo->layer_nc(i);
576  li.set_limits(
578  li.reserve_modules(256);
579  }
580  // Resize the module bounds collector vector
581  layerModuleShapeVec_.resize(trackerInfo->n_layers());
582 
583  MaterialHistogram material_histogram(trackerInfo->mat_nbins_z(), trackerInfo->mat_nbins_r());
584 
585  // This works for both Phase1 and Phase2.
586  // Phase2 TrackerGeometry returns empty det-vectors for TIB and TEC.
587  addPixBGeometry(*trackerInfo, material_histogram);
588  addPixEGeometry(*trackerInfo, material_histogram);
589  addTIBGeometry(*trackerInfo, material_histogram);
590  addTIDGeometry(*trackerInfo, material_histogram);
591  addTOBGeometry(*trackerInfo, material_histogram);
592  addTECGeometry(*trackerInfo, material_histogram);
593 
594  // r_in/out kept as squares until here, root them; fill ModuleShape vectors of layers
595  unsigned int n_mod = 0;
596  for (int i = 0; i < trackerInfo->n_layers(); ++i) {
597  auto &li = trackerInfo->layer_nc(i);
598  li.set_r_in_out(std::sqrt(li.rin()), std::sqrt(li.rout()));
599  li.set_propagate_to(li.is_barrel() ? li.r_mean() : li.z_mean());
600  li.set_q_bin(qBinDefaults[i]);
601  unsigned int maxsid = li.shrink_modules();
602 
603  n_mod += maxsid;
604 
605  // Make sure the short id fits in the 14 bits...
606  assert(maxsid < 1u << 13);
607  assert(n_mod > 0);
608 
609  // Fill ModuleShape vectors
610  int n_shapes = layerModuleShapeVec_[i].size();
611  li.resize_shapes(n_shapes);
612  for (auto &[shape, id] : layerModuleShapeVec_[i]) {
613  li.register_shape(shape, id);
614  }
615  }
616 
617  // Material grid
618  aggregateMaterialInfo(*trackerInfo, material_histogram);
619  fillLayers(*trackerInfo);
620 
621  // Propagation configuration
622  {
623  using namespace mkfit;
624  PropagationConfig &pconf = trackerInfo->prop_config_nc();
625  pconf.backward_fit_to_pca = false;
630  else
636  pconf.apply_tracker_info(trackerInfo.get());
637  }
638 
639 #ifdef DUMP_MKF_GEO
640  printf("Total number of modules %u, 14-bits fit up to %u modules\n", n_mod, 1u << 13);
641 #endif
642 
643  return std::make_unique<MkFitGeometry>(iRecord.get(geomToken_),
644  iRecord.get(trackerToken_),
645  iRecord.get(ttopoToken_),
646  std::move(trackerInfo),
647  layerNrConv_);
648 }
void addTIDGeometry(mkfit::TrackerInfo &trk_info, MaterialHistogram &material_histogram)
layer_module_shape_vec_t layerModuleShapeVec_
void addTOBGeometry(mkfit::TrackerInfo &trk_info, MaterialHistogram &material_histogram)
void addTECGeometry(mkfit::TrackerInfo &trk_info, MaterialHistogram &material_histogram)
PropagationFlags forward_fit_pflags
void fillLayers(mkfit::TrackerInfo &trk_info)
void addPixBGeometry(mkfit::TrackerInfo &trk_info, MaterialHistogram &material_histogram)
edm::ESGetToken< GeometricSearchTracker, TrackerRecoGeometryRecord > trackerToken_
PropagationFlags backward_fit_pflags
const TrackerTopology * trackerTopo_
assert(be >=bs)
PropagationFlags finding_inter_layer_pflags
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > ttopoToken_
const TrackerGeometry * trackerGeom_
bool isThere(GeomDetEnumerators::SubDetector subdet) const
T sqrt(T t)
Definition: SSEVec.h:23
PropagationFlags seed_fit_pflags
double f[11][100]
void addTIBGeometry(mkfit::TrackerInfo &trk_info, MaterialHistogram &material_histogram)
PropagationFlags pca_prop_pflags
bool usePtMultScat
Definition: Config.cc:8
Log< level::Info, false > LogInfo
void aggregateMaterialInfo(mkfit::TrackerInfo &trk_info, MaterialHistogram &material_histogram)
mkfit::rectvec< MatHistBin > MaterialHistogram
mkfit::LayerNumberConverter layerNrConv_
void apply_tracker_info(const TrackerInfo *ti)
Definition: TrackerInfo.cc:13
void addPixEGeometry(mkfit::TrackerInfo &trk_info, MaterialHistogram &material_histogram)
PropagationFlags finding_intra_layer_pflags
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
def move(src, dest)
Definition: eostools.py:511
bool usePropToPlane
Definition: Config.cc:7

Member Data Documentation

◆ geomToken_

edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> MkFitGeometryESProducer::geomToken_
private

Definition at line 99 of file MkFitGeometryESProducer.cc.

Referenced by MkFitGeometryESProducer(), and produce().

◆ layerModuleShapeVec_

layer_module_shape_vec_t MkFitGeometryESProducer::layerModuleShapeVec_
private

Definition at line 106 of file MkFitGeometryESProducer.cc.

Referenced by fillShapeAndPlacement(), and produce().

◆ layerNrConv_

mkfit::LayerNumberConverter MkFitGeometryESProducer::layerNrConv_ = {mkfit::TkLayout::phase1}
private

Definition at line 105 of file MkFitGeometryESProducer.cc.

Referenced by fillShapeAndPlacement(), and produce().

◆ trackerGeom_

const TrackerGeometry* MkFitGeometryESProducer::trackerGeom_ = nullptr
private

◆ trackerToken_

edm::ESGetToken<GeometricSearchTracker, TrackerRecoGeometryRecord> MkFitGeometryESProducer::trackerToken_
private

Definition at line 101 of file MkFitGeometryESProducer.cc.

Referenced by MkFitGeometryESProducer(), and produce().

◆ trackerTopo_

const TrackerTopology* MkFitGeometryESProducer::trackerTopo_ = nullptr
private

Definition at line 103 of file MkFitGeometryESProducer.cc.

Referenced by fillShapeAndPlacement(), and produce().

◆ ttopoToken_

edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> MkFitGeometryESProducer::ttopoToken_
private

Definition at line 100 of file MkFitGeometryESProducer.cc.

Referenced by MkFitGeometryESProducer(), and produce().