Commit 1c39b1d4 authored by Valentina Fioretti's avatar Valentina Fioretti
Browse files

templates added

parent 3a054350
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -114,7 +114,6 @@ GEOM.EXPERIMENT = 1
# Experiment = 1
#

GEOM.MAXSTEP = 0.1

# selecting the chamber material
GEOM.VACUUM = 1
+0 −11
Original line number Diff line number Diff line
@@ -36,17 +36,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// **********************************************************************
//
//
// ***************************************************************************
//                          OPTPhys.cc  -  description
//                             -------------------
//    Author        : Valentina Fioretti
//    creation date : 31/03/2016
//    email         : fioretti@iasfbo.inaf.it
// ***************************************************************************/
//
//

#if defined (GEANT4_11_1)

+0 −9
Original line number Diff line number Diff line
@@ -36,15 +36,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// **********************************************************************
//
//
// ***************************************************************************
//                          OPTPhys.hh  -  description
//                             -------------------
//    Author		: Valentina Fioretti, Andrea Bulgarelli
//    creation date	: 10/02/2015
//    email		: fioretti@iasfbo.inaf.it, bulgarelli@iasfbo.inaf.it
// ***************************************************************************/



+132 −0
Original line number Diff line number Diff line
// 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.
// **********************************************************************


#if defined(GEANT4_11_1)

#include "geometry_template.hh"
#include "G4Element.hh"
#include "G4Material.hh"
#include "G4Box.hh"
#include "G4Cons.hh"
#include "G4Polyhedra.hh"
#include "G4Tubs.hh"
#include "G4Trap.hh"
#include "G4Sphere.hh"
#include "G4LogicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4PVPlacement.hh"
#include "G4VisAttributes.hh"
#include "G4SubtractionSolid.hh"
#include "BoGEMMSGlobalMemory.hh"
#include "globals.hh"
#include "G4NistManager.hh"
#include "G4PVReplica.hh"
#include "MaterialsDefinition.hh"
#include "G4PVParameterised.hh"
#include "G4SubtractionSolid.hh"


#include "G4SystemOfUnits.hh"
#include "G4PhysicalConstants.hh"
#include "G4UserLimits.hh"



// Regions
#include "G4Region.hh"
#include "G4RegionStore.hh"
#include "G4ProductionCuts.hh"

// CADMesh
#include "CADMesh.hh"


#include <math.h>
#include <cstdlib>
#define PI 3.14159265


geometry_template::geometry_template()
: G4VUserDetectorConstruction()
{

    World_phys = 0;
    World_log = 0;
    materials = new MaterialsDefinition;

}

geometry_template::~geometry_template() {}

//The "geometry_template" string is registered as the name of the geometry to be used in the .conf file
DerivedRegister<geometry_template> geometry_template::reg("geometry_template");

G4VPhysicalVolume* geometry_template::Construct() {

    //DefineMaterials();
    World_phys = gm.ConstructWorld();
    World_log = gm.World_log;
    World_phys = ConstructGeometry(World_phys);
    
    ConfigureRegionCuts();

    return World_phys;
    
}

void geometry_template::ConfigureRegionCuts()
{

    G4String regName;
    G4Region* region = nullptr;
    G4ProductionCuts* cuts = nullptr;

    //----> Example on how to assign cuts to a region
    // custom cuts
    G4double customCut = 0.001 * mm;
    gm.config->readInto(customCut, "REGION.CUT");

    regName = "geometry_template_region";
    region = G4RegionStore::GetInstance()->GetRegion(regName);
    if (region) {
        cuts = new G4ProductionCuts;
        cuts->SetProductionCut(customCut);
        region->SetProductionCuts(cuts);
    }
    
    G4cout << "[geometry_template] Applying custom production cuts to region" << G4endl;

}

G4VPhysicalVolume* geometry_template::ConstructGeometry(G4VPhysicalVolume* World_phys) {
    
    // Region definition
    G4Region* region_target = new G4Region("geometry_template_region");
    
    // ----> BUILD GEOMETRY
    
    // example of getting material from list
    material_selection = materials->GetMaterial(<number>);
    
    // example on how to define custom parameters to be used in the .conf file
    <data_type> par_name = <value> * <unit>;
    gm.config->readInto(par_name, "PARAMETER NAME IN THE .CONF");
    
    return World_phys;
}

#endif
+96 −0
Original line number Diff line number Diff line
// 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 PROTONSCATTERING_H
#define PROTONSCATTERING_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 geometry_template: public G4VUserDetectorConstruction {
public:

        geometry_template();
        ~geometry_template();

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

protected:

    
        void DefineSensitiveDetector();
        MaterialsDefinition* materials;

        // World
        //Physical Volumes
        G4VPhysicalVolume* World_phys;
        G4LogicalVolume* World_log;
    
        //getting material from list    
        G4Material* material_selection;

private:
    
    static DerivedRegister<geometry_template> reg;
    

    

};

#endif




Loading