From 544cbfa05601434ff4f5413a0103588fe2f695a8 Mon Sep 17 00:00:00 2001 From: Markus Frank <Markus.Frank@cern.ch> Date: Tue, 1 Oct 2019 16:56:44 +0200 Subject: [PATCH] Fix examples to handle TGeoScaledShape --- DDCore/src/DetectorImp.cpp | 5 +- DDCore/src/plugins/LCDDConverter.cpp | 15 +++++- DDG4/examples/readHEPMC.py | 6 ++- DDG4/plugins/Geant4EventReaderHepMC.cpp | 4 ++ DDG4/src/Geant4Converter.cpp | 49 ++++++++++--------- examples/CLICSiD/CMakeLists.txt | 4 +- examples/ClientTests/compact/MiniTel.xml | 40 +++++++-------- examples/ClientTests/src/MiniTel.cpp | 6 +-- examples/DDDB/include/Detector/DeVeloSensor.h | 16 +++--- .../SimpleDetector/src/ZPlanarTracker_geo.cpp | 2 +- 10 files changed, 84 insertions(+), 63 deletions(-) diff --git a/DDCore/src/DetectorImp.cpp b/DDCore/src/DetectorImp.cpp index ece2ef65d..f89d06c39 100644 --- a/DDCore/src/DetectorImp.cpp +++ b/DDCore/src/DetectorImp.cpp @@ -164,6 +164,7 @@ DetectorImp::DetectorImp(const string& name) #if ROOT_VERSION_CODE >= ROOT_VERSION(6,20,0) //TGeoUnit::setUnitType(TGeoUnit::kTGeant4Units); #endif + SetName(name.c_str()); SetTitle("DD4hep detector description object"); set_terminate( description_unexpected ); InstanceCount::increment(this); @@ -202,13 +203,13 @@ DetectorImp::~DetectorImp() { if ( m_manager ) { lock_guard<recursive_mutex> lock(detector_instances().lock); if ( m_manager == gGeoManager ) gGeoManager = 0; - Detector* description = detector_instances().get(m_manager->GetName()); + Detector* description = detector_instances().get(GetName()); if ( 0 != description ) { detector_instances().remove(m_manager->GetName()); } } deletePtr(m_surfaceManager); - destroyData(true); + destroyData(false); m_extensions.clear(); InstanceCount::decrement(this); } diff --git a/DDCore/src/plugins/LCDDConverter.cpp b/DDCore/src/plugins/LCDDConverter.cpp index ecf007aec..c0afbe2c2 100644 --- a/DDCore/src/plugins/LCDDConverter.cpp +++ b/DDCore/src/plugins/LCDDConverter.cpp @@ -46,7 +46,6 @@ #include "TGeoTrd2.h" #include "TGeoTube.h" #include "TGeoScaledShape.h" -//#include "TGeoEllipsoid.h" #include "TGeoNode.h" #include "TClass.h" @@ -473,6 +472,20 @@ xml_h LCDDConverter::handleSolid(const string& name, const TGeoShape* shape) con solid.setAttr(_U(dz), sh->GetDz()); solid.setAttr(_U(lunit), "cm"); } + else if (isa == TGeoScaledShape::Class()) { + TGeoScaledShape* sh = (TGeoScaledShape*) shape; + const double* vals = sh->GetScale()->GetScale(); + Solid s_sh(sh->GetShape()); + handleSolid(s_sh.name(), s_sh.ptr()); + geo.doc_solids.append(solid = xml_elt_t(geo.doc, _U(scale))); + solid.setAttr(_U(name), Unicode(shape_name)); + solid.setAttr(_U(shape), s_sh.name()); + solid.setAttr(_U(x), vals[0]); + solid.setAttr(_U(y), vals[1]); + solid.setAttr(_U(z), vals[2]); + solid.setAttr(_U(aunit), "deg"); + solid.setAttr(_U(lunit), "cm"); + } else if (isa == TGeoCompositeShape::Class() || isa == TGeoUnion::Class() || isa == TGeoIntersection::Class() || diff --git a/DDG4/examples/readHEPMC.py b/DDG4/examples/readHEPMC.py index e43f235df..d8eccc9c2 100644 --- a/DDG4/examples/readHEPMC.py +++ b/DDG4/examples/readHEPMC.py @@ -7,7 +7,7 @@ dd4hep simulation example setup using the python configuration """ from __future__ import absolute_import, unicode_literals -import logging +import os, logging logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO) logger = logging.getLogger(__name__) @@ -29,11 +29,13 @@ def run(input_file): evtid = 0 while ret: try: + parts.clear() + prim_vtx.clear() ret = gen.readParticles(evtid, prim_vtx, parts) evtid = evtid + 1 except Exception as X: logger.error('\nException: readParticles: %s', str(X)) - ret = None + if evtid > 0: os._exit(0); if ret: for v in prim_vtx: logger.info('Mask:%04X (X:%8.2g,Y:%8.2g,Z:%8.2g) time:%8.2g Outgoing:%4d particles', diff --git a/DDG4/plugins/Geant4EventReaderHepMC.cpp b/DDG4/plugins/Geant4EventReaderHepMC.cpp index ad0afc49d..361ad5d1e 100644 --- a/DDG4/plugins/Geant4EventReaderHepMC.cpp +++ b/DDG4/plugins/Geant4EventReaderHepMC.cpp @@ -239,6 +239,8 @@ Geant4EventReaderHepMC::readParticles(int /* ev_id */, primary_vertex->z = 0; if ( !m_events->ok() ) { + vertices.clear(); + output.clear(); return EVENT_READER_EOF; } else if ( m_events->read() ) { @@ -283,6 +285,8 @@ Geant4EventReaderHepMC::readParticles(int /* ev_id */, ++m_currEvent; return EVENT_READER_OK; } + vertices.clear(); + output.clear(); return EVENT_READER_EOF; } diff --git a/DDG4/src/Geant4Converter.cpp b/DDG4/src/Geant4Converter.cpp index 19d2628b9..aca245643 100644 --- a/DDG4/src/Geant4Converter.cpp +++ b/DDG4/src/Geant4Converter.cpp @@ -571,50 +571,51 @@ void* Geant4Converter::handleMaterial(const string& name, Material medium) const void* Geant4Converter::handleSolid(const string& name, const TGeoShape* shape) const { G4VSolid* solid = 0; if (shape) { - PrintLevel lvl = debugShapes ? ALWAYS : outputLevel; if (0 != (solid = data().g4Solids[shape])) { return solid; } - else if (shape->IsA() == TGeoShapeAssembly::Class()) { + TClass* isa = shape->IsA(); + PrintLevel lvl = debugShapes ? ALWAYS : outputLevel; + if (isa == TGeoShapeAssembly::Class()) { // Assemblies have no corresponding 'shape' in Geant4. Ignore the shape translation. // It does not harm, since this 'shape' is never accessed afterwards. data().g4Solids[shape] = solid; return solid; } - else if (shape->IsA() == TGeoBBox::Class()) { + else if (isa == TGeoBBox::Class()) { const TGeoBBox* sh = (const TGeoBBox*) shape; solid = new G4Box(name, sh->GetDX() * CM_2_MM, sh->GetDY() * CM_2_MM, sh->GetDZ() * CM_2_MM); } - else if (shape->IsA() == TGeoTube::Class()) { + else if (isa == TGeoTube::Class()) { const TGeoTube* sh = (const TGeoTube*) shape; solid = new G4Tubs(name, sh->GetRmin() * CM_2_MM, sh->GetRmax() * CM_2_MM, sh->GetDz() * CM_2_MM, 0, 2. * M_PI); } - else if (shape->IsA() == TGeoTubeSeg::Class()) { + else if (isa == TGeoTubeSeg::Class()) { const TGeoTubeSeg* sh = (const TGeoTubeSeg*) shape; solid = new G4Tubs(name, sh->GetRmin() * CM_2_MM, sh->GetRmax() * CM_2_MM, sh->GetDz() * CM_2_MM, sh->GetPhi1() * DEGREE_2_RAD, (sh->GetPhi2()-sh->GetPhi1()) * DEGREE_2_RAD); } - else if (shape->IsA() == TGeoEltu::Class()) { + else if (isa == TGeoEltu::Class()) { const TGeoEltu* sh = (const TGeoEltu*) shape; solid = new G4EllipticalTube(name,sh->GetA() * CM_2_MM, sh->GetB() * CM_2_MM, sh->GetDz() * CM_2_MM); } - else if (shape->IsA() == TGeoTrd1::Class()) { + else if (isa == TGeoTrd1::Class()) { const TGeoTrd1* sh = (const TGeoTrd1*) shape; solid = new G4Trd(name, sh->GetDx1() * CM_2_MM, sh->GetDx2() * CM_2_MM, sh->GetDy() * CM_2_MM, sh->GetDy() * CM_2_MM, sh->GetDz() * CM_2_MM); } - else if (shape->IsA() == TGeoTrd2::Class()) { + else if (isa == TGeoTrd2::Class()) { const TGeoTrd2* sh = (const TGeoTrd2*) shape; solid = new G4Trd(name, sh->GetDx1() * CM_2_MM, sh->GetDx2() * CM_2_MM, sh->GetDy1() * CM_2_MM, sh->GetDy2() * CM_2_MM, sh->GetDz() * CM_2_MM); } - else if (shape->IsA() == TGeoHype::Class()) { + else if (isa == TGeoHype::Class()) { const TGeoHype* sh = (const TGeoHype*) shape; solid = new G4Hype(name, sh->GetRmin() * CM_2_MM, sh->GetRmax() * CM_2_MM, sh->GetStIn() * DEGREE_2_RAD, sh->GetStOut() * DEGREE_2_RAD, sh->GetDz() * CM_2_MM); } - else if (shape->IsA() == TGeoXtru::Class()) { + else if (isa == TGeoXtru::Class()) { const TGeoXtru* sh = (const TGeoXtru*) shape; size_t nz = sh->GetNz(); vector<G4ExtrudedSolid::ZSection> z; @@ -629,7 +630,7 @@ void* Geant4Converter::handleSolid(const string& name, const TGeoShape* shape) c } solid = new G4ExtrudedSolid(name, polygon, z); } - else if (shape->IsA() == TGeoPgon::Class()) { + else if (isa == TGeoPgon::Class()) { const TGeoPgon* sh = (const TGeoPgon*) shape; double phi_start = sh->GetPhi1() * DEGREE_2_RAD; double phi_total = (sh->GetDphi() + sh->GetPhi1()) * DEGREE_2_RAD; @@ -641,7 +642,7 @@ void* Geant4Converter::handleSolid(const string& name, const TGeoShape* shape) c } solid = new G4Polyhedra(name, phi_start, phi_total, sh->GetNedges(), sh->GetNz(), &z[0], &rmin[0], &rmax[0]); } - else if (shape->IsA() == TGeoPcon::Class()) { + else if (isa == TGeoPcon::Class()) { const TGeoPcon* sh = (const TGeoPcon*) shape; double phi_start = sh->GetPhi1() * DEGREE_2_RAD; double phi_total = (sh->GetDphi() + sh->GetPhi1()) * DEGREE_2_RAD; @@ -653,45 +654,45 @@ void* Geant4Converter::handleSolid(const string& name, const TGeoShape* shape) c } solid = new G4Polycone(name, phi_start, phi_total, sh->GetNz(), &z[0], &rmin[0], &rmax[0]); } - else if (shape->IsA() == TGeoCone::Class()) { + else if (isa == TGeoCone::Class()) { const TGeoCone* sh = (const TGeoCone*) shape; solid = new G4Cons(name, sh->GetRmin1() * CM_2_MM, sh->GetRmax1() * CM_2_MM, sh->GetRmin2() * CM_2_MM, sh->GetRmax2() * CM_2_MM, sh->GetDz() * CM_2_MM, 0.0, 2.*M_PI); } - else if (shape->IsA() == TGeoConeSeg::Class()) { + else if (isa == TGeoConeSeg::Class()) { const TGeoConeSeg* sh = (const TGeoConeSeg*) shape; solid = new G4Cons(name, sh->GetRmin1() * CM_2_MM, sh->GetRmax1() * CM_2_MM, sh->GetRmin2() * CM_2_MM, sh->GetRmax2() * CM_2_MM, sh->GetDz() * CM_2_MM, sh->GetPhi1() * DEGREE_2_RAD, (sh->GetPhi2()-sh->GetPhi1()) * DEGREE_2_RAD); } - else if (shape->IsA() == TGeoParaboloid::Class()) { + else if (isa == TGeoParaboloid::Class()) { const TGeoParaboloid* sh = (const TGeoParaboloid*) shape; solid = new G4Paraboloid(name, sh->GetDz() * CM_2_MM, sh->GetRlo() * CM_2_MM, sh->GetRhi() * CM_2_MM); } #if 0 /* Not existent */ - else if (shape->IsA() == TGeoEllisoid::Class()) { + else if (isa == TGeoEllisoid::Class()) { const TGeoParaboloid* sh = (const TGeoParaboloid*) shape; solid = new G4Paraboloid(name, sh->GetDz() * CM_2_MM, sh->GetRlo() * CM_2_MM, sh->GetRhi() * CM_2_MM); } #endif - else if (shape->IsA() == TGeoSphere::Class()) { + else if (isa == TGeoSphere::Class()) { const TGeoSphere* sh = (const TGeoSphere*) shape; solid = new G4Sphere(name, sh->GetRmin() * CM_2_MM, sh->GetRmax() * CM_2_MM, sh->GetPhi1() * DEGREE_2_RAD, sh->GetPhi2() * DEGREE_2_RAD, sh->GetTheta1() * DEGREE_2_RAD, sh->GetTheta2() * DEGREE_2_RAD); } - else if (shape->IsA() == TGeoTorus::Class()) { + else if (isa == TGeoTorus::Class()) { const TGeoTorus* sh = (const TGeoTorus*) shape; solid = new G4Torus(name, sh->GetRmin() * CM_2_MM, sh->GetRmax() * CM_2_MM, sh->GetR() * CM_2_MM, sh->GetPhi1() * DEGREE_2_RAD, sh->GetDphi() * DEGREE_2_RAD); } - else if (shape->IsA() == TGeoTrap::Class()) { + else if (isa == TGeoTrap::Class()) { const TGeoTrap* sh = (const TGeoTrap*) shape; solid = new G4Trap(name, sh->GetDz() * CM_2_MM, sh->GetTheta() * DEGREE_2_RAD, sh->GetPhi() * DEGREE_2_RAD, sh->GetH1() * CM_2_MM, sh->GetBl1() * CM_2_MM, sh->GetTl1() * CM_2_MM, sh->GetAlpha1() * DEGREE_2_RAD, sh->GetH2() * CM_2_MM, sh->GetBl2() * CM_2_MM, sh->GetTl2() * CM_2_MM, sh->GetAlpha2() * DEGREE_2_RAD); } - else if (shape->IsA() == TGeoArb8::Class()) { + else if (isa == TGeoArb8::Class()) { vector<G4TwoVector> vertices; TGeoTrap* sh = (TGeoTrap*) shape; Double_t* vtx_xy = sh->GetVertices(); @@ -699,7 +700,7 @@ void* Geant4Converter::handleSolid(const string& name, const TGeoShape* shape) c vertices.emplace_back(G4TwoVector(vtx_xy[0] * CM_2_MM,vtx_xy[1] * CM_2_MM)); solid = new G4GenericTrap(name, sh->GetDz() * CM_2_MM, vertices); } - else if (shape->IsA() == TGeoScaledShape::Class()) { + else if (isa == TGeoScaledShape::Class()) { TGeoScaledShape* sh = (TGeoScaledShape*) shape; const double* vals = sh->GetScale()->GetScale(); Solid s_sh(sh->GetShape()); @@ -708,7 +709,7 @@ void* Geant4Converter::handleSolid(const string& name, const TGeoShape* shape) c scaled, G4Scale3D(vals[0],vals[1],vals[2])); printout(INFO,"G4Shapes","Converting scaled shape from reflection: %s",sh->GetName()); } - else if (shape->IsA() == TGeoCompositeShape::Class()) { + else if (isa == TGeoCompositeShape::Class()) { const TGeoCompositeShape* sh = (const TGeoCompositeShape*) shape; const TGeoBoolNode* boolean = sh->GetBoolNode(); TGeoBoolNode::EGeoBoolType oper = boolean->GetBooleanOperator(); @@ -776,12 +777,12 @@ void* Geant4Converter::handleSolid(const string& name, const TGeoShape* shape) c } if (!solid) { - string err = "Failed to handle unknown solid shape:" + name + " of type " + string(shape->IsA()->GetName()); + string err = "Failed to handle unknown solid shape:" + name + " of type " + string(isa->GetName()); throw runtime_error(err); } else { printout(lvl,"Geant4Converter","++ Successessfully converted shape [%p] of type:%s to %s.", - solid,shape->IsA()->GetName(),typeName(typeid(*solid)).c_str()); + solid,isa->GetName(),typeName(typeid(*solid)).c_str()); } data().g4Solids[shape] = solid; } diff --git a/examples/CLICSiD/CMakeLists.txt b/examples/CLICSiD/CMakeLists.txt index 4e0ff6b2f..f0500edfc 100644 --- a/examples/CLICSiD/CMakeLists.txt +++ b/examples/CLICSiD/CMakeLists.txt @@ -154,14 +154,14 @@ if (DD4HEP_USE_GEANT4) COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh" EXEC_ARGS root.exe -b -x -n -q -l "${DD4hep_DIR}/examples/DDG4/examples/run.C(\"${CLICSiDEx_INSTALL}/scripts/${script}\")" REGEX_PASS "UserEvent_1 INFO Geant4TestEventAction> calling end.event_id=9" - REGEX_FAIL "Exception;EXCEPTION;ERROR;Error" ) + REGEX_FAIL "EXCEPTION;ERROR;Error" ) # # Execute identical source linked executable dd4hep_add_test_reg( CLICSiD_DDG4_${script}_as_exe_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh" EXEC_ARGS ${script} REGEX_PASS "UserEvent_1 INFO Geant4TestEventAction> calling end.event_id=9" - REGEX_FAIL "Exception;EXCEPTION;ERROR;Error" ) + REGEX_FAIL "EXCEPTION;ERROR;Error" ) endforeach(script) # # Invoke G4 multi-threading tests if enabled diff --git a/examples/ClientTests/compact/MiniTel.xml b/examples/ClientTests/compact/MiniTel.xml index 388f1ab9e..f51073fd5 100644 --- a/examples/ClientTests/compact/MiniTel.xml +++ b/examples/ClientTests/compact/MiniTel.xml @@ -40,7 +40,7 @@ <detector name="MyLHCBdetector1" type="MiniTelPixel" material="Silicon" vis="DetVis" id ="1" sensitive="true" readout="MyLHCBdetector1Hits" limits="minitel_limits_1" region="minitel_region_1"> <dimensions z="1*mm" y="10*cm" x="10*cm" /> - <position z="0*mm" y="0*cm" x="0*cm" /> + <position z="10*mm" y="0*cm" x="0*cm" /> <module name="pixel" type="MiniTelPixel" material="Silicon" x="6*mm" y="6*mm" z="1*mm" vis="ModVis" alpha="-2.*radian" beta="-2.*radian" gamma="-0.*radian" /> <reflect/> </detector> @@ -48,7 +48,7 @@ <detector name="MyLHCBdetector2" type="MiniTelPixel" material="Silicon" vis="DetVis" id ="2" sensitive="true" readout="MyLHCBdetector2Hits" limits="minitel_limits" region="minitel_region"> <dimensions z="1*mm" y="10*cm" x="10*cm" /> - <position z="10*mm" y="0*cm" x="0*cm" /> + <position z="20*mm" y="0*cm" x="0*cm" /> <module name="pixel" type="MiniTelPixel" material="Silicon" x="6*mm" y="6*mm" z="1*mm" vis="ModVis" alpha="-2.*radian" beta="-2.*radian" gamma="-0.*radian" /> <reflect/> </detector> @@ -56,7 +56,7 @@ <detector name="MyLHCBdetector3" type="MiniTelPixel" material="Silicon" vis="DetVis" id ="3" sensitive="true" readout="MyLHCBdetector3Hits" limits="minitel_limits" region="minitel_region"> <dimensions z="1*mm" y="10*cm" x="10*cm" /> - <position z="20*mm" y="0*cm" x="0*cm" /> + <position z="30*mm" y="0*cm" x="0*cm" /> <module name="pixel" type="MiniTelPixel" material="Silicon" x="6*mm" y="6*mm" z="5*mm" vis="ModVis" alpha="-2.*radian" beta="-2.*radian" gamma="-0.*radian" /> <reflect/> </detector> @@ -65,7 +65,7 @@ <detector name="MyLHCBdetector4" type="MiniTelPixel" material="Silicon" vis="DetVis" id ="4" sensitive="true" readout="MyLHCBdetector4Hits" limits="minitel_limits" region="minitel_region"> <dimensions z="1*mm" y="10*cm" x="10*cm"/> - <position z="30*mm" y="0*cm" x="0*cm" /> + <position z="40*mm" y="0*cm" x="0*cm" /> <module name="pixel" type="MiniTelPixel" material="Silicon" x="6*mm" y="6*mm" z="21*mm" vis="ModVis" alpha="-2.*radian" beta="-2.*radian" gamma="-0.*radian" /> <reflect/> </detector> @@ -74,7 +74,7 @@ <detector name="MyLHCBdetector5" type="MiniTelPixel" material="Silicon" vis="DetVis" id ="5" sensitive="true" readout="MyLHCBdetector5Hits" limits="minitel_limits" region="minitel_region"> <dimensions z="1*mm" y="10*cm" x="10*cm"/> - <position z="40*mm" y="0*cm" x="0*cm" /> + <position z="50*mm" y="0*cm" x="0*cm" /> <module name="pixel" type="MiniTelPixel" material="Silicon" x="6*mm" y="6*mm" z="10*mm" vis="ModVis" alpha="-2.*radian" beta="-2.*radian" gamma="-0.*radian" /> <reflect/> </detector> @@ -83,7 +83,7 @@ <detector name="MyLHCBdetector6" type="MiniTelPixel" material="Silicon" vis="DetVis" id ="6" sensitive="true" readout="MyLHCBdetector6Hits" limits="minitel_limits" region="minitel_region"> <dimensions z="1*mm" y="10*cm" x="10*cm" /> - <position z="50*mm" y="0*cm" x="0*cm" /> + <position z="60*mm" y="0*cm" x="0*cm" /> <module name="pixel" type="MiniTelPixel" material="Silicon" x="6*mm" y="6*mm" z="1*mm" vis="ModVis" alpha="-2.*radian" beta="-2.*radian" gamma="-0.*radian" /> <reflect/> </detector> @@ -92,7 +92,7 @@ <detector name="MyLHCBdetector7" type="MiniTelPixel" material="Silicon" vis="DetVis" id ="7" sensitive="true" readout="MyLHCBdetector7Hits" limits="minitel_limits" region="minitel_region"> <dimensions z="1*mm" y="10*cm" x="10*cm" /> - <position z="60*mm" y="0*cm" x="0*cm" /> + <position z="70*mm" y="0*cm" x="0*cm" /> <module name="pixel" type="MiniTelPixel" material="Silicon" x="6*mm" y="6*mm" z="1*mm" vis="ModVis" alpha="-2.*radian" beta="-2.*radian" gamma="-0.*radian" /> <reflect/> </detector> @@ -101,7 +101,7 @@ <detector name="MyLHCBdetector8" type="MiniTelPixel" material="Silicon" vis="DetVis" id ="8" sensitive="true" readout="MyLHCBdetector8Hits" limits="minitel_limits" region="minitel_region"> <dimensions z="1*mm" y="10*cm" x="10*cm" /> - <position z="70*mm" y="0*cm" x="0*cm" /> + <position z="80*mm" y="0*cm" x="0*cm" /> <module name="pixel" type="MiniTelPixel" material="Silicon" x="6*mm" y="6*mm" z="1*mm" vis="ModVis" alpha="-2.*radian" beta="-2.*radian" gamma="-0.*radian" /> <reflect/> </detector> @@ -109,7 +109,7 @@ <detector name="MyLHCBdetector9" type="MiniTelPixel" material="Silicon" vis="DetVis" id ="9" sensitive="true" readout="MyLHCBdetector9Hits" limits="minitel_limits" region="minitel_region"> <dimensions z="1*mm" y="10*cm" x="10*cm" /> - <position z="80*mm" y="0*cm" x="0*cm" /> + <position z="90*mm" y="0*cm" x="0*cm" /> <module name="pixel" type="MiniTelPixel" material="Silicon" x="6*mm" y="6*mm" z="1*mm" vis="ModVis" alpha="-2.*radian" beta="-2.*radian" gamma="-0.*radian" /> <reflect/> </detector> @@ -117,7 +117,7 @@ <detector name="MyLHCBdetector10" type="MiniTelPixel" material="Silicon" vis="DetVis" id ="10" sensitive="true" readout="MyLHCBdetector10Hits" limits="minitel_limits" region="minitel_region"> <dimensions z="1*mm" y="10*cm" x="10*cm" /> - <position z="90*mm" y="0*cm" x="0*cm" /> + <position z="100*mm" y="0*cm" x="0*cm" /> <module name="pixel" type="MiniTelPixel" material="Silicon" x="6*mm" y="6*mm" z="1*mm" vis="ModVis" alpha="-2.*radian" beta="-2.*radian" gamma="-0.*radian" /> <reflect/> </detector> @@ -155,43 +155,43 @@ <readouts> <readout name="MyLHCBdetector1Hits"> <segmentation type="CartesianGridXY" grid_size_x="6*mm" grid_size_y="6*mm" /> - <id>system:6,side:1,x:12:-6,y:24:-6</id> + <id>system:6,side:2,x:12:-6,y:24:-6</id> </readout> <readout name="MyLHCBdetector2Hits"> <segmentation type="CartesianGridXY" grid_size_x="6*mm" grid_size_y="6*mm" /> - <id>system:6,side:1,x:12:-6,y:24:-6</id> + <id>system:6,side:2,x:12:-6,y:24:-6</id> </readout> <readout name="MyLHCBdetector3Hits"> <segmentation type="CartesianGridXY" grid_size_x="6*mm" grid_size_y="6*mm" /> - <id>system:6,side:1,x:12:-6,y:24:-6</id> + <id>system:6,side:2,x:12:-6,y:24:-6</id> </readout> <readout name="MyLHCBdetector4Hits"> <segmentation type="CartesianGridXY" grid_size_x="6*mm" grid_size_y="6*mm" /> - <id>system:6,side:1,x:12:-6,y:24:-6</id> + <id>system:6,side:2,x:12:-6,y:24:-6</id> </readout> <readout name="MyLHCBdetector5Hits"> <segmentation type="CartesianGridXY" grid_size_x="6*mm" grid_size_y="6*mm" /> - <id>system:6,side:1,x:12:-6,y:24:-6</id> + <id>system:6,side:2,x:12:-6,y:24:-6</id> </readout> <readout name="MyLHCBdetector6Hits"> <segmentation type="CartesianGridXY" grid_size_x="6*mm" grid_size_y="6*mm" /> - <id>system:6,side:1,x:12:-6,y:24:-6</id> + <id>system:6,side:2,x:12:-6,y:24:-6</id> </readout> <readout name="MyLHCBdetector7Hits"> <segmentation type="CartesianGridXY" grid_size_x="6*mm" grid_size_y="6*mm" /> - <id>system:6,side:1,x:12:-6,y:24:-6</id> + <id>system:6,side:2,x:12:-6,y:24:-6</id> </readout> <readout name="MyLHCBdetector8Hits"> <segmentation type="CartesianGridXY" grid_size_x="6*mm" grid_size_y="6*mm" /> - <id>system:6,side:1,x:12:-6,y:24:-6</id> + <id>system:6,side:2,x:12:-6,y:24:-6</id> </readout> <readout name="MyLHCBdetector9Hits"> <segmentation type="CartesianGridXY" grid_size_x="6*mm" grid_size_y="6*mm" /> - <id>system:6,side:1,x:12:-6,y:24:-6</id> + <id>system:6,side:2,x:12:-6,y:24:-6</id> </readout> <readout name="MyLHCBdetector10Hits"> <segmentation type="CartesianGridXY" grid_size_x="6*mm" grid_size_y="6*mm" /> - <id>system:6,side:1,x:12:-6,y:24:-6</id> + <id>system:6,side:2,x:12:-6,y:24:-6</id> </readout> </readouts> diff --git a/examples/ClientTests/src/MiniTel.cpp b/examples/ClientTests/src/MiniTel.cpp index 3d76b40a9..7583008ae 100644 --- a/examples/ClientTests/src/MiniTel.cpp +++ b/examples/ClientTests/src/MiniTel.cpp @@ -112,7 +112,8 @@ static Ref_t create_detector(Detector &description, xml_h e, SensitiveDetector s m_volume.setSensitiveDetector(sens); PlacedVolume pv1, pv2; - pv1 = assembly.placeVolume(m_volume,Transform3D(Position(det_x,det_y,det_z))); //det_x,det_y,det_z are the dimensions of the detector in space + // det_x,det_y,det_z are the dimensions of the detector in space + pv1 = assembly.placeVolume(m_volume,Transform3D(Position(det_x,det_y,det_z))); if ( x_det.hasChild(_U(reflect)) ) { /// Reflect in XY-plane pv2 = assembly.placeVolume(m_volume,Transform3D(Rotation3D(1., 0., 0., 0., 1., 0., 0., 0., -1.), @@ -122,14 +123,13 @@ static Ref_t create_detector(Detector &description, xml_h e, SensitiveDetector s if ( dtctr.isSensitive() ) { // Set volume attributes sens.setType("tracker"); - pv1.addPhysVolID("system",detectors_id); pv1.addPhysVolID("side",0); if ( pv2.isValid() ) { - pv2.addPhysVolID("system",detectors_id); pv2.addPhysVolID("side",1); } } auto pv = motherVol.placeVolume(assembly); + pv.addPhysVolID("system",detectors_id); sdet.setPlacement(pv); // Support additional test if Detector_InhibitConstants is set to TRUE description.constant<double>("world_side"); diff --git a/examples/DDDB/include/Detector/DeVeloSensor.h b/examples/DDDB/include/Detector/DeVeloSensor.h index 5278ae3a3..8c0a3bdb2 100644 --- a/examples/DDDB/include/Detector/DeVeloSensor.h +++ b/examples/DDDB/include/Detector/DeVeloSensor.h @@ -301,22 +301,22 @@ namespace gaudi { { return 0 == (staticData().de_user&DeVeloFlags::LEFT); } /// Return true for X>0 side of the detector (+ve x is Left) bool isLeft () const - { return 1 == (staticData().de_user&DeVeloFlags::LEFT); } + { return 0 != (staticData().de_user&DeVeloFlags::LEFT); } /// Returns true if sensor is downstream. bool isDownstream () const - { return 1 == (staticData().de_user&DeVeloFlags::DOWNSTREAM); } + { return 0 != (staticData().de_user&DeVeloFlags::DOWNSTREAM); } /// Returns true if pile up Sensor. bool isPileUp () const - { return 1 == (staticData().de_user&DeVeloFlags::PU_TYPE); } + { return 0 != (staticData().de_user&DeVeloFlags::PU_TYPE); } /// Returns true if R Sensor. bool isR () const - { return 1 == (staticData().de_user&DeVeloFlags::R_TYPE); } + { return 0 != (staticData().de_user&DeVeloFlags::R_TYPE); } /// Returns true if Phi Sensor. bool isPhi () const - { return 1 == (staticData().de_user&DeVeloFlags::PHI_TYPE); } + { return 0 != (staticData().de_user&DeVeloFlags::PHI_TYPE); } /// Returns true if sensor is top cabled. bool isTop () const - { return 1 == (staticData().de_user&DeVeloFlags::TOP); } + { return 0 != (staticData().de_user&DeVeloFlags::TOP); } /// Returns true if sensor is bottom cabled. bool isBottom () const { return 0 == (staticData().de_user&DeVeloFlags::TOP); } @@ -325,13 +325,13 @@ namespace gaudi { * with time. */ bool isReadOut() const - { return 1 == (staticData().de_user&DeVeloFlags::READOUT); } + { return 0 != (staticData().de_user&DeVeloFlags::READOUT); } /** Check whether this sensor exists or is TELL1 w/o sensor (cached condition). * This information is based on CondDB, i.e. it can change * with time. */ bool tell1WithoutSensor() const - { return 1 == (staticData().de_user&DeVeloFlags::T1NOSENS); } + { return 0 != (staticData().de_user&DeVeloFlags::T1NOSENS); } unsigned int globalZoneOfStrip(const unsigned int strip) const { diff --git a/examples/SimpleDetector/src/ZPlanarTracker_geo.cpp b/examples/SimpleDetector/src/ZPlanarTracker_geo.cpp index 1a52a77a7..ec7a203f8 100644 --- a/examples/SimpleDetector/src/ZPlanarTracker_geo.cpp +++ b/examples/SimpleDetector/src/ZPlanarTracker_geo.cpp @@ -42,7 +42,7 @@ static Ref_t create_element(Detector& description, xml_h e, SensitiveDetector se try { isStripDetector = x_det.attr<bool>( _Unicode(isStripDetector) ) ; - } catch(std::runtime_error ){} + } catch(const std::runtime_error& ){} //========= loop over layer elements in xml ====================================== -- GitLab