CMS 3D CMS Logo

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

#include <RPCGeometryParsFromDD.h>

Public Member Functions

void build (const DDCompactView *cview, const MuonGeometryConstants &muonConstants, RecoIdealGeometry &rgeo)
 
void build (const cms::DDCompactView *cview, const MuonGeometryConstants &muonConstants, RecoIdealGeometry &rgeo)
 
 RPCGeometryParsFromDD ()
 
 ~RPCGeometryParsFromDD ()
 

Private Member Functions

void buildGeometry (DDFilteredView &fview, const MuonGeometryConstants &muonConstants, RecoIdealGeometry &rgeo)
 
void buildGeometry (cms::DDFilteredView &fview, const MuonGeometryConstants &muonConstants, RecoIdealGeometry &rgeo)
 

Detailed Description

Definition at line 27 of file RPCGeometryParsFromDD.h.

Constructor & Destructor Documentation

◆ RPCGeometryParsFromDD()

RPCGeometryParsFromDD::RPCGeometryParsFromDD ( )

Definition at line 27 of file RPCGeometryParsFromDD.cc.

27 {}

◆ ~RPCGeometryParsFromDD()

RPCGeometryParsFromDD::~RPCGeometryParsFromDD ( )

Definition at line 29 of file RPCGeometryParsFromDD.cc.

29 {}

Member Function Documentation

◆ build() [1/2]

void RPCGeometryParsFromDD::build ( const DDCompactView cview,
const MuonGeometryConstants muonConstants,
RecoIdealGeometry rgeo 
)

Definition at line 32 of file RPCGeometryParsFromDD.cc.

References buildGeometry(), ALCARECOTkAlBeamHalo_cff::filter, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by RPCRecoIdealDBLoader::beginRun().

34  {
35  const std::string attribute = "ReadOutName";
36  const std::string value = "MuonRPCHits";
37 
38  // Asking only for the MuonRPC's
40  DDFilteredView fview(*cview, filter);
41 
42  this->buildGeometry(fview, muonConstants, rgeo);
43 }
void buildGeometry(DDFilteredView &fview, const MuonGeometryConstants &muonConstants, RecoIdealGeometry &rgeo)
Definition: value.py:1

◆ build() [2/2]

void RPCGeometryParsFromDD::build ( const cms::DDCompactView cview,
const MuonGeometryConstants muonConstants,
RecoIdealGeometry rgeo 
)

Definition at line 47 of file RPCGeometryParsFromDD.cc.

References buildGeometry(), ALCARECOTkAlBeamHalo_cff::filter, and AlCaHLTBitMon_QueryRunRegistry::string.

49  {
50  const std::string attribute = "ReadOutName";
51  const std::string value = "MuonRPCHits";
52  const cms::DDFilter filter(attribute, value);
53  cms::DDFilteredView fview(*cview, filter);
54  this->buildGeometry(fview, muonConstants, rgeo);
55 }
void buildGeometry(DDFilteredView &fview, const MuonGeometryConstants &muonConstants, RecoIdealGeometry &rgeo)
Definition: value.py:1

◆ buildGeometry() [1/2]

void RPCGeometryParsFromDD::buildGeometry ( DDFilteredView fview,
const MuonGeometryConstants muonConstants,
RecoIdealGeometry rgeo 
)
private

Definition at line 59 of file RPCGeometryParsFromDD.cc.

References RPCNumberingScheme::baseNumberToUnitNumber(), gather_cfg::cout, DDfetch(), DDValue::doubles(), DDFilteredView::firstChild(), DDFilteredView::geoHistory(), MuonGeometryNumbering::geoHistoryToBaseNumber(), RecoIdealGeometry::insert(), createfilelist::int, DDFilteredView::logicalPart(), Skims_PA_cff::name, DDName::name(), DDBase< N, C >::name(), DDFilteredView::nextSibling(), me0TriggerPseudoDigis_cff::nStrips, DDSolid::parameters(), DetId::rawId(), DDFilteredView::rotation(), DDLogicalPart::solid(), DDFilteredView::specifics(), HistogramManager_cfi::specs, AlCaHLTBitMon_QueryRunRegistry::string, Calorimetry_cff::thickness, DDFilteredView::translation(), ApeEstimator_cff::width, x, y, and z.

Referenced by build().

61  {
62  for (bool doSubDets = fview.firstChild(); doSubDets == true; doSubDets = fview.nextSibling()) {
63  // Get the Base Muon Number
64  MuonGeometryNumbering mdddnum(muonConstants);
65  MuonBaseNumber mbn = mdddnum.geoHistoryToBaseNumber(fview.geoHistory());
66 
67  // Get the The Rpc det Id
68  RPCNumberingScheme rpcnum(muonConstants);
69  const int detid = rpcnum.baseNumberToUnitNumber(mbn);
70 
71  RPCDetId rpcid(detid);
72 
73  DDValue numbOfStrips("nStrips");
74 
75  std::vector<const DDsvalues_type*> specs(fview.specifics());
76  int nStrips = 0;
77  for (auto& spec : specs) {
78  if (DDfetch(spec, numbOfStrips)) {
79  nStrips = int(numbOfStrips.doubles()[0]);
80  }
81  }
82  if (nStrips == 0)
83  std::cout << "No strip found!!" << std::endl;
84 
85  const std::vector<double> dpar = fview.logicalPart().solid().parameters();
86 
87  const std::string name = fview.logicalPart().name().name();
88 
89  edm::LogVerbatim("RPCGeometryParsFromDD")
90  << " (1) "
91  << "detid: " << detid << " name: " << name << " number of Strips: " << nStrips;
92 
93  const std::vector<std::string> strpars = {name};
94  const DDTranslation& tran = fview.translation();
95 
96  const DDRotationMatrix& rota = fview.rotation(); //.Inverse();
97  DD3Vector x, y, z;
98  rota.GetComponents(x, y, z);
99  std::vector<double> pars;
100  if (dpar.size() == 3) {
101  const double width = dpar[0];
102  const double length = dpar[1];
103  const double thickness = dpar[2];
104  edm::LogVerbatim("RPCGeometryParsFromDD")
105  << " (2) dpar.size() == 3, width: " << width << " length: " << length << " thickness: " << thickness;
106  pars = {width, length, thickness, numbOfStrips.doubles()[0]};
107  } else {
108  const double dpar4 = dpar[4];
109  const double dpar8 = dpar[8];
110  const double dpar0 = dpar[0];
111  pars = {dpar4, dpar8, dpar0, 0.4, numbOfStrips.doubles()[0]};
112  edm::LogVerbatim("RPCGeometryParsFromDD")
113  << " (3), else, dpar[4]: " << dpar4 << " dpar[8]: " << dpar8 << " dpar[0]: " << dpar0;
114  }
115 
116  const std::vector<double> vtra = {tran.x(), tran.y(), tran.z()};
117 
118  edm::LogVerbatim("RPCGeometryParsFromDD")
119  << " (4), tran.x() " << tran.x() << " tran.y(): " << tran.y() << " tran.z(): " << tran.z();
120 
121  const std::vector<double> vrot = {x.X(), x.Y(), x.Z(), y.X(), y.Y(), y.Z(), z.X(), z.Y(), z.Z()};
122  edm::LogVerbatim("RPCGeometryParsFromDD")
123  << " (5), x.X(), x.Y(), x.Z(), y.X(), y.Y(), y.Z(), z.X(), z.Y(), z.Z() " << x.X() << ", " << x.Y() << ", "
124  << x.Z() << ", " << y.X() << ", " << y.Y() << ", " << y.Z() << ", " << z.X() << ", " << z.Y() << ", " << z.Z();
125  rgeo.insert(rpcid.rawId(), vtra, vrot, pars, strpars);
126  }
127 }
Log< level::Info, true > LogVerbatim
bool nextSibling()
set the current node to the next sibling ...
bool insert(DetId id, const std::vector< double > &trans, const std::vector< double > &rot, const std::vector< double > &pars)
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:125
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
const std::string & name() const
Returns the name.
Definition: DDName.cc:41
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
const N & name() const
Definition: DDBase.h:59
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
std::vector< const DDsvalues_type * > specifics() const
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
bool firstChild()
set the current node to the first child ...
const DDTranslation & translation() const
The absolute translation of the current node.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7

◆ buildGeometry() [2/2]

void RPCGeometryParsFromDD::buildGeometry ( cms::DDFilteredView fview,
const MuonGeometryConstants muonConstants,
RecoIdealGeometry rgeo 
)
private

Definition at line 131 of file RPCGeometryParsFromDD.cc.

References RPCNumberingScheme::baseNumberToUnitNumber(), cms::DDFilteredView::firstChild(), MuonGeometryNumbering::geoHistoryToBaseNumber(), cms::DDFilteredView::get(), cms::DDFilteredView::history(), RecoIdealGeometry::insert(), Skims_PA_cff::name, cms::DDFilteredView::name(), me0TriggerPseudoDigis_cff::nStrips, cms::DDFilteredView::parameters(), cms::DDFilteredView::rot(), makeMuonMisalignmentScenario::rot, cms::DDFilteredView::solid(), AlCaHLTBitMon_QueryRunRegistry::string, cms::DDFilteredView::translation(), x, y, and z.

133  {
134  while (fview.firstChild()) {
135  MuonGeometryNumbering mdddnum(muonConstants);
136  RPCNumberingScheme rpcnum(muonConstants);
137  int rawidCh = rpcnum.baseNumberToUnitNumber(mdddnum.geoHistoryToBaseNumber(fview.history()));
138  RPCDetId rpcid = RPCDetId(rawidCh);
139 
140  auto nStrips = fview.get<double>("nStrips");
141 
142  std::vector<double> dpar = fview.parameters();
143 
144  std::string_view name = fview.name();
145 
146  edm::LogVerbatim("RPCGeometryParsFromDD")
147  << " (1), detid: " << rawidCh << " name: " << std::string(name) << " number of Strips: " << nStrips;
148 
149  const std::vector<std::string> strpars = {std::string(name)};
150 
151  std::vector<double> tran(3);
152  tran[0] = static_cast<double>(fview.translation().X()) / dd4hep::mm;
153  tran[1] = static_cast<double>(fview.translation().Y()) / dd4hep::mm;
154  tran[2] = static_cast<double>(fview.translation().Z()) / dd4hep::mm;
155 
156  DDRotationMatrix rota;
157  fview.rot(rota);
158  DD3Vector x, y, z;
159  rota.GetComponents(x, y, z);
160  const std::vector<double> rot = {x.X(), x.Y(), x.Z(), y.X(), y.Y(), y.Z(), z.X(), z.Y(), z.Z()};
161 
162  if (dd4hep::isA<dd4hep::Box>(fview.solid())) {
163  const std::vector<double> pars = {
164  dpar[0] / dd4hep::mm, dpar[1] / dd4hep::mm, dpar[2] / dd4hep::mm, double(nStrips)};
165  edm::LogVerbatim("RPCGeometryParsFromDD")
166  << " (2), dd4hep::Box, width: " << dpar[0] / dd4hep::mm << " length: " << dpar[1] / dd4hep::mm
167  << " thickness: " << dpar[2] / dd4hep::mm;
168  rgeo.insert(rpcid, tran, rot, pars, strpars);
169  } else {
170  const double ti = 0.4;
171  const std::vector<double> pars = {
172  dpar[0] / dd4hep::mm, dpar[1] / dd4hep::mm, dpar[3] / dd4hep::mm, ti, double(nStrips)};
173  edm::LogVerbatim("RPCGeometryParsFromDD") << " (3), else, dpar[0] (i.e. dpar[4] for DD): " << dpar[0] / dd4hep::mm
174  << " dpar[1] (i.e. dpar[8] for DD): " << dpar[1] / dd4hep::mm
175  << " dpar[3] (i.e. dpar[0] for DD): " << dpar[3] / dd4hep::mm;
176  rgeo.insert(rpcid, tran, rot, pars, strpars);
177  }
178  edm::LogVerbatim("RPCGeometryParsFromDD")
179  << " (4), tran.x(): " << tran[0] << " tran.y(): " << tran[1] << " tran.z(): " << tran[2];
180  edm::LogVerbatim("RPCGeometryParsFromDD")
181  << " (5), x.X(), x.Y(), x.Z(), y.X(), y.Y(), y.Z(), z.X(), z.Y(), z.Z(): " << x.X() << ", " << x.Y() << ", "
182  << x.Z() << ", " << y.X() << ", " << y.Y() << ", " << y.Z() << ", " << z.X() << ", " << z.Y() << ", " << z.Z();
183  }
184 }
Log< level::Info, true > LogVerbatim
bool insert(DetId id, const std::vector< double > &trans, const std::vector< double > &rot, const std::vector< double > &pars)
const Double_t * rot() const
The absolute rotation of the current node.
nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
std::string_view name() const
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
const ExpandedNodes & history()
The numbering history of the current node.
bool firstChild()
set the current node to the first child
T get(const std::string &)
extract attribute value
dd4hep::Solid solid() const
const std::vector< double > parameters() const
extract shape parameters
const Translation translation() const