CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions
GeometricDetLoader Class Reference

#include <GeometricDetLoader.h>

Inheritance diagram for GeometricDetLoader:
edm::one::EDAnalyzer< edm::one::WatchRuns > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (edm::Event const &iEvent, edm::EventSetup const &) override
 
void beginJob () override
 
void beginRun (edm::Run const &iEvent, edm::EventSetup const &) override
 
void endJob () override
 
void endRun (edm::Run const &iEvent, edm::EventSetup const &) override
 
 GeometricDetLoader (const edm::ParameterSet &iConfig)
 
 ~GeometricDetLoader () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns >
 EDAnalyzer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void putOne (const GeometricDet *gd, PGeometricDet *pgd, int lev)
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 14 of file GeometricDetLoader.h.

Constructor & Destructor Documentation

◆ GeometricDetLoader()

GeometricDetLoader::GeometricDetLoader ( const edm::ParameterSet iConfig)
explicit

Definition at line 26 of file GeometricDetLoader.cc.

26  {
27  std::cout << "GeometricDetLoader::GeometricDetLoader" << std::endl;
28 }

References gather_cfg::cout.

◆ ~GeometricDetLoader()

GeometricDetLoader::~GeometricDetLoader ( )
override

Definition at line 30 of file GeometricDetLoader.cc.

30 { std::cout << "GeometricDetLoader::~GeometricDetLoader" << std::endl; }

References gather_cfg::cout.

Member Function Documentation

◆ analyze()

void GeometricDetLoader::analyze ( edm::Event const &  iEvent,
edm::EventSetup const &   
)
inlineoverridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 21 of file GeometricDetLoader.h.

21 {}

◆ beginJob()

void GeometricDetLoader::beginJob ( void  )
inlineoverridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 19 of file GeometricDetLoader.h.

19 {}

◆ beginRun()

void GeometricDetLoader::beginRun ( edm::Run const &  iEvent,
edm::EventSetup const &  es 
)
override

Definition at line 32 of file GeometricDetLoader.cc.

32  {
33  std::cout << "GeometricDetLoader::beginJob" << std::endl;
34  PGeometricDet* pgd = new PGeometricDet;
36  if (!mydbservice.isAvailable()) {
37  std::cout << "PoolDBOutputService unavailable" << std::endl;
38  return;
39  }
42  es.get<IdealGeometryRecord>().get(pDD);
43  es.get<IdealGeometryRecord>().get(rDD);
44  const GeometricDet* tracker = &(*rDD);
45 
46  // so now I have the tracker itself. loop over all its components to store them.
47  putOne(tracker, pgd, 0);
48  std::vector<const GeometricDet*> tc = tracker->components();
49  std::cout << "Tracker has " << tc.size() << " components." << std::endl; //, lets go through them." << std::endl;
50  std::vector<const GeometricDet*>::const_iterator git = tc.begin();
51  std::vector<const GeometricDet*>::const_iterator egit = tc.end();
52  int count = 0;
53  int lev = 1;
54  for (; git != egit; ++git) { // one level below "tracker"
55  putOne(*git, pgd, lev);
56  std::vector<const GeometricDet*> inone = (*git)->components();
57  // << ctste.name((*git)->type())
58  // std::cout << lev << " type " << (*git)->type() << " " << int((*git)->geographicalId()) << std::endl; // << " has " << inone.size() << " components." << std::endl;
59  if (inone.empty())
60  ++count;
61  std::vector<const GeometricDet*>::const_iterator git2 = inone.begin();
62  std::vector<const GeometricDet*>::const_iterator egit2 = inone.end();
63  ++lev;
64  for (; git2 != egit2; ++git2) { // level 2
65  putOne(*git2, pgd, 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())
69  ++count;
70  std::vector<const GeometricDet*>::const_iterator git3 = intwo.begin();
71  std::vector<const GeometricDet*>::const_iterator egit3 = intwo.end();
72  ++lev;
73  for (; git3 != egit3; ++git3) { // level 3
74  putOne(*git3, pgd, 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())
78  ++count;
79  std::vector<const GeometricDet*>::const_iterator git4 = inthree.begin();
80  std::vector<const GeometricDet*>::const_iterator egit4 = inthree.end();
81  ++lev;
82  for (; git4 != egit4; ++git4) { //level 4
83  putOne(*git4, pgd, 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())
87  ++count;
88  std::vector<const GeometricDet*>::const_iterator git5 = infour.begin();
89  std::vector<const GeometricDet*>::const_iterator egit5 = infour.end();
90  ++lev;
91  for (; git5 != egit5; ++git5) { // level 5
92  putOne(*git5, pgd, 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())
96  ++count;
97  std::vector<const GeometricDet*>::const_iterator git6 = infive.begin();
98  std::vector<const GeometricDet*>::const_iterator egit6 = infive.end();
99  ++lev;
100  for (; git6 != egit6; ++git6) { //level 6
101  putOne(*git6, pgd, 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  } // level 6
107  --lev;
108  } // level 5
109  --lev;
110  } // level 4
111  --lev;
112  } //level 3
113  --lev;
114  } // level 2
115  --lev;
116  }
117  std::vector<const GeometricDet*> modules = tracker->deepComponents();
118  std::cout << " No. of Tracker components \"deepComponents\" = " << modules.size() << std::endl;
119  std::cout << " Counted # of lowest \"leaves\" = " << count << std::endl;
120  if (mydbservice->isNewTagRequest("PGeometricDetRcd")) {
121  mydbservice->createNewIOV<PGeometricDet>(
122  pgd, mydbservice->beginOfTime(), mydbservice->endOfTime(), "PGeometricDetRcd");
123  } else {
124  std::cout << "PGeometricDetRcd Tag is already present." << std::endl;
125  }
126 }

References cond::service::PoolDBOutputService::beginOfTime(), KineDebug3::count(), gather_cfg::cout, cond::service::PoolDBOutputService::createNewIOV(), cond::service::PoolDBOutputService::endOfTime(), edm::EventSetup::get(), get, edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), putOne(), and PbPb_ZMuSkimMuonDPG_cff::tracker.

◆ endJob()

void GeometricDetLoader::endJob ( void  )
inlineoverridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 23 of file GeometricDetLoader.h.

23 {}

◆ endRun()

void GeometricDetLoader::endRun ( edm::Run const &  iEvent,
edm::EventSetup const &   
)
inlineoverride

Definition at line 22 of file GeometricDetLoader.h.

22 {}

◆ putOne()

void GeometricDetLoader::putOne ( const GeometricDet gd,
PGeometricDet pgd,
int  lev 
)
private

Definition at line 128 of file GeometricDetLoader.cc.

128  {
129  // std::cout << "putting name: " << gd->name().name();
130  // std::cout << " gid: " << gd->geographicalID();
131  // std::cout << " type: " << gd->type() << std::endl;
132  // std::cout << "shape = " << gd->shape()<<"; name = "<<gd->name().name()<<"; parameter number = "<<gd->params().size()<<std::endl;
134  const DDTranslation& tran = gd->translation();
135  const DDRotationMatrix& rot = gd->rotation();
136  DD3Vector x, y, z;
137  rot.GetComponents(x, y, z);
138  item._name = gd->name();
139  item._level = lev;
140  item._x = tran.X();
141  item._y = tran.Y();
142  item._z = tran.Z();
143  item._phi = gd->phi();
144  item._rho = gd->rho();
145  item._a11 = x.X();
146  item._a12 = y.X();
147  item._a13 = z.X();
148  item._a21 = x.Y();
149  item._a22 = y.Y();
150  item._a23 = z.Y();
151  item._a31 = x.Z();
152  item._a32 = y.Z();
153  item._a33 = z.Z();
154  item._shape = static_cast<int>(gd->shape());
155  item._type = gd->type();
156  if (gd->shape() == DDSolidShape::ddbox) {
157  item._params0 = gd->params()[0];
158  item._params1 = gd->params()[1];
159  item._params2 = gd->params()[2];
160  item._params3 = 0;
161  item._params4 = 0;
162  item._params5 = 0;
163  item._params6 = 0;
164  item._params7 = 0;
165  item._params8 = 0;
166  item._params9 = 0;
167  item._params10 = 0;
168  } else if (gd->shape() == DDSolidShape::ddtrap) {
169  item._params0 = gd->params()[0];
170  item._params1 = gd->params()[1];
171  item._params2 = gd->params()[2];
172  item._params3 = gd->params()[3];
173  item._params4 = gd->params()[4];
174  item._params5 = gd->params()[5];
175  item._params6 = gd->params()[6];
176  item._params7 = gd->params()[7];
177  item._params8 = gd->params()[8];
178  item._params9 = gd->params()[9];
179  item._params10 = gd->params()[10];
180  } else {
181  item._params0 = 0;
182  item._params1 = 0;
183  item._params2 = 0;
184  item._params3 = 0;
185  item._params4 = 0;
186  item._params5 = 0;
187  item._params6 = 0;
188  item._params7 = 0;
189  item._params8 = 0;
190  item._params9 = 0;
191  item._params10 = 0;
192  }
193  item._geographicalID = gd->geographicalID();
194  // FIXME: These are moved to PGeometricDetExtra:
195  //item._volume = gd->volume();
196  //item._density = gd->density();
197  //item._weight = gd->weight();
198  //item._copy = gd->copyno();
199  //item._material = gd->material();
200  item._radLength = gd->radLength();
201  item._xi = gd->xi();
202  item._pixROCRows = gd->pixROCRows();
203  item._pixROCCols = gd->pixROCCols();
204  item._pixROCx = gd->pixROCx();
205  item._pixROCy = gd->pixROCy();
206  item._stereo = gd->stereo();
207  item._siliconAPVNum = gd->siliconAPVNum();
208  pgd->pgeomdets_.push_back(item);
209 }

References ddbox, ddtrap, GeometricDet::geographicalID(), B2GTnPMonitor_cfi::item, GeometricDet::name(), GeometricDet::params(), PGeometricDet::pgeomdets_, GeometricDet::phi(), GeometricDet::pixROCCols(), GeometricDet::pixROCRows(), GeometricDet::pixROCx(), GeometricDet::pixROCy(), GeometricDet::radLength(), GeometricDet::rho(), makeMuonMisalignmentScenario::rot, GeometricDet::rotation(), GeometricDet::shape(), GeometricDet::siliconAPVNum(), GeometricDet::stereo(), GeometricDet::translation(), GeometricDet::type(), x, GeometricDet::xi(), y, and z.

Referenced by beginRun().

GeometricDet::phi
double phi() const
Definition: GeometricDet.h:121
DDAxes::y
DDSolidShape::ddtrap
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition: PoolDBOutputService.cc:187
GeometricDet::type
GeometricEnumType type() const
Definition: GeometricDet.h:125
modules
Definition: ZHLTMatchFilter.cc:17
gather_cfg.cout
cout
Definition: gather_cfg.py:144
GeometricDetLoader::putOne
void putOne(const GeometricDet *gd, PGeometricDet *pgd, int lev)
Definition: GeometricDetLoader.cc:128
DDAxes::x
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
DDRotationMatrix
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
Definition: DDRotationMatrix.h:8
DD3Vector
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
Definition: DDTranslation.h:6
GeometricDet::rotation
RotationMatrix const & rotation() const
Definition: GeometricDet.h:119
GeometricDet::shape
DDSolidShape const & shape() const
Definition: GeometricDet.h:124
cond::service::PoolDBOutputService::createNewIOV
void createNewIOV(const T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t, const std::string &recordName)
Definition: PoolDBOutputService.h:110
DDTranslation
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDAxes::z
edm::ESHandle
Definition: DTSurvey.h:22
GeometricDet
Definition: GeometricDet.h:30
GeometricDet::radLength
double radLength() const
Definition: GeometricDet.h:171
PGeometricDet::Item
Definition: PGeometricDet.h:14
PbPb_ZMuSkimMuonDPG_cff.tracker
tracker
Definition: PbPb_ZMuSkimMuonDPG_cff.py:60
GeometricDet::stereo
bool stereo() const
Definition: GeometricDet.h:184
KineDebug3::count
void count()
Definition: KinematicConstrainedVertexUpdatorT.h:21
GeometricDet::pixROCRows
double pixROCRows() const
Definition: GeometricDet.h:176
GeometricDet::geographicalID
DetId geographicalID() const
Definition: GeometricDet.h:153
edm::Service< cond::service::PoolDBOutputService >
GeometricDet::pixROCx
double pixROCx() const
Definition: GeometricDet.h:178
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
get
#define get
GeometricDet::rho
double rho() const
Definition: GeometricDet.h:122
cond::service::PoolDBOutputService::endOfTime
cond::Time_t endOfTime() const
Definition: PoolDBOutputService.cc:185
DDSolidShape::ddbox
GeometricDet::params
std::vector< double > const & params() const
Definition: GeometricDet.h:131
GeometricDet::siliconAPVNum
double siliconAPVNum() const
Definition: GeometricDet.h:185
GeometricDet::pixROCCols
double pixROCCols() const
Definition: GeometricDet.h:177
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
GeometricDet::xi
double xi() const
Definition: GeometricDet.h:172
GeometricDet::pixROCy
double pixROCy() const
Definition: GeometricDet.h:179
cond::service::PoolDBOutputService::isNewTagRequest
bool isNewTagRequest(const std::string &recordName)
Definition: PoolDBOutputService.cc:100
GeometricDet::name
std::string const & name() const
Definition: GeometricDet.h:126
GeometricDet::translation
Translation const & translation() const
Definition: GeometricDet.h:120
PGeometricDet::pgeomdets_
std::vector< Item > pgeomdets_
Definition: PGeometricDet.h:50
PGeometricDet
Definition: PGeometricDet.h:9
IdealGeometryRecord
Definition: IdealGeometryRecord.h:27