Commit e18371c8 authored by Valentina Fioretti's avatar Valentina Fioretti
Browse files

User defined geom and phys external

parent ded5fb56
Loading
Loading
Loading
Loading
+30 −8
Original line number Diff line number Diff line
@@ -8,10 +8,7 @@ project(bogemms)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules")

#----------------------------------------------------------------------------
# Find Geant4 package, activating all available UI and Vis drivers by default
# You can set WITH_GEANT4_UIVIS to OFF via the command line or ccmake/cmake-gui
# to build a batch mode only executable
#
# Geant4 and MPI
option(WITH_GEANT4_UIVIS "Build example with Geant4 UI and Vis drivers" ON)
if(WITH_GEANT4_UIVIS)
  find_package(Geant4 REQUIRED ui_all vis_all)
@@ -21,7 +18,8 @@ endif()

find_package(G4mpi REQUIRED)

# Override default values with command-line definitions
#----------------------------------------------------------------------------
# Geant4 version and macros
if(DEFINED GEANT4_VERSION)
    set(GEANT4_VERSION "${GEANT4_VERSION}" CACHE STRING "Set Geant4 version" FORCE)
else()
@@ -29,6 +27,8 @@ else()
endif()
add_definitions(${GEANT4_VERSION})

#----------------------------------------------------------------------------
# Optional dependencies
option(NOROOTBUILD "Build without ROOT" ON)
option(SQLBUILD "Build with SQLite" OFF)
option(MONGODBBUILD "Build with MongoDB" OFF)
@@ -55,13 +55,18 @@ if(MONGODBBUILD)
    include_directories(${mongocxx_INCLUDE_DIRS} ${bsoncxx_INCLUDE_DIRS})
endif()

# Print the values of options
option(USER_CLASSES "Enable user-defined geometry and physics classes" OFF)
set(USER_CLASSES_PATH "" CACHE PATH "Path to user-defined classes")

#----------------------------------------------------------------------------
# Log build options
message(STATUS "GEANT4 VERSION: ${GEANT4_VERSION}")
message(STATUS "NO ROOT BUILDING OPTIONS: ${NOROOTBUILD}")
message(STATUS "SQLite BUILDING OPTIONS: ${SQLBUILD}")
message(STATUS "MongoDB BUILDING OPTIONS: ${MONGODBBUILD}")

message(STATUS "library: ${mongocxx_LIBRARIES}")
message(STATUS "USER CLASSES ENABLED: ${USER_CLASSES}")
message(STATUS "USER CLASSES PATH: ${USER_CLASSES_PATH}")

#----------------------------------------------------------------------------
# Setup Geant4 include directories and compile definitions
@@ -75,6 +80,17 @@ include(${Geant4_USE_FILE})
####### 3) Directories for the compiler

include_directories(${PROJECT_SOURCE_DIR}/code ${PROJECT_SOURCE_DIR}/phys ${PROJECT_SOURCE_DIR}/geom ${Geant4_INCLUDE_DIR} ${G4mpi_INCLUDE_DIR})

# Add user path if requested
if(USER_CLASSES AND EXISTS ${USER_CLASSES_PATH})
  include_directories(${USER_CLASSES_PATH})
  file(GLOB user_sources ${USER_CLASSES_PATH}/*.cc)
  file(GLOB user_headers ${USER_CLASSES_PATH}/*.hh)
else()
  set(user_sources "")
  set(user_headers "")
endif()

file(GLOB sources_code ${PROJECT_SOURCE_DIR}/code/*.cc)
file(GLOB sources_phys ${PROJECT_SOURCE_DIR}/phys/*.cc)
file(GLOB sources_geom ${PROJECT_SOURCE_DIR}/geom/*.cc)
@@ -103,7 +119,13 @@ endif()
#----------------------------------------------------------------------------
# Add the executable, and link it to the Geant4 libraries
#
add_executable(bogemms ${PROJECT_SOURCE_DIR}/code/bogemms.cc ${sources_code} ${sources_phys} ${sources_geom} ${headers_code} ${headers_phys} ${headers_geom})
add_executable(bogemms
  ${PROJECT_SOURCE_DIR}/code/bogemms.cc
  ${sources_code} ${headers_code}
  ${sources_phys} ${headers_phys}
  ${sources_geom} ${headers_geom}
  ${user_sources} ${user_headers}
)
target_link_libraries(bogemms ${G4mpi_LIBRARIES} ${Geant4_LIBRARIES} ${EXTRALIBS})

#----------------------------------------------------------------------------

geom/EXACRAD.cc

deleted100644 → 0
+0 −1362

File deleted.

Preview size limit exceeded, changes collapsed.

geom/GAMMA.hh

deleted100644 → 0
+0 −111
Original line number Diff line number Diff line
/***************************************************************************
                          GAMMA.hh  -  description
                             -------------------
    begin                : 2018
    Authors              : V. Fioretti (INAF/IASF Bologna)

 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software for non commercial purpose              *
 *   and for public research institutes; you can redistribute it and/or    *
 *   modify it under the terms of the GNU General Public License.          *
 *   For commercial purpose see appropriate license terms                  *
 *                                                                         *
 ***************************************************************************/

#ifndef GAMMA_H
#define GAMMA_H 1
#include "globals.hh"


class G4LogicalVolume;
class G4VPhysicalVolume;
class G4Material;
class G4Region;
class G4UserLimits;

#include "G4VisAttributes.hh"
#include "G4VUserDetectorConstruction.hh"
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4Material.hh"
#include "G4SubtractionSolid.hh"
#include "G4IntersectionSolid.hh"
#include "G4UnionSolid.hh"
#include "G4Region.hh"
#include "G4RegionStore.hh"
#include "G4Element.hh"
#include "G4SDManager.hh"
#include "G4RunManager.hh"
#include "MaterialsDefinition.hh"
#include "G4UIcommand.hh"

#include "G4PhysicalVolumeStore.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4SolidStore.hh"

#include "G4VisAttributes.hh"
#include "G4Colour.hh"

//Factory
#include "GeoClassFactory.hh"

class GAMMA: public G4VUserDetectorConstruction {
public:

        GAMMA();
        ~GAMMA();

        G4VPhysicalVolume* Construct();
        void SetPhysicalWorld(G4VPhysicalVolume* World_phys);
        void DefineMaterials();
        G4VPhysicalVolume* ConstructGeometry(G4VPhysicalVolume* World_phys);
    

protected:

    
        void DefineSensitiveDetector();
        MaterialsDefinition* materials;

        // World
        //Physical Volumes
        G4VPhysicalVolume* World_phys;
        G4LogicalVolume* World_log;
    
        //Materials
    
        G4Material* chamber_mat;
        G4Material* foil_mat;
        G4Material* coll_mat;
        G4Material* coll_tube_mat;
        G4Material* coll_plate_mat;
        G4Material* erosita_plate_mat;
        G4Material* erosita_coating_mat;
        G4Material* spo_plate_mat;
        G4Material* spo_coating1_mat;
        G4Material* spo_coating2_mat;
        G4Material* spo_coating3_mat;
        G4Material* spo_waterfilm_mat;
        G4Material* det_mat;

private:
    
    G4UserLimits* target_limit;            // pointer to user step limits
    static DerivedRegister<GAMMA> reg;
    

    

};

#endif




geom/GeometryCOSI_ACS.cc

deleted100644 → 0
+0 −9973

File deleted.

Preview size limit exceeded, changes collapsed.

geom/GeometryCOSI_ACS.hh

deleted100644 → 0
+0 −128
Original line number Diff line number Diff line
/***************************************************************************
                          GeometryCOSI_ACS.hh    
    description:          Mass model of COSI ACS, based on mass model in 
                          MEGAlib for the balloon
                             -------------------
    begin                : 2023
    Authors              : A. Ciabattoni (INAF OAS Bologna) alex.ciabattoni@inaf.it
  
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software for non commercial purpose              *
 *   and for public research institutes; you can redistribute it and/or    *
 *   modify it under the terms of the GNU General Public License.          *
 *   For commercial purpose see appropriate license terms                  *
 *                                                                         *
 ***************************************************************************/
// Copyright 2025 Valentina Fioretti
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// **********************************************************************

#ifndef GeometryCOSI_ACS_H
#define GeometryCOSI_ACS_H
#include "globals.hh"


class G4LogicalVolume;
class G4VPhysicalVolume;
class G4Material;
class G4Region;
class G4UserLimits;

#include "G4VisAttributes.hh"
#include "G4VUserDetectorConstruction.hh"
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4Material.hh"
#include "G4SubtractionSolid.hh"
#include "G4IntersectionSolid.hh"
#include "G4UnionSolid.hh"
#include "G4Region.hh"
#include "G4RegionStore.hh"
#include "G4Element.hh"
#include "G4SDManager.hh"
#include "G4RunManager.hh"
#include "MaterialsDefinition.hh"

#include "G4PhysicalVolumeStore.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4SolidStore.hh"

#include "G4VisAttributes.hh"
#include "G4Colour.hh"

//Factory
#include "GeoClassFactory.hh"


class GeometryCOSI_ACS: public G4VUserDetectorConstruction {
public:

    GeometryCOSI_ACS();
    ~GeometryCOSI_ACS();

    G4VPhysicalVolume* Construct();
    void SetPhysicalWorld(G4VPhysicalVolume* World_phys);
    void DefineMaterials();
    G4VPhysicalVolume* ConstructGeometry(G4VPhysicalVolume* World_phys);

protected:

    void DefineSensitiveDetector();
    MaterialsDefinition* materials;

    // World
    //Physical Volumes
    G4VPhysicalVolume* World_phys;
    G4LogicalVolume* World_log;

    //Materials

    G4Material* chamber_mat;
    G4Material* CsI_mat;
    G4Material* SiPad_mat;
    G4Material* boro_glass_mat;
    G4Material* bialkali_mat;        
    G4Material* Al_mat;
    G4Material* PMTInside_mat;
    G4Material* bgo_mat;
    G4Material* ej560_mat;
    G4Material* refl1_mat;
    G4Material* refl2_mat;
    G4Material* refl3_mat;
    G4Material* SiPM_mat;
    G4Material* sy184_mat;
    G4Material* tefl_mat;
    G4Material* plastic_mat;
    G4Material* wood_mat;
    G4Material* wood2_mat;
    G4Material* coll_mat;
    G4Material* glass_mat;
    G4Material* coat_mat;
    G4Material* foam_mat;
    G4Material* rubber_mat;
    G4Material* steel_mat;
    G4Material* peek_mat;

private:
    
    G4UserLimits* target_limit;            // pointer to user step limits
    static DerivedRegister<GeometryCOSI_ACS> reg;
};

#endif
Loading