23 #include "CLHEP/Units/GlobalSystemOfUnits.h"
27 #include <boost/lexical_cast.hpp>
39 DDValue val(attribute, value, 0.0);
57 std::cout <<
"Building the geometry service" << std::endl;
58 LogDebug(
"GEMGeometryBuilderFromDDD") <<
"Building the geometry service";
61 LogDebug(
"GEMGeometryBuilderFromDDD") <<
"About to run through the GEM structure\n"
62 <<
" First logical part "
65 LogDebug(
"GEMGeometryBuilderFromDDD") <<
"doSubDets = " << doSubDets;
67 LogDebug(
"GEMGeometryBuilderFromDDD") <<
"start the loop";
74 LogDebug(
"GEMGeometryBuilderFromDDD") <<
"Getting the Muon base Number";
77 LogDebug(
"GEMGeometryBuilderFromDDD") <<
"Start the GEM Numbering Schema";
81 LogDebug(
"GEMGeometryBuilderFromDDD") <<
"GEM eta partition rawId: " << rollDetId.rawId() <<
", detId: " << rollDetId;
84 GEMDetId chamberId(rollDetId.chamberId());
85 LogDebug(
"GEMGeometryBuilderFromDDD") <<
"GEM chamber rawId: " << chamberId.rawId() <<
", detId: " << chamberId;
86 const int stationId(rollDetId.station());
87 if (stationId > maxStation) maxStation = stationId;
89 if (rollDetId.roll()==1) ++nChambers;
91 DDValue numbOfStrips(
"nStrips");
94 std::vector<const DDsvalues_type* > specs(fview.
specifics());
95 std::vector<const DDsvalues_type* >::iterator is = specs.begin();
96 double nStrips = 0., nPads = 0.;
97 for (;is != specs.end(); is++)
99 if (
DDfetch( *is, numbOfStrips)) nStrips = numbOfStrips.
doubles()[0];
102 LogDebug(
"GEMGeometryBuilderFromDDD")
103 << ((nStrips == 0. ) ? (
"No nStrips found!!") : (
"Number of strips: " + boost::lexical_cast<
std::string>(nStrips)));
104 LogDebug(
"GEMGeometryBuilderFromDDD")
105 << ((nPads == 0. ) ? (
"No nPads found!!") : (
"Number of pads: " + boost::lexical_cast<
std::string>(nPads)));
120 rota.GetComponents(x,y,z);
123 float(y.X()),
float(y.Y()),
float(y.Z()),
124 float(z.X()),
float(z.Y()),
float(z.Z()));
126 float be = dpar[4]/cm;
127 float te = dpar[8]/cm;
128 float ap = dpar[0]/cm;
134 std::vector<float> pars;
138 pars.push_back(nStrips);
139 pars.push_back(nPads);
141 LogDebug(
"GEMGeometryBuilderFromDDD")
142 <<
"GEM " << name <<
" par " << be <<
" " << te <<
" " << ap <<
" " << dpar[0];
166 std::vector<GEMDetId> vDetId;
168 int oldRollNumber = 1;
169 for (
unsigned i=1;
i<=partitions.size(); ++
i){
170 GEMDetId detId(partitions.at(
i-1)->id());
171 const int rollNumber(detId.roll());
173 if (rollNumber < oldRollNumber ||
i == partitions.size()) {
175 if (
i == partitions.size()) vDetId.push_back(detId);
178 GEMDetId chamberId(fId.chamberId());
186 LogDebug(
"GEMGeometryBuilderFromDDD") <<
"Creating chamber " << chamberId <<
" with " << vDetId.size() <<
" eta partitions" << std::endl;
188 for(
auto id : vDetId){
189 LogDebug(
"GEMGeometryBuilderFromDDD") <<
"Adding eta partition " <<
id <<
" to GEM chamber" << std::endl;
193 LogDebug(
"GEMGeometryBuilderFromDDD") <<
"Adding the chamber to the geometry" << std::endl;
197 vDetId.push_back(detId);
198 oldRollNumber = rollNumber;
208 if (detIdL1.layer()==2)
continue;
209 GEMDetId detIdL2(detIdL1.region(),detIdL1.ring(),detIdL1.station(),2,detIdL1.chamber(),0);
210 auto ch2 = geometry->
chamber(detIdL2);
212 LogDebug(
"GEMGeometryBuilderFromDDD") <<
"First chamber for super chamber: " << detIdL1 << std::endl;
213 LogDebug(
"GEMGeometryBuilderFromDDD") <<
"Second chamber for super chamber: " << detIdL2 << std::endl;
215 LogDebug(
"GEMGeometryBuilderFromDDD") <<
"Creating new GEM super chamber out of chambers." << std::endl;
218 sch->
add(const_cast<GEMChamber*>(ch2));
220 LogDebug(
"GEMGeometryBuilderFromDDD") <<
"Adding the super chamber to the geometry." << std::endl;
226 for (
int re = -1; re <= 1; re = re+2) {
236 for (
int ri=1; ri<=1; ++ri) {
238 for (
unsigned sch=0; sch<superChambers.size(); ++sch){
239 const GEMDetId detId(superChambers.at(sch)->id());
240 if (detId.region() != re || detId.station() != st || detId.ring() != ri)
continue;
241 ring->
add(const_cast<GEMSuperChamber*>(superChambers.at(sch)));
242 LogDebug(
"GEMGeometryBuilderFromDDD") <<
"Adding super chamber " << detId <<
" to ring: "
243 <<
"re " << re <<
" st " << st <<
" ri " << ri << std::endl;
245 LogDebug(
"GEMGeometryBuilderFromDDD") <<
"Adding ring " << ri <<
" to station " <<
"re " << re <<
" st " << st << std::endl;
246 station->
add(const_cast<GEMRing*>(ring));
247 geometry->
add(const_cast<GEMRing*>(ring));
249 LogDebug(
"GEMGeometryBuilderFromDDD") <<
"Adding station " << st <<
" to region " << re << std::endl;
250 region->
add(const_cast<GEMStation*>(station));
251 geometry->
add(const_cast<GEMStation*>(station));
253 LogDebug(
"GEMGeometryBuilderFromDDD") <<
"Adding region " << re <<
" to the geometry " << std::endl;
254 geometry->
add(const_cast<GEMRegion*>(region));
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
GEMGeometry * buildGeometry(DDFilteredView &fview, const MuonDDDConstants &muonConstants)
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.
void add(GEMChamber *ch)
Add chamber to the super chamber which takes ownership.
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.
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
void add(GEMRing *ring)
Add ring to the station which takes ownership.
const GEMEtaPartition * etaPartition(GEMDetId id) const
Return a GEMEtaPartition given its id.
void add(GEMSuperChamber *ch)
Add super chamber to the ring which takes ownership.
TkRotation & rotateAxes(const Basic3DVector< T > &newX, const Basic3DVector< T > &newY, const Basic3DVector< T > &newZ)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
std::string to_string(const T &t)
GEMGeometry * build(const DDCompactView *cview, const MuonDDDConstants &muonConstants)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
const std::vector< const GEMEtaPartition * > & etaPartitions() const
Return a vector of all GEM eta partitions.
void add(GEMEtaPartition *roll)
Add EtaPartition to the chamber which takes ownership.
void setName(std::string name)
Set the station name.
GEMGeometryBuilderFromDDD()
virtual int baseNumberToUnitNumber(const MuonBaseNumber &)
const std::vector< const GEMSuperChamber * > & superChambers() const
Return a vector of all GEM super chambers.
~GEMGeometryBuilderFromDDD()
void add(GEMRegion *region)
Add a GEMRegion to the Geometry.
const GEMChamber * chamber(GEMDetId id) const
const std::vector< const GEMChamber * > & chambers() const
Return a vector of all GEM chambers.
ESHandle< TrackerGeometry > geometry
bool firstChild()
set the current node to the first child ...
void add(GEMStation *st)
Add station to the region which takes ownership.
const DDTranslation & translation() const
The absolute translation of the current node.
std::vector< const DDsvalues_type * > specifics() const
static char chambers[264][20]
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)
The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.