Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update #6

Merged
merged 7 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@


build/
build2/
build*/
doxygen_documentation/html
doxygen_documentation/latex
.vscode/
CMakeLists.txt
240617_analysis/*

240617_analysis/*
55 changes: 0 additions & 55 deletions 240617_analysis/okamoto_yield.ipynb

This file was deleted.

22 changes: 9 additions & 13 deletions common/framework/include/OMSim.hh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "OMSimSteppingAction.hh"
#include "OMSimUIinterface.hh"

#include <G4RunManager.hh>
#include <G4MTRunManager.hh>
#include <G4VisExecutive.hh>
#include <G4UIExecutive.hh>

Expand Down Expand Up @@ -53,28 +53,24 @@ public:
void startVisualisationIfRequested();
// OMSimDetectorConstruction* getDetectorConstruction();

G4Navigator *getNavigator() { return mNavigator; };
G4Navigator *getNavigator() { return mNavigator.get(); };
void extendOptions(po::options_description pNewOptions);
po::options_description mGeneralOptions;

private:
void initialLoggerConfiguration();
int determineNumberOfThreads();
po::variables_map parseArguments(int pArgumentCount, char *pArgumentVector[]);
void setUserArgumentsToArgTable(po::variables_map pVariablesMap);
void setGeneralOptions();

G4RunManager *mRunManager = nullptr;
G4VisExecutive *mVisManager = nullptr;
G4Navigator *mNavigator = nullptr;
G4VUserPhysicsList *mPhysics = nullptr;
G4VUserPrimaryGeneratorAction *mGenAction = nullptr;
G4UserRunAction *mRunAction = nullptr;
G4UserEventAction *mEventAction = nullptr;
G4UserTrackingAction *mTracking = nullptr;
G4UserSteppingAction *mStepping = nullptr;
G4TouchableHistory *mHistory = nullptr;
std::unique_ptr<G4MTRunManager> mRunManager;
std::unique_ptr<G4VisExecutive> mVisManager;
std::unique_ptr<G4VUserPhysicsList> mPhysics;
std::unique_ptr<G4TouchableHistory> mHistory;
std::unique_ptr<G4Navigator> mNavigator;

G4double mStartingTime = 0;
std::chrono::high_resolution_clock::time_point mStartingTime;
};

#endif // OMSIM_H
19 changes: 19 additions & 0 deletions common/framework/include/OMSimActionInitialization.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#ifndef OMSimActionInitialization_h
#define OMSimActionInitialization_h 1

#include "G4VUserActionInitialization.hh"

class OMSimActionInitialization : public G4VUserActionInitialization
{
public:
OMSimActionInitialization(long pSeed);
virtual ~OMSimActionInitialization();

virtual void BuildForMaster() const;
virtual void Build() const;

private:
long mMasterSeed;
};

#endif
2 changes: 1 addition & 1 deletion common/framework/include/OMSimDataFileTypes.hh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class abcDataFile
{
public:
abcDataFile(G4String pFileName);
~abcDataFile();
G4String mFileName;
G4String mObjectName;

Expand All @@ -66,7 +67,6 @@ public:
abcMaterialData(G4String pFileName) : abcDataFile(pFileName){};
G4Material *mMaterial;
G4MaterialPropertiesTable *mMPT;
G4NistManager *mMatDatBase;

void createMaterial();
void extractAbsorptionLength();
Expand Down
27 changes: 16 additions & 11 deletions common/framework/include/OMSimHitManager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

#include <G4ThreeVector.hh>
#include <fstream>
#include <G4AutoLock.hh>
#include <G4Threading.hh>

/**
* @struct HitStats
Expand Down Expand Up @@ -59,15 +61,9 @@ class OMSimHitManager
OMSimHitManager &operator=(const OMSimHitManager &) = delete;

public:
/**
* @brief Returns the singleton instance of the OMSimHitManager.
* @return A reference to the singleton instance.
*/
static OMSimHitManager &getInstance()
{
static OMSimHitManager instance;
return instance;
}


static OMSimHitManager& getInstance();

void appendHitInfo(
G4double pGlobalTime,
Expand All @@ -88,13 +84,22 @@ public:
HitStats getHitsOfModule(int pModuleIndex = 0);
void sortHitStatsByTime(HitStats &pHits);
std::vector<int> calculateMultiplicity(const G4double pTimeWindow, int pModuleNumber = 0);
std::map<G4int, HitStats> mModuleHits; ///< Map of a HitStats containing hit information for each simulated optical module

G4int getNextDetectorIndex() { return ++mCurrentIndex; }
void mergeThreadData();

std::map<G4int, HitStats> mModuleHits; ///< Map of a HitStats containing hit information for each simulated optical module

private:
std::map<G4int, G4int> mNumPMTs; ///< Map of number of PMTs in the used optical modules
G4int mCurrentIndex = -1;

static G4Mutex mMutex;
static OMSimHitManager* mInstance;

struct ThreadLocalData {
std::map<G4int, HitStats> moduleHits;
};
G4ThreadLocal static ThreadLocalData* mThreadData;
};

#endif
12 changes: 9 additions & 3 deletions common/framework/include/OMSimRunAction.hh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
#define OMSimRunAction_h 1

#include <G4UserRunAction.hh>

#include "OMSimHitManager.hh"
#include "OMSimLogger.hh"
class G4Run;

class OMSimRunAction : public G4UserRunAction
Expand All @@ -12,8 +13,13 @@ public:
~OMSimRunAction(){};

public:
void BeginOfRunAction(const G4Run*){};
void EndOfRunAction(const G4Run*){};
void BeginOfRunAction(const G4Run *) {};
void EndOfRunAction(const G4Run *run) override
{
log_debug("EndOfRunAction called");
// Merge thread data here
OMSimHitManager::getInstance().mergeThreadData();
}
};

#endif
2 changes: 1 addition & 1 deletion common/framework/include/OMSimSensitiveDetector.hh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class OMSimSensitiveDetector : public G4VSensitiveDetector
{
public:
OMSimSensitiveDetector(G4String pName, DetectorType pDetectorType);
virtual ~OMSimSensitiveDetector() {};
~OMSimSensitiveDetector() {};

G4bool ProcessHits(G4Step *pStep, G4TouchableHistory *pTouchableHistory) override;
void setPMTResponse(OMSimPMTResponse *pResponse);
Expand Down
2 changes: 1 addition & 1 deletion common/framework/include/OMSimUIinterface.hh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public:
*/
void runBeamOn(G4int pNumberOfEvents = -1)
{
log_debug("Running beamOn command");
log_trace("Running beamOn command");
G4int lNumEvents = pNumberOfEvents >= 0 ? pNumberOfEvents : OMSimCommandArgsTable::getInstance().get<G4int>("numevents");
applyCommand("/run/beamOn ", lNumEvents);
}
Expand Down
Loading
Loading