23 #include "CLHEP/Units/GlobalSystemOfUnits.h"
32 using namespace SurfaceOrientation;
49 solid(fv.logicalPart().solid()),
51 fv.translation().
y()/cm,
52 fv.translation().
z()/cm)),
56 for (
int i=0;
i<6; ++
i) {
81 cout <<
"volumeHandle ctor: Unexpected solid: " << (int)
solid.
shape() << endl;
88 std::vector<std::string>
temp;
89 std::string pname =
"table";
94 if (temp.size() != 1) {
95 cout <<
"*** WARNING: volume has > 1 SpecPar " << pname << endl;
99 cout <<
"*** WARNING: volume does not have a SpecPar " << pname << endl;
105 std::vector<double>
temp;
106 const std::string pname =
"masterSector";
110 if (temp.size() != 1) {
111 cout <<
"*** WARNING: volume has > 1 SpecPar " << pname << endl;
115 cout <<
"*** WARNING: volume does not have a SpecPar " << pname << endl;
129 cout <<
"*** WARNING: wrong RMin/RN/RMax , shape: " << (int)
shape() << endl;
132 <<
" Shape= " << (int)
shape()
141 cout <<
" Orientation of surfaces:";
142 std::string sideName[3] = {
"positiveSide",
"negativeSide",
"onSurface"};
143 for (
int i=0;
i<6; ++
i) {
191 if (x.Cross(y).Dot(z) < 0.5) {
192 cout <<
"*** WARNING: Rotation is not RH "<< endl;
198 rotResult(
float(x.X()),
float(x.Y()),
float(x.Z()),
199 float(y.X()),
float(y.Y()),
float(y.Z()),
200 float(z.X()),
float(z.Y()),
float(z.Z()));
207 cout <<
"Refplane pos " << refPlane->position() << endl;
214 if (refPlane->toGlobal(globalZdir).z()<0.) {
215 globalZdir=-globalZdir;
219 if (chk < .999)
cout <<
"*** WARNING RefPlane check failed!***"
238 sin(startPhi+deltaPhi),0.));
246 GlobalPoint pos_zplus(center_.x(),center_.y(),center_.z()+zhalf);
247 GlobalPoint pos_zminus(center_.x(),center_.y(),center_.z()-zhalf);
252 rCentr*
sin(startPhi),
254 surfaces[
zplus] =
new Plane(pos_zplus, rot_Z);
256 surfaces[
phiplus] =
new Plane(pos_phiplus, rot_phiplus);
260 cout <<
"Actual Center at: " << center_ <<
" R " << center_.perp()
261 <<
" phi " << center_.phi() << endl;
262 cout <<
"RN " << theRN << endl;
264 cout <<
"pos_zplus " << pos_zplus <<
" "
265 << pos_zplus.perp() <<
" " << pos_zplus.phi() << endl
266 <<
"pos_zminus " << pos_zminus <<
" "
267 << pos_zminus.perp() <<
" " << pos_zminus.phi() << endl
268 <<
"pos_phiplus " << pos_phiplus <<
" "
269 << pos_phiplus.perp() <<
" " << pos_phiplus.phi() <<endl
270 <<
"pos_phiminus " << pos_phiminus <<
" "
271 << pos_phiminus.perp() <<
" " << pos_phiminus.phi() <<endl;
273 cout <<
"y_phiplus " << y_phiplus << endl;
274 cout <<
"y_phiminus " << y_phiminus << endl;
287 if (pos_zplus.z() < pos_zminus.z()) {
288 cout <<
"*** WARNING: pos_zplus < pos_zminus " << endl;
291 cout <<
"*** WARNING: pos_phiplus < pos_phiminus " << endl;
301 if (&s1==(surfaces[which_side]).
get()){
306 const float maxtilt = 0.999;
308 const Surface &
s2 = *(surfaces[which_side]);
352 const Cone * co1 =
dynamic_cast<const Cone*
>(&s1);
354 const Cone * co2 =
dynamic_cast<const Cone*
>(&
s2);
377 if (&s1==(surfaces[which_side]).
get()){
378 isAssigned[which_side] =
true;
382 if (!sameSurface(s1,which_side)){
383 cout <<
"***ERROR: setSurface: trying to assign a surface that does not match destination surface. Skipping." << endl;
384 const Surface &
s2 = *(surfaces[which_side]);
395 if (isAssigned[which_side]) {
396 if (&s1!=(surfaces[which_side]).
get()){
397 cout <<
"*** WARNING volumeHandle::setSurface: trying to reassign a surface to a different surface instance" << endl;
401 surfaces[which_side] = &s1;
402 isAssigned[which_side] =
true;
414 return *(surfaces[which_side]);
421 assert(which_side >=0 && which_side <6);
422 return *(surfaces[which_side]);
426 std::vector<VolumeSide>
428 std::vector<VolumeSide>
result;
429 for (
int i=0;
i<6; ++
i){
439 surfaces[i]->side(center_,0.3)));
445 std::vector<std::string>
names;
446 for (handles::const_iterator
i = begin;
448 names.push_back((*i)->name);
451 sort(names.begin(),names.end());
452 std::vector<std::string>::iterator
i = unique(names.begin(),names.end());
453 int nvols = int(i - names.begin());
454 cout << nvols <<
" ";
455 copy(names.begin(),
i, ostream_iterator<std::string>(
cout,
" "));
461 #include "MagneticField/GeomBuilder/src/buildBox.icc"
462 #include "MagneticField/GeomBuilder/src/buildTrap.icc"
463 #include "MagneticField/GeomBuilder/src/buildTubs.icc"
464 #include "MagneticField/GeomBuilder/src/buildCons.icc"
465 #include "MagneticField/GeomBuilder/src/buildPseudoTrap.icc"
466 #include "MagneticField/GeomBuilder/src/buildTruncTubs.icc"
void buildBox(const DDExpandedView &fv)
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
const std::vector< double > & doubles() const
a reference to the double-valued values stored in the given instance of DDValue
Local3DVector LocalVector
DDsvalues_type mergedSpecifics() const
void buildPhiZSurf(double startPhi, double deltaPhi, double zhalf, double rCentr)
DDSolidShape shape() const
The type of the solid.
double deltaPhi(float phi1, float phi2)
void buildTubs(const DDExpandedView &fv)
GlobalVector normalVector() const
std::vector< VolumeSide > sides() const
The surfaces and they orientation, as required to build a MagVolume.
Sin< T >::type sin(const T &t)
Geom::Phi< T > phi() const
void buildPseudoTrap(const DDExpandedView &fv)
const GlobalPoint & center() const
Return the center of the volume.
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
static void printUniqueNames(handles::const_iterator begin, handles::const_iterator end)
Just for debugging...
std::string name
Name of the volume.
DDSolidShape shape() const
Shape of the solid.
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
const DDMaterial & material() const
Returns a reference object of the material this LogicalPart is made of.
GlobalPoint vertex() const
Global position of the cone vertex.
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Scalar radius() const
Radius of the cylinder.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
LocalPoint toLocal(const GlobalPoint &gp) const
Cos< T >::type cos(const T &t)
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
std::maps an index to a DDValue. The index corresponds to the index assigned to the name of the std::...
std::string magFile
Name of magnetic field table file.
void buildCons(const DDExpandedView &fv)
void referencePlane(const DDExpandedView &fv)
volumeHandle(const DDExpandedView &fv, bool expand2Pi=false)
const std::vector< std::string > & strings() const
a reference to the std::string-valued values stored in the given instance of DDValue ...
const Surface & surface(int which_side) const
Get the current surface on specified side.
void buildTrap(const DDExpandedView &fv)
int masterSector
The sector for which an interpolator for this class of volumes should be built.
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the expanded-view.
const PositionType & position() const
Provides an exploded view of the detector (tree-view)
static const HistoName names[]
bool setSurface(const Surface &s1, Sides which_side)
Assign a shared surface perorming sanity checks.
bool sameSurface(const Surface &s1, Sides which_side, float tolerance=0.01)
Find out if two surfaces are the same physical surface.
const std::string & name() const
Returns the name.
Global3DVector GlobalVector
Geom::Theta< float > openingAngle() const
Angle of the cone.
void buildTruncTubs(const DDExpandedView &fv)