From c22988dfdb96955b217182b18c2fa93616e3d739 Mon Sep 17 00:00:00 2001 From: Frank Gaede <frank.gaede@desy.de> Date: Tue, 10 Feb 2015 13:23:08 +0000 Subject: [PATCH] - added 'dimension' argument to DD4hep_SiTrackerBarrelSurfacePlugin (FG) to handle pixel and strip detectors - updated release notes --- DDDetectors/src/SiTrackerBarrel_surfaces.cpp | 86 ++++++++++++++------ ReadMe.txt | 12 +-- doc/release.notes | 15 +++- 3 files changed, 79 insertions(+), 34 deletions(-) diff --git a/DDDetectors/src/SiTrackerBarrel_surfaces.cpp b/DDDetectors/src/SiTrackerBarrel_surfaces.cpp index 030dce20b..3e5a62ee5 100644 --- a/DDDetectors/src/SiTrackerBarrel_surfaces.cpp +++ b/DDDetectors/src/SiTrackerBarrel_surfaces.cpp @@ -7,33 +7,73 @@ // //==================================================================== // Framework include files +namespace { + struct UserData { + int dimension ; + }; +} + +#define SURFACEINSTALLER_DATA UserData #define DD4HEP_USE_SURFACEINSTALL_HELPER DD4hep_SiTrackerBarrelSurfacePlugin #include "DD4hep/SurfaceInstaller.h" -/// Install measurement surfaces -template <typename UserData> -void Installer<UserData>::install(DetElement component, PlacedVolume pv) { - Volume comp_vol = pv.volume(); - if ( comp_vol.isSensitive() ) { - Volume mod_vol = parentVolume(component); - DD4hep::Geometry::Box mod_shape(mod_vol.solid()), comp_shape(comp_vol.solid()); +namespace{ + template <> void Installer<UserData>::handle_arguments(int argc, char** argv) { + for(int i=0; i<argc; ++i) { + double value = -1; + char* ptr = ::strchr(argv[i],'='); + + if ( ptr ) { + std::string name( argv[i] , ptr ) ; + + value = DD4hep::Geometry::_toDouble(++ptr); - if ( !comp_shape.isValid() || !mod_shape.isValid() ) { - invalidInstaller("Components and/or modules are not boxes -- invalid shapes"); + if( name=="dimension" ) data.dimension = value ; + + std::cout << "DD4hep_SiTrackerBarrelSurfacePlugin: argument[" << i << "] = " << name + << " = " << value << std::endl; + } } - else if ( !handleUsingCache(component,comp_vol) ) { - const double* trans = placementTranslation(component); - double half_module_thickness = mod_shape->GetDZ(); - double sensitive_z_position = trans[2]; - double outer_thickness = half_module_thickness + sensitive_z_position; - double inner_thickness = half_module_thickness - sensitive_z_position; - //Surface is placed at the center of the volume, no need to shift origin - //Make sure u,v,n form a right-handed coordinate system, v along the final z - Vector3D u(-1.,0.,0.), v(0.,-1.,0.), n(0.,0.,1.), o(0.,0.,0.); - - VolPlane surf(comp_vol,Type(Type::Sensitive,Type::Measurement1D), - inner_thickness, outer_thickness, u, v, n, o); - addSurface(component,surf); + } + + + + + /// Install measurement surfaces + template <typename UserData> + void Installer<UserData>::install(DetElement component, PlacedVolume pv) { + Volume comp_vol = pv.volume(); + if ( comp_vol.isSensitive() ) { + Volume mod_vol = parentVolume(component); + DD4hep::Geometry::Box mod_shape(mod_vol.solid()), comp_shape(comp_vol.solid()); + + if ( !comp_shape.isValid() || !mod_shape.isValid() ) { + invalidInstaller("Components and/or modules are not boxes -- invalid shapes"); + } + else if ( !handleUsingCache(component,comp_vol) ) { + const double* trans = placementTranslation(component); + double half_module_thickness = mod_shape->GetDZ(); + double sensitive_z_position = trans[2]; + double outer_thickness = half_module_thickness + sensitive_z_position; + double inner_thickness = half_module_thickness - sensitive_z_position; + //Surface is placed at the center of the volume, no need to shift origin + //Make sure u,v,n form a right-handed coordinate system, v along the final z + Vector3D u(-1.,0.,0.), v(0.,-1.,0.), n(0.,0.,1.), o(0.,0.,0.); + + Type type( Type::Sensitive ) ; + + if( data.dimension == 1 ) { + type.setProperty( Type::Measurement1D , true ) ; + } else if( data.dimension != 2 ) { + throw std::runtime_error("**** DD4hep_SiTrackerBarrelSurfacePlugin: no or wrong 'dimension' argument given - has to be 1 or 2") ; + } + + VolPlane surf(comp_vol, type, inner_thickness, outer_thickness, u, v, n, o); + + addSurface(component,surf); + } } } -} + + +}// namespace diff --git a/ReadMe.txt b/ReadMe.txt index 7a659597c..2974b2006 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -30,7 +30,7 @@ to Geant4. The Geant4 installation needs to be located using the variable -DGean - examples - Contains different detector examples (CLICSiD, ILDExDet, ILDExSimu) together with example applications to illustrate + Contains different detector examples (CLICSiD, AlignDet, ClientTests) together with example applications to illustrate the their usage for simulation, reconstruction and visualization with an emphasis to minimize software dependencies. For instance, the simulation application example will require to compiler and link against Geant4 but not the reconstruction application. @@ -211,14 +211,6 @@ or build all examples in one go: make install ; make test - or: - ctest -V -R converter - ctest -V -R sim - ctest -V -R noviceN04 + ... -9) run SLIC simulation on lccd file created with DD4Hep: - - -# make sure slic is in the path and then: -slic -g ./ILD_toy.lcdd -o ILD_toy.slcio -x -m ../DD4hep/DDExamples/ILDExSimu/run1.mac diff --git a/doc/release.notes b/doc/release.notes index ff8f571be..674bfe899 100644 --- a/doc/release.notes +++ b/doc/release.notes @@ -12,7 +12,8 @@ DD4hep ---- Release Notes - DDDetectors - new Package containing generic DD4hep detector palette (MF) - + - added 'dimension' argument to DD4hep_SiTrackerBarrelSurfacePlugin (FG) + to handle pixel and strip detectors - DDRec (FG) - added simple data structs in DDRec/DetectorData.h @@ -52,6 +53,7 @@ DD4hep ---- Release Notes - fixed LCDD el-mag. field converter - add generic surface installers - allow for string constants in lcdd define section + - added arguments for surface plugins - DDSegmentation (FG) : - fixed compiler warning w/ left shift count >= width of type @@ -61,6 +63,8 @@ DD4hep ---- Release Notes - examples - add new test MiniTel(escope) to ClientTests (MF) + - moved old obsolete examples to attic + - CMake: - made DD4HEP_USE_BOOST an option flag (FG) @@ -77,6 +81,15 @@ DD4hep ---- Release Notes - fixed code formating with emacs style: ./doc/format_code.sh + - removed subpackages ( moved to https://svnsrv.desy.de/public/aidasoft/DD4hep/attic ): + DDExamples_obs/ + DDSense/ + examples/ILDExDet/ + examples/ILDExSimu/ + examples/firstExample/ + examples/noviceN04/ + + - plus many small bug fixes (use svn log for details ) -- GitLab