CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
TrackerGeometricDetExtraESModule Class Reference

#include <TrackerGeometricDetExtraESModule.h>

Inheritance diagram for TrackerGeometricDetExtraESModule:
edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Member Functions

std::shared_ptr< std::vector< GeometricDetExtra > > produce (const IdealGeometryRecord &)
 
 TrackerGeometricDetExtraESModule (const edm::ParameterSet &p)
 
 ~TrackerGeometricDetExtraESModule () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ~ESProducer ()(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval) override
 overrides DataProxyProvider method More...
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
 DataProxyProvider ()
 
const ComponentDescriptiondescription () const
 
bool isUsingRecord (const EventSetupRecordKey &) const
 
const KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey) const
 
void resetProxies (const EventSetupRecordKey &iRecordType)
 
void resetProxiesIfTransient (const EventSetupRecordKey &iRecordType)
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider () noexcept(false)
 

Private Member Functions

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

Private Attributes

bool fromDDD_
 

Additional Inherited Members

- Public Types inherited from edm::eventsetup::DataProxyProvider
typedef std::vector< std::pair< DataKey, edm::propagate_const< std::shared_ptr< DataProxy > > > > KeyedProxies
 
typedef std::vector< EventSetupRecordKeyKeys
 
typedef std::map< EventSetupRecordKey, KeyedProxiesRecordProxies
 
- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::ESProducer
 ESProducer (const ESProducer &)=delete
 
ESProducer const & operator= (const ESProducer &)=delete
 
template<typename T >
void setWhatProduced (T *iThis, const es::Label &iLabel=es::Label())
 
template<typename T >
void setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
void setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
void setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel=es::Label())
 
- 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 eventsetup::EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList) override
 override DataProxyProvider method More...
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
void eraseAll (const EventSetupRecordKey &iRecordKey)
 deletes all the Proxies in aStream More...
 
void invalidateProxies (const EventSetupRecordKey &iRecordKey)
 
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &)
 

Detailed Description

Definition at line 10 of file TrackerGeometricDetExtraESModule.h.

Constructor & Destructor Documentation

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

Definition at line 24 of file TrackerGeometricDetExtraESModule.cc.

References edm::ESProducer::setWhatProduced().

25  : fromDDD_(p.getParameter<bool>("fromDDD"))
26 {
27  setWhatProduced(this);
28 }
T getParameter(std::string const &) const
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
TrackerGeometricDetExtraESModule::~TrackerGeometricDetExtraESModule ( )
override

Definition at line 30 of file TrackerGeometricDetExtraESModule.cc.

30 {}

Member Function Documentation

std::shared_ptr< std::vector< GeometricDetExtra > > TrackerGeometricDetExtraESModule::produce ( const IdealGeometryRecord iRecord)

Definition at line 33 of file TrackerGeometricDetExtraESModule.cc.

References GeometricDet::components(), KineDebug3::count(), GeometricDet::deepComponents(), ev, fromDDD_, edm::eventsetup::EventSetupRecord::get(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), DDExpandedView::goTo(), GeometricDet::navType(), PGeometricDetExtra::pgdes_, putOne(), AlCaHLTBitMon_QueryRunRegistry::string, and trackingTruthProducer_cfi::tracker.

33  {
34  auto gde = std::make_shared<std::vector<GeometricDetExtra> >();
35  // get the GeometricDet which has a nav_type
37  iRecord.get ( gd );
38  if (fromDDD_) {
39  // traverse all components from the tracker down;
40  // read the DD if from DD
41  const GeometricDet* tracker = &(*gd);
43  iRecord.get( cpv );
44  DDExpandedView ev(*cpv);
45  ev.goTo(tracker->navType());
46  putOne((*gde), tracker, ev, 0);
47  std::vector<const GeometricDet*> tc = tracker->components();
48  std::vector<const GeometricDet*>::const_iterator git = tc.begin();
49  std::vector<const GeometricDet*>::const_iterator egit = tc.end();
50  int count=0;
51  int lev = 1;
52  // CmsTrackerStringToEnum ctst
53  gde->reserve(tracker->deepComponents().size());
54  for (; git!= egit; ++git) { // one level below "tracker"
55  ev.goTo((*git)->navType());
56  putOne((*gde), *git, ev, lev);
57  std::vector<const GeometricDet*> inone = (*git)->components();
58  // std::cout << lev << " type " << (*git)->type() << " " << int((*git)->geographicalId()) << std::endl; // << " has " << inone.size() << " components." << std::endl;
59  if ( inone.empty() ) ++count;
60  std::vector<const GeometricDet*>::const_iterator git2 = inone.begin();
61  std::vector<const GeometricDet*>::const_iterator egit2 = inone.end();
62  ++lev;
63  for (; git2 != egit2; ++git2) { // level 2
64  ev.goTo((*git2)->navType());
65  putOne((*gde), *git2, ev, lev);
66  std::vector<const GeometricDet*> intwo= (*git2)->components();
67  // std::cout << lev << "\ttype " << (*git2)->type() << " " << int((*git2)->geographicalId()) << std::endl; // << " has " << intwo.size() << " components." << std::endl;
68  if ( intwo.empty() ) ++count;
69  std::vector<const GeometricDet*>::const_iterator git3 = intwo.begin();
70  std::vector<const GeometricDet*>::const_iterator egit3 = intwo.end();
71  ++lev;
72  for (; git3 != egit3; ++git3) { // level 3
73  ev.goTo((*git3)->navType());
74  putOne((*gde), *git3, ev, lev);
75  std::vector<const GeometricDet*> inthree= (*git3)->components();
76  //std::cout << lev << "\t\ttype " << (*git3)->type() << " " << int((*git3)->geographicalId()) << std::endl; // << " has " << inthree.size() << " components." << std::endl;
77  if ( inthree.empty() ) ++count;
78  std::vector<const GeometricDet*>::const_iterator git4 = inthree.begin();
79  std::vector<const GeometricDet*>::const_iterator egit4 = inthree.end();
80  ++lev;
81  for (; git4 != egit4; ++git4) { //level 4
82  ev.goTo((*git4)->navType());
83  putOne((*gde), *git4, ev, lev);
84  std::vector<const GeometricDet*> infour= (*git4)->components();
85  // std::cout << lev << "\t\t\ttype " << (*git4)->type() << " " << int((*git4)->geographicalId()) << std::endl; // << " has " << infour.size() << " components." << std::endl;
86  if ( infour.empty() ) ++count;
87  std::vector<const GeometricDet*>::const_iterator git5 = infour.begin();
88  std::vector<const GeometricDet*>::const_iterator egit5 = infour.end();
89  ++lev;
90  for (; git5 != egit5; ++git5) { // level 5
91  ev.goTo((*git5)->navType());
92  putOne((*gde), *git5, ev, lev);
93  std::vector<const GeometricDet*> infive= (*git5)->components();
94  // std::cout << lev << "\t\t\t\ttype " << (*git5)->type() << " " << int((*git5)->geographicalId()) << std::endl; // << " has " << infive.size() << " components." << std::endl;
95  if ( infive.empty() ) ++count;
96  std::vector<const GeometricDet*>::const_iterator git6 = infive.begin();
97  std::vector<const GeometricDet*>::const_iterator egit6 = infive.end();
98  ++lev;
99  for (; git6 != egit6; ++git6) { //level 6
100  ev.goTo((*git6)->navType());
101  putOne((*gde), *git6, ev, lev);
102  std::vector<const GeometricDet*> insix= (*git6)->components();
103  // std::cout << lev << "\t\t\t\t\ttype " << (*git6)->type() << " " << int((*git6)->geographicalId()) << std::endl; // << " has " << insix.size() << " components." << std::endl;
104  if ( insix.empty() ){
105  ++count;
106  } else {
107  edm::LogError("GeometricDetExtra") << "Hierarchy has exceeded hard-coded level 6 for Tracker " ;
108  }
109  } // level 6
110  --lev;
111  } // level 5
112  --lev;
113  } // level 4
114  --lev;
115  } //level 3
116  --lev;
117  } // level 2
118  --lev;
119  }
120  }else{
121  // if it is not from the DD, then just get the GDE from ES and match w/ GD.
123  iRecord.getRecord<PGeometricDetExtraRcd>().get(pgde);
124  std::map<uint32_t, const GeometricDet*> helperMap;
125  const GeometricDet* tracker = &(*gd);
126  helperMap[gd->geographicalID()] = tracker;
127  std::vector<const GeometricDet*> tc = tracker->components();
128  std::vector<const GeometricDet*>::const_iterator git = tc.begin();
129  std::vector<const GeometricDet*>::const_iterator egit = tc.end();
130  for (; git!= egit; ++git) { // one level below "tracker"
131  helperMap[(*git)->geographicalID()] = (*git);
132  std::vector<const GeometricDet*> inone = (*git)->components();
133  std::vector<const GeometricDet*>::const_iterator git2 = inone.begin();
134  std::vector<const GeometricDet*>::const_iterator egit2 = inone.end();
135  for (; git2 != egit2; ++git2) { // level 2
136  helperMap[(*git2)->geographicalID()] = (*git2);
137  std::vector<const GeometricDet*> intwo= (*git2)->components();
138  std::vector<const GeometricDet*>::const_iterator git3 = intwo.begin();
139  std::vector<const GeometricDet*>::const_iterator egit3 = intwo.end();
140  for (; git3 != egit3; ++git3) { // level 3
141  helperMap[(*git3)->geographicalID()] = (*git3);
142  std::vector<const GeometricDet*> inthree= (*git3)->components();
143  std::vector<const GeometricDet*>::const_iterator git4 = inthree.begin();
144  std::vector<const GeometricDet*>::const_iterator egit4 = inthree.end();
145  for (; git4 != egit4; ++git4) { //level 4
146  helperMap[(*git4)->geographicalID()] = (*git4);
147  std::vector<const GeometricDet*> infour= (*git4)->components();
148  std::vector<const GeometricDet*>::const_iterator git5 = infour.begin();
149  std::vector<const GeometricDet*>::const_iterator egit5 = infour.end();
150  for (; git5 != egit5; ++git5) { // level 5
151  helperMap[(*git5)->geographicalID()] = (*git5);
152  std::vector<const GeometricDet*> infive= (*git5)->components();
153  std::vector<const GeometricDet*>::const_iterator git6 = infive.begin();
154  std::vector<const GeometricDet*>::const_iterator egit6 = infive.end();
155  for (; git6 != egit6; ++git6) { //level 6
156  helperMap[(*git6)->geographicalID()] = (*git6);
157  if ( !(*git6)->components().empty() ){
158  edm::LogError("GeometricDetExtra") << "Hierarchy has exceeded hard-coded level of 6 for Tracker " ;
159  }
160  } // level 6
161  } // level 5
162  } // level 4
163  } //level 3
164  } // level 2
165  }
166 
167  const std::vector<PGeometricDetExtra::Item>& pgdes = pgde->pgdes_;
168  gde->reserve(pgdes.size());
169  std::vector<DDExpandedNode> evs; //EMPTY
170  std::string nm; //EMPTY
171  for (const auto & pgde : pgdes) {
172  // 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 );
173  gde->emplace_back( GeometricDetExtra(helperMap[pgde._geographicalId], pgde._geographicalId, evs
174  , pgde._volume, pgde._density, pgde._weight, pgde._copy
175  , pgde._material, nm));
176  }
177  }
178  return std::shared_ptr<std::vector<GeometricDetExtra> >(gde);
179 }
void putOne(std::vector< GeometricDetExtra > &gde, const GeometricDet *gd, const DDExpandedView &ev, int lev)
nav_type const & navType() const
Definition: GeometricDet.h:151
std::vector< Item > pgdes_
bool ev
ConstGeometricDetContainer & components()
Definition: GeometricDet.h:176
void get(HolderT &iHolder) const
ConstGeometricDetContainer deepComponents() const
Provides an exploded view of the detector (tree-view)
void TrackerGeometricDetExtraESModule::putOne ( std::vector< GeometricDetExtra > &  gde,
const GeometricDet gd,
const DDExpandedView ev,
int  lev 
)
private

Definition at line 181 of file TrackerGeometricDetExtraESModule.cc.

References DDExpandedView::copyno(), DEFINE_FWK_EVENTSETUP_MODULE, GeometricDet::geographicalId(), DDExpandedView::geoHistory(), DDExpandedView::logicalPart(), dataset::name, AlCaHLTBitMon_QueryRunRegistry::string, and funct::true.

Referenced by produce().

181  {
182  std::string matname = ((ev.logicalPart()).material()).name().fullname();
183  std::string lpname = ((ev.logicalPart()).name().fullname());
184  std::vector<DDExpandedNode> evs = GeometricDetExtra::GeoHistory(ev.geoHistory().begin(),ev.geoHistory().end());
185  gde.emplace_back(GeometricDetExtra( gd, gd->geographicalId(), evs,
186  ((ev.logicalPart()).solid()).volume(), ((ev.logicalPart()).material()).density(),
187  ((ev.logicalPart()).material()).density() * ( ((ev.logicalPart()).solid()).volume() / 1000.),
188  ev.copyno(), matname, lpname, true ));
189 }
std::vector< DDExpandedNode > GeoHistory
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:212
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the expanded-view.

Member Data Documentation

bool TrackerGeometricDetExtraESModule::fromDDD_
private

Definition at line 22 of file TrackerGeometricDetExtraESModule.h.

Referenced by produce().