CMS 3D CMS Logo

Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Private Attributes

MagGeoBuilderFromDDD::volumeHandle Class Reference

#include <volumeHandle.h>

List of all members.

Public Types

typedef Surface::GlobalPoint GlobalPoint
typedef Surface::LocalPoint LocalPoint
typedef Surface::LocalVector LocalVector
typedef
SurfaceOrientation::GlobalFace 
Sides

Public Member Functions

const GlobalPointcenter () const
 Return the center of the volume.
bool isIron () const
 Temporary hack to pass information on material. Will eventually be replaced!
bool isPlaneMatched (int which_side) const
 if the specified surface has been matched.
Geom::Phi< float > maxPhi () const
 Maximum value of phi covered by the volume.
double maxZ () const
Geom::Phi< float > minPhi () const
 Minimum value of phi covered by the volume.
double minR () const
 Minimum R for any point within the volume.
double minZ () const
 Z limits.
const GloballyPositioned< float > * placement () const
 FIXME: currently returns max RN (to be fixed?). Used by: bLayer::maxR()
int references (int which_side) const
const double RN () const
 Distance of (x,y) plane from origin.
bool sameSurface (const Surface &s1, Sides which_side, float tolerance=0.01)
 Find out if two surfaces are the same physical surface.
bool setSurface (const Surface &s1, Sides which_side)
 Assign a shared surface perorming sanity checks.
DDSolidShape shape () const
 Shape of the solid.
std::vector< VolumeSidesides () const
 The surfaces and they orientation, as required to build a MagVolume.
const Surfacesurface (Sides which_side) const
const Surfacesurface (int which_side) const
 Get the current surface on specified side.
bool toExpand () const
 volumeHandle (const DDExpandedView &fv, bool expand2Pi=false)
 ~volumeHandle ()

Static Public Member Functions

static void printUniqueNames (handles::const_iterator begin, handles::const_iterator end)
 Just for debugging...

Public Attributes

int copyno
 copy number
std::string magFile
 Name of magnetic field table file.
MagVolume6FacesmagVolume
 Pointer to the final MagVolume (must be set from outside)
int masterSector
 The sector for which an interpolator for this class of volumes should be built.
std::string name
 Name of the volume.

Private Member Functions

void buildBox (const DDExpandedView &fv)
void buildCons (const DDExpandedView &fv)
void buildPhiZSurf (double startPhi, double deltaPhi, double zhalf, double rCentr)
void buildPseudoTrap (const DDExpandedView &fv)
void buildTrap (const DDExpandedView &fv)
void buildTruncTubs (const DDExpandedView &fv)
void buildTubs (const DDExpandedView &fv)
volumeHandle operator= (const volumeHandle &v)
void referencePlane (const DDExpandedView &fv)
 volumeHandle (const volumeHandle &v)

Private Attributes

GlobalPoint center_
bool expand
bool isAssigned [6]
bool isIronFlag
GloballyPositioned< float > * refPlane
DDSolid solid
RCPS surfaces [6]
Geom::Phi< float > thePhiMin
double theRMax
double theRMin
double theRN

Detailed Description

A temporary container to cache info on a six-surface volume during the processing. Used to sort, organise, and build shared planes. One instance is created for each DDVolume. The parameters of the boundary surfaces are calculated during construction.

Date:
2009/05/13 15:55:54
Revision:
1.9
Author:
N. Amapane - INFN Torino

Definition at line 27 of file volumeHandle.h.


Member Typedef Documentation

Definition at line 29 of file volumeHandle.h.

Definition at line 30 of file volumeHandle.h.

Definition at line 31 of file volumeHandle.h.

Definition at line 32 of file volumeHandle.h.


Constructor & Destructor Documentation

MagGeoBuilderFromDDD::volumeHandle::volumeHandle ( const DDExpandedView fv,
bool  expand2Pi = false 
)

Definition at line 40 of file volumeHandle.cc.

References buildBox(), buildCons(), buildPseudoTrap(), buildTrap(), buildTruncTubs(), buildTubs(), center(), center_, conv, copyno, gather_cfg::cout, ddbox, ddcons, DDfetch(), ddpseudotrap, ddtrap, ddtrunctubs, ddtubs, MagGeoBuilderFromDDD::debug, DDValue::doubles(), spr::find(), i, isAssigned, isIronFlag, j, DDExpandedView::logicalPart(), magFile, masterSector, DDLogicalPart::material(), DDExpandedView::mergedSpecifics(), name, DDName::name(), DDBase< N, C >::name(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), referencePlane(), DDSolid::shape(), shape(), solid, DDValue::strings(), surfaces, cond::rpcobtemp::temp, theRMax, theRMin, and theRN.

  : name(fv.logicalPart().name().name()),
    copyno(fv.copyno()),
    magVolume(0),
    masterSector(1),
    theRN(0.),
    theRMin(0.),
    theRMax(0.),
    refPlane(0),
    solid(fv.logicalPart().solid()),
    center_(GlobalPoint(fv.translation().x()/cm,
                        fv.translation().y()/cm,
                        fv.translation().z()/cm)),
    expand(expand2Pi),
    isIronFlag(false)
{
  for (int i=0; i<6; ++i) {
    isAssigned[i] = false;
  }

  
  if (MagGeoBuilderFromDDD::debug) {  
    cout.precision(7);
  }
  

  referencePlane(fv);

  if (solid.shape() == ddbox) {
    buildBox(fv);
  } else if (solid.shape() == ddtrap) {
    buildTrap(fv);
  } else if (solid.shape() == ddcons) {
    buildCons(fv);
  } else if (solid.shape() == ddtubs) {   
    buildTubs(fv);
  } else if (solid.shape() == ddpseudotrap) {   
    buildPseudoTrap(fv);
  } else if (solid.shape() == ddtrunctubs) {   
    buildTruncTubs(fv);
  } else {
    cout << "volumeHandle ctor: Unexpected solid: " << (int) solid.shape() << endl;
  }


  DDsvalues_type sv(fv.mergedSpecifics());
    
  { // Extract the name of associated field file.
    std::vector<std::string> temp;
    std::string pname = "table";
    DDValue val(pname);
    DDsvalues_type sv(fv.mergedSpecifics());
    if (DDfetch(&sv,val)) {
      temp = val.strings();
      if (temp.size() != 1) {
        cout << "*** WARNING: volume has > 1 SpecPar " << pname << endl;
      }
      magFile = temp[0];

      string find="[copyNo]";
      std::size_t j;
      for ( ; (j = magFile.find(find)) != string::npos ; ) {
        stringstream conv;
        conv << setfill('0') << setw(2) << copyno;
        string repl;
        conv >> repl;
        magFile.replace(j, find.length(), repl);
      }
      
    } else {
      cout << "*** WARNING: volume does not have a SpecPar " << pname << endl;
      cout << " DDsvalues_type:  " << fv.mergedSpecifics() << endl;
    }
  }

  { // Extract the number of the master sector.
    std::vector<double> temp;
    const std::string pname = "masterSector";
    DDValue val(pname);
    if (DDfetch(&sv,val)) {
      temp = val.doubles();
      if (temp.size() != 1) {
        cout << "*** WARNING: volume has > 1 SpecPar " << pname << endl;
      }
      masterSector = int(temp[0]+.5);
    } else {
      if (MagGeoBuilderFromDDD::debug) { 
        cout << "Volume does not have a SpecPar " << pname 
             << " using: " << copyno << endl;
        cout << " DDsvalues_type:  " << fv.mergedSpecifics() << endl;
      }
      masterSector = copyno;
    }  
  }
  
  // Get material for this volume
  if (fv.logicalPart().material().name().name() == "Iron") isIronFlag=true;  


  if (MagGeoBuilderFromDDD::debug) {  
    cout << " RMin =  " << theRMin <<endl;
    cout << " RMax =  " << theRMax <<endl;
      
    if (theRMin < 0 || theRN < theRMin || theRMax < theRN) 
      cout << "*** WARNING: wrong RMin/RN/RMax , shape: " << (int) shape() << endl;

    cout << "Summary: " << name << " " << copyno
         << " Shape= " << (int) shape()
         << " trasl " << center()
         << " R " << center().perp()
         << " phi " << center().phi()
         << " magFile " << magFile
         << " Material= " << fv.logicalPart().material().name()
         << " isIron= " << isIronFlag
         << " masterSector= " << masterSector << std::endl;

    cout << " Orientation of surfaces:";
    std::string sideName[3] =  {"positiveSide", "negativeSide", "onSurface"};
    for (int i=0; i<6; ++i) {    
      cout << "  " << i << ":" << sideName[surfaces[i]->side(center_,0.3)];
    }
    cout << endl;
  }
}
MagGeoBuilderFromDDD::volumeHandle::~volumeHandle ( )

Definition at line 36 of file volumeHandle.cc.

                                               {
  delete refPlane;
}
MagGeoBuilderFromDDD::volumeHandle::volumeHandle ( const volumeHandle v) [private]

Member Function Documentation

void MagGeoBuilderFromDDD::volumeHandle::buildBox ( const DDExpandedView fv) [private]

Referenced by volumeHandle().

void MagGeoBuilderFromDDD::volumeHandle::buildCons ( const DDExpandedView fv) [private]

Referenced by volumeHandle().

void MagGeoBuilderFromDDD::volumeHandle::buildPhiZSurf ( double  startPhi,
double  deltaPhi,
double  zhalf,
double  rCentr 
) [private]

Definition at line 241 of file volumeHandle.cc.

References funct::cos(), gather_cfg::cout, MagGeoBuilderFromDDD::debug, SurfaceOrientation::phiminus, SurfaceOrientation::phiplus, funct::sin(), SurfaceOrientation::zminus, and SurfaceOrientation::zplus.

                                                                      {
  // This is 100% equal for cons and tubs!!!

  GlobalVector planeXAxis = refPlane->toGlobal(LocalVector( 1, 0, 0));
  GlobalVector planeYAxis = refPlane->toGlobal(LocalVector( 0, 1, 0));
  GlobalVector planeZAxis = refPlane->toGlobal(LocalVector( 0, 0, 1));

  // Local Y axis of the faces at +-phi.
  GlobalVector y_phiplus = refPlane->toGlobal(LocalVector(cos(startPhi+deltaPhi),
                                                          sin(startPhi+deltaPhi),0.));
  GlobalVector y_phiminus = refPlane->toGlobal(LocalVector(cos(startPhi),
                                                           sin(startPhi),0.));

  Surface::RotationType rot_Z(planeXAxis,planeYAxis);
  Surface::RotationType rot_phiplus(planeZAxis, y_phiplus); 
  Surface::RotationType rot_phiminus(planeZAxis, y_phiminus);

  GlobalPoint pos_zplus(center_.x(),center_.y(),center_.z()+zhalf);
  GlobalPoint pos_zminus(center_.x(),center_.y(),center_.z()-zhalf);
  // BEWARE: in this case, the origin for phiplus,phiminus surfaces is 
  // at radius R and not on a plane passing by center_ orthogonal to the radius.
  GlobalPoint pos_phiplus(refPlane->toGlobal(LocalPoint(rCentr*cos(startPhi+deltaPhi),rCentr*sin(startPhi+deltaPhi),0.)));
  GlobalPoint pos_phiminus(refPlane->toGlobal(LocalPoint(rCentr*cos(startPhi),
                                                         rCentr*sin(startPhi),
                                                         0.)));
  surfaces[zplus]    = new Plane(pos_zplus, rot_Z);
  surfaces[zminus]   = new Plane(pos_zminus, rot_Z);
  surfaces[phiplus]  = new Plane(pos_phiplus, rot_phiplus);
  surfaces[phiminus] = new Plane(pos_phiminus, rot_phiminus);  
  
  if (MagGeoBuilderFromDDD::debug) {
    cout << "Actual Center at: " << center_ << " R " << center_.perp()
         << " phi " << center_.phi() << endl;
    cout << "RN            " << theRN << endl;

    cout << "pos_zplus    " << pos_zplus << " "
         << pos_zplus.perp() << " " << pos_zplus.phi() << endl
         << "pos_zminus   " << pos_zminus << " "
         << pos_zminus.perp() << " " << pos_zminus.phi() << endl
         << "pos_phiplus  " << pos_phiplus << " "
         << pos_phiplus.perp() << " " << pos_phiplus.phi() <<endl
         << "pos_phiminus " << pos_phiminus << " "
         << pos_phiminus.perp() << " " << pos_phiminus.phi() <<endl;

    cout << "y_phiplus " << y_phiplus << endl;
    cout << "y_phiminus " << y_phiminus << endl;

    cout << "rot_Z " << surfaces[zplus]->toGlobal(LocalVector(0.,0.,1.)) << endl
         << "rot_phi+ " << surfaces[phiplus]->toGlobal(LocalVector(0.,0.,1.))
         << " phi " << surfaces[phiplus]->toGlobal(LocalVector(0.,0.,1.)).phi()
         << endl
         << "rot_phi- " << surfaces[phiminus]->toGlobal(LocalVector(0.,0.,1.))
         << " phi " << surfaces[phiminus]->toGlobal(LocalVector(0.,0.,1.)).phi()
         << endl;
  }
  
//   // Check ordering.
  if (MagGeoBuilderFromDDD::debug) {
    if (pos_zplus.z() < pos_zminus.z()) {
      cout << "*** WARNING: pos_zplus < pos_zminus " << endl;
    }
    if (Geom::Phi<float>(pos_phiplus.phi()-pos_phiminus.phi()) < 0. ) {
      cout << "*** WARNING: pos_phiplus < pos_phiminus " << endl;
    }
  }
}
void MagGeoBuilderFromDDD::volumeHandle::buildPseudoTrap ( const DDExpandedView fv) [private]

Referenced by volumeHandle().

void MagGeoBuilderFromDDD::volumeHandle::buildTrap ( const DDExpandedView fv) [private]

Referenced by volumeHandle().

void MagGeoBuilderFromDDD::volumeHandle::buildTruncTubs ( const DDExpandedView fv) [private]

Referenced by volumeHandle().

void MagGeoBuilderFromDDD::volumeHandle::buildTubs ( const DDExpandedView fv) [private]

Referenced by volumeHandle().

const Surface::GlobalPoint & MagGeoBuilderFromDDD::volumeHandle::center ( ) const
bool MagGeoBuilderFromDDD::volumeHandle::isIron ( ) const [inline]

Temporary hack to pass information on material. Will eventually be replaced!

Definition at line 108 of file volumeHandle.h.

References isIronFlag.

{return isIronFlag;}
bool MagGeoBuilderFromDDD::volumeHandle::isPlaneMatched ( int  which_side) const [inline]

if the specified surface has been matched.

Definition at line 48 of file volumeHandle.h.

References isAssigned.

                                            {
    return isAssigned[which_side];
  }
Geom::Phi<float> MagGeoBuilderFromDDD::volumeHandle::maxPhi ( ) const [inline]

Maximum value of phi covered by the volume.

Definition at line 79 of file volumeHandle.h.

References SurfaceOrientation::phiplus, GloballyPositioned< T >::position(), and surface().

Referenced by MagGeoBuilderFromDDD::ExtractPhiMax::operator()().

double MagGeoBuilderFromDDD::volumeHandle::maxZ ( ) const [inline]
Geom::Phi<float> MagGeoBuilderFromDDD::volumeHandle::minPhi ( ) const [inline]

Minimum value of phi covered by the volume.

Definition at line 75 of file volumeHandle.h.

References thePhiMin.

{return thePhiMin;}
double MagGeoBuilderFromDDD::volumeHandle::minR ( ) const [inline]

Minimum R for any point within the volume.

Definition at line 88 of file volumeHandle.h.

References theRMin.

{return theRMin;}
double MagGeoBuilderFromDDD::volumeHandle::minZ ( ) const [inline]
volumeHandle MagGeoBuilderFromDDD::volumeHandle::operator= ( const volumeHandle v) [private]
const GloballyPositioned<float>* MagGeoBuilderFromDDD::volumeHandle::placement ( ) const [inline]

FIXME: currently returns max RN (to be fixed?). Used by: bLayer::maxR()

Position and rotation

Definition at line 94 of file volumeHandle.h.

References refPlane.

Referenced by MagGeoBuilderFromDDD::buildInterpolator().

{return refPlane;}
void MagGeoBuilderFromDDD::volumeHandle::printUniqueNames ( handles::const_iterator  begin,
handles::const_iterator  end 
) [static]

Just for debugging...

Definition at line 459 of file volumeHandle.cc.

References filterCSVwithJSON::copy, gather_cfg::cout, end, i, h::names, and python::multivaluedict::sort().

Referenced by MagGeoBuilderFromDDD::bLayer::bLayer(), MagGeoBuilderFromDDD::bRod::bRod(), MagGeoBuilderFromDDD::bSector::bSector(), and MagGeoBuilderFromDDD::eSector::eSector().

                                                                                                               {
    std::vector<std::string> names;
    for (handles::const_iterator i = begin; 
         i != end; ++i){
      names.push_back((*i)->name);
    }
     
    sort(names.begin(),names.end());
    std::vector<std::string>::iterator i = unique(names.begin(),names.end());
    int nvols = int(i - names.begin());
    cout << nvols << " ";
    copy(names.begin(), i, ostream_iterator<std::string>(cout, " "));
     
    cout << endl;
}
void MagGeoBuilderFromDDD::volumeHandle::referencePlane ( const DDExpandedView fv) [private]

Definition at line 170 of file volumeHandle.cc.

References gather_cfg::cout, ddpseudotrap, MagGeoBuilderFromDDD::debug, Vector3DBase< T, FrameTag >::dot(), DDExpandedView::rotation(), x, detailsBasic3DVector::y, and z.

Referenced by volumeHandle().

                                                                             {
  // The refPlane is the "main plane" for the solid. It corresponds to the 
  // x,y plane in the DDD local frame, and defines a frame where the local
  // coordinates are the same as in DDD. 
  // In the geometry version 85l_030919, this plane is normal to the 
  // beam line for all volumes but pseudotraps, so that global R is along Y,
  // global phi is along -X and global Z along Z:
  //
  //   Global(for vol at pi/2)    Local 
  //   +R (+Y)                    +Y
  //   +phi(-X)                   -X
  //   +Z                         +Z
  //
  // For pseudotraps the refPlane is parallel to beam line and global R is
  // along Z, global phi is along +-X and and global Z along Y:
  // 
  //   Global(for vol at pi/2)    Local 
  //   +R (+Y)                    +Z
  //   +phi(-X)                   +X
  //   +Z                         +Y
  //
  // Note that the frame is centered in the DDD volume center, which is
  // inside the volume for DDD boxes and (pesudo)trapezoids, on the beam line
  // for tubs, cons and trunctubs. 

  // In geometry version 1103l, trapezoids have X and Z in the opposite direction
  // than the above.  Boxes are either oriented as described above or in some case 
  // have opposite direction for Y and X.

  // The global position
  Surface::PositionType & posResult = center_;

  // The reference plane rotation
  DD3Vector x, y, z;
  fv.rotation().GetComponents(x,y,z);
  if (MagGeoBuilderFromDDD::debug) {
    if (x.Cross(y).Dot(z) < 0.5) {
      cout << "*** WARNING: Rotation is not RH "<< endl;
    }
  }
  
  // The global rotation
  Surface::RotationType
    rotResult(float(x.X()),float(x.Y()),float(x.Z()),
              float(y.X()),float(y.Y()),float(y.Z()),
              float(z.X()),float(z.Y()),float(z.Z()));

  refPlane = new GloballyPositioned<float>(posResult, rotResult);

  // Check correct orientation
  if (MagGeoBuilderFromDDD::debug) {

    cout << "Refplane pos  " << refPlane->position() << endl;

    // See comments above for the conventions for orientation.
    LocalVector globalZdir(0.,0.,1.); // Local direction of the axis along global Z 
    if (solid.shape() == ddpseudotrap) {
      globalZdir = LocalVector(0.,1.,0.);    
    }
    if (refPlane->toGlobal(globalZdir).z()<0.) {
      globalZdir=-globalZdir;
    }

    float chk = refPlane->toGlobal(globalZdir).dot(GlobalVector(0,0,1));
    if (chk < .999) cout << "*** WARNING RefPlane check failed!***"
                         << chk << endl; 
  }
}
int MagGeoBuilderFromDDD::volumeHandle::references ( int  which_side) const [inline]

Definition at line 52 of file volumeHandle.h.

                                       { // FIXME!
/*     return surfaces[which_side]->references(); */
    return 0;
  }
const double MagGeoBuilderFromDDD::volumeHandle::RN ( ) const [inline]

Distance of (x,y) plane from origin.

Definition at line 39 of file volumeHandle.h.

References theRN.

Referenced by MagGeoBuilderFromDDD::ExtractRN::operator()().

{return theRN;}
bool MagGeoBuilderFromDDD::volumeHandle::sameSurface ( const Surface s1,
Sides  which_side,
float  tolerance = 0.01 
)

Find out if two surfaces are the same physical surface.

Definition at line 313 of file volumeHandle.cc.

References gather_cfg::cout, MagGeoBuilderFromDDD::debug, Vector3DBase< T, FrameTag >::dot(), mag(), Plane::normalVector(), Cone::openingAngle(), p1, p2, GloballyPositioned< T >::position(), Cylinder::radius(), indexGen::s2, GloballyPositioned< T >::toLocal(), and Cone::vertex().

{
  //Check for null comparison
  if (&s1==(surfaces[which_side]).get()){
    if (MagGeoBuilderFromDDD::debug) cout << "      sameSurface: OK (same ptr)" << endl;
    return true;
  }

  const float maxtilt  = 0.999;

  const Surface & s2 = *(surfaces[which_side]);
  // Try with a plane.
  const Plane * p1 = dynamic_cast<const Plane*>(&s1);
  if (p1!=0) {
    const Plane * p2 = dynamic_cast<const Plane*>(&s2);
    if (p2==0) {
      if (MagGeoBuilderFromDDD::debug) cout << "      sameSurface: different types" << endl;
      return false;
    }
    
    if ( (fabs(p1->normalVector().dot(p2->normalVector())) > maxtilt)
         && (fabs((p1->toLocal(p2->position())).z()) < tolerance) ) {
      if (MagGeoBuilderFromDDD::debug) cout << "      sameSurface: OK "
                      << fabs(p1->normalVector().dot(p2->normalVector()))
                      << " " << fabs((p1->toLocal(p2->position())).z()) << endl;
      return true;
    } else{
      if (MagGeoBuilderFromDDD::debug) cout << "      sameSurface: not the same: "
                      << p1->normalVector() << p1->position() << endl
                      << "                                 "
                      << p2->normalVector() << p2->position() << endl
                      << fabs(p1->normalVector().dot(p2->normalVector()))
                      << " " << (p1->toLocal(p2->position())).z()<< endl;
      return false;
    }
  }

  // Try with a cylinder.  
  const Cylinder * cy1 = dynamic_cast<const Cylinder*>(&s1);
  if (cy1!=0) {
    const Cylinder * cy2 = dynamic_cast<const Cylinder*>(&s2);
    if (cy2==0) {
      if (MagGeoBuilderFromDDD::debug) cout << "      sameSurface: different types" << endl;
      return false;
    }
    // Assume axis is the same!
    if (fabs(cy1->radius() - cy2->radius()) < tolerance) {
      return true;
    } else {
      return false;
    }
  }

  // Try with a cone.  
  const Cone * co1 = dynamic_cast<const Cone*>(&s1);
  if (co1!=0) {
    const Cone * co2 = dynamic_cast<const Cone*>(&s2);
    if (co2==0) {
      if (MagGeoBuilderFromDDD::debug) cout << "      sameSurface: different types" << endl;
      return false;
    }
    // FIXME
    if (fabs(co1->openingAngle()-co2->openingAngle()) < maxtilt 
        && (co1->vertex()-co2->vertex()).mag() < tolerance) {
      return true;
    } else {
      return false;
    }
  }

  if (MagGeoBuilderFromDDD::debug) cout << "      sameSurface: unknown surfaces..." << endl;
  return false;
}
bool MagGeoBuilderFromDDD::volumeHandle::setSurface ( const Surface s1,
Sides  which_side 
)

Assign a shared surface perorming sanity checks.

Definition at line 389 of file volumeHandle.cc.

References gather_cfg::cout, MagGeoBuilderFromDDD::debug, mergeVDriftHistosByStation::name, Plane::normalVector(), p1, p2, GloballyPositioned< T >::position(), and indexGen::s2.

{
 //Check for null assignment
  if (&s1==(surfaces[which_side]).get()){
    isAssigned[which_side] = true;
    return true;
  }

  if (!sameSurface(s1,which_side)){
    cout << "***ERROR: setSurface: trying to assign a surface that does not match destination surface. Skipping." << endl;    
    const Surface & s2 = *(surfaces[which_side]);
    //FIXME: Just planes for the time being!!!
    const Plane * p1 = dynamic_cast<const Plane*>(&s1);
    const Plane * p2 = dynamic_cast<const Plane*>(&s2);
    if (p1!=0 && p2 !=0) 
      cout << p1->normalVector() << p1->position() << endl
           << p2->normalVector() << p2->position() << endl;
    return false;
  }
  

  if (isAssigned[which_side]) {
    if (&s1!=(surfaces[which_side]).get()){
      cout << "*** WARNING volumeHandle::setSurface: trying to reassign a surface to a different surface instance" << endl;
      return false;
    }
  } else {
    surfaces[which_side] = &s1;
    isAssigned[which_side] = true;
    if (MagGeoBuilderFromDDD::debug) cout << "     Volume " << name << " # " << copyno << " Assigned: " << (int) which_side << endl;
    return true;
  }

  return false; // let the compiler be happy
}
DDSolidShape MagGeoBuilderFromDDD::volumeHandle::shape ( void  ) const [inline]

Shape of the solid.

Definition at line 97 of file volumeHandle.h.

References DDSolid::shape(), and solid.

Referenced by MagGeoBuilderFromDDD::buildInterpolator(), and volumeHandle().

{return solid.shape();}
std::vector< VolumeSide > MagGeoBuilderFromDDD::volumeHandle::sides ( void  ) const

The surfaces and they orientation, as required to build a MagVolume.

Definition at line 442 of file volumeHandle.cc.

References ddtubs, i, SurfaceOrientation::inner, SurfaceOrientation::phiminus, SurfaceOrientation::phiplus, query::result, and asciidump::s.

Referenced by MagGeoBuilderFromDDD::buildInterpolator().

                                             {
  std::vector<VolumeSide> result;
  for (int i=0; i<6; ++i){
    // If this is just a master volume out of wich a 2pi volume
    // should be built (e.g. central cylinder), skip the phi boundaries.
    if (expand && (i==phiplus || i==phiminus)) continue;

    // FIXME: Skip null inner degenerate cylindrical surface
    if (solid.shape() == ddtubs && i == SurfaceOrientation::inner && theRMin < 0.001) continue;

    ReferenceCountingPointer<Surface> s = const_cast<Surface*> (surfaces[i].get());
    result.push_back(VolumeSide(s, GlobalFace(i),
                                surfaces[i]->side(center_,0.3)));
  }
  return result;
}
const Surface & MagGeoBuilderFromDDD::volumeHandle::surface ( int  which_side) const

Get the current surface on specified side.

Definition at line 435 of file volumeHandle.cc.

Referenced by maxPhi(), maxZ(), and minZ().

                                                              {
  assert(which_side >=0 && which_side <6);
  return *(surfaces[which_side]);
}
const Surface & MagGeoBuilderFromDDD::volumeHandle::surface ( Sides  which_side) const

Definition at line 428 of file volumeHandle.cc.

                                                                {
  return *(surfaces[which_side]);
}
bool MagGeoBuilderFromDDD::volumeHandle::toExpand ( ) const [inline]

Definition at line 105 of file volumeHandle.h.

References expand.

Referenced by MagGeoBuilderFromDDD::buildInterpolator().

{return expand;}

Member Data Documentation

Definition at line 161 of file volumeHandle.h.

Referenced by volumeHandle().

copy number

Definition at line 62 of file volumeHandle.h.

Referenced by MagGeoBuilderFromDDD::build(), MagGeoBuilderFromDDD::buildInterpolator(), and volumeHandle().

Definition at line 165 of file volumeHandle.h.

Referenced by toExpand().

Definition at line 122 of file volumeHandle.h.

Referenced by isPlaneMatched(), and volumeHandle().

Definition at line 168 of file volumeHandle.h.

Referenced by isIron(), and volumeHandle().

Name of magnetic field table file.

Definition at line 60 of file volumeHandle.h.

Referenced by MagGeoBuilderFromDDD::build(), MagGeoBuilderFromDDD::buildInterpolator(), and volumeHandle().

Pointer to the final MagVolume (must be set from outside)

Definition at line 103 of file volumeHandle.h.

The sector for which an interpolator for this class of volumes should be built.

Definition at line 111 of file volumeHandle.h.

Referenced by MagGeoBuilderFromDDD::build(), MagGeoBuilderFromDDD::buildInterpolator(), and volumeHandle().

Name of the volume.

Definition at line 58 of file volumeHandle.h.

Referenced by MagGeoBuilderFromDDD::buildInterpolator(), and volumeHandle().

Definition at line 155 of file volumeHandle.h.

Referenced by placement().

Definition at line 158 of file volumeHandle.h.

Referenced by shape(), and volumeHandle().

Definition at line 120 of file volumeHandle.h.

Referenced by volumeHandle().

Definition at line 150 of file volumeHandle.h.

Referenced by minPhi().

Definition at line 149 of file volumeHandle.h.

Referenced by volumeHandle().

Definition at line 148 of file volumeHandle.h.

Referenced by minR(), and volumeHandle().

Definition at line 144 of file volumeHandle.h.

Referenced by RN(), and volumeHandle().