CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
PGeometricDetBuilder Class Reference
Inheritance diagram for PGeometricDetBuilder:
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 beginRun (edm::Run const &iEvent, edm::EventSetup const &) override
 
void endRun (edm::Run const &iEvent, edm::EventSetup const &) override
 
 PGeometricDetBuilder (const edm::ParameterSet &)
 
- 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
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () 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
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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)
 

Private Attributes

bool fromDD4hep_
 

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 = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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 23 of file PGeometricDetBuilder.cc.

Constructor & Destructor Documentation

◆ PGeometricDetBuilder()

PGeometricDetBuilder::PGeometricDetBuilder ( const edm::ParameterSet iConfig)

Definition at line 36 of file PGeometricDetBuilder.cc.

36  {
37  fromDD4hep_ = iConfig.getParameter<bool>("fromDD4hep");
38 }

References fromDD4hep_, and edm::ParameterSet::getParameter().

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 28 of file PGeometricDetBuilder.cc.

28 {}

◆ beginRun()

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

Definition at line 40 of file PGeometricDetBuilder.cc.

40  {
41  PGeometricDet* pgd = new PGeometricDet;
43  if (!mydbservice.isAvailable()) {
44  edm::LogError("PGeometricDetBuilder") << "PoolDBOutputService unavailable";
45  return;
46  }
47  if (!fromDD4hep_) {
49  es.get<IdealGeometryRecord>().get(pDD);
50  } else {
52  es.get<IdealGeometryRecord>().get(pDD);
53  }
55  es.get<IdealGeometryRecord>().get(rDD);
56  const GeometricDet* tracker = &(*rDD);
57 
58  // so now I have the tracker itself. loop over all its components to store them.
59  putOne(tracker, pgd, 0);
60  std::vector<const GeometricDet*> tc = tracker->components();
61  std::vector<const GeometricDet*>::const_iterator git = tc.begin();
62  std::vector<const GeometricDet*>::const_iterator egit = tc.end();
63  int count = 0;
64  int lev = 1;
65  for (; git != egit; ++git) { // one level below "tracker"
66  putOne(*git, pgd, lev);
67  std::vector<const GeometricDet*> inone = (*git)->components();
68  if (inone.empty())
69  ++count;
70  std::vector<const GeometricDet*>::const_iterator git2 = inone.begin();
71  std::vector<const GeometricDet*>::const_iterator egit2 = inone.end();
72  ++lev;
73  for (; git2 != egit2; ++git2) { // level 2
74  putOne(*git2, pgd, lev);
75  std::vector<const GeometricDet*> intwo = (*git2)->components();
76  if (intwo.empty())
77  ++count;
78  std::vector<const GeometricDet*>::const_iterator git3 = intwo.begin();
79  std::vector<const GeometricDet*>::const_iterator egit3 = intwo.end();
80  ++lev;
81  for (; git3 != egit3; ++git3) { // level 3
82  putOne(*git3, pgd, lev);
83  std::vector<const GeometricDet*> inthree = (*git3)->components();
84  if (inthree.empty())
85  ++count;
86  std::vector<const GeometricDet*>::const_iterator git4 = inthree.begin();
87  std::vector<const GeometricDet*>::const_iterator egit4 = inthree.end();
88  ++lev;
89  for (; git4 != egit4; ++git4) { //level 4
90  putOne(*git4, pgd, lev);
91  std::vector<const GeometricDet*> infour = (*git4)->components();
92  if (infour.empty())
93  ++count;
94  std::vector<const GeometricDet*>::const_iterator git5 = infour.begin();
95  std::vector<const GeometricDet*>::const_iterator egit5 = infour.end();
96  ++lev;
97  for (; git5 != egit5; ++git5) { // level 5
98  putOne(*git5, pgd, lev);
99  std::vector<const GeometricDet*> infive = (*git5)->components();
100  if (infive.empty())
101  ++count;
102  std::vector<const GeometricDet*>::const_iterator git6 = infive.begin();
103  std::vector<const GeometricDet*>::const_iterator egit6 = infive.end();
104  ++lev;
105  for (; git6 != egit6; ++git6) { //level 6
106  putOne(*git6, pgd, lev);
107  std::vector<const GeometricDet*> insix = (*git6)->components();
108  if (insix.empty())
109  ++count;
110  } // level 6
111  --lev;
112  } // level 5
113  --lev;
114  } // level 4
115  --lev;
116  } //level 3
117  --lev;
118  } // level 2
119  --lev;
120  }
121  std::vector<const GeometricDet*> modules = tracker->deepComponents();
122  if (mydbservice->isNewTagRequest("IdealGeometryRecord")) {
123  mydbservice->createNewIOV<PGeometricDet>(
124  pgd, mydbservice->beginOfTime(), mydbservice->endOfTime(), "IdealGeometryRecord");
125  } else {
126  edm::LogError("PGeometricDetBuilder") << "PGeometricDetBuilder Tag already present";
127  }
128 }

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

◆ endRun()

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

Definition at line 29 of file PGeometricDetBuilder.cc.

29 {}

◆ putOne()

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

Definition at line 130 of file PGeometricDetBuilder.cc.

130  {
132  const Translation& tran = gd->translation();
133  const RotationMatrix& rot = gd->rotation();
134  DD3Vector x, y, z;
135  rot.GetComponents(x, y, z);
136  item._name = gd->name();
137  item._ns = std::string();
138  item._level = lev;
139  item._x = tran.X();
140  item._y = tran.Y();
141  item._z = tran.Z();
142  item._phi = gd->phi();
143  item._rho = gd->rho();
144  item._a11 = x.X();
145  item._a12 = y.X();
146  item._a13 = z.X();
147  item._a21 = x.Y();
148  item._a22 = y.Y();
149  item._a23 = z.Y();
150  item._a31 = x.Z();
151  item._a32 = y.Z();
152  item._a33 = z.Z();
153  item._shape = static_cast<int>(gd->shape_dd4hep());
154  item._type = gd->type();
155  if (gd->shape_dd4hep() == cms::DDSolidShape::ddbox) {
156  item._params0 = gd->params()[0];
157  item._params1 = gd->params()[1];
158  item._params2 = gd->params()[2];
159  item._params3 = 0;
160  item._params4 = 0;
161  item._params5 = 0;
162  item._params6 = 0;
163  item._params7 = 0;
164  item._params8 = 0;
165  item._params9 = 0;
166  item._params10 = 0;
167  } else if (gd->shape_dd4hep() == cms::DDSolidShape::ddtrap) {
168  item._params0 = gd->params()[0];
169  item._params1 = gd->params()[1];
170  item._params2 = gd->params()[2];
171  item._params3 = gd->params()[3];
172  item._params4 = gd->params()[4];
173  item._params5 = gd->params()[5];
174  item._params6 = gd->params()[6];
175  item._params7 = gd->params()[7];
176  item._params8 = gd->params()[8];
177  item._params9 = gd->params()[9];
178  item._params10 = gd->params()[10];
179  } else {
180  item._params0 = 0;
181  item._params1 = 0;
182  item._params2 = 0;
183  item._params3 = 0;
184  item._params4 = 0;
185  item._params5 = 0;
186  item._params6 = 0;
187  item._params7 = 0;
188  item._params8 = 0;
189  item._params9 = 0;
190  item._params10 = 0;
191  }
192  item._geographicalID = gd->geographicalId();
193  item._radLength = gd->radLength();
194  item._xi = gd->xi();
195  item._pixROCRows = gd->pixROCRows();
196  item._pixROCCols = gd->pixROCCols();
197  item._pixROCx = gd->pixROCx();
198  item._pixROCy = gd->pixROCy();
199  item._stereo = gd->stereo();
200  item._siliconAPVNum = gd->siliconAPVNum();
201 
202  GeometricDet::nav_type const& nt = gd->navType();
203  size_t nts = nt.size();
204  item._numnt = nts;
205  std::vector<int> tempnt(nt.begin(), nt.end());
206  for (size_t extrant = nt.size(); extrant < 11; ++extrant) {
207  tempnt.push_back(-1);
208  }
209  item._nt0 = tempnt[0];
210  item._nt1 = tempnt[1];
211  item._nt2 = tempnt[2];
212  item._nt3 = tempnt[3];
213  item._nt4 = tempnt[4];
214  item._nt5 = tempnt[5];
215  item._nt6 = tempnt[6];
216  item._nt7 = tempnt[7];
217  item._nt8 = tempnt[8];
218  item._nt9 = tempnt[9];
219  item._nt10 = tempnt[10];
220 
221  pgd->pgeomdets_.push_back(item);
222 }

References cms::ddbox, cms::ddtrap, GeometricDet::geographicalId(), B2GTnPMonitor_cfi::item, GeometricDet::name(), GeometricDet::navType(), nt, GeometricDet::params(), PGeometricDet::pgeomdets_, GeometricDet::phi(), GeometricDet::pixROCCols(), GeometricDet::pixROCRows(), GeometricDet::pixROCx(), GeometricDet::pixROCy(), GeometricDet::radLength(), GeometricDet::rho(), makeMuonMisalignmentScenario::rot, GeometricDet::rotation(), GeometricDet::shape_dd4hep(), GeometricDet::siliconAPVNum(), GeometricDet::stereo(), AlCaHLTBitMon_QueryRunRegistry::string, GeometricDet::translation(), GeometricDet::type(), x, GeometricDet::xi(), y, and z.

Referenced by beginRun().

Member Data Documentation

◆ fromDD4hep_

bool PGeometricDetBuilder::fromDD4hep_
private

Definition at line 33 of file PGeometricDetBuilder.cc.

Referenced by beginRun(), and PGeometricDetBuilder().

GeometricDet::phi
double phi() const
Definition: GeometricDet.h:102
DDAxes::y
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition: PoolDBOutputService.cc:215
nt
int nt
Definition: AMPTWrapper.h:42
modules
Definition: MuonCleanerBySegments.cc:35
PGeometricDetBuilder::putOne
void putOne(const GeometricDet *gd, PGeometricDet *pgd, int lev)
Definition: PGeometricDetBuilder.cc:130
DDAxes::x
GeometricDet::translation
const Translation & translation() const
Definition: GeometricDet.h:100
RotationMatrix
ROOT::Math::Rotation3D RotationMatrix
Definition: PGeometricDetBuilder.cc:21
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
GeometricDet::name
const std::string & name() const
Definition: GeometricDet.h:90
GeometricDet::params
const std::vector< double > & params() const
Definition: GeometricDet.h:116
GeometricDet::shape_dd4hep
const cms::DDSolidShape & shape_dd4hep() const
Definition: GeometricDet.h:114
cond::service::PoolDBOutputService::createNewIOV
void createNewIOV(const T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t, const std::string &recordName)
Definition: PoolDBOutputService.h:116
GeometricDet::rotation
const RotationMatrix & rotation() const
Definition: GeometricDet.h:103
DDAxes::z
edm::ESHandle< GeometricDet >
GeometricDet
Definition: GeometricDet.h:31
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
GeometricDet::radLength
double radLength() const
Definition: GeometricDet.h:126
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
PGeometricDet::Item
Definition: PGeometricDet.h:14
DD3Vector
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
Definition: PGeometricDetBuilder.cc:19
GeometricDet::nav_type
std::vector< int > nav_type
Definition: GeometricDet.h:42
PbPb_ZMuSkimMuonDPG_cff.tracker
tracker
Definition: PbPb_ZMuSkimMuonDPG_cff.py:60
GeometricDet::stereo
bool stereo() const
Definition: GeometricDet.h:136
GeometricDet::geographicalId
const DetId & geographicalId() const
Definition: GeometricDet.h:96
GeometricDet::pixROCRows
double pixROCRows() const
Definition: GeometricDet.h:131
edm::Service< cond::service::PoolDBOutputService >
cms::DDSolidShape::ddtrap
cms::DDSolidShape::ddbox
Translation
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > Translation
Definition: PGeometricDetBuilder.cc:20
GeometricDet::pixROCx
double pixROCx() const
Definition: GeometricDet.h:133
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
get
#define get
edm::ESTransientHandle
Definition: ESTransientHandle.h:41
GeometricDet::rho
double rho() const
Definition: GeometricDet.h:101
cond::service::PoolDBOutputService::endOfTime
cond::Time_t endOfTime() const
Definition: PoolDBOutputService.cc:213
GeometricDet::siliconAPVNum
double siliconAPVNum() const
Definition: GeometricDet.h:139
GeometricDet::pixROCCols
double pixROCCols() const
Definition: GeometricDet.h:132
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
GeometricDet::xi
double xi() const
Definition: GeometricDet.h:127
GeometricDet::pixROCy
double pixROCy() const
Definition: GeometricDet.h:134
cond::service::PoolDBOutputService::isNewTagRequest
bool isNewTagRequest(const std::string &recordName)
Definition: PoolDBOutputService.cc:128
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
GeometricDet::type
const GeometricEnumType & type() const
Definition: GeometricDet.h:91
PGeometricDet::pgeomdets_
std::vector< Item > pgeomdets_
Definition: PGeometricDet.h:50
PGeometricDet
Definition: PGeometricDet.h:9
IdealGeometryRecord
Definition: IdealGeometryRecord.h:25
PGeometricDetBuilder::fromDD4hep_
bool fromDD4hep_
Definition: PGeometricDetBuilder.cc:33
GeometricDet::navType
const nav_type & navType() const
Definition: GeometricDet.h:94