CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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

edm::ESGetToken< DDCompactView,
IdealGeometryRecord
compactViewToken_
 
edm::ESGetToken
< cms::DDCompactView,
IdealGeometryRecord
dd4HepCompactViewToken_
 
bool fromDD4hep_
 
edm::ESGetToken< GeometricDet,
IdealGeometryRecord
geometricDetToken_
 

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
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, 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)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
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...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 24 of file PGeometricDetBuilder.cc.

Constructor & Destructor Documentation

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

Definition at line 40 of file PGeometricDetBuilder.cc.

References compactViewToken_, dd4HepCompactViewToken_, fromDD4hep_, geometricDetToken_, and edm::ParameterSet::getParameter().

40  {
41  fromDD4hep_ = iConfig.getParameter<bool>("fromDD4hep");
42  dd4HepCompactViewToken_ = esConsumes<edm::Transition::BeginRun>();
43  compactViewToken_ = esConsumes<edm::Transition::BeginRun>();
44  geometricDetToken_ = esConsumes<edm::Transition::BeginRun>();
45 }
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > dd4HepCompactViewToken_
edm::ESGetToken< DDCompactView, IdealGeometryRecord > compactViewToken_
edm::ESGetToken< GeometricDet, IdealGeometryRecord > geometricDetToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303

Member Function Documentation

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

Implements edm::one::EDAnalyzerBase.

Definition at line 29 of file PGeometricDetBuilder.cc.

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

Definition at line 47 of file PGeometricDetBuilder.cc.

References cond::service::PoolDBOutputService::beginOfTime(), compactViewToken_, GeometricDet::components(), submitPVResolutionJobs::count, cond::service::PoolDBOutputService::createOneIOV(), dd4HepCompactViewToken_, fromDD4hep_, geometricDetToken_, edm::EventSetup::getData(), edm::EventSetup::getTransientHandle(), edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), and putOne().

47  {
48  PGeometricDet pgd;
50  if (!mydbservice.isAvailable()) {
51  edm::LogError("PGeometricDetBuilder") << "PoolDBOutputService unavailable";
52  return;
53  }
54  if (!fromDD4hep_) {
55  auto pDD = es.getTransientHandle(compactViewToken_);
56  } else {
57  auto pDD = es.getTransientHandle(dd4HepCompactViewToken_);
58  }
59  const GeometricDet* tracker = &es.getData(geometricDetToken_);
60 
61  // so now I have the tracker itself. loop over all its components to store them.
62  putOne(tracker, &pgd, 0);
63  std::vector<const GeometricDet*> tc = tracker->components();
64  std::vector<const GeometricDet*>::const_iterator git = tc.begin();
65  std::vector<const GeometricDet*>::const_iterator egit = tc.end();
66  int count = 0;
67  int lev = 1;
68  for (; git != egit; ++git) { // one level below "tracker"
69  putOne(*git, &pgd, lev);
70  std::vector<const GeometricDet*> inone = (*git)->components();
71  if (inone.empty())
72  ++count;
73  std::vector<const GeometricDet*>::const_iterator git2 = inone.begin();
74  std::vector<const GeometricDet*>::const_iterator egit2 = inone.end();
75  ++lev;
76  for (; git2 != egit2; ++git2) { // level 2
77  putOne(*git2, &pgd, lev);
78  std::vector<const GeometricDet*> intwo = (*git2)->components();
79  if (intwo.empty())
80  ++count;
81  std::vector<const GeometricDet*>::const_iterator git3 = intwo.begin();
82  std::vector<const GeometricDet*>::const_iterator egit3 = intwo.end();
83  ++lev;
84  for (; git3 != egit3; ++git3) { // level 3
85  putOne(*git3, &pgd, lev);
86  std::vector<const GeometricDet*> inthree = (*git3)->components();
87  if (inthree.empty())
88  ++count;
89  std::vector<const GeometricDet*>::const_iterator git4 = inthree.begin();
90  std::vector<const GeometricDet*>::const_iterator egit4 = inthree.end();
91  ++lev;
92  for (; git4 != egit4; ++git4) { //level 4
93  putOne(*git4, &pgd, lev);
94  std::vector<const GeometricDet*> infour = (*git4)->components();
95  if (infour.empty())
96  ++count;
97  std::vector<const GeometricDet*>::const_iterator git5 = infour.begin();
98  std::vector<const GeometricDet*>::const_iterator egit5 = infour.end();
99  ++lev;
100  for (; git5 != egit5; ++git5) { // level 5
101  putOne(*git5, &pgd, lev);
102  std::vector<const GeometricDet*> infive = (*git5)->components();
103  if (infive.empty())
104  ++count;
105  std::vector<const GeometricDet*>::const_iterator git6 = infive.begin();
106  std::vector<const GeometricDet*>::const_iterator egit6 = infive.end();
107  ++lev;
108  for (; git6 != egit6; ++git6) { //level 6
109  putOne(*git6, &pgd, lev);
110  std::vector<const GeometricDet*> insix = (*git6)->components();
111  if (insix.empty())
112  ++count;
113  } // level 6
114  --lev;
115  } // level 5
116  --lev;
117  } // level 4
118  --lev;
119  } //level 3
120  --lev;
121  } // level 2
122  --lev;
123  }
124  if (mydbservice->isNewTagRequest("IdealGeometryRecord")) {
125  mydbservice->createOneIOV(pgd, mydbservice->beginOfTime(), "IdealGeometryRecord");
126  } else {
127  edm::LogError("PGeometricDetBuilder") << "PGeometricDetBuilder Tag already present";
128  }
129 }
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > dd4HepCompactViewToken_
edm::ESGetToken< DDCompactView, IdealGeometryRecord > compactViewToken_
edm::ESGetToken< GeometricDet, IdealGeometryRecord > geometricDetToken_
Log< level::Error, false > LogError
void createOneIOV(const T &payload, cond::Time_t firstSinceTime, const std::string &recordName)
ConstGeometricDetContainer & components()
Definition: GeometricDet.h:150
bool isNewTagRequest(const std::string &recordName)
bool isAvailable() const
Definition: Service.h:40
void putOne(const GeometricDet *gd, PGeometricDet *pgd, int lev)
void PGeometricDetBuilder::endRun ( edm::Run const &  iEvent,
edm::EventSetup const &   
)
inlineoverride

Definition at line 30 of file PGeometricDetBuilder.cc.

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

Definition at line 131 of file PGeometricDetBuilder.cc.

References PGeometricDet::Item::_a11, PGeometricDet::Item::_a12, PGeometricDet::Item::_a13, PGeometricDet::Item::_a21, PGeometricDet::Item::_a22, PGeometricDet::Item::_a23, PGeometricDet::Item::_a31, PGeometricDet::Item::_a32, PGeometricDet::Item::_a33, PGeometricDet::Item::_geographicalID, PGeometricDet::Item::_level, PGeometricDet::Item::_name, PGeometricDet::Item::_ns, PGeometricDet::Item::_nt0, PGeometricDet::Item::_nt1, PGeometricDet::Item::_nt10, PGeometricDet::Item::_nt2, PGeometricDet::Item::_nt3, PGeometricDet::Item::_nt4, PGeometricDet::Item::_nt5, PGeometricDet::Item::_nt6, PGeometricDet::Item::_nt7, PGeometricDet::Item::_nt8, PGeometricDet::Item::_nt9, PGeometricDet::Item::_numnt, PGeometricDet::Item::_params0, PGeometricDet::Item::_params1, PGeometricDet::Item::_params10, PGeometricDet::Item::_params2, PGeometricDet::Item::_params3, PGeometricDet::Item::_params4, PGeometricDet::Item::_params5, PGeometricDet::Item::_params6, PGeometricDet::Item::_params7, PGeometricDet::Item::_params8, PGeometricDet::Item::_params9, PGeometricDet::Item::_phi, PGeometricDet::Item::_pixROCCols, PGeometricDet::Item::_pixROCRows, PGeometricDet::Item::_pixROCx, PGeometricDet::Item::_pixROCy, PGeometricDet::Item::_radLength, PGeometricDet::Item::_rho, PGeometricDet::Item::_shape, PGeometricDet::Item::_siliconAPVNum, PGeometricDet::Item::_stereo, PGeometricDet::Item::_type, PGeometricDet::Item::_x, PGeometricDet::Item::_xi, PGeometricDet::Item::_y, PGeometricDet::Item::_z, 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(), cms_rounding::roundIfNear0(), GeometricDet::shape_dd4hep(), GeometricDet::siliconAPVNum(), GeometricDet::stereo(), AlCaHLTBitMon_QueryRunRegistry::string, GeometricDet::translation(), GeometricDet::type(), x, GeometricDet::xi(), y, and z.

Referenced by beginRun().

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

Member Data Documentation

edm::ESGetToken<DDCompactView, IdealGeometryRecord> PGeometricDetBuilder::compactViewToken_
private

Definition at line 36 of file PGeometricDetBuilder.cc.

Referenced by beginRun(), and PGeometricDetBuilder().

edm::ESGetToken<cms::DDCompactView, IdealGeometryRecord> PGeometricDetBuilder::dd4HepCompactViewToken_
private

Definition at line 35 of file PGeometricDetBuilder.cc.

Referenced by beginRun(), and PGeometricDetBuilder().

bool PGeometricDetBuilder::fromDD4hep_
private

Definition at line 34 of file PGeometricDetBuilder.cc.

Referenced by beginRun(), and PGeometricDetBuilder().

edm::ESGetToken<GeometricDet, IdealGeometryRecord> PGeometricDetBuilder::geometricDetToken_
private

Definition at line 37 of file PGeometricDetBuilder.cc.

Referenced by beginRun(), and PGeometricDetBuilder().