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
 

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

typedef std::unordered_map< int, GapCollectorlayer_gap_map_t
 
using MaterialHistogram = mkfit::rectvec< MatHistBin >
 

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_
 
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 30 of file MkFitGeometryESProducer.cc.

Member Typedef Documentation

◆ layer_gap_map_t

typedef std::unordered_map<int, GapCollector> MkFitGeometryESProducer::layer_gap_map_t
private

Definition at line 60 of file MkFitGeometryESProducer.cc.

◆ MaterialHistogram

Definition at line 70 of file MkFitGeometryESProducer.cc.

Constructor & Destructor Documentation

◆ MkFitGeometryESProducer()

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

Definition at line 97 of file MkFitGeometryESProducer.cc.

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

97  {
98  auto cc = setWhatProduced(this);
99  geomToken_ = cc.consumes();
100  ttopoToken_ = cc.consumes();
101  trackerToken_ = cc.consumes();
102 }
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 334 of file MkFitGeometryESProducer.cc.

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

Referenced by produce().

334  {
335 #ifdef DUMP_MKF_GEO
336  printf("\n*** addPixBGeometry\n\n");
337 #endif
338  for (auto &det : trackerGeom_->detsPXB()) {
339  fillShapeAndPlacement(det, trk_info, material_histogram);
340  }
341 }
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 343 of file MkFitGeometryESProducer.cc.

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

Referenced by produce().

343  {
344 #ifdef DUMP_MKF_GEO
345  printf("\n*** addPixEGeometry\n\n");
346 #endif
347  for (auto &det : trackerGeom_->detsPXF()) {
348  fillShapeAndPlacement(det, trk_info, material_histogram);
349  }
350 }
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 379 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().

379  {
380 #ifdef DUMP_MKF_GEO
381  printf("\n*** addTECGeometry\n\n");
382 #endif
383  // For TEC we also need to discover hole in radial extents.
384  layer_gap_map_t lgc_map;
385  for (auto &det : trackerGeom_->detsTEC()) {
386  fillShapeAndPlacement(det, trk_info, material_histogram, &lgc_map);
387  }
388  // Now loop over the GapCollectors and see if there is a coverage gap.
389  std::ostringstream ostr;
390  ostr << "addTECGeometry() gap report:\n";
391  GapCollector::Interval itvl;
392  for (auto &[layer, gcol] : lgc_map) {
393  gcol.sqrt_elements();
394  if (gcol.find_gap(itvl, 0.5)) {
395  ostr << " layer: " << layer << ", gap: " << itvl.x << " -> " << itvl.y << " width = " << itvl.y - itvl.x << "\n";
396  ostr << " all gaps: ";
397  gcol.print_gaps(ostr);
398  ostr << "\n";
399  trk_info.layer_nc(layer).set_r_hole_range(itvl.x, itvl.y);
400  }
401  }
402  edm::LogVerbatim("MkFitGeometryESProducer") << ostr.str();
403 }
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:204
const TrackerGeometry * trackerGeom_
void fillShapeAndPlacement(const GeomDet *det, mkfit::TrackerInfo &trk_info, MaterialHistogram &material_histogram, layer_gap_map_t *lgc_map=nullptr)
const DetContainer & detsTEC() const
std::unordered_map< int, GapCollector > layer_gap_map_t

◆ addTIBGeometry()

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

Definition at line 352 of file MkFitGeometryESProducer.cc.

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

Referenced by produce().

352  {
353 #ifdef DUMP_MKF_GEO
354  printf("\n*** addTIBGeometry\n\n");
355 #endif
356  for (auto &det : trackerGeom_->detsTIB()) {
357  fillShapeAndPlacement(det, trk_info, material_histogram);
358  }
359 }
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 370 of file MkFitGeometryESProducer.cc.

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

Referenced by produce().

370  {
371 #ifdef DUMP_MKF_GEO
372  printf("\n*** addTIDGeometry\n\n");
373 #endif
374  for (auto &det : trackerGeom_->detsTID()) {
375  fillShapeAndPlacement(det, trk_info, material_histogram);
376  }
377 }
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 361 of file MkFitGeometryESProducer.cc.

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

Referenced by produce().

361  {
362 #ifdef DUMP_MKF_GEO
363  printf("\n*** addTOBGeometry\n\n");
364 #endif
365  for (auto &det : trackerGeom_->detsTOB()) {
366  fillShapeAndPlacement(det, trk_info, material_histogram);
367  }
368 }
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 413 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().

414  {
415  //from histogram (vector of tuples) to grid
416  for (int i = 0; i < trk_info.mat_nbins_z(); i++) {
417  for (int j = 0; j < trk_info.mat_nbins_r(); j++) {
418  const MatHistBin &mhb = material_histogram(i, j);
419  if (mhb.weight > 0) {
420  trk_info.material_bbxi(i, j) = mhb.xi / mhb.weight;
421  trk_info.material_radl(i, j) = mhb.rl / mhb.weight;
422  }
423  }
424  }
425 }
int mat_nbins_r() const
Definition: TrackerInfo.h:225
float material_radl(int binZ, int binR) const
Definition: TrackerInfo.h:233
float material_bbxi(int binZ, int binR) const
Definition: TrackerInfo.h:232
int mat_nbins_z() const
Definition: TrackerInfo.h:224

◆ considerPoint()

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

Definition at line 188 of file MkFitGeometryESProducer.cc.

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

Referenced by fillShapeAndPlacement().

188  {
189  // Use radius squared during bounding-region search.
190  float r = gp.perp2(), z = gp.z();
191  li.extend_limits(r, z);
192 }

◆ fillDescriptions()

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

◆ fillLayers()

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

Definition at line 427 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(), SiStripPI::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().

427  {
428  mkfit::rectvec<int> rneighbor_map(trk_info.mat_nbins_z(), trk_info.mat_nbins_r());
429  mkfit::rectvec<int> zneighbor_map(trk_info.mat_nbins_z(), trk_info.mat_nbins_r());
430 
431  for (int im = 0; im < trk_info.n_layers(); ++im) {
432  const mkfit::LayerInfo &li = trk_info.layer(im);
433  if (!li.is_barrel() && li.zmax() < 0)
434  continue; // neg endcap covered by pos
435  int rin, rout, zmin, zmax;
436  rin = trk_info.mat_bin_r(li.rin());
437  rout = trk_info.mat_bin_r(li.rout()) + 1;
438  if (li.is_barrel()) {
439  zmin = 0;
440  zmax = trk_info.mat_bin_z(std::max(std::abs(li.zmax()), std::abs(li.zmin()))) + 1;
441  } else {
442  zmin = trk_info.mat_bin_z(li.zmin());
443  zmax = trk_info.mat_bin_z(li.zmax()) + 1;
444  }
445  for (int i = zmin; i < zmax; i++) {
446  for (int j = rin; j < rout; j++) {
447  if (trk_info.material_bbxi(i, j) == 0) {
448  float distancesqmin = 100000;
449  for (int i2 = zmin; i2 < zmax; i2++) {
450  for (int j2 = rin; j2 < rout; j2++) {
451  if (j == j2 && i == i2)
452  continue;
453  auto mydistsq = (i - i2) * (i - i2) + (j - j2) * (j - j2);
454  if (mydistsq < distancesqmin && trk_info.material_radl(i2, j2) > 0) {
455  distancesqmin = mydistsq;
456  zneighbor_map(i, j) = i2;
457  rneighbor_map(i, j) = j2;
458  }
459  }
460  } // can work on speedup here
461  }
462  }
463  }
464  for (int i = zmin; i < zmax; i++) {
465  for (int j = rin; j < rout; j++) {
466  if (trk_info.material_bbxi(i, j) == 0) {
467  int iN = zneighbor_map(i, j);
468  int jN = rneighbor_map(i, j);
469  trk_info.material_bbxi(i, j) = trk_info.material_bbxi(iN, jN);
470  trk_info.material_radl(i, j) = trk_info.material_radl(iN, jN);
471  }
472  }
473  }
474  } //module loop
475 }
float rin() const
Definition: TrackerInfo.h:67
float zmax() const
Definition: TrackerInfo.h:71
int mat_nbins_r() const
Definition: TrackerInfo.h:225
float zmin() const
Definition: TrackerInfo.h:70
float material_radl(int binZ, int binR) const
Definition: TrackerInfo.h:233
int n_layers() const
Definition: TrackerInfo.h:202
int mat_bin_z(float z) const
Definition: TrackerInfo.h:228
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int mat_bin_r(float r) const
Definition: TrackerInfo.h:229
const LayerInfo & layer(int l) const
Definition: TrackerInfo.h:203
float material_bbxi(int binZ, int binR) const
Definition: TrackerInfo.h:232
float rout() const
Definition: TrackerInfo.h:68
int mat_nbins_z() const
Definition: TrackerInfo.h:224
bool is_barrel() const
Definition: TrackerInfo.h:77

◆ 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 194 of file MkFitGeometryESProducer.cc.

References b, b2, reco::ceil(), considerPoint(), mkfit::LayerNumberConverter::convertLayerNumber(), PVValHelper::dx, PVValHelper::dy, PVValHelper::dz, Exception, f, findRZBox(), GeomDet::geographicalId(), mps_fire::i, TrackerTopology::isStereo(), dqmiolumiharvest::j, TrackerTopology::layer(), mkfit::TrackerInfo::layer_nc(), layerNrConv_, mkfit::TrackerInfo::mat_nbins_r(), mkfit::TrackerInfo::mat_nbins_z(), mkfit::TrackerInfo::mat_range_r(), mkfit::TrackerInfo::mat_range_z(), SiStripPI::max, Surface::mediumProperties(), SiStripPI::min, hltL1SingleMuFiltered5_cfi::overlap, AlCaHLTBitMon_ParallelJobs::p, PV3DBase< T, PVType, FrameType >::perp2(), PosEndcap, GeomDet::position(), MediumProperties::radLen(), DetId::rawId(), GeomDet::rotation(), TrackerTopology::side(), DetId::subdetId(), 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().

197  {
198  DetId detid = det->geographicalId();
199 
200  float xy[4][2];
201  float half_length, dz;
202  const Bounds *b = &((det->surface()).bounds());
203 
204  if (const TrapezoidalPlaneBounds *b2 = dynamic_cast<const TrapezoidalPlaneBounds *>(b)) {
205  // See sec. "TrapezoidalPlaneBounds parameters" in doc/reco-geom-notes.txt
206  std::array<const float, 4> const &par = b2->parameters();
207  xy[0][0] = -par[0];
208  xy[0][1] = -par[3];
209  xy[1][0] = -par[1];
210  xy[1][1] = par[3];
211  xy[2][0] = par[1];
212  xy[2][1] = par[3];
213  xy[3][0] = par[0];
214  xy[3][1] = -par[3];
215  half_length = par[3];
216  dz = par[2];
217 
218 #ifdef DUMP_MKF_GEO
219  printf("TRAP 0x%x %f %f %f %f ", detid.rawId(), par[0], par[1], par[2], par[3]);
220 #endif
221  } else if (const RectangularPlaneBounds *b2 = dynamic_cast<const RectangularPlaneBounds *>(b)) {
222  // Rectangular
223  float dx = b2->width() * 0.5; // half width
224  float dy = b2->length() * 0.5; // half length
225  xy[0][0] = -dx;
226  xy[0][1] = -dy;
227  xy[1][0] = -dx;
228  xy[1][1] = dy;
229  xy[2][0] = dx;
230  xy[2][1] = dy;
231  xy[3][0] = dx;
232  xy[3][1] = -dy;
233  half_length = dy;
234  dz = b2->thickness() * 0.5; // half thickness
235 
236 #ifdef DUMP_MKF_GEO
237  printf("RECT 0x%x %f %f %f ", detid.rawId(), dx, dy, dz);
238 #endif
239  } else {
240  throw cms::Exception("UnimplementedFeature") << "unsupported Bounds class";
241  }
242 
243  const bool useMatched = false;
244  int lay =
246  trackerTopo_->layer(detid),
247  useMatched,
248  trackerTopo_->isStereo(detid),
249  trackerTopo_->side(detid) == static_cast<unsigned>(TrackerDetSide::PosEndcap));
250 #ifdef DUMP_MKF_GEO
251  printf(" subdet=%d layer=%d side=%d is_stereo=%d --> mkflayer=%d\n",
252  detid.subdetId(),
253  trackerTopo_->layer(detid),
254  trackerTopo_->side(detid),
255  trackerTopo_->isStereo(detid),
256  lay);
257 #endif
258 
259  mkfit::LayerInfo &layer_info = trk_info.layer_nc(lay);
260  if (lgc_map) {
261  (*lgc_map)[lay].reset_current();
262  }
263  float zbox_min = 1000, zbox_max = 0, rbox_min = 1000, rbox_max = 0;
264  for (int i = 0; i < 4; ++i) {
265  Local3DPoint lp1(xy[i][0], xy[i][1], -dz);
266  Local3DPoint lp2(xy[i][0], xy[i][1], dz);
267  GlobalPoint gp1 = det->surface().toGlobal(lp1);
268  GlobalPoint gp2 = det->surface().toGlobal(lp2);
269  considerPoint(gp1, layer_info);
270  considerPoint(gp2, layer_info);
271  findRZBox(gp1, rbox_min, rbox_max, zbox_min, zbox_max);
272  findRZBox(gp2, rbox_min, rbox_max, zbox_min, zbox_max);
273  if (lgc_map) {
274  (*lgc_map)[lay].extend_current(gp1.perp2());
275  (*lgc_map)[lay].extend_current(gp2.perp2());
276  }
277  }
278  if (lgc_map) {
279  (*lgc_map)[lay].add_current();
280  }
281  // Module information
282  const auto &p = det->position();
283  auto z = det->rotation().z();
284  auto x = det->rotation().x();
285  layer_info.register_module(
286  {{p.x(), p.y(), p.z()}, {z.x(), z.y(), z.z()}, {x.x(), x.y(), x.z()}, half_length, detid.rawId()});
287  // Set some layer parameters (repeatedly, would require hard-coding otherwise)
288  layer_info.set_subdet(detid.subdetId());
289  layer_info.set_is_pixel(detid.subdetId() <= 2);
290  layer_info.set_is_stereo(trackerTopo_->isStereo(detid));
291 
292  bool doubleSide = false; //double modules have double material
293  if (detid.subdetId() == SiStripSubdetector::TIB)
294  doubleSide = trackerTopo_->tibIsDoubleSide(detid);
295  else if (detid.subdetId() == SiStripSubdetector::TID)
296  doubleSide = trackerTopo_->tidIsDoubleSide(detid);
297  else if (detid.subdetId() == SiStripSubdetector::TOB)
298  doubleSide = trackerTopo_->tobIsDoubleSide(detid);
299  else if (detid.subdetId() == SiStripSubdetector::TEC)
300  doubleSide = trackerTopo_->tecIsDoubleSide(detid);
301 
302  if (!doubleSide) //fill material
303  {
304  //module material
305  const float bbxi = det->surface().mediumProperties().xi();
306  const float radL = det->surface().mediumProperties().radLen();
307  //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
308  const float iBin = trk_info.mat_range_z() / trk_info.mat_nbins_z();
309  const float jBin = trk_info.mat_range_r() / trk_info.mat_nbins_r();
310  for (int i = std::floor(zbox_min / iBin); i < std::ceil(zbox_max / iBin); i++) {
311  for (int j = std::floor(rbox_min / jBin); j < std::ceil(rbox_max / jBin); j++) {
312  const float iF = i * iBin;
313  const float jF = j * jBin;
314  float overlap = std::max(0.f, std::min(jF + jBin, rbox_max) - std::max(jF, rbox_min)) *
315  std::max(0.f, std::min(iF + iBin, zbox_max) - std::max(iF, zbox_min));
316  if (overlap > 0)
317  material_histogram(i, j).add(overlap, bbxi, radL);
318  }
319  }
320  }
321 }
constexpr int32_t ceil(float num)
bool tibIsDoubleSide(const DetId &id) const
bool tecIsDoubleSide(const DetId &id) const
bool tidIsDoubleSide(const DetId &id) const
bool isStereo(const DetId &id) const
const TrackerTopology * trackerTopo_
unsigned int side(const DetId &id) const
LayerInfo & layer_nc(int l)
Definition: TrackerInfo.h:204
bool tobIsDoubleSide(const DetId &id) const
constexpr bool useMatched
unsigned int layer(const DetId &id) const
int mat_nbins_r() const
Definition: TrackerInfo.h:225
const Surface::RotationType & rotation() const
The rotation defining the local R.F.
Definition: GeomDet.h:46
Basic3DVector< T > x() const
float radLen() const
float mat_range_z() const
Definition: TrackerInfo.h:226
Basic3DVector< T > z() const
void considerPoint(const GlobalPoint &gp, mkfit::LayerInfo &lay_info)
double f[11][100]
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
float mat_range_r() const
Definition: TrackerInfo.h:227
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
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
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:224

◆ 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 501 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(), layerNrConv_, SiStripPI::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, mathSSE::sqrt(), trackerGeom_, trackerToken_, trackerTopo_, ttopoToken_, and mkfit::Config::usePropToPlane.

501  {
502  auto trackerInfo = std::make_unique<mkfit::TrackerInfo>();
503 
504  trackerGeom_ = &iRecord.get(geomToken_);
505  trackerTopo_ = &iRecord.get(ttopoToken_);
506 
507  const float *qBinDefaults = nullptr;
508 
509  // std::string path = "Geometry/TrackerCommonData/data/";
511  edm::LogInfo("MkFitGeometryESProducer") << "Extracting PhaseI geometry";
512  trackerInfo->create_layers(18, 27, 27);
513  qBinDefaults = phase1QBins;
514 
515  trackerInfo->create_material(300, 300.0f, 120, 120.0f);
518  edm::LogInfo("MkFitGeometryESProducer") << "Extracting PhaseII geometry";
520  trackerInfo->create_layers(16, 22, 22);
521  qBinDefaults = phase2QBins;
522  trackerInfo->create_material(300, 300.0f, 120, 120.0f);
523  } else {
524  throw cms::Exception("UnimplementedFeature") << "unsupported / unknowen geometry version";
525  }
526 
527  // Prepare layer boundaries for bounding-box search
528  for (int i = 0; i < trackerInfo->n_layers(); ++i) {
529  auto &li = trackerInfo->layer_nc(i);
530  li.set_limits(
532  li.reserve_modules(256);
533  }
534 
535  MaterialHistogram material_histogram(trackerInfo->mat_nbins_z(), trackerInfo->mat_nbins_r());
536 
537  // This is sort of CMS-phase1 specific ... but fireworks code uses it for PhaseII as well.
538  addPixBGeometry(*trackerInfo, material_histogram);
539  addPixEGeometry(*trackerInfo, material_histogram);
540  addTIBGeometry(*trackerInfo, material_histogram);
541  addTIDGeometry(*trackerInfo, material_histogram);
542  addTOBGeometry(*trackerInfo, material_histogram);
543  addTECGeometry(*trackerInfo, material_histogram);
544 
545  // r_in/out kept as squares until here, root them
546  unsigned int n_mod = 0;
547  for (int i = 0; i < trackerInfo->n_layers(); ++i) {
548  auto &li = trackerInfo->layer_nc(i);
549  li.set_r_in_out(std::sqrt(li.rin()), std::sqrt(li.rout()));
550  li.set_propagate_to(li.is_barrel() ? li.r_mean() : li.z_mean());
551  li.set_q_bin(qBinDefaults[i]);
552  unsigned int maxsid = li.shrink_modules();
553 
554  n_mod += maxsid;
555 
556  // Make sure the short id fits in the 14 bits...
557  assert(maxsid < 1u << 13);
558  assert(n_mod > 0);
559  }
560 
561  // Material grid
562  aggregateMaterialInfo(*trackerInfo, material_histogram);
563  fillLayers(*trackerInfo);
564 
565  // Propagation configuration
566  {
567  using namespace mkfit;
568  PropagationConfig &pconf = trackerInfo->prop_config_nc();
569  pconf.backward_fit_to_pca = false;
574  else
580  pconf.apply_tracker_info(trackerInfo.get());
581  }
582 
583 #ifdef DUMP_MKF_GEO
584  printf("Total number of modules %u, 14-bits fit up to %u modules\n", n_mod, 1u << 13);
585 #endif
586 
587  return std::make_unique<MkFitGeometry>(iRecord.get(geomToken_),
588  iRecord.get(trackerToken_),
589  iRecord.get(ttopoToken_),
590  std::move(trackerInfo),
591  layerNrConv_);
592 }
void addTIDGeometry(mkfit::TrackerInfo &trk_info, MaterialHistogram &material_histogram)
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:19
PropagationFlags seed_fit_pflags
double f[11][100]
void addTIBGeometry(mkfit::TrackerInfo &trk_info, MaterialHistogram &material_histogram)
PropagationFlags pca_prop_pflags
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
constexpr bool usePropToPlane
Definition: Config.h:51
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ geomToken_

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

Definition at line 88 of file MkFitGeometryESProducer.cc.

Referenced by MkFitGeometryESProducer(), and produce().

◆ layerNrConv_

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

Definition at line 94 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 90 of file MkFitGeometryESProducer.cc.

Referenced by MkFitGeometryESProducer(), and produce().

◆ trackerTopo_

const TrackerTopology* MkFitGeometryESProducer::trackerTopo_ = nullptr
private

Definition at line 92 of file MkFitGeometryESProducer.cc.

Referenced by fillShapeAndPlacement(), and produce().

◆ ttopoToken_

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

Definition at line 89 of file MkFitGeometryESProducer.cc.

Referenced by MkFitGeometryESProducer(), and produce().