test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
GEMGeometryBuilderFromDDD Class Reference

#include <GEMGeometryBuilderFromDDD.h>

Public Member Functions

GEMGeometrybuild (const DDCompactView *cview, const MuonDDDConstants &muonConstants)
 
 GEMGeometryBuilderFromDDD (bool comp11)
 
 ~GEMGeometryBuilderFromDDD ()
 

Private Member Functions

GEMGeometrybuildGeometry (DDFilteredView &fview, const MuonDDDConstants &muonConstants)
 

Private Attributes

bool theComp11Flag
 

Detailed Description

Build the GEMGeometry ftom the DDD description

Author
M. Maggi - INFN Bari

Definition at line 22 of file GEMGeometryBuilderFromDDD.h.

Constructor & Destructor Documentation

GEMGeometryBuilderFromDDD::GEMGeometryBuilderFromDDD ( bool  comp11)

Implementation of the GEM Geometry Builder from DDD

Author
Port of: MuDDDGEMBuilder (ORCA)
M. Maggi - INFN Bari

Definition at line 28 of file GEMGeometryBuilderFromDDD.cc.

28  : theComp11Flag(comp11)
29 { }
GEMGeometryBuilderFromDDD::~GEMGeometryBuilderFromDDD ( )

Definition at line 31 of file GEMGeometryBuilderFromDDD.cc.

32 { }

Member Function Documentation

GEMGeometry * GEMGeometryBuilderFromDDD::build ( const DDCompactView cview,
const MuonDDDConstants muonConstants 
)

Definition at line 34 of file GEMGeometryBuilderFromDDD.cc.

References DDFilteredView::addFilter(), DDSpecificsFilter::AND, buildGeometry(), alcazmumu_cfi::filter, DDSpecificsFilter::matches, DDSpecificsFilter::setCriteria(), AlCaHLTBitMon_QueryRunRegistry::string, and relativeConstraints::value.

Referenced by GEMGeometryESModule::produce().

35 {
36  std::string attribute = "ReadOutName"; // could come from .orcarc
37  std::string value = "MuonGEMHits"; // could come from .orcarc
38  DDValue val(attribute, value, 0.0);
39 
40  // Asking only for the MuonGEM's
42  filter.setCriteria(val, // name & value of a variable
45  true, // compare strings otherwise doubles
46  true // use merged-specifics or simple-specifics
47  );
48  DDFilteredView fview(*cview);
49  fview.addFilter(filter);
50 
51  return this->buildGeometry(fview, muonConstants);
52 }
GEMGeometry * buildGeometry(DDFilteredView &fview, const MuonDDDConstants &muonConstants)
void setCriteria(const DDValue &nameVal, comp_op, log_op l=AND, bool asString=true, bool merged=true)
Definition: DDFilter.cc:285
The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.
Definition: DDFilter.h:37
GEMGeometry * GEMGeometryBuilderFromDDD::buildGeometry ( DDFilteredView fview,
const MuonDDDConstants muonConstants 
)
private

Definition at line 54 of file GEMGeometryBuilderFromDDD.cc.

References GEMGeometry::add(), GEMNumberingScheme::baseNumberToUnitNumber(), DDfetch(), cond::rpcobgas::detid, DDValue::doubles(), DDFilteredView::firstChild(), GeomDetEnumerators::GEM, DDFilteredView::geoHistory(), MuonDDDNumbering::geoHistoryToBaseNumber(), geometry, LogDebug, DDFilteredView::logicalPart(), DDName::name(), mergeVDriftHistosByStation::name, DDBase< N, C >::name(), DDFilteredView::nextSibling(), DDSolid::parameters(), makeMuonMisalignmentScenario::rot, TkRotation< T >::rotateAxes(), DDFilteredView::rotation(), DDLogicalPart::solid(), DDFilteredView::specifics(), AlCaHLTBitMon_QueryRunRegistry::string, DDFilteredView::translation(), x, detailsBasic3DVector::y, and detailsBasic3DVector::z.

Referenced by build().

55 {
56  LogDebug("GEMGeometryBuilderFromDDD") <<"Building the geometry service";
58 
59  LogDebug("GEMGeometryBuilderFromDDD") << "About to run through the GEM structure\n"
60  <<" First logical part "
61  <<fview.logicalPart().name().name();
62  bool doSubDets = fview.firstChild();
63 
64  LogDebug("GEMGeometryBuilderFromDDD") << "doSubDets = " << doSubDets;
65  while (doSubDets)
66  {
67  LogDebug("GEMGeometryBuilderFromDDD") <<"start the loop";
68 
69  // Get the Base Muon Number
70  MuonDDDNumbering mdddnum(muonConstants);
71  LogDebug("GEMGeometryBuilderFromDDD") <<"Getting the Muon base Number";
72  MuonBaseNumber mbn = mdddnum.geoHistoryToBaseNumber(fview.geoHistory());
73  LogDebug("GEMGeometryBuilderFromDDD") <<"Start the GEM Numbering Schema";
74  // Get the The GEM det Id
75  GEMNumberingScheme gemnum(muonConstants);
76  int detid = 0;
77 
78  LogDebug("GEMGeometryBuilderFromDDD") <<"Getting the Unit Number";
79  detid = gemnum.baseNumberToUnitNumber(mbn);
80  LogDebug("GEMGeometryBuilderFromDDD") <<"Getting the GEM det Id "<<detid;
81 
82  GEMDetId gemmid(detid);
83  // GEMDetId chid(gemmid.region(),gemmid.ring(),gemmid.station(),gemmid.sector(),gemmid.layer(),gemmid.subsector(),0);
84 
85  LogDebug("GEMGeometryBuilderFromDDD") <<"The GEMDetid is "<<gemmid;
86 
87  DDValue numbOfStrips("nStrips");
88  DDValue numbOfPads("nPads");
89 
90  std::vector<const DDsvalues_type* > specs(fview.specifics());
91  std::vector<const DDsvalues_type* >::iterator is = specs.begin();
92  double nStrips = 0., nPads = 0.;
93  for (;is != specs.end(); is++)
94  {
95  if (DDfetch( *is, numbOfStrips)) nStrips = numbOfStrips.doubles()[0];
96  if (DDfetch( *is, numbOfPads)) nPads = numbOfPads.doubles()[0];
97  }
98  LogDebug("GEMGeometryBuilderFromDDD") << ((nStrips == 0. ) ? ("No nStrips found!!") : (""));
99  LogDebug("GEMGeometryBuilderFromDDD") << ((nPads == 0. ) ? ("No nPads found!!") : (""));
100  //std::cout <<"# strips, pads: "<< nStrips<<", "<<nPads<<std::endl;
101 
102 
103  std::vector<double> dpar=fview.logicalPart().solid().parameters();
104  std::string name = fview.logicalPart().name().name();
105  DDTranslation tran = fview.translation();
106  //removed .Inverse after comparing to DT...
107  DDRotationMatrix rota = fview.rotation();//.Inverse();
108  Surface::PositionType pos(tran.x()/cm, tran.y()/cm, tran.z()/cm);
109  // CLHEP way
110 // Surface::RotationType rot(rota.xx(),rota.xy(),rota.xz(),
111 // rota.yx(),rota.yy(),rota.yz(),
112 // rota.zx(),rota.zy(),rota.zz());
113 
114 //ROOT::Math way
115  DD3Vector x, y, z;
116  rota.GetComponents(x,y,z);
117  // doesn't this just re-inverse???
118  Surface::RotationType rot (float(x.X()), float(x.Y()), float(x.Z()),
119  float(y.X()), float(y.Y()), float(y.Z()),
120  float(z.X()), float(z.Y()), float(z.Z()));
121 
122  Bounds* bounds = 0;
123  float be = dpar[4]/cm;
124  float te = dpar[8]/cm;
125  float ap = dpar[0]/cm;
126  float ti = 0.4/cm;
127  // TrapezoidalPlaneBounds*
128  bounds = new TrapezoidalPlaneBounds(be, te, ap, ti);
129 
130  std::vector<float> pars;
131  pars.push_back(dpar[4]/cm); //b/2;
132  pars.push_back(dpar[8]/cm); //B/2;
133  pars.push_back(dpar[0]/cm); //h/2;
134  pars.push_back(nStrips);
135  pars.push_back(nPads);
136 
137  LogDebug("GEMGeometryBuilderFromDDD") <<"GEM "<<name
138  <<" par "<<dpar[4]/cm
139  <<" "<<dpar[8]/cm<<" "<<dpar[3]/cm<<" "
140  <<dpar[0];
141 
143 
144  //Change of axes for the forward
145  Basic3DVector<float> newX(1.,0.,0.);
146  Basic3DVector<float> newY(0.,0.,1.);
147  // if (tran.z() > 0. )
148  newY *= -1;
149  Basic3DVector<float> newZ(0.,1.,0.);
150  rot.rotateAxes (newX, newY, newZ);
151 
152  LogDebug("GEMGeometryBuilderFromDDD") <<" Number of strips "<<nStrips<<" Number of pads "<<nPads;
153  BoundPlane* bp = new BoundPlane(pos, rot, bounds);
155  GEMEtaPartition* gep = new GEMEtaPartition(gemmid, surf, e_p_specs);
156  geometry->add(gep);
157 
158  std::list<GEMEtaPartition *> gepls;
159  /*
160  if (chids.find(chid)!=chids.end()){
161  gepls = chids[chid];
162  }
163  */
164  gepls.push_back(gep);
165  //chids[chid]=gepls;
166 
167  doSubDets = fview.nextSibling(); // go to next layer
168  }
169  /*
170  // Create the GEMChambers and store them on the Geometry
171  for( std::map<GEMDetId, std::list<GEMEtaPartition *> >::iterator ich=chids.begin();
172  ich != chids.end(); ich++){
173  GEMDetId chid = ich->first;
174  std::list<GEMEtaPartition * > gepls = ich->second;5D
175 
176  // compute the overall boundplane. At the moment we use just the last
177  // surface
178  BoundPlane* bp=0;
179  for(std::list<GEMEtaPartition *>::iterator gepl=gepls.begin();
180  gepl!=gepls.end(); gepl++){
181  const BoundPlane& bps = (*gepl)->surface();
182  bp = const_cast<BoundPlane *>(&bps);
183  }
184 
185  ReferenceCountingPointer<BoundPlane> surf(bp);
186  // Create the chamber
187  GEMChamber* ch = new GEMChamber (chid, surf);
188  // Add the etapartitions to the chamber
189  for(std::list<GEMEtaPartition *>::iterator gepl=gepls.begin();
190  gepl!=gepls.end(); rl++){
191  ch->add(*gepl);
192  }
193  // Add the chamber to the geometry
194  geometry->add(ch);
195  }
196  */
197  return geometry;
198 }
#define LogDebug(id)
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:150
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
const N & name() const
Definition: DDBase.h:82
bool nextSibling()
set the current node to the next sibling ...
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
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 *.
Definition: DDsvalues.cc:102
float float float z
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
Definition: DDTranslation.h:6
void add(GEMEtaPartition *etaPartition)
Add a GEM etaPartition to the Geometry.
Definition: GEMGeometry.cc:71
ESHandle< TrackerGeometry > geometry
bool firstChild()
set the current node to the first child ...
Definition: Bounds.h:22
const DDTranslation & translation() const
The absolute translation of the current node.
std::vector< const DDsvalues_type * > specifics() const
Definition: DDAxes.h:10
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
const std::string & name() const
Returns the name.
Definition: DDName.cc:87

Member Data Documentation

bool GEMGeometryBuilderFromDDD::theComp11Flag
private

Definition at line 37 of file GEMGeometryBuilderFromDDD.h.