CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

boost::shared_ptr< std::vector
< GeometricDetExtra > > 
produce (const IdealGeometryRecord &)
 
 TrackerGeometricDetExtraESModule (const edm::ParameterSet &p)
 
virtual ~TrackerGeometricDetExtraESModule ()
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
virtual ~ESProducer ()
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
virtual void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval)
 overrides DataProxyProvider method More...
 
virtual ~ESProxyFactoryProducer ()
 
- 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 ()
 

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, boost::shared_ptr
< DataProxy > > > 
KeyedProxies
 
typedef std::vector
< EventSetupRecordKey
Keys
 
typedef std::map
< EventSetupRecordKey,
KeyedProxies
RecordProxies
 
- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::ESProducer
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::auto_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const eventsetup::EventSetupRecordKey &iRecord, std::auto_ptr< eventsetup::ProxyFactoryBase > &iFactory, const std::string &iLabel=std::string())
 
virtual void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList)
 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 ( )
virtual

Definition at line 30 of file TrackerGeometricDetExtraESModule.cc.

30 {}

Member Function Documentation

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

Definition at line 33 of file TrackerGeometricDetExtraESModule.cc.

References GeometricDet::components(), prof2calltree::count, GeometricDet::deepComponents(), fromDDD_, edm::eventsetup::EventSetupRecord::get(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), DDExpandedView::goTo(), i, GeometricDet::navType(), putOne(), and patCandidatesForDimuonsSequences_cff::tracker.

33  {
34  boost::shared_ptr<std::vector<GeometricDetExtra> > gde (new 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.size() == 0 ) ++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.size() == 0 ) ++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.size() == 0 ) ++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.size() == 0 ) ++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.size() == 0 ) ++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.size() == 0 ){
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().size() != 0 ){
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 (unsigned int i = 0; i < pgdes.size(); ++i) {
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->push_back( GeometricDetExtra(helperMap[pgdes[i]._geographicalId], pgdes[i]._geographicalId, evs
174  , pgdes[i]._volume, pgdes[i]._density, pgdes[i]._weight, pgdes[i]._copy
175  , pgdes[i]._material, nm));
176  }
177  }
178  return boost::shared_ptr<std::vector<GeometricDetExtra> >(gde);
179 }
int i
Definition: DBlmapReader.cc:9
void putOne(std::vector< GeometricDetExtra > &gde, const GeometricDet *gd, const DDExpandedView &ev, int lev)
nav_type const & navType() const
Definition: GeometricDet.h:138
void get(HolderT &iHolder) const
ConstGeometricDetContainer deepComponents() const
GeometricDetContainer & components()
Definition: GeometricDet.h:163
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(), GeometricDet::geographicalId(), DDExpandedView::geoHistory(), DDExpandedView::logicalPart(), mergeVDriftHistosByStation::name, 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.push_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:199
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().