diff --git a/DDCore/include/DD4hep/Fields.h b/DDCore/include/DD4hep/Fields.h index b26be8dd4bf85bd6071d1e4c22a0033036442079..3a586a236ca644435098c8c04dc71a8e07545707 100644 --- a/DDCore/include/DD4hep/Fields.h +++ b/DDCore/include/DD4hep/Fields.h @@ -177,7 +177,7 @@ namespace dd4hep { combinedElectric((const double*) &pos, field); } - /// + /// Returns the 3 electric field components (x, y, z) if many components are present Direction combinedElectric(const Position& pos) const { Direction field; combinedElectric((const double*) &pos, (double*) &field); @@ -195,7 +195,7 @@ namespace dd4hep { /// Returns the 3 magnetic field components (x, y, z) if many components are present void combinedMagnetic(const double* pos, double* field) const; - /// + /// Returns the 3 magnetic field components (x, y, z) at a given position Direction combinedMagnetic(const Position& pos) const { Direction field; combinedMagnetic((const double*) &pos, (double*) &field); @@ -212,7 +212,7 @@ namespace dd4hep { electricField((double*) &pos, field); } - /// + /// Returns the 3 electric field components (x, y, z) at a given position Direction electricField(const Position& pos) const { Direction field; electricField((const double*) &pos, (double*) &field); @@ -231,7 +231,7 @@ namespace dd4hep { magneticField((double*) &pos, (double*) &field); } - /// + /// Returns the 3 electric field components (x, y, z) at a given position Direction magneticField(const Position& pos) const { Direction field; magneticField((double*) &pos, (double*) &field); diff --git a/DDG4/examples/initAClick.C b/DDG4/examples/initAClick.C index 7b817df9767c91a9e0ab92740785c3b61d29fee6..03a044dd976beda1409c834695465d598d18bb02 100644 --- a/DDG4/examples/initAClick.C +++ b/DDG4/examples/initAClick.C @@ -63,7 +63,7 @@ int initAClick(const char* command=0) { std::string defs = ""; std::string libs = " -L"+rootsys+"/lib"; std::string inc = " -I"+dd4hep+"/examples/DDG4/examples -I"+dd4hep + " -I"+dd4hep+"/include"; - libs += " -L"+dd4hep+"/lib -lDDCore -lDDG4 -lDDSegmentation"; + libs += " -L"+dd4hep+"/lib -lDDCore -lDDG4"; if ( !geant4.empty() ) { inc += " -I"+geant4+"/include/Geant4"; #ifdef __APPLE__ diff --git a/examples/LHeD/compact/compact_Lhe_dip_sol_ell.xml b/examples/LHeD/compact/compact_Lhe_dip_sol_ell.xml index 1631f46026e4fa16e807cb1135589200f02a3d5d..c0923fd07d978e5c3f5e90c1ac8bb7bdef5acc49 100644 --- a/examples/LHeD/compact/compact_Lhe_dip_sol_ell.xml +++ b/examples/LHeD/compact/compact_Lhe_dip_sol_ell.xml @@ -36,7 +36,7 @@ </includes> <define> - <constant name="Lhe_Detector_dir" value="${DD4hep}/examples/LHeD/" type="string"/>; + <constant name="Lhe_Detector_dir" value="${DD4hepINSTALL}/examples/LHeD/" type="string"/>; <constant name="world_side" value="20.*m"/> <constant name="world_x" value="world_side"/> <constant name="world_y" value="world_side"/> diff --git a/examples/LHeD/src/Lhe_BP_SiTrackerEndcap2_geo.cpp b/examples/LHeD/src/Lhe_BP_SiTrackerEndcap2_geo.cpp index f45c55cee0c580ae598110435aceeebcda2a86e3..5124dc5950ccba88af664f1ddc6e1488ce527fa7 100644 --- a/examples/LHeD/src/Lhe_BP_SiTrackerEndcap2_geo.cpp +++ b/examples/LHeD/src/Lhe_BP_SiTrackerEndcap2_geo.cpp @@ -25,8 +25,6 @@ using namespace dd4hep::detail; static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector sens) { typedef vector<PlacedVolume> Placements; - double ra = 0.; - double rb = 0.; xml_det_t x_det = e; Material vacuum = description.vacuum(); int det_id = x_det.id(); @@ -34,8 +32,8 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s bool reflect = x_det.reflect(false); DetElement sdet (det_name,det_id); Assembly assembly (det_name); - ra = x_det.rmax(); // ellipse long radius - y - rb = x_det.r(); // ellipse short radius - x + // MSF: unused! double ra = x_det.rmax(); // ellipse long radius - y + // MSF: unused! double rb = x_det.r(); // ellipse short radius - x //Volume assembly (det_name,Box(10000,10000,10000),vacuum); Volume motherVol = description.pickMotherVolume(sdet); int m_id=0, c_id=0, n_sensor=0; diff --git a/examples/LHeD/src/Lhe_BeamPipe_Central_geo.cpp b/examples/LHeD/src/Lhe_BeamPipe_Central_geo.cpp index 6dfa67de8ca5770a3e22e0db95a285a4ce06e36a..977d22962096b7b90a094903d23295080fe0d987 100644 --- a/examples/LHeD/src/Lhe_BeamPipe_Central_geo.cpp +++ b/examples/LHeD/src/Lhe_BeamPipe_Central_geo.cpp @@ -26,22 +26,12 @@ #include <map> #include <string> -using dd4hep::Transform3D; -using dd4hep::Position; -using dd4hep::RotationY; -using dd4hep::RotateY; -using dd4hep::ConeSegment; -using dd4hep::SubtractionSolid; -using dd4hep::Material; -using dd4hep::Volume; -using dd4hep::Solid; -using dd4hep::Tube; -namespace units = dd4hep; -using dd4hep::rec::Vector3D; -using dd4hep::rec::VolCylinder; -using dd4hep::rec::VolCone; -using dd4hep::rec::SurfaceType; +//using dd4hep::rec::Vector3D; +//using dd4hep::rec::VolCylinder; +//using dd4hep::rec::VolCone; +//using dd4hep::rec::SurfaceType; +namespace units = dd4hep; using namespace std; using namespace dd4hep; using namespace dd4hep::detail; @@ -51,9 +41,9 @@ class SimpleCylinderImpl : public dd4hep::rec::VolCylinderImpl{ double _half_length ; public: /// standard c'tor with all necessary arguments - origin is (0,0,0) if not given. - SimpleCylinderImpl( dd4hep::Volume vol, SurfaceType type, - double thickness_inner ,double thickness_outer, Vector3D origin ) : - dd4hep::rec::VolCylinderImpl( vol, type, thickness_inner, thickness_outer, origin ), + SimpleCylinderImpl( Volume vol, rec::SurfaceType type, + double thickness_inner ,double thickness_outer, rec::Vector3D origin ) : + rec::VolCylinderImpl( vol, type, thickness_inner, thickness_outer, origin ), _half_length(0){ } void setHalfLength( double half_length){ @@ -62,17 +52,17 @@ public: void setID( dd4hep::long64 id ) { _id = id ; } // overwrite to include points inside the inner radius of the barrel - bool insideBounds(const Vector3D& point, double epsilon) const { + bool insideBounds(const rec::Vector3D& point, double epsilon) const { return ( std::abs( point.rho() - origin().rho() ) < epsilon && std::abs( point.z() ) < _half_length ) ; } - virtual std::vector< std::pair<Vector3D, Vector3D> > getLines(unsigned nMax=100){ + virtual std::vector< std::pair<rec::Vector3D, rec::Vector3D> > getLines(unsigned nMax=100){ - std::vector< std::pair<Vector3D, Vector3D> > lines ; + std::vector< std::pair<rec::Vector3D, rec::Vector3D> > lines ; lines.reserve( nMax ) ; - Vector3D zv( 0. , 0. , _half_length ) ; + rec::Vector3D zv( 0. , 0. , _half_length ) ; double r = _o.rho() ; unsigned n = nMax / 4 ; @@ -80,13 +70,13 @@ public: for( unsigned i = 0 ; i < n ; ++i ) { - Vector3D rv0( r*sin( i *dPhi ) , r*cos( i *dPhi ) , 0. ) ; - Vector3D rv1( r*sin( (i+1)*dPhi ) , r*cos( (i+1)*dPhi ) , 0. ) ; + rec::Vector3D rv0( r*sin( i *dPhi ) , r*cos( i *dPhi ) , 0. ) ; + rec::Vector3D rv1( r*sin( (i+1)*dPhi ) , r*cos( (i+1)*dPhi ) , 0. ) ; - Vector3D pl0 = zv + rv0 ; - Vector3D pl1 = zv + rv1 ; - Vector3D pl2 = -zv + rv1 ; - Vector3D pl3 = -zv + rv0 ; + rec::Vector3D pl0 = zv + rv0 ; + rec::Vector3D pl1 = zv + rv1 ; + rec::Vector3D pl2 = -zv + rv1 ; + rec::Vector3D pl3 = -zv + rv0 ; lines.push_back( std::make_pair( pl0, pl1 ) ) ; lines.push_back( std::make_pair( pl1, pl2 ) ) ; @@ -97,11 +87,11 @@ public: } }; -class SimpleCylinder : public dd4hep::rec::VolSurface{ +class SimpleCylinder : public rec::VolSurface{ public: - SimpleCylinder( dd4hep::Volume vol, dd4hep::rec::SurfaceType type, double thickness_inner , - double thickness_outer, Vector3D origin ) : - dd4hep::rec::VolSurface( new SimpleCylinderImpl( vol, type, thickness_inner , thickness_outer, origin ) ) { + SimpleCylinder( Volume vol, rec::SurfaceType type, double thickness_inner , + double thickness_outer, rec::Vector3D origin ) : + rec::VolSurface( new SimpleCylinderImpl(vol, type, thickness_inner , thickness_outer, origin ) ) { } SimpleCylinderImpl* operator->() { return static_cast<SimpleCylinderImpl*>( _surf ) ; } } ; @@ -110,20 +100,20 @@ public: static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector sens) { printout(dd4hep::DEBUG,"Lhe_Beampipe", "Creating Beampipe" ) ; -// typedef vector<PlacedVolume> Placements; + // typedef vector<PlacedVolume> Placements; xml_det_t x_det = e; string name = x_det.nameStr(); DetElement sdet (name,x_det.id()); Material mat (description.material(x_det.materialStr())); -// vector<double> rmin,rmax,z,thickness; + // vector<double> rmin,rmax,z,thickness; double rmin, rmax, thickness, z; -// PlacedVolume pv; + // PlacedVolume pv; -// multiplication factor for ellipse major radius -// rmin ellipse short radius -// rmax ellipse long radius -// thickness BP thickness -// z z-length + // multiplication factor for ellipse major radius + // rmin ellipse short radius + // rmax ellipse long radius + // thickness BP thickness + // z z-length rmax = 1.; thickness = 1.; rmin = 1.; @@ -134,18 +124,15 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s rmax = dim.rmax(); thickness = dim.thickness(); z = dim.z(); -// rmin.push_back(dim.rmin()); -// rmax.push_back(dim.rmax()); -// z.push_back(dim.z()); -// thickness.push_back(dim.thickness()); + // rmin.push_back(dim.rmin()); + // rmax.push_back(dim.rmax()); + // z.push_back(dim.z()); + // thickness.push_back(dim.thickness()); } - double ra = 1.; // ellipse long radius init - ra = rmax; // ellipse long radius - double rb = 1.; // ellipse short radius init - rb = rmin; // ellipse short radius - double thick = 1.; // BP thickness - thick = thickness; // BP thickness + double ra = rmax; // ellipse long radius init + double rb = rmin; // ellipse short radius init + double thick = thickness; // BP thickness EllipticalTube bpElTubeOut(ra+thick, rb+thick, z); EllipticalTube bpElTubeInn(ra, rb, z+thick); @@ -158,54 +145,54 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s SubtractionSolid beamTube(beamTube1,bpTube2); Volume det_vol(name, beamTube, mat); - PlacedVolume pv = description.pickMotherVolume(sdet).placeVolume(det_vol,Position(0,0,0)); + PlacedVolume pv_det = description.pickMotherVolume(sdet).placeVolume(det_vol,Position(0,0,0)); double z_offset = x_det.hasAttr(_U(z_offset)) ? x_det.z_offset() : 0.0; bool reflect = x_det.hasAttr(_U(reflect)) ? x_det.reflect() : false; -if ( z_offset >= 0 ) { - if ( reflect) { - PlacedVolume pv = description.pickMotherVolume(sdet).placeVolume(det_vol,Position(0,0,0)); - sdet.setPlacement(pv); - det_vol.setVisAttributes(description, x_det.visStr()); - det_vol.setLimitSet(description, x_det.limitsStr()); - det_vol.setRegion(description, x_det.regionStr()); - if ( x_det.isSensitive() ) { - SensitiveDetector sd = sens; - xml_dim_t sd_typ = x_det.child(_U(sensitive)); - det_vol.setSensitiveDetector(sens); - sd.setType(sd_typ.typeStr()); - } - } else { - PlacedVolume pv = description.pickMotherVolume(sdet).placeVolume(det_vol,Position(0,0,z_offset)); - sdet.setPlacement(pv); - det_vol.setVisAttributes(description, x_det.visStr()); - det_vol.setLimitSet(description, x_det.limitsStr()); - det_vol.setRegion(description, x_det.regionStr()); - if ( x_det.isSensitive() ) { - SensitiveDetector sd = sens; - xml_dim_t sd_typ = x_det.child(_U(sensitive)); - det_vol.setSensitiveDetector(sens); - sd.setType(sd_typ.typeStr()); + if ( z_offset >= 0 ) { + if ( reflect) { + PlacedVolume pv = description.pickMotherVolume(sdet).placeVolume(det_vol,Position(0,0,0)); + sdet.setPlacement(pv); + det_vol.setVisAttributes(description, x_det.visStr()); + det_vol.setLimitSet(description, x_det.limitsStr()); + det_vol.setRegion(description, x_det.regionStr()); + if ( x_det.isSensitive() ) { + SensitiveDetector sd = sens; + xml_dim_t sd_typ = x_det.child(_U(sensitive)); + det_vol.setSensitiveDetector(sens); + sd.setType(sd_typ.typeStr()); + } + } else { + PlacedVolume pv = description.pickMotherVolume(sdet).placeVolume(det_vol,Position(0,0,z_offset)); + sdet.setPlacement(pv); + det_vol.setVisAttributes(description, x_det.visStr()); + det_vol.setLimitSet(description, x_det.limitsStr()); + det_vol.setRegion(description, x_det.regionStr()); + if ( x_det.isSensitive() ) { + SensitiveDetector sd = sens; + xml_dim_t sd_typ = x_det.child(_U(sensitive)); + det_vol.setSensitiveDetector(sens); + sd.setType(sd_typ.typeStr()); + } } - } } else { - PlacedVolume pv = description.pickMotherVolume(sdet).placeVolume(det_vol,Position(0,0,z_offset-z)); - sdet.setPlacement(pv); - det_vol.setVisAttributes(description, x_det.visStr()); - det_vol.setLimitSet(description, x_det.limitsStr()); - det_vol.setRegion(description, x_det.regionStr()); - if ( x_det.isSensitive() ) { - SensitiveDetector sd = sens; - xml_dim_t sd_typ = x_det.child(_U(sensitive)); - det_vol.setSensitiveDetector(sens); - sd.setType(sd_typ.typeStr()); + PlacedVolume pv = description.pickMotherVolume(sdet).placeVolume(det_vol,Position(0,0,z_offset-z)); + sdet.setPlacement(pv); + det_vol.setVisAttributes(description, x_det.visStr()); + det_vol.setLimitSet(description, x_det.limitsStr()); + det_vol.setRegion(description, x_det.regionStr()); + if ( x_det.isSensitive() ) { + SensitiveDetector sd = sens; + xml_dim_t sd_typ = x_det.child(_U(sensitive)); + det_vol.setSensitiveDetector(sens); + sd.setType(sd_typ.typeStr()); } } if ( x_det.hasAttr(_U(id)) ) { int det_id = x_det.id(); - pv.addPhysVolID("system",det_id); + pv_det.addPhysVolID("system",det_id); } return sdet; }