CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
TrackerGeometricDetExtraESModule Class Reference
Inheritance diagram for TrackerGeometricDetExtraESModule:
edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Member Functions

std::unique_ptr< std::vector< GeometricDetExtra > > produce (const IdealGeometryRecord &)
 
 TrackerGeometricDetExtraESModule (const edm::ParameterSet &p)
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
ESProducer const & operator= (const ESProducer &)=delete
 
template<typename Record >
void updateFromMayConsumes (unsigned int iIndex, const Record &iRecord)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer ()(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
 ESProxyFactoryProducer (const ESProxyFactoryProducer &)=delete
 
const ESProxyFactoryProduceroperator= (const ESProxyFactoryProducer &)=delete
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
void createKeyedProxies (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
 DataProxyProvider ()
 
 DataProxyProvider (const DataProxyProvider &)=delete
 
const ComponentDescriptiondescription () const
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const DataProxyProvideroperator= (const DataProxyProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider () noexcept(false)
 

Static Public Member Functions

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

Private Member Functions

void putOne (std::vector< GeometricDetExtra > &gde, const GeometricDet *gd, const DDExpandedView &ev, int lev)
 

Private Attributes

edm::ESGetToken< cms::DDCompactView, IdealGeometryRecorddd4hepToken_
 
edm::ESGetToken< DDCompactView, IdealGeometryRecordddToken_
 
const bool fromDD4hep_
 
const bool fromDDD_
 
edm::ESGetToken< GeometricDet, IdealGeometryRecordgeometricDetToken_
 
edm::ESGetToken< PGeometricDetExtra, PGeometricDetExtraRcdpgToken_
 

Additional Inherited Members

- Protected Types inherited from edm::ESProxyFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::DataProxyProvider
using KeyedProxiesVector = std::vector< std::pair< DataKey, std::shared_ptr< DataProxy >>>
 
- Protected Member Functions inherited from edm::ESProducer
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 TArg >
ESConsumesCollectorT< TRecord > setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel={})
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
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::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedProxiesVector registerProxies (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &key)
 

Detailed Description

Definition at line 24 of file TrackerGeometricDetExtraESModule.cc.

Constructor & Destructor Documentation

TrackerGeometricDetExtraESModule::TrackerGeometricDetExtraESModule ( const edm::ParameterSet p)

Definition at line 45 of file TrackerGeometricDetExtraESModule.cc.

References HltBtagPostValidation_cff::c, dd4hepToken_, ddToken_, fromDD4hep_, fromDDD_, geometricDetToken_, pgToken_, and edm::ESProducer::setWhatProduced().

46  : fromDDD_(p.getParameter<bool>("fromDDD")), fromDD4hep_(p.getParameter<bool>("fromDD4hep")) {
47  auto c = setWhatProduced(this);
49  if (fromDDD_) {
50  ddToken_ = c.consumes<DDCompactView>(edm::ESInputTag());
51  } else if (fromDD4hep_) {
53  } else {
55  }
56 }
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:138
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
edm::ESGetToken< DDCompactView, IdealGeometryRecord > ddToken_
edm::ESGetToken< PGeometricDetExtra, PGeometricDetExtraRcd > pgToken_
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > dd4hepToken_
edm::ESGetToken< GeometricDet, IdealGeometryRecord > geometricDetToken_

Member Function Documentation

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

Definition at line 58 of file TrackerGeometricDetExtraESModule.cc.

References edm::ConfigurationDescriptions::add(), and edm::ParameterSetDescription::add().

58  {
60  descDB.add<bool>("fromDDD", false);
61  descDB.add<bool>("fromDD4hep", false);
62  descriptions.add("trackerNumberingExtraGeometryDB", descDB);
63 
65  desc.add<bool>("fromDDD", true);
66  desc.add<bool>("fromDD4hep", false);
67  descriptions.add("trackerNumberingExtraGeometry", desc);
68 
70  descDD4hep.add<bool>("fromDDD", false);
71  descDD4hep.add<bool>("fromDD4hep", true);
72  descriptions.add("DD4hep_trackerNumberingExtraGeometry", descDD4hep);
73 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::unique_ptr< std::vector< GeometricDetExtra > > TrackerGeometricDetExtraESModule::produce ( const IdealGeometryRecord iRecord)

Definition at line 75 of file TrackerGeometricDetExtraESModule.cc.

References GeometricDet::components(), KineDebug3::count(), dd4hepToken_, ddToken_, GeometricDet::deepComponents(), ev, fromDD4hep_, fromDDD_, geometricDetToken_, edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getTransientHandle(), DDExpandedView::goTo(), GeometricDet::name(), GeometricDet::navType(), PGeometricDetExtra::pgdes_, pgToken_, GeometricDet::pixROCCols(), GeometricDet::pixROCRows(), GeometricDet::pixROCx(), GeometricDet::pixROCy(), putOne(), GeometricDet::radLength(), GeometricDet::siliconAPVNum(), GeometricDet::stereo(), AlCaHLTBitMon_QueryRunRegistry::string, PbPb_ZMuSkimMuonDPG_cff::tracker, and GeometricDet::xi().

76  {
77  auto gde = std::make_unique<std::vector<GeometricDetExtra> >();
78  // get the GeometricDet which has a nav_type
79  GeometricDet const& gd = iRecord.get(geometricDetToken_);
80  if (fromDDD_) {
81  // traverse all components from the tracker down;
82  // read the DD if from DD
83  const GeometricDet* tracker = &(gd);
85  DDExpandedView ev(*cpv);
86  ev.goTo(tracker->navType());
87  putOne((*gde), tracker, ev, 0);
88  std::vector<const GeometricDet*> tc = tracker->components();
89  std::vector<const GeometricDet*>::const_iterator git = tc.begin();
90  std::vector<const GeometricDet*>::const_iterator egit = tc.end();
91  int count = 0;
92  int lev = 1;
93  // CmsTrackerStringToEnum ctst
94  gde->reserve(tracker->deepComponents().size());
95  for (; git != egit; ++git) { // one level below "tracker"
96  ev.goTo((*git)->navType());
97  putOne((*gde), *git, ev, lev);
98  std::vector<const GeometricDet*> inone = (*git)->components();
99  // std::cout << lev << " type " << (*git)->type() << " " << int((*git)->geographicalId()) << std::endl; // << " has " << inone.size() << " components." << std::endl;
100  if (inone.empty())
101  ++count;
102  std::vector<const GeometricDet*>::const_iterator git2 = inone.begin();
103  std::vector<const GeometricDet*>::const_iterator egit2 = inone.end();
104  ++lev;
105  for (; git2 != egit2; ++git2) { // level 2
106  ev.goTo((*git2)->navType());
107  putOne((*gde), *git2, ev, lev);
108  std::vector<const GeometricDet*> intwo = (*git2)->components();
109  // std::cout << lev << "\ttype " << (*git2)->type() << " " << int((*git2)->geographicalId()) << std::endl; // << " has " << intwo.size() << " components." << std::endl;
110  if (intwo.empty())
111  ++count;
112  std::vector<const GeometricDet*>::const_iterator git3 = intwo.begin();
113  std::vector<const GeometricDet*>::const_iterator egit3 = intwo.end();
114  ++lev;
115  for (; git3 != egit3; ++git3) { // level 3
116  ev.goTo((*git3)->navType());
117  putOne((*gde), *git3, ev, lev);
118  std::vector<const GeometricDet*> inthree = (*git3)->components();
119  //std::cout << lev << "\t\ttype " << (*git3)->type() << " " << int((*git3)->geographicalId()) << std::endl; // << " has " << inthree.size() << " components." << std::endl;
120  if (inthree.empty())
121  ++count;
122  std::vector<const GeometricDet*>::const_iterator git4 = inthree.begin();
123  std::vector<const GeometricDet*>::const_iterator egit4 = inthree.end();
124  ++lev;
125  for (; git4 != egit4; ++git4) { //level 4
126  ev.goTo((*git4)->navType());
127  putOne((*gde), *git4, ev, lev);
128  std::vector<const GeometricDet*> infour = (*git4)->components();
129  // std::cout << lev << "\t\t\ttype " << (*git4)->type() << " " << int((*git4)->geographicalId()) << std::endl; // << " has " << infour.size() << " components." << std::endl;
130  if (infour.empty())
131  ++count;
132  std::vector<const GeometricDet*>::const_iterator git5 = infour.begin();
133  std::vector<const GeometricDet*>::const_iterator egit5 = infour.end();
134  ++lev;
135  for (; git5 != egit5; ++git5) { // level 5
136  ev.goTo((*git5)->navType());
137  putOne((*gde), *git5, ev, lev);
138  std::vector<const GeometricDet*> infive = (*git5)->components();
139  // std::cout << lev << "\t\t\t\ttype " << (*git5)->type() << " " << int((*git5)->geographicalId()) << std::endl; // << " has " << infive.size() << " components." << std::endl;
140  if (infive.empty())
141  ++count;
142  std::vector<const GeometricDet*>::const_iterator git6 = infive.begin();
143  std::vector<const GeometricDet*>::const_iterator egit6 = infive.end();
144  ++lev;
145  for (; git6 != egit6; ++git6) { //level 6
146  ev.goTo((*git6)->navType());
147  putOne((*gde), *git6, ev, lev);
148  std::vector<const GeometricDet*> insix = (*git6)->components();
149  // std::cout << lev << "\t\t\t\t\ttype " << (*git6)->type() << " " << int((*git6)->geographicalId()) << std::endl; // << " has " << insix.size() << " components." << std::endl;
150  if (insix.empty()) {
151  ++count;
152  } else {
153  edm::LogError("GeometricDetExtra") << "Hierarchy has exceeded hard-coded level 6 for Tracker ";
154  }
155  } // level 6
156  --lev;
157  } // level 5
158  --lev;
159  } // level 4
160  --lev;
161  } //level 3
162  --lev;
163  } // level 2
164  --lev;
165  }
166  } else if (fromDD4hep_) {
167  // FIXME:
168  // traverse all components from the tracker down;
169  // read the DD if from DD
170  const GeometricDet* tracker = &(gd);
172  edm::LogInfo("GeometricDetExtra") << " Top node is " << tracker << " " << tracker->name() << std::endl;
173  edm::LogInfo("GeometricDetExtra") << " radLength " << tracker->radLength() << "\n"
174  << " xi " << tracker->xi() << "\n"
175  << " PixelROCRows " << tracker->pixROCRows() << "\n"
176  << " PixROCCols " << tracker->pixROCCols() << "\n"
177  << " PixelROC_X " << tracker->pixROCx() << "\n"
178  << " PixelROC_Y " << tracker->pixROCy() << "\n"
179  << "TrackerStereoDetectors " << (tracker->stereo() ? "true" : "false") << "\n"
180  << "SiliconAPVNumber " << tracker->siliconAPVNum() << "\n";
181  } else {
182  // if it is not from the DD, then just get the GDE from ES and match w/ GD.
183  PGeometricDetExtra const& pgde = iRecord.getRecord<PGeometricDetExtraRcd>().get(pgToken_);
184  std::map<uint32_t, const GeometricDet*> helperMap;
185  const GeometricDet* tracker = &gd;
186  helperMap[gd.geographicalID()] = tracker;
187  std::vector<const GeometricDet*> tc = tracker->components();
188  std::vector<const GeometricDet*>::const_iterator git = tc.begin();
189  std::vector<const GeometricDet*>::const_iterator egit = tc.end();
190  for (; git != egit; ++git) { // one level below "tracker"
191  helperMap[(*git)->geographicalID()] = (*git);
192  std::vector<const GeometricDet*> inone = (*git)->components();
193  std::vector<const GeometricDet*>::const_iterator git2 = inone.begin();
194  std::vector<const GeometricDet*>::const_iterator egit2 = inone.end();
195  for (; git2 != egit2; ++git2) { // level 2
196  helperMap[(*git2)->geographicalID()] = (*git2);
197  std::vector<const GeometricDet*> intwo = (*git2)->components();
198  std::vector<const GeometricDet*>::const_iterator git3 = intwo.begin();
199  std::vector<const GeometricDet*>::const_iterator egit3 = intwo.end();
200  for (; git3 != egit3; ++git3) { // level 3
201  helperMap[(*git3)->geographicalID()] = (*git3);
202  std::vector<const GeometricDet*> inthree = (*git3)->components();
203  std::vector<const GeometricDet*>::const_iterator git4 = inthree.begin();
204  std::vector<const GeometricDet*>::const_iterator egit4 = inthree.end();
205  for (; git4 != egit4; ++git4) { //level 4
206  helperMap[(*git4)->geographicalID()] = (*git4);
207  std::vector<const GeometricDet*> infour = (*git4)->components();
208  std::vector<const GeometricDet*>::const_iterator git5 = infour.begin();
209  std::vector<const GeometricDet*>::const_iterator egit5 = infour.end();
210  for (; git5 != egit5; ++git5) { // level 5
211  helperMap[(*git5)->geographicalID()] = (*git5);
212  std::vector<const GeometricDet*> infive = (*git5)->components();
213  std::vector<const GeometricDet*>::const_iterator git6 = infive.begin();
214  std::vector<const GeometricDet*>::const_iterator egit6 = infive.end();
215  for (; git6 != egit6; ++git6) { //level 6
216  helperMap[(*git6)->geographicalID()] = (*git6);
217  if (!(*git6)->components().empty()) {
218  edm::LogError("GeometricDetExtra") << "Hierarchy has exceeded hard-coded level of 6 for Tracker ";
219  }
220  } // level 6
221  } // level 5
222  } // level 4
223  } //level 3
224  } // level 2
225  }
226 
227  const std::vector<PGeometricDetExtra::Item>& pgdes = pgde.pgdes_;
228  gde->reserve(pgdes.size());
229  std::vector<DDExpandedNode> evs; //EMPTY
230  std::string nm; //EMPTY
231  for (const auto& pgde : pgdes) {
232  // GeometricDetExtra( GeometricDet const *gd, DetId id, GeoHistory& gh, double vol, double dens, double wgt, double cpy, const std::string& mat, const std::string& name, bool dd=false );
233  gde->emplace_back(GeometricDetExtra(helperMap[pgde._geographicalId],
234  pgde._geographicalId,
235  evs,
236  pgde._volume,
237  pgde._density,
238  pgde._weight,
239  pgde._copy,
240  pgde._material,
241  nm));
242  }
243  }
244  return gde;
245 }
double pixROCy() const
Definition: GeometricDet.h:179
double radLength() const
Definition: GeometricDet.h:171
void putOne(std::vector< GeometricDetExtra > &gde, const GeometricDet *gd, const DDExpandedView &ev, int lev)
nav_type const & navType() const
Definition: GeometricDet.h:129
std::vector< Item > pgdes_
ESTransientHandle< ProductT > getTransientHandle(ESGetToken< ProductT, DepRecordT > const &iToken) const
bool ev
edm::ESGetToken< DDCompactView, IdealGeometryRecord > ddToken_
ConstGeometricDetContainer & components()
Definition: GeometricDet.h:139
std::string const & name() const
Definition: GeometricDet.h:126
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
double pixROCCols() const
Definition: GeometricDet.h:177
double xi() const
Definition: GeometricDet.h:172
double pixROCx() const
Definition: GeometricDet.h:178
edm::ESGetToken< PGeometricDetExtra, PGeometricDetExtraRcd > pgToken_
ConstGeometricDetContainer deepComponents() const
double siliconAPVNum() const
Definition: GeometricDet.h:185
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > dd4hepToken_
bool stereo() const
Definition: GeometricDet.h:184
double pixROCRows() const
Definition: GeometricDet.h:176
Provides an exploded view of the detector (tree-view)
edm::ESGetToken< GeometricDet, IdealGeometryRecord > geometricDetToken_
void TrackerGeometricDetExtraESModule::putOne ( std::vector< GeometricDetExtra > &  gde,
const GeometricDet gd,
const DDExpandedView ev,
int  lev 
)
private

Definition at line 247 of file TrackerGeometricDetExtraESModule.cc.

References DDExpandedView::copyno(), DEFINE_FWK_EVENTSETUP_MODULE, fastSimProducer_cff::density, GeometricDet::geographicalId(), DDExpandedView::geoHistory(), DDExpandedView::logicalPart(), Skims_PA_cff::name, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by produce().

250  {
251  std::string matname = ((ev.logicalPart()).material()).name().fullname();
252  std::string lpname = ((ev.logicalPart()).name().fullname());
253  std::vector<DDExpandedNode> evs = GeometricDetExtra::GeoHistory(ev.geoHistory().begin(), ev.geoHistory().end());
254  gde.emplace_back(
256  gd->geographicalId(),
257  evs,
258  ((ev.logicalPart()).solid()).volume(),
259  ((ev.logicalPart()).material()).density(),
260  ((ev.logicalPart()).material()).density() * (((ev.logicalPart()).solid()).volume() / 1000.),
261  ev.copyno(),
262  matname,
263  lpname,
264  true));
265 }
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
int copyno() const
Copy number associated with the current node.
DetId geographicalId() const
Definition: GeometricDet.h:154
std::vector< DDExpandedNode > GeoHistory
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the expanded-view.

Member Data Documentation

edm::ESGetToken<cms::DDCompactView, IdealGeometryRecord> TrackerGeometricDetExtraESModule::dd4hepToken_
private
edm::ESGetToken<DDCompactView, IdealGeometryRecord> TrackerGeometricDetExtraESModule::ddToken_
private
const bool TrackerGeometricDetExtraESModule::fromDD4hep_
private
const bool TrackerGeometricDetExtraESModule::fromDDD_
private
edm::ESGetToken<GeometricDet, IdealGeometryRecord> TrackerGeometricDetExtraESModule::geometricDetToken_
private
edm::ESGetToken<PGeometricDetExtra, PGeometricDetExtraRcd> TrackerGeometricDetExtraESModule::pgToken_
private