CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SiStripHashedDetIdESModule.cc
Go to the documentation of this file.
9 
10 using namespace sistrip;
11 
18 public:
20  ~SiStripHashedDetIdESModule() override;
21 
23  std::unique_ptr<SiStripHashedDetId> produce(const SiStripHashedDetIdRcd&);
24 
25 private:
27 };
28 
29 // -----------------------------------------------------------------------------
30 //
32  : geomToken_(setWhatProduced(this, &SiStripHashedDetIdESModule::produce).consumes()) {
33  edm::LogVerbatim("HashedDetId") << "[SiStripHashedDetIdESSourceFromGeom::" << __func__ << "]"
34  << " Constructing object...";
35 }
36 
37 // -----------------------------------------------------------------------------
38 //
40  edm::LogVerbatim("HashedDetId") << "[SiStripHashedDetIdESSourceFromGeom::" << __func__ << "]"
41  << " Destructing object...";
42 }
43 
44 // -----------------------------------------------------------------------------
45 //
46 std::unique_ptr<SiStripHashedDetId> SiStripHashedDetIdESModule::produce(const SiStripHashedDetIdRcd& rcd) {
47  edm::LogVerbatim("HashedDetId") << "[SiStripHashedDetIdFakeESSource::" << __func__ << "]"
48  << " Building \"fake\" hashed DetId map from geometry";
49 
50  const auto& geom = rcd.get(geomToken_);
51 
52  std::vector<uint32_t> dets;
53  dets.reserve(16000);
54 
55  for (const auto& iter : geom.detUnits()) {
56  const auto strip = dynamic_cast<StripGeomDetUnit const*>(iter);
57  if (strip) {
58  dets.push_back((strip->geographicalId()).rawId());
59  }
60  }
61  edm::LogVerbatim(mlDqmCommon_) << "[SiStripHashedDetIdESModule::" << __func__ << "]"
62  << " Retrieved " << dets.size() << " sistrip DetIds from geometry!";
63 
64  // Create hash map object
65  auto hash = std::make_unique<SiStripHashedDetId>(dets);
66  LogTrace(mlDqmCommon_) << "[SiStripHashedDetIdESModule::" << __func__ << "]"
67  << " DetId hash map: " << std::endl
68  << *hash;
69 
70  return hash;
71 }
72 
Log< level::Info, true > LogVerbatim
std::unique_ptr< SiStripHashedDetId > produce(const SiStripHashedDetIdRcd &)
Builds hashed DetId map based on DetIds read from geometry database.
#define LogTrace(id)
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
static const char mlDqmCommon_[]
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
SiStripHashedDetIdESModule(const edm::ParameterSet &)
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_