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 string find=
"[copyNo]";
101 for ( ; (j =
magFile.find(find)) != string::npos ; ) {
103 conv << setfill(
'0') << setw(2) <<
copyno;
106 magFile.replace(j, find.length(), repl);
110 cout <<
"*** WARNING: volume does not have a SpecPar " << pname << endl;
116 std::vector<double>
temp;
117 const std::string pname =
"masterSector";
121 if (temp.size() != 1) {
122 cout <<
"*** WARNING: volume has > 1 SpecPar " << pname << endl;
127 cout <<
"Volume does not have a SpecPar " << pname
128 <<
" using: " <<
copyno << endl;
144 cout <<
"*** WARNING: wrong RMin/RN/RMax , shape: " << (int)
shape() << endl;
147 <<
" Shape= " << (int)
shape()
156 cout <<
" Orientation of surfaces:";
157 std::string sideName[3] = {
"positiveSide",
"negativeSide",
"onSurface"};
158 for (
int i=0;
i<6; ++
i) {
206 if (x.Cross(y).Dot(z) < 0.5) {
207 cout <<
"*** WARNING: Rotation is not RH "<< endl;
213 rotResult(
float(x.X()),
float(x.Y()),
float(x.Z()),
214 float(y.X()),
float(y.Y()),
float(y.Z()),
215 float(z.X()),
float(z.Y()),
float(z.Z()));
222 cout <<
"Refplane pos " << refPlane->position() << endl;
229 if (refPlane->toGlobal(globalZdir).z()<0.) {
230 globalZdir=-globalZdir;
234 if (chk < .999)
cout <<
"*** WARNING RefPlane check failed!***"
253 sin(startPhi+deltaPhi),0.));
261 GlobalPoint pos_zplus(center_.x(),center_.y(),center_.z()+zhalf);
262 GlobalPoint pos_zminus(center_.x(),center_.y(),center_.z()-zhalf);
267 rCentr*
sin(startPhi),
269 surfaces[
zplus] =
new Plane(pos_zplus, rot_Z);
271 surfaces[
phiplus] =
new Plane(pos_phiplus, rot_phiplus);
275 cout <<
"Actual Center at: " << center_ <<
" R " << center_.perp()
276 <<
" phi " << center_.phi() << endl;
277 cout <<
"RN " << theRN << endl;
279 cout <<
"pos_zplus " << pos_zplus <<
" "
280 << pos_zplus.perp() <<
" " << pos_zplus.phi() << endl
281 <<
"pos_zminus " << pos_zminus <<
" "
282 << pos_zminus.perp() <<
" " << pos_zminus.phi() << endl
283 <<
"pos_phiplus " << pos_phiplus <<
" "
284 << pos_phiplus.perp() <<
" " << pos_phiplus.phi() <<endl
285 <<
"pos_phiminus " << pos_phiminus <<
" "
286 << pos_phiminus.perp() <<
" " << pos_phiminus.phi() <<endl;
288 cout <<
"y_phiplus " << y_phiplus << endl;
289 cout <<
"y_phiminus " << y_phiminus << endl;
302 if (pos_zplus.z() < pos_zminus.z()) {
303 cout <<
"*** WARNING: pos_zplus < pos_zminus " << endl;
306 cout <<
"*** WARNING: pos_phiplus < pos_phiminus " << endl;
316 if (&s1==(surfaces[which_side]).
get()){
321 const float maxtilt = 0.999;
323 const Surface &
s2 = *(surfaces[which_side]);
367 const Cone * co1 =
dynamic_cast<const Cone*
>(&s1);
369 const Cone * co2 =
dynamic_cast<const Cone*
>(&
s2);
392 if (&s1==(surfaces[which_side]).
get()){
393 isAssigned[which_side] =
true;
397 if (!sameSurface(s1,which_side)){
398 cout <<
"***ERROR: setSurface: trying to assign a surface that does not match destination surface. Skipping." << endl;
399 const Surface &
s2 = *(surfaces[which_side]);
410 if (isAssigned[which_side]) {
411 if (&s1!=(surfaces[which_side]).
get()){
412 cout <<
"*** WARNING volumeHandle::setSurface: trying to reassign a surface to a different surface instance" << endl;
416 surfaces[which_side] = &s1;
417 isAssigned[which_side] =
true;
429 return *(surfaces[which_side]);
436 assert(which_side >=0 && which_side <6);
437 return *(surfaces[which_side]);
441 std::vector<VolumeSide>
443 std::vector<VolumeSide>
result;
444 for (
int i=0;
i<6; ++
i){
454 surfaces[i]->side(center_,0.3)));
460 std::vector<std::string>
names;
461 for (handles::const_iterator
i = begin;
463 names.push_back((*i)->name);
466 sort(names.begin(),names.end());
467 std::vector<std::string>::iterator
i = unique(names.begin(),names.end());
468 int nvols = int(i - names.begin());
469 cout << nvols <<
" ";
470 copy(names.begin(),
i, ostream_iterator<std::string>(
cout,
" "));
476 #include "MagneticField/GeomBuilder/src/buildBox.icc"
477 #include "MagneticField/GeomBuilder/src/buildTrap.icc"
478 #include "MagneticField/GeomBuilder/src/buildTubs.icc"
479 #include "MagneticField/GeomBuilder/src/buildCons.icc"
480 #include "MagneticField/GeomBuilder/src/buildPseudoTrap.icc"
481 #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)
static HepMC::IO_HEPEVT conv
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
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
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 *.
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::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.
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)
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.
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)