Commit 09c84f4b authored by Valentina Fioretti's avatar Valentina Fioretti
Browse files

new input logic, removed flag to activate MT

parent 5dd1013d
Loading
Loading
Loading
Loading
+238 −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.
// **********************************************************************

#include "BoGEMMSApplication.hh"
#include "globals.hh"
#include "G4VUserDetectorConstruction.hh"
#include "G4Element.hh"
#include "G4Material.hh"
#include "G4Box.hh"
#include "G4Cons.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4PVPlacement.hh"
#include "G4VisAttributes.hh"
#include "G4SubtractionSolid.hh"
#include "G4Region.hh"
#include "G4RegionStore.hh"
#include "ConfigFile.hh"
#include "BoGEMMSGlobalMemory.hh"
#include "G4RunManager.hh"
#include "GeoClassFactory.hh"
#include "PhysClassFactory.hh"


#if defined(GEANT4_11_1)
#include "FTFP_BERT.hh"
//#include "EXACRAD.hh"
//#include "GDMLread.hh"
//#include "GeometryCOSI.hh"
//#include "GeometryCOSI_ACS.hh"
#include "G4StepLimiterPhysics.hh"
#endif



#if defined(GEANT4_11_1)
#include "FTFP_BERT.hh"
#include "G4EmStandardPhysics.hh"
#include "G4EmStandardPhysics_option4.hh"
#include "G4EmLivermorePolarizedPhysics.hh"
#include "G4OpticalParameters.hh"
#include "G4OpticalPhysics.hh"
#endif

#if defined(GEANT4_11_1)
#include "G4SystemOfUnits.hh"
#include "G4PhysicalConstants.hh"
#endif


#include <iostream>
#include <map>
using namespace std;

GeoClassFactory::map_type * GeoClassFactory::map = NULL;
PhysClassFactory::map_type * PhysClassFactory::map = NULL;

#include "PhysClassFactory.hh"
#include "FTFP_BERT.hh"

//std::map<std::string, std::function<std::shared_ptr<G4VUserDetectorConstruction>()>> ClassFactory::classMap;


BoGEMMSApplication::BoGEMMSApplication() {
    World_phys = 0;
}


BoGEMMSApplication::~BoGEMMSApplication() {}


void BoGEMMSApplication::DefinePhysicList(G4RunManager * runManager) {

 /*
    switch(gm.physVersion) {

#if defined(GEANT4_11_1)
        case 800: {
            
            ///AREMBES
            AREMBESPhys *physList = new AREMBESPhys;
            runManager->SetUserInitialization(physList);
            G4String hadronname;
            gm.config->readInto(hadronname, "HADRONPHYS.NAME");
            physList->AddPhysicsList(hadronname);
        }
            break;
            
        case 410: {
            
            ///COSI
            G4VModularPhysicsList* physicsList = new FTFP_BERT;
            physicsList->ReplacePhysics(new G4EmLivermorePolarizedPhysics());
 
            G4OpticalPhysics* opticalPhysics = new G4OpticalPhysics();
            auto opticalParams               = G4OpticalParameters::Instance();

            //opticalParams->SetScintEnhancedTimeConstants(true);
            //opticalParams->SetScintFiniteRiseTime(true); // for the rise time
            opticalParams->SetScintTrackSecondariesFirst(true); // default
            
            opticalParams->SetWLSTimeProfile("delta"); // default

            opticalParams->SetCerenkovMaxPhotonsPerStep(100);
            opticalParams->SetCerenkovMaxBetaChange(10.0);
            opticalParams->SetCerenkovTrackSecondariesFirst(true);
            
            
            physicsList->RegisterPhysics(opticalPhysics);
            runManager->SetUserInitialization(physicsList);
             
        }
            break;
        
        case 420: {

            ///COSI (2)
            G4VModularPhysicsList* physicsList = new G4VModularPhysicsList();
            physicsList->RegisterPhysics(new G4EmStandardPhysics());
            physicsList->RegisterPhysics(new G4OpticalPhysics());
            runManager->SetUserInitialization(physicsList);
        }
	    break;

        case 430: {
            // COSI (3)
            G4VModularPhysicsList* physicsList = new FTFP_BERT;
            physicsList->ReplacePhysics(new G4EmLivermorePolarizedPhysics());
 
            runManager->SetUserInitialization(physicsList);
        }
        break;
            
#endif
	default: {
		cout << "Physic list version wrong: " << gm.physVersion << endl;
		exit(1);
	}
	break;
    }

    cout << "physics list ID " << gm.physVersion << endl;
  */
    
    cout << "Physics class activated: " << gm.physVersion << endl;
    auto obj = PhysClassFactory::createInstance(gm.physVersion);
    if (obj) {
        runManager->SetUserInitialization(obj);
        //obj->AddPhysicsList(hadronname);
    } else {
        std::cout << "Physics class not found." << std::endl;
    }

}


G4VPhysicalVolume* BoGEMMSApplication::Construct() {

    /*
    //geometry definition
    switch(gm.geomVersion) {

    #if defined(GEANT4_11_1)
    case 22: {
            cout << "Build EXACRAD experiment" << endl;
            EXACRAD* detector = new EXACRAD();
            World_phys = detector->Construct();
    }
    break;
    case 29: {
            cout << "Build COSI" << endl;
            GeometryCOSI* detector = new GeometryCOSI();
            World_phys = detector->Construct();
        }
        break;
    case 32: {
            cout << "Build COSI ACS" << endl;
            GeometryCOSI_ACS* detector = new GeometryCOSI_ACS();
            World_phys = detector->Construct();
        }
        break;
    case 40: {
            cout << "Build GDML reader" << endl;
            GDMLread* detector = new GDMLread();
            World_phys = detector->Construct();
        }
        break;
    #endif

    default:
        cout << "Geometry version wrong: " << gm.geomVersion << endl;
        exit(1);
    }*/

    /*
    ClassFactory::registerClass<EXACRAD>("EXACRAD");

    auto obj = ClassFactory::create("EXACRAD");
    if (obj) {
        World_phys = obj->Construct();
    } else {
        std::cout << "Class not found." << std::endl;
    }
     
     */
    
    cout << "Geometry class activated: " << gm.geomVersion << endl;
    
    auto obj = GeoClassFactory::createInstance(gm.geomVersion);
    if (obj) {
        World_phys = obj->Construct();
    } else {
        std::cout << "Geometry class not found." << std::endl;
    }
    
    return World_phys;
}

void BoGEMMSApplication::ConstructSDandField() {
    
    gm.AddXYZDetector();

}
+52 −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 BOGEMMSAPPLICATION_H
#define BOGEMMSAPPLICATION_H
#include "globals.hh"
#include "G4RunManager.hh"
class G4LogicalVolume;
class G4VPhysicalVolume;
class G4Material;
class G4Region;
#include "G4VUserDetectorConstruction.hh"
#include "FTFP_BERT.hh"
#include "PhysClassFactory.hh"

class BoGEMMSApplication : public G4VUserDetectorConstruction {
public:
    BoGEMMSApplication();

    ~BoGEMMSApplication();

    G4VPhysicalVolume* Construct();
    
    G4VPhysicalVolume* ConstructWorld();

    void DefinePhysicList(G4RunManager * runManager);

    G4LogicalVolume* World_log;

    G4VPhysicalVolume* World_phys;

    G4Material* World_mat;

    void ConstructSDandField();
    
    
};

#endif
+434 −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.
// **********************************************************************

#include "G4MPImanager.hh"
#include "BoGEMMSGlobalMemory.hh"
#include <fstream>
#include <iomanip>
#include <stdio.h>
#include "G4LogicalVolume.hh"
#include <G4VPhysicalVolume.hh>
#include "G4ThreeVector.hh"
#include <G4VSolid.hh>
#include "G4PVPlacement.hh"
#include "G4VUserDetectorConstruction.hh"
#include "G4PVReplica.hh"
#include "G4SDManager.hh"
#include "G4Element.hh"
#include "G4Material.hh"
#include "G4PVPlacement.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4VisAttributes.hh"
#include "G4SubtractionSolid.hh"
#include "G4Region.hh"
#include "G4RegionStore.hh"
#include "globals.hh"
#include "G4VUserDetectorConstruction.hh"

#include "FITSOutput_XYZ.hh"
#include "CXYZSD.hh"

#if defined(GEANT4_11_1)
#include "G4SystemOfUnits.hh"
#include "G4PhysicalConstants.hh"
#endif

#include "SQLliteOutput_XYZ.hh"
#include "MongoOutput_XYZ.hh"


#include <fitsio.h>

using namespace std;

BoGEMMSGlobalMemory gm;

BoGEMMSGlobalMemory::BoGEMMSGlobalMemory() {

    //scrivi il file XYZ
    enableWriteXYZ = true;

    //scrivi i file di output in formato FITS
    enableWriteFITS = false;
    
    enableFITSCompression= true;

    enableWriteFITSEnd = false;

    //scrivi i file di output in formato TXT
    enableWriteTXT = false;

    enableLowEnergyPhysic = true;

    enableHighEnergyPhysic = true;

    nfileFITSXYZ = 0;
    nfileSQLXYZ = 0;
    nfileMONGODBXYZ = 0;

    compressionlevel = 9;

    detector_volmin = -1;
    detector_volmax = -1;
    

// 	G4cout << "BoGEMMSGlobalMemory::BoGEMMSGlobalMemory()" << G4endl;
}


BoGEMMSGlobalMemory::~BoGEMMSGlobalMemory() {
}

void BoGEMMSGlobalMemory::OpenConfigFile() {
    config = new ConfigFile(gm.configFileName);
    config->readInto(enableWriteFITS, "IO.FILETYPE.FITS");
    config->readInto(enableFITSCompression, "IO.FILETYPE.FITS.COMPRESS");
    config->readInto(enableWriteFITSEnd, "IO.FILETYPE.FITSEND");
    config->readInto(enableWriteSQlite3, "IO.FILETYPE.SQLITE3");
    config->readInto(enableWriteMONGODB, "IO.FILETYPE.MONGODB");
    config->readInto(enableWriteXYZ, "IO.FILE.XYZ");
    cout << "IO.FILETYPE.FITS " << enableWriteFITS << endl;
    cout << "IO.FILETYPE.FITSEND " << enableWriteFITSEnd << endl;
    cout << "IO.FILETYPE.SQLITE3 " << enableWriteSQlite3 << endl;
    cout << "IO.FILETYPE.MONGODB " << enableWriteMONGODB << endl;
    cout << "IO.FILE.XYZ " << enableWriteXYZ << endl;
    config->readInto(geomVersion, "GEOM.VERSION");
    config->readInto(physVersion, "ENERGYPROCESS.VERSION");
    cout << "GEOM.VERSION " << geomVersion << endl;
    cout << "ENERGYPROCESS.VERSION " << physVersion << endl;

}

void BoGEMMSGlobalMemory::InitFiles() {
    if(enableWriteFITS && enableWriteXYZ) {
        fits_xyz = new FITSOutput_XYZ();
        fits_xyz->init();
    }
	

    #ifdef SQLITE3
        if(enableWriteSQlite3 && enableWriteXYZ) {
            sqlite3_config(SQLITE_CONFIG_SERIALIZED);
            sqlite3_xyz = new SQLliteOutput_XYZ();
            sqlite3_xyz->init();
        }
    #endif
    
    #ifdef MONGODB
        if(enableWriteMONGODB && enableWriteXYZ) {
            mongodb_xyz = new MongoOutput_XYZ();
            mongodb_xyz->init();
        }
    #endif
}

G4String BoGEMMSGlobalMemory::GetOutputXYZFileNameTXT() {
    char fn[255];
    //sprintf(fn, "xyz.%ld.out", nfileFITSXYZ);
    snprintf(fn, sizeof(fn), "xyz.%ld.out", nfileFITSXYZ);
    std::ofstream asciiFile(fn, std::ios::app);
    if(asciiFile.is_open()) {
        long pos;
        pos=asciiFile.tellp();
        if(pos > 1700000000)
            nfileFITSXYZ++;
    }
    //sprintf(fn, "xyz.%ld.out", nfileFITSXYZ);
    snprintf(fn, sizeof(fn), "xyz.%ld.out", nfileFITSXYZ);
    outputXYZFileNameTXT = fn;
    return outputXYZFileNameTXT;
}


G4String BoGEMMSGlobalMemory::GetOutputXYZFileNameFITS() {
    char fn[255];
    char fn2[255];
    G4String name;
    name = "";
    gm.config->readInto(name, "TEMPFITSOUTPUT.PREFIX");
    G4int rank = G4MPImanager::GetManager()->GetRank();
    //sprintf(fn, "%sxyz.%ld.task%d.fits", name.data(), nfileFITSXYZ, rank);
    snprintf(fn, sizeof(fn), "%sxyz.%ld.task%d.fits", name.data(), nfileFITSXYZ, rank);
    //sprintf(fn2, "xyz.%ld.task%d.fits", nfileFITSXYZ, rank);
    snprintf(fn2, sizeof(fn2), "xyz.%ld.task%d.fits", nfileFITSXYZ, rank);

    outputXYZFileNameFITS = fn;
    outputXYZFileNameFITS_base = fn2;
    nfileFITSXYZ++;
    return outputXYZFileNameFITS;
}

G4String BoGEMMSGlobalMemory::GetOutputSQLliteXYZFileName() {
    
    G4int rank = G4MPImanager::GetManager()->GetRank();
    char fn[255];
    //sprintf(fn, "xyz.%ld.task%d.db", nfileSQLXYZ, rank);
    snprintf(fn, sizeof(fn), "xyz.%ld.task%d.db", nfileSQLXYZ, rank);
    outputXYZFileNameSQLlite_base = fn;
    
    nfileSQLXYZ++;
    return outputXYZFileNameSQLlite_base;
}

G4String BoGEMMSGlobalMemory::GetOutputMongoXYZCollectionName() {
    G4int rank = G4MPImanager::GetManager()->GetRank();
    G4String collection_name = "";
    gm.config->readInto(collection_name, "IO.FILETYPE.MONGODB.COLLECTION_NAME");
    char fn[255];
    snprintf(fn, sizeof(fn), "%s_collection_task%d", collection_name.c_str(), rank);
    outputXYZCollectionNameMongo_base = fn;
    
    return outputXYZCollectionNameMongo_base;
}

G4String BoGEMMSGlobalMemory::GetMongoUri() {
    G4String uri_address = "";
    gm.config->readInto(uri_address, "IO.FILETYPE.MONGODB.ADDRESS");
    cout << "IO.FILETYPE.MONGODB.ADDRESS " << uri_address << endl;
    return uri_address;
}

bool BoGEMMSGlobalMemory::GetFITSCompressionStatus(){
    return enableFITSCompression;
}


int BoGEMMSGlobalMemory::CopyFileFits(char* in, char* out) {
    G4String ins;
    ins = in;
    G4String outs;
    outs = out;
    if(ins == outs)
        return 0;
    G4cout << "Copy files from " << ins << " to " << outs << G4endl;
    fitsfile *infptr, *outfptr;   /* FITS file pointers defined in fitsio.h */
    int status = 0;       /* status must always be initialized = 0  */
    /* Open the input file */
    if ( !fits_open_file(&infptr, in, READONLY, &status) )
    {
        /* Create the output file */
        if ( !fits_create_file(&outfptr, out, &status) )
        {

            /* copy the previous, current, and following HDUs */
            fits_copy_file(infptr, outfptr, 1, 1, 1, &status);

            fits_close_file(outfptr,  &status);
        }
        fits_delete_file(infptr, &status);
    }
    //delete temp file
// 	fits_delete_file(infptr, &status);
    /* if error occured, print out error message */
    if (status) fits_report_error(stderr, status);
    return(status);

}

void BoGEMMSGlobalMemory::AddXYZDetector(G4LogicalVolume* log) {
    gm.logs_sd.push_back(log);
}

void BoGEMMSGlobalMemory::AddXYZDetector() {
    std::vector<G4LogicalVolume*>::iterator log_it;
    for (log_it = gm.logs_sd.begin(); log_it != gm.logs_sd.end(); ++log_it)
    {
        G4LogicalVolume* log = *log_it;
        G4SDManager* SDman_XYZ = G4SDManager::GetSDMpointer();
        G4String name_xyz = log->GetName();
        name_xyz += "SD";
        CXYZSD *vsd = new CXYZSD(name_xyz);
        SDman_XYZ->AddNewDetector(vsd);
        log->SetSensitiveDetector(vsd);
    }
}

G4VPhysicalVolume* BoGEMMSGlobalMemory::ConstructWorld() {
    
    G4double WorldSizeX;
    G4double WorldSizeY;
    G4double WorldSizeZ;
    
    G4double WorldSize_input = 0;
    gm.config->readInto(WorldSize_input, "WORLD.BOX.SIDE");
    G4cout << "WORLD.BOX.SIDE: " << WorldSize_input << G4endl;
    
    if (WorldSize_input > 0.0) {
        WorldSizeX=WorldSize_input*mm;
        WorldSizeY=WorldSize_input*mm;
        WorldSizeZ=WorldSize_input*mm;
        
    } else {
        
        WorldSizeX=40000.0*mm;
        WorldSizeY=40000.0*mm;
        WorldSizeZ=40000.0*mm;

    }
    
    
    //G4double WorldSizeX=4000.000*mm;
    //G4double WorldSizeY=4000.000*mm;
    //G4double WorldSizeZ=4000.000*mm;

    G4cout << "######################################################" << G4endl;
    G4cout << "World dimension: " << WorldSizeX << " * " << WorldSizeY << " * " << WorldSizeZ << G4endl;
    G4cout << "######################################################" << G4endl;

    G4String name, symbol;
    G4double a, z, density;

    G4double temperature, pressure;
    density     = universe_mean_density;
    pressure    = 3.e-18*pascal;
    temperature = 2.73*kelvin;


    World_mat = new G4Material(name="Galactic", z=1., a=1.01*g/mole, density,kStateGas,temperature,pressure);

    G4Box* solidWorld = new G4Box("World",
                                  WorldSizeX/2,WorldSizeY/2,WorldSizeZ/2);

    World_log = new G4LogicalVolume(solidWorld,
                                    World_mat,
                                    "World");
    
    World_log->SetVisAttributes (&G4VisAttributes::GetInvisible);

    World_phys = new G4PVPlacement(0,G4ThreeVector(),
                                   World_log,
                                   "World",
                                   0,
                                   false,
                                   0);

    return World_phys;
}

unsigned char BoGEMMSGlobalMemory::LUTParticleType(G4String p) {
    unsigned char particleID;
    particleID = 0;
    if(p == "gamma")
        particleID = 1;
    if(p == "e-")
        particleID = 2;
    if(p == "e+")
        particleID = 3;
    if(p == "proton")
        particleID = 4;
    if(p == "mu+")
        particleID = 5;
    if(p == "mu-")
        particleID = 6;
    if(p == "tau+")
        particleID = 7;
    if(p == "tau-")
        particleID = 8;
    if(p == "GenericIon")
        particleID = 9;
    if(p == "neutron")
        particleID = 10;
    if(p == "pi+")
        particleID = 11;
    if(p == "pi-")
        particleID = 12;
    if(p == "triton")
        particleID = 13;
    if(p == "sigma-")
        particleID = 14;
    if(p == "sigma+")
        particleID = 15;
    if(p == "nu_mu")
        particleID = 16;
    if(p == "nu_e")
        particleID = 17;
    if(p == "lambda")
        particleID = 18;
    if(p == "kaon0S")
        particleID = 19;
    if(p == "kaon0L")
        particleID = 20;
    if(p == "kaon-")
        particleID = 21;
    if(p == "kaon+")
        particleID = 22;
    if(p == "deuteron")
        particleID = 23;
    if(p == "anti_xi0")
        particleID = 24;
    if(p == "anti_xi-")
        particleID = 25;
    if(p == "anti_sigma-")
        particleID = 26;
    if(p == "anti_proton")
        particleID = 27;
    if(p == "anti_nu_mu")
        particleID = 28;
    if(p == "anti_nu_e")
        particleID = 29;
    if(p == "anti_neutron")
        particleID = 30;
    if(p == "anti_lambda")
        particleID = 31;
    if(p == "alpha")
        particleID = 32;
    if(p == "Si30[0.0]")
        particleID = 33;
    if(p == "Si29[0.0]")
        particleID = 34;
    if(p == "Si28[0.0] ")
        particleID = 35;

    return particleID;
}

unsigned char BoGEMMSGlobalMemory::LUTProcessType(G4String p) {
    unsigned char processID;
    processID = 0;
    if(p == "UserLimit")
        processID = 1;
    if(p == "Transportation")
        processID = 2;
    if(p == "hLowEIoni")
        processID = 3;
    if(p == "msc")
        processID = 4;
    if(p == "LowEnergyIoni")
        processID = 5;
    if(p == "LowEnBrem")
        processID = 6;
    if(p == "eIoni")
        processID = 7;
    if(p == "eBrem")
        processID = 8;
    if(p == "annihil")
        processID = 9;
    if(p == "phot")
        processID = 10;
    if(p == "compt")
        processID = 11;
    if(p == "conv")
        processID = 12;
    if(p == "LowEnPhotoElec")
        processID = 13;
    if(p == "LowEnCompton")
        processID=14;
    return processID;
}

+165 −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 BOGEMMSGLOBALMEMORY_H
#define BOGEMMSGLOBALMEMORY_H

#define USE_FITS 1


#include "G4ios.hh"
#include "G4String.hh"
#include "CXYZSD.hh"
#include "ConfigFile.hh"

class G4VPhysicalVolume;
class FITSOutput_XYZ;
class G4LogicalVolume;
class G4VPhysicalVolume;
class G4Material;

#ifdef SQLITE3
class SQLliteOutput_XYZ;
#endif

#ifdef MONGODB
class MongoOutput_XYZ;
#endif

class BoGEMMSGlobalMemory {
public:
    BoGEMMSGlobalMemory();

    ~BoGEMMSGlobalMemory();

    G4String configFileName; //the name of the config file

    G4String GetOutputXYZFileNameTXT();

    G4String GetOutputXYZFileNameFITS();
    
    bool GetFITSCompressionStatus();
    
    G4String GetOutputSQLliteXYZFileName();
    
    G4String GetOutputMongoXYZCollectionName();
    
    G4String GetMongoUri();
    

    void OpenConfigFile();

    G4int event_id;

    G4bool DOWNLOADGEOMETRY;

    int compressionlevel;

    void AddXYZDetector(G4LogicalVolume* logs);

    void AddXYZDetector();

    FITSOutput_XYZ* fits_xyz;

    
#ifdef SQLITE3
	
	SQLliteOutput_XYZ* sqlite3_xyz;
	
#endif

#ifdef MONGODB
    
    MongoOutput_XYZ* mongodb_xyz;
    
#endif

    void InitFiles();

    long nfileFITSXYZ;
    long nfileSQLXYZ;
    long nfileMONGODBXYZ;

    ConfigFile* config;

    G4VPhysicalVolume* ConstructWorld();

    G4LogicalVolume* World_log;

    G4VPhysicalVolume* World_phys;

    G4Material* World_mat;

    unsigned char LUTParticleType(G4String p);

    unsigned char LUTProcessType(G4String p);

    int CopyFileFits(char* in, char* out);

public:

    int detector_volmin;

    int detector_volmax;

    //configuration (see constructor)

    bool enableLowEnergyPhysic;

    bool enableHighEnergyPhysic;

    G4bool enableWriteINOUT;

    G4bool enableWriteXYZ;

    G4bool enableWriteFITS;

    G4bool enableFITSCompression;
    
    G4bool enableWriteFITSEnd;
    
    G4bool enableWriteSQlite3;
    
    G4bool enableWriteMONGODB;

    G4bool enableWriteTXT;

    G4String geomVersion;

    G4String physVersion;


public:


    G4String outputXYZFileNameTXT;

    G4String outputXYZFileNameFITS;

    G4String outputXYZFileNameFITS_base;
    
    G4String outputXYZFileNameSQLlite_base;
    
    G4String outputXYZCollectionNameMongo_base;

    std::vector<G4LogicalVolume*> logs_sd;

};

extern BoGEMMSGlobalMemory gm;

#endif

+1 −16
Original line number Diff line number Diff line
@@ -14,27 +14,12 @@
// limitations under the License.
// **********************************************************************

//
/// \file PrimaryGeneratorAction.cc
/// \brief Implementation of the PrimaryGeneratorAction class
//
//
// $Id: PrimaryGeneratorAction.cc 89705 2015-04-27 17:15:27Z maire $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//
// 02.01.2019 V. Fioretti
// - Adaptation to BoGEMMS architecture to select both GPS and custom primary generator
//
// **********************************************************************

#include "G4Event.hh"
#include "G4GeneralParticleSource.hh"
#include "G4ParticleGun.hh"

#include "BoGEMMSPrimaryGeneratorAction.hh"
#include "THELGlobalMemory.hh"
#include "BoGEMMSGlobalMemory.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4PrimaryParticle.hh"
Loading