24 #include "CLHEP/Units/GlobalSystemOfUnits.h"
57 LogDebug(
"RPCGeometryBuilderFromDDD") <<
"Building the geometry service";
60 LogDebug(
"RPCGeometryBuilderFromDDD") <<
"About to run through the RPC structure\n"
61 <<
" First logical part "
65 LogDebug(
"RPCGeometryBuilderFromDDD") <<
"doSubDets = " << doSubDets;
67 LogDebug(
"RPCGeometryBuilderFromDDD") <<
"start the loop";
71 LogDebug(
"RPCGeometryBuilderFromDDD") <<
"Getting the Muon base Number";
73 LogDebug(
"RPCGeometryBuilderFromDDD") <<
"Start the Rpc Numbering Schema";
77 LogDebug(
"RPCGeometryBuilderFromDDD") <<
"Getting the Unit Number";
79 LogDebug(
"RPCGeometryBuilderFromDDD") <<
"Getting the RPC det Id "<<detid;
84 LogDebug(
"RPCGeometryBuilderFromDDD") <<
"The RPCDetid is "<<rpcid;
86 DDValue numbOfStrips(
"nStrips");
88 std::vector<const DDsvalues_type* > specs(fview.
specifics());
90 for (
auto is=specs.begin();is!=specs.end(); ++is){
91 if (
DDfetch( *is, numbOfStrips)){
92 nStrips=int(numbOfStrips.
doubles()[0]);
96 LogDebug(
"RPCGeometryBuilderFromDDD") << ((nStrips == 0 ) ? (
"No strip found!!") : (
""));
111 rota.GetComponents(x,y,z);
114 float(y.X()),
float(y.Y()),
float(y.Z()),
115 float(z.X()),
float(z.Y()),
float(z.Z()));
121 const float width = dpar[0]/cm;
122 const float length = dpar[1]/cm;
123 const float thickness = dpar[2]/cm;
126 const std::vector<float> pars = {
width, length, float(numbOfStrips.
doubles()[0]) };
132 if (tran.z() >-1500. ){
141 LogDebug(
"RPCGeometryBuilderFromDDD") <<
"Barrel "<<name
143 <<
" "<<length<<
" "<<thickness;
146 const float be = dpar[4]/cm;
147 const float te = dpar[8]/cm;
148 const float ap = dpar[0]/cm;
149 const float ti = 0.4/cm;
152 const std::vector<float> pars = {float(dpar[4]/cm) , float(dpar[8]/cm) ,
153 float(dpar[0]/cm) , float(numbOfStrips.
doubles()[0]) };
155 LogDebug(
"RPCGeometryBuilderFromDDD") <<
"Forward "<<name
156 <<
" par "<<dpar[4]/cm
157 <<
" "<<dpar[8]/cm<<
" "<<dpar[3]/cm<<
" "
170 LogDebug(
"RPCGeometryBuilderFromDDD") <<
" Number of strips "<<nStrips;
177 auto rls =
chids.find(chid);
178 if ( rls ==
chids.end() ) rls =
chids.insert(std::make_pair(chid, std::list<RPCRoll*>())).first;
179 rls->second.push_back(r);
184 for (
auto ich=
chids.begin(); ich !=
chids.end(); ++ich ) {
186 const auto& rls = ich->second;
190 if ( !rls.empty() ) {
192 const auto& refSurf = (*rls.begin())->surface();
193 if ( chid.
region() == 0 ) {
194 float corners[6] = {0,0,0,0,0,0};
195 for (
auto rl : rls ) {
196 const double h2 = rl->surface().bounds().length()/2;
197 const double w2 = rl->surface().bounds().width()/2;
198 const auto x1y1AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(-w2,-h2,0)));
199 const auto x2y2AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(+w2,+h2,0)));
200 corners[0] =
std::min(corners[0], x1y1AtRef.x());
201 corners[1] =
std::min(corners[1], x1y1AtRef.y());
202 corners[2] =
std::max(corners[2], x2y2AtRef.x());
203 corners[3] =
std::max(corners[3], x2y2AtRef.y());
205 corners[4] =
std::min(corners[4], x1y1AtRef.z());
206 corners[5] =
std::max(corners[5], x1y1AtRef.z());
208 const LocalPoint lpOfCentre((corners[0]+corners[2])/2, (corners[1]+corners[3])/2, 0);
209 const auto gpOfCentre = refSurf.toGlobal(lpOfCentre);
210 auto bounds =
new RectangularPlaneBounds((corners[2]-corners[0])/2, (corners[3]-corners[1])/2, (corners[5]-corners[4])+0.5);
211 bp =
new BoundPlane(gpOfCentre, refSurf.rotation(), bounds);
214 float cornersLo[3] = {0,0,0}, cornersHi[3] = {0,0,0};
215 float cornersZ[2] = {0,0};
216 for (
auto rl : rls ) {
218 const double w2 = rl->surface().bounds().width()/2;
220 const double r = topo.radius();
221 const double wAtLo = w2/r*(r-h2);
222 const double wAtHi = w2/r*(r+h2);
224 const auto x1y1AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(-wAtLo, -h2, 0)));
225 const auto x2y1AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(+wAtLo, -h2, 0)));
226 const auto x1y2AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(-wAtHi, +h2, 0)));
227 const auto x2y2AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(+wAtHi, +h2, 0)));
229 cornersLo[0] =
std::min(cornersLo[0], x1y1AtRef.x());
230 cornersLo[1] =
std::max(cornersLo[1], x2y1AtRef.x());
231 cornersLo[2] =
std::min(cornersLo[2], x1y1AtRef.y());
233 cornersHi[0] =
std::min(cornersHi[0], x1y2AtRef.x());
234 cornersHi[1] =
std::max(cornersHi[1], x2y2AtRef.x());
235 cornersHi[2] =
std::max(cornersHi[2], x1y2AtRef.y());
237 cornersZ[0] =
std::min(cornersZ[0], x1y1AtRef.z());
238 cornersZ[1] =
std::max(cornersZ[1], x1y1AtRef.z());
240 const LocalPoint lpOfCentre((cornersHi[0]+cornersHi[1])/2, (cornersLo[2]+cornersHi[2])/2, 0);
241 const auto gpOfCentre = refSurf.toGlobal(lpOfCentre);
242 auto bounds =
new TrapezoidalPlaneBounds((cornersLo[1]-cornersLo[0])/2, (cornersHi[1]-cornersHi[0])/2, (cornersHi[2]-cornersLo[2])/2, (cornersZ[1]-cornersZ[0])+0.5);
243 bp =
new BoundPlane(gpOfCentre, refSurf.rotation(), bounds);
251 for (
auto rl : rls ) ch->
add(rl);
virtual int baseNumberToUnitNumber(const MuonBaseNumber &)
void add(RPCRoll *rl)
Add Roll to the chamber which takes ownership.
~RPCGeometryBuilderFromDDD()
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
const std::vector< double > & doubles() const
a reference to the double-valued values stored in the given instance of DDValue
virtual float length() const =0
common ppss p3p6s2 common epss epspn46 common const1 w2
void addFilter(const DDFilter &, DDLogOp op=DDLogOp::AND)
bool nextSibling()
set the current node to the next sibling ...
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
const Bounds & bounds() const
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
type of data representation of DDCompactView
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
RPCGeometry * build(const DDCompactView *cview, const MuonDDDConstants &muonConstants)
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
void add(RPCRoll *roll)
Add a RPC roll to the Geometry.
TkRotation & rotateAxes(const Basic3DVector< T > &newX, const Basic3DVector< T > &newY, const Basic3DVector< T > &newZ)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
RPCGeometry * buildGeometry(DDFilteredView &fview, const MuonDDDConstants &muonConstants)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
std::map< RPCDetId, std::list< RPCRoll * > > chids
RPCGeometryBuilderFromDDD(bool comp11)
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
ESHandle< TrackerGeometry > geometry
int subsector() const
SubSector id : some sectors are divided along the phi direction in subsectors (from 1 to 4 in Barrel...
bool firstChild()
set the current node to the first child ...
const DDTranslation & translation() const
The absolute translation of the current node.
std::vector< const DDsvalues_type * > specifics() const
MuonBaseNumber geoHistoryToBaseNumber(const DDGeoHistory &history)
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
const std::string & name() const
Returns the name.
void setCriteria(const DDValue &nameVal, DDCompOp, DDLogOp l=DDLogOp::AND, bool asString=true, bool merged=true)
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.