Skip to content
Snippets Groups Projects
Commit 72ee0078 authored by Marilena Bandieramonte's avatar Marilena Bandieramonte
Browse files

LArWheelSolid creation added to Geo2G4SolidFactory class

parent 93205711
No related branches found
No related tags found
No related merge requests found
Pipeline #1268027 failed
......@@ -6,10 +6,11 @@ project( "GeoModelG4" VERSION 1.0.0 LANGUAGES CXX )
# Add sub-packages.
add_subdirectory(GeoMaterial2G4)
add_subdirectory(GeoModel2G4)
add_subdirectory(GeoSpecialShapes)
add_subdirectory(GeoModel2G4)
install(EXPORT GeoMaterial2G4-export FILE GeoModelG4-GeoMaterial2G4.cmake DESTINATION lib/GeoModelG4)
install(EXPORT GeoModel2G4-export FILE GeoModelG4-GeoModel2G4.cmake DESTINATION lib/GeoModelG4)
install(EXPORT GeoSpecialShapes-export FILE GeoModelG4-GeoSpecialShapes.cmake DESTINATION lib/GeoModelG4)
install(EXPORT GeoModel2G4-export FILE GeoModelG4-GeoModel2G4.cmake DESTINATION lib/GeoModelG4)
install(FILES cmake/GeoModelG4Config.cmake DESTINATION lib/GeoModelG4)
......@@ -44,7 +44,7 @@ include(${Geant4_USE_FILE})
add_library( GeoModel2G4 SHARED ${HEADERS} ${SOURCES} )
target_link_libraries( GeoModel2G4
PUBLIC ${GEANT4_LIBRARIES}
PRIVATE ${CLHEP_LIBRARIES} GeoMaterial2G4 )
PRIVATE ${CLHEP_LIBRARIES} GeoMaterial2G4 GeoSpecialShapes)
target_include_directories( GeoModel2G4 SYSTEM PUBLIC ${GEANT4_INCLUDE_DIRS} PRIVATE ${CLHEP_INCLUDE_DIRS} ${GeoModelCore_INCLUDE_DIRS} )
target_include_directories( GeoModel2G4 PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
......
......@@ -8,7 +8,7 @@
#include <map>
#include <string>
//#include "LArWheelSolid_type.h"
#include "LArWheelSolid_type.h"
class G4VSolid;
class GeoShape;
......@@ -18,8 +18,8 @@ class Geo2G4SolidFactory
public:
//typedef ServiceHandle<StoreGateSvc> StoreGateSvc_t;
//typedef std::pair<LArWheelSolid_t, int> LArWheelSolidDef_t;
//typedef std::map<std::string, LArWheelSolidDef_t> LArWheelSolid_typemap;
typedef std::pair<LArWheelSolid_t, int> LArWheelSolidDef_t;
typedef std::map<std::string, LArWheelSolidDef_t> LArWheelSolid_typemap;
Geo2G4SolidFactory();
G4VSolid* Build(const GeoShape*, std::string name=std::string("")) const;
......@@ -29,9 +29,9 @@ public:
*/
//StoreGateSvc_t& detStore() const;
private:
//G4VSolid* createLArWheelSolid(const std::string& name, const LArWheelSolidDef_t & lwsdef) const;
G4VSolid* createLArWheelSolid(const std::string& name, const LArWheelSolidDef_t & lwsdef) const;
//static const LArWheelSolid_typemap s_lwsTypes;
static const LArWheelSolid_typemap s_lwsTypes;
};
......
......@@ -3,9 +3,9 @@
*/
#include "GeoModel2G4/Geo2G4SolidFactory.h"
//TODO #include "LArWheelSolid.h"
//TODO #include "LArWheelSolidDDProxy.h"
//TODO #include "GeoSpecialShapes/LArCustomShape.h"
#include "GeoModel2G4/LArWheelSolid.h"
#include "GeoModel2G4/LArWheelSolidDDProxy.h"
#include "GeoSpecialShapes/LArCustomShape.h"
#include "GeoModelKernel/GeoShape.h"
#include "GeoModelKernel/GeoBox.h"
......@@ -57,55 +57,54 @@
typedef std::map<const GeoShape*, G4VSolid*, std::less<const GeoShape*> > shapesMap;
typedef std::map<std::string, G4VSolid*,std::less<std::string> > customSolidMap;
//TODO const Geo2G4SolidFactory::LArWheelSolid_typemap Geo2G4SolidFactory::s_lwsTypes = {
// { "LAr::EMEC::InnerWheel::Absorber", {InnerAbsorberWheel, 1} },
// { "LAr::EMEC::Pos::InnerWheel::Absorber", {InnerAbsorberWheel, 1} },
//
// { "LAr::EMEC::OuterWheel::Absorber", {OuterAbsorberWheel, 1} },
// { "LAr::EMEC::Pos::OuterWheel::Absorber", {OuterAbsorberWheel, 1} },
//
// { "LAr::EMEC::InnerWheel::Electrode", {InnerElectrodWheel, 1} },
// { "LAr::EMEC::Pos::InnerWheel::Electrode", {InnerElectrodWheel, 1} },
//
// { "LAr::EMEC::OuterWheel::Electrode", {OuterElectrodWheel, 1} },
// { "LAr::EMEC::Pos::OuterWheel::Electrode", {OuterElectrodWheel, 1} },
//
// { "LAr::EMEC::Neg::InnerWheel::Absorber", {InnerAbsorberWheel, -1} },
//
// { "LAr::EMEC::Neg::OuterWheel::Absorber", {OuterAbsorberWheel, -1} },
//
// { "LAr::EMEC::Neg::InnerWheel::Electrode", {InnerElectrodWheel, -1} },
//
// { "LAr::EMEC::Neg::OuterWheel::Electrode", {OuterElectrodWheel, -1} },
//
// { "LAr::EMEC::InnerModule::Absorber", {InnerAbsorberModule, 1} },
//
// { "LAr::EMEC::OuterModule::Absorber", {OuterAbsorberModule, 1} },
//
// { "LAr::EMEC::InnerModule::Electrode", {InnerElectrodModule, 1} },
//
// { "LAr::EMEC::OuterModule::Electrode", {OuterElectrodModule, 1} },
//
// { "LAr::EMEC::InnerWheel::Glue", {InnerGlueWheel, 1} },
// { "LAr::EMEC::Pos::InnerWheel::Glue", {InnerGlueWheel, 1} },
//
// { "LAr::EMEC::InnerWheel::Lead", {InnerLeadWheel, 1} },
// { "LAr::EMEC::Pos::InnerWheel::Lead", {InnerLeadWheel, 1} },
//
// { "LAr::EMEC::OuterWheel::Glue", {OuterGlueWheel, 1} },
// { "LAr::EMEC::Pos::OuterWheel::Glue", {OuterGlueWheel, 1} },
//
// { "LAr::EMEC::OuterWheel::Lead", {OuterLeadWheel, 1} },
// { "LAr::EMEC::Pos::OuterWheel::Lead", {OuterLeadWheel, 1} },
//
// { "LAr::EMEC::Neg::InnerWheel::Glue", {InnerGlueWheel, -1} },
//
// { "LAr::EMEC::Neg::OuterWheel::Glue", {OuterGlueWheel, -1} },
//
// { "LAr::EMEC::Neg::InnerWheel::Lead", {InnerLeadWheel, -1} },
//
// { "LAr::EMEC::Neg::OuterWheel::Lead", {OuterLeadWheel, -1} }
//};
const Geo2G4SolidFactory::LArWheelSolid_typemap Geo2G4SolidFactory::s_lwsTypes = {
{ "LAr::EMEC::InnerWheel::Absorber", {InnerAbsorberWheel, 1} },
{ "LAr::EMEC::Pos::InnerWheel::Absorber", {InnerAbsorberWheel, 1} },
{ "LAr::EMEC::OuterWheel::Absorber", {OuterAbsorberWheel, 1} },
{ "LAr::EMEC::Pos::OuterWheel::Absorber", {OuterAbsorberWheel, 1} },
{ "LAr::EMEC::InnerWheel::Electrode", {InnerElectrodWheel, 1} },
{ "LAr::EMEC::Pos::InnerWheel::Electrode", {InnerElectrodWheel, 1} },
{ "LAr::EMEC::OuterWheel::Electrode", {OuterElectrodWheel, 1} },
{ "LAr::EMEC::Pos::OuterWheel::Electrode", {OuterElectrodWheel, 1} },
{ "LAr::EMEC::Neg::InnerWheel::Absorber", {InnerAbsorberWheel, -1} },
{ "LAr::EMEC::Neg::OuterWheel::Absorber", {OuterAbsorberWheel, -1} },
{ "LAr::EMEC::Neg::InnerWheel::Electrode", {InnerElectrodWheel, -1} },
{ "LAr::EMEC::Neg::OuterWheel::Electrode", {OuterElectrodWheel, -1} },
{ "LAr::EMEC::InnerModule::Absorber", {InnerAbsorberModule, 1} },
{ "LAr::EMEC::OuterModule::Absorber", {OuterAbsorberModule, 1} },
{ "LAr::EMEC::InnerModule::Electrode", {InnerElectrodModule, 1} },
{ "LAr::EMEC::OuterModule::Electrode", {OuterElectrodModule, 1} },
{ "LAr::EMEC::InnerWheel::Glue", {InnerGlueWheel, 1} },
{ "LAr::EMEC::Pos::InnerWheel::Glue", {InnerGlueWheel, 1} },
{ "LAr::EMEC::InnerWheel::Lead", {InnerLeadWheel, 1} },
{ "LAr::EMEC::Pos::InnerWheel::Lead", {InnerLeadWheel, 1} },
{ "LAr::EMEC::OuterWheel::Glue", {OuterGlueWheel, 1} },
{ "LAr::EMEC::Pos::OuterWheel::Glue", {OuterGlueWheel, 1} },
{ "LAr::EMEC::OuterWheel::Lead", {OuterLeadWheel, 1} },
{ "LAr::EMEC::Pos::OuterWheel::Lead", {OuterLeadWheel, 1} },
{ "LAr::EMEC::Neg::InnerWheel::Glue", {InnerGlueWheel, -1} },
{ "LAr::EMEC::Neg::OuterWheel::Glue", {OuterGlueWheel, -1} },
{ "LAr::EMEC::Neg::InnerWheel::Lead", {InnerLeadWheel, -1} },
{ "LAr::EMEC::Neg::OuterWheel::Lead", {OuterLeadWheel, -1} }
};
Geo2G4SolidFactory::Geo2G4SolidFactory()
{
......@@ -497,69 +496,69 @@ G4VSolid *Geo2G4SolidFactory::Build(const GeoShape* geoShape, std::string name)
//
// Custom Shapes (presently LAr shapes only)
//
//TODO: LAr custom shape
// else if(geoShape->typeID() == LArCustomShape::getClassTypeID())
// {
// const LArCustomShape* customShape = dynamic_cast<const LArCustomShape*> (geoShape);
// if (nullptr==customShape) throw std::runtime_error("TypeID did not match cast for custom shape");
// std::string customName = customShape->name();
// customSolidMap::const_iterator it = customSolids.find(customName);
// if(it!=customSolids.end())
// theSolid = it->second;
// else
// {
// theSolid = nullptr;
// if(customName == "LAr::EMEC::InnerWheel::Absorber" || customName == "LAr::EMEC::Pos::InnerWheel::Absorber"){
// theSolid = new LArWheelSolid(customName, InnerAbsorberWheel, 1);
// } else if(customName == "LAr::EMEC::OuterWheel::Absorber" || customName == "LAr::EMEC::Pos::OuterWheel::Absorber"){
// theSolid = new LArWheelSolid(customName, OuterAbsorberWheel, 1);
// } else if(customName == "LAr::EMEC::InnerWheel::Electrode" || customName == "LAr::EMEC::Pos::InnerWheel::Electrode"){
// theSolid = new LArWheelSolid(customName, InnerElectrodWheel, 1);
// } else if(customName == "LAr::EMEC::OuterWheel::Electrode" || customName == "LAr::EMEC::Pos::OuterWheel::Electrode"){
// theSolid = new LArWheelSolid(customName, OuterElectrodWheel, 1);
// } else if(customName == "LAr::EMEC::Neg::InnerWheel::Absorber"){
// theSolid = new LArWheelSolid(customName, InnerAbsorberWheel, -1);
// } else if(customName == "LAr::EMEC::Neg::OuterWheel::Absorber"){
// theSolid = new LArWheelSolid(customName, OuterAbsorberWheel, -1);
// } else if(customName == "LAr::EMEC::Neg::InnerWheel::Electrode"){
// theSolid = new LArWheelSolid(customName, InnerElectrodWheel, -1);
// } else if(customName == "LAr::EMEC::Neg::OuterWheel::Electrode"){
// theSolid = new LArWheelSolid(customName, OuterElectrodWheel, -1);
// } else if(customName == "LAr::EMEC::InnerModule::Absorber"){
// theSolid = new LArWheelSolid(customName, InnerAbsorberModule, 1);
// } else if(customName == "LAr::EMEC::OuterModule::Absorber"){
// theSolid = new LArWheelSolid(customName, OuterAbsorberModule, 1);
// } else if(customName == "LAr::EMEC::InnerModule::Electrode"){
// theSolid = new LArWheelSolid(customName, InnerElectrodModule, 1);
// } else if(customName == "LAr::EMEC::OuterModule::Electrode"){
// theSolid = new LArWheelSolid(customName, OuterElectrodModule, 1);
// } else if(customName == "LAr::EMEC::InnerWheel::Glue" || customName == "LAr::EMEC::Pos::InnerWheel::Glue"){
// theSolid = new LArWheelSolid(customName, InnerGlueWheel, 1);
// } else if(customName == "LAr::EMEC::InnerWheel::Lead" || customName == "LAr::EMEC::Pos::InnerWheel::Lead"){
// theSolid = new LArWheelSolid(customName, InnerLeadWheel, 1);
// } else if(customName == "LAr::EMEC::OuterWheel::Glue" || customName == "LAr::EMEC::Pos::OuterWheel::Glue"){
// theSolid = new LArWheelSolid(customName, OuterGlueWheel, 1);
// } else if(customName == "LAr::EMEC::OuterWheel::Lead" || customName == "LAr::EMEC::Pos::OuterWheel::Lead"){
// theSolid = new LArWheelSolid(customName, OuterLeadWheel, 1);
// } else if(customName == "LAr::EMEC::Neg::InnerWheel::Glue"){
// theSolid = new LArWheelSolid(customName, InnerGlueWheel, -1);
// } else if(customName == "LAr::EMEC::Neg::InnerWheel::Lead"){
// theSolid = new LArWheelSolid(customName, InnerLeadWheel, -1);
// } else if(customName == "LAr::EMEC::Neg::OuterWheel::Glue"){
// theSolid = new LArWheelSolid(customName, OuterGlueWheel, -1);
// } else if(customName == "LAr::EMEC::Neg::OuterWheel::Lead"){
// theSolid = new LArWheelSolid(customName, OuterLeadWheel, -1);
// }
//
// theSolid = createLArWheelSolid(customName, s_lwsTypes.at(customName) ); // map.at throws std::out_of_range exception on unknown shape name
// if ( nullptr == theSolid ) {
// std::string error = std::string("Can't create LArWheelSolid for name ") + customName + " in Geo2G4SolidFactory::Build";
// throw std::runtime_error(error);
// }
//
// if(theSolid != nullptr) customSolids[customName] = theSolid;
// }
// }
//LAr custom shape
else if(geoShape->typeID() == LArCustomShape::getClassTypeID())
{
const LArCustomShape* customShape = dynamic_cast<const LArCustomShape*> (geoShape);
if (nullptr==customShape) throw std::runtime_error("TypeID did not match cast for custom shape");
std::string customName = customShape->name();
customSolidMap::const_iterator it = customSolids.find(customName);
if(it!=customSolids.end())
theSolid = it->second;
else
{
theSolid = nullptr;
if(customName == "LAr::EMEC::InnerWheel::Absorber" || customName == "LAr::EMEC::Pos::InnerWheel::Absorber"){
theSolid = new LArWheelSolid(customName, InnerAbsorberWheel, 1);
} else if(customName == "LAr::EMEC::OuterWheel::Absorber" || customName == "LAr::EMEC::Pos::OuterWheel::Absorber"){
theSolid = new LArWheelSolid(customName, OuterAbsorberWheel, 1);
} else if(customName == "LAr::EMEC::InnerWheel::Electrode" || customName == "LAr::EMEC::Pos::InnerWheel::Electrode"){
theSolid = new LArWheelSolid(customName, InnerElectrodWheel, 1);
} else if(customName == "LAr::EMEC::OuterWheel::Electrode" || customName == "LAr::EMEC::Pos::OuterWheel::Electrode"){
theSolid = new LArWheelSolid(customName, OuterElectrodWheel, 1);
} else if(customName == "LAr::EMEC::Neg::InnerWheel::Absorber"){
theSolid = new LArWheelSolid(customName, InnerAbsorberWheel, -1);
} else if(customName == "LAr::EMEC::Neg::OuterWheel::Absorber"){
theSolid = new LArWheelSolid(customName, OuterAbsorberWheel, -1);
} else if(customName == "LAr::EMEC::Neg::InnerWheel::Electrode"){
theSolid = new LArWheelSolid(customName, InnerElectrodWheel, -1);
} else if(customName == "LAr::EMEC::Neg::OuterWheel::Electrode"){
theSolid = new LArWheelSolid(customName, OuterElectrodWheel, -1);
} else if(customName == "LAr::EMEC::InnerModule::Absorber"){
theSolid = new LArWheelSolid(customName, InnerAbsorberModule, 1);
} else if(customName == "LAr::EMEC::OuterModule::Absorber"){
theSolid = new LArWheelSolid(customName, OuterAbsorberModule, 1);
} else if(customName == "LAr::EMEC::InnerModule::Electrode"){
theSolid = new LArWheelSolid(customName, InnerElectrodModule, 1);
} else if(customName == "LAr::EMEC::OuterModule::Electrode"){
theSolid = new LArWheelSolid(customName, OuterElectrodModule, 1);
} else if(customName == "LAr::EMEC::InnerWheel::Glue" || customName == "LAr::EMEC::Pos::InnerWheel::Glue"){
theSolid = new LArWheelSolid(customName, InnerGlueWheel, 1);
} else if(customName == "LAr::EMEC::InnerWheel::Lead" || customName == "LAr::EMEC::Pos::InnerWheel::Lead"){
theSolid = new LArWheelSolid(customName, InnerLeadWheel, 1);
} else if(customName == "LAr::EMEC::OuterWheel::Glue" || customName == "LAr::EMEC::Pos::OuterWheel::Glue"){
theSolid = new LArWheelSolid(customName, OuterGlueWheel, 1);
} else if(customName == "LAr::EMEC::OuterWheel::Lead" || customName == "LAr::EMEC::Pos::OuterWheel::Lead"){
theSolid = new LArWheelSolid(customName, OuterLeadWheel, 1);
} else if(customName == "LAr::EMEC::Neg::InnerWheel::Glue"){
theSolid = new LArWheelSolid(customName, InnerGlueWheel, -1);
} else if(customName == "LAr::EMEC::Neg::InnerWheel::Lead"){
theSolid = new LArWheelSolid(customName, InnerLeadWheel, -1);
} else if(customName == "LAr::EMEC::Neg::OuterWheel::Glue"){
theSolid = new LArWheelSolid(customName, OuterGlueWheel, -1);
} else if(customName == "LAr::EMEC::Neg::OuterWheel::Lead"){
theSolid = new LArWheelSolid(customName, OuterLeadWheel, -1);
}
theSolid = createLArWheelSolid(customName, s_lwsTypes.at(customName) ); // map.at throws std::out_of_range exception on unknown shape name
if ( nullptr == theSolid ) {
std::string error = std::string("Can't create LArWheelSolid for name ") + customName + " in Geo2G4SolidFactory::Build";
throw std::runtime_error(error);
}
if(theSolid != nullptr) customSolids[customName] = theSolid;
}
}
//
// Catch All
//
......@@ -575,17 +574,17 @@ G4VSolid *Geo2G4SolidFactory::Build(const GeoShape* geoShape, std::string name)
return theSolid;
}
//TODO createLArWheelSolid
//G4VSolid* Geo2G4SolidFactory::createLArWheelSolid(const std::string& name, const LArWheelSolidDef_t & lwsdef) const { // LArWheelSolid_t wheelType, int zside
// LArWheelSolid_t wheelType = lwsdef.first;
// int zside = lwsdef.second;
//
// LArWheelSolid * theLWS = new LArWheelSolid(name, wheelType, zside);
//
// LArWheelSolidDDProxy * theLWS_p = new LArWheelSolidDDProxy(theLWS);
// // ownership is passed to detStore
// if ( detStore()->record(theLWS_p, name).isFailure() ) {
// std::cout<<"Can't store proxy for LArWheelSolid to the DetectorStore"<<std::endl;
// delete theLWS_p;
// }
// return theLWS;
//}
G4VSolid* Geo2G4SolidFactory::createLArWheelSolid(const std::string& name, const LArWheelSolidDef_t & lwsdef) const { // LArWheelSolid_t wheelType, int zside
LArWheelSolid_t wheelType = lwsdef.first;
int zside = lwsdef.second;
LArWheelSolid * theLWS = new LArWheelSolid(name, wheelType, zside);
LArWheelSolidDDProxy * theLWS_p = new LArWheelSolidDDProxy(theLWS);
// ownership is passed to detStore
//if ( detStore()->record(theLWS_p, name).isFailure() ) {
// std::cout<<"Can't store proxy for LArWheelSolid to the DetectorStore"<<std::endl;
// delete theLWS_p;
//}
return theLWS;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment