21 #include "CLHEP/Units/GlobalSystemOfUnits.h"
29 #include <boost/lexical_cast.hpp>
31 using namespace SurfaceOrientation;
48 solid(fv.logicalPart().solid()),
50 fv.translation().
y()/cm,
51 fv.translation().
z()/cm)),
56 string volName =
name;
57 volName.erase(0,volName.rfind(
'_')+1);
58 volumeno =boost::lexical_cast<
unsigned short>(volName);
60 for (
int i=0;
i<6; ++
i) {
85 cout <<
"volumeHandle ctor: Unexpected solid: " << (int)
solid.
shape() << endl;
149 cout <<
"*** WARNING: wrong RMin/RN/RMax , shape: " << (int)
shape() << endl;
152 <<
" Shape= " << (int)
shape()
161 cout <<
" Orientation of surfaces:";
162 std::string sideName[3] = {
"positiveSide",
"negativeSide",
"onSurface"};
163 for (
int i=0;
i<6; ++
i) {
211 if (x.Cross(y).Dot(z) < 0.5) {
212 cout <<
"*** WARNING: Rotation is not RH "<< endl;
218 rotResult(
float(x.X()),
float(x.Y()),
float(x.Z()),
219 float(y.X()),
float(y.Y()),
float(y.Z()),
220 float(z.X()),
float(z.Y()),
float(z.Z()));
227 cout <<
"Refplane pos " << refPlane->position() << endl;
234 if (refPlane->toGlobal(globalZdir).z()<0.) {
235 globalZdir=-globalZdir;
239 if (chk < .999)
cout <<
"*** WARNING RefPlane check failed!***"
258 sin(startPhi+deltaPhi),0.));
266 GlobalPoint pos_zplus(center_.x(),center_.y(),center_.z()+zhalf);
267 GlobalPoint pos_zminus(center_.x(),center_.y(),center_.z()-zhalf);
272 rCentr*
sin(startPhi),
274 surfaces[
zplus] =
new Plane(pos_zplus, rot_Z);
276 surfaces[
phiplus] =
new Plane(pos_phiplus, rot_phiplus);
280 cout <<
"Actual Center at: " << center_ <<
" R " << center_.perp()
281 <<
" phi " << center_.phi() << endl;
282 cout <<
"RN " << theRN << endl;
284 cout <<
"pos_zplus " << pos_zplus <<
" "
285 << pos_zplus.perp() <<
" " << pos_zplus.phi() << endl
286 <<
"pos_zminus " << pos_zminus <<
" "
287 << pos_zminus.perp() <<
" " << pos_zminus.phi() << endl
288 <<
"pos_phiplus " << pos_phiplus <<
" "
289 << pos_phiplus.perp() <<
" " << pos_phiplus.phi() <<endl
290 <<
"pos_phiminus " << pos_phiminus <<
" "
291 << pos_phiminus.perp() <<
" " << pos_phiminus.phi() <<endl;
293 cout <<
"y_phiplus " << y_phiplus << endl;
294 cout <<
"y_phiminus " << y_phiminus << endl;
307 if (pos_zplus.z() < pos_zminus.z()) {
308 cout <<
"*** WARNING: pos_zplus < pos_zminus " << endl;
311 cout <<
"*** WARNING: pos_phiplus < pos_phiminus " << endl;
321 if (&s1==(surfaces[which_side]).
get()){
326 const float maxtilt = 0.999;
328 const Surface &
s2 = *(surfaces[which_side]);
372 const Cone * co1 =
dynamic_cast<const Cone*
>(&s1);
374 const Cone * co2 =
dynamic_cast<const Cone*
>(&
s2);
397 if (&s1==(surfaces[which_side]).
get()){
398 isAssigned[which_side] =
true;
402 if (!sameSurface(s1,which_side)){
403 cout <<
"***ERROR: setSurface: trying to assign a surface that does not match destination surface. Skipping." << endl;
404 const Surface &
s2 = *(surfaces[which_side]);
415 if (isAssigned[which_side]) {
416 if (&s1!=(surfaces[which_side]).
get()){
417 cout <<
"*** WARNING volumeHandle::setSurface: trying to reassign a surface to a different surface instance" << endl;
421 surfaces[which_side] = &s1;
422 isAssigned[which_side] =
true;
434 return *(surfaces[which_side]);
441 assert(which_side >=0 && which_side <6);
442 return *(surfaces[which_side]);
446 std::vector<VolumeSide>
448 std::vector<VolumeSide>
result;
449 for (
int i=0;
i<6; ++
i){
459 surfaces[i]->side(center_,0.3)));
465 std::vector<std::string>
names;
466 for (handles::const_iterator
i = begin;
468 if (uniq) names.push_back((*i)->name);
469 else names.push_back((*i)->name+
":"+boost::lexical_cast<string>((*i)->copyno));
472 sort(names.begin(),names.end());
474 std::vector<std::string>::iterator
i = unique(names.begin(),names.end());
475 int nvols = int(i - names.begin());
476 cout << nvols <<
" ";
477 copy(names.begin(),
i, ostream_iterator<std::string>(
cout,
" "));
479 cout << names.size() <<
" ";
480 copy(names.begin(), names.end(), ostream_iterator<std::string>(
cout,
" "));
486 #include "MagneticField/GeomBuilder/src/buildBox.icc"
487 #include "MagneticField/GeomBuilder/src/buildTrap.icc"
488 #include "MagneticField/GeomBuilder/src/buildTubs.icc"
489 #include "MagneticField/GeomBuilder/src/buildCons.icc"
490 #include "MagneticField/GeomBuilder/src/buildPseudoTrap.icc"
491 #include "MagneticField/GeomBuilder/src/buildTruncTubs.icc"
unsigned short copyno
copy number
void buildBox(const DDExpandedView &fv)
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
Local3DVector LocalVector
void buildPhiZSurf(double startPhi, double deltaPhi, double zhalf, double rCentr)
static const HistoName names[]
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
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
std::string name
Name of the volume.
DDSolidShape shape() const
Shape of the solid.
GlobalPoint vertex() const
Global position of the cone vertex.
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::string magFile
Name of magnetic field table file.
DDSolidShape shape(void) const
The type of the solid.
void buildCons(const DDExpandedView &fv)
void referencePlane(const DDExpandedView &fv)
volumeHandle(const DDExpandedView &fv, bool expand2Pi=false)
unsigned short volumeno
volume number
static void printUniqueNames(handles::const_iterator begin, handles::const_iterator end, bool uniq=true)
Just for debugging...
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.
volatile std::atomic< bool > shutdown_flag false
const PositionType & position() const
Provides an exploded view of the detector (tree-view)
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.
const DDMaterial & material(void) const
Returns a reference object of the material this LogicalPart is made of.
Global3DVector GlobalVector
Geom::Theta< float > openingAngle() const
Angle of the cone.
void buildTruncTubs(const DDExpandedView &fv)