Skip to content

Commit

Permalink
changed some methods name
Browse files Browse the repository at this point in the history
  • Loading branch information
martinunland committed Jul 23, 2024
1 parent 76474c2 commit 9969fae
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 10 deletions.
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ project(OMSim)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})

# Add these lines for debug information
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")
#set(CMAKE_BUILD_TYPE Debug)
#set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")

# Option to build example with Geant4 UI and Vis drivers
option(WITH_GEANT4_UIVIS "Build example with Geant4 UI and Vis drivers" ON)
Expand Down Expand Up @@ -50,9 +50,9 @@ include(${ROOT_USE_FILE})
# Include the subdirectories

add_subdirectory(common)
#add_subdirectory(effective_area)
add_subdirectory(effective_area)
#add_subdirectory(radioactive_decays)
add_subdirectory(supernova)
#add_subdirectory(supernova)

# Copy auxiliary files from source directory to binary directory
set(mdom_aux
Expand Down
4 changes: 2 additions & 2 deletions common/framework/include/OMSimHitManager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ public:
G4int pModuleIndex = 0);

void reset();
std::vector<double> countHits(int pModuleIndex = 0);
std::vector<double> countMergedHits(int pModuleIndex = 0);
void setNumberOfPMTs(int pNumberOfPMTs, int pModuleIndex = 0);
HitStats getHitsOfModule(int pModuleIndex = 0);
HitStats getMergedHitsOfModule(int pModuleIndex = 0);
HitStats getSingleThreadHitsOfModule(int pModuleIndex = 0);
bool areThereHitsInModuleSingleThread(int pModuleIndex = 0);
void sortHitStatsByTime(HitStats &pHits);
Expand Down
5 changes: 3 additions & 2 deletions common/framework/src/OMSimHitManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ void OMSimHitManager::setNumberOfPMTs(int pNumberOfPMTs, int pModuleIndex)
* @param moduleIndex Index of the module for which to retrieve hit statistics. Default is 0.
* @return A HitStats structure containing hit information of specified module.
*/
HitStats OMSimHitManager::getHitsOfModule(int pModuleIndex)
HitStats OMSimHitManager::getMergedHitsOfModule(int pModuleIndex)
{
return mModuleHits[pModuleIndex];
}
Expand Down Expand Up @@ -195,7 +195,7 @@ void OMSimHitManager::reset()
* @param pModuleIndex Index of the module for which to count hits. Default is 0.
* @return A vector containing the hit count for each PMT in the specified module.
*/
std::vector<double> OMSimHitManager::countHits(int pModuleIndex)
std::vector<double> OMSimHitManager::countMergedHits(int pModuleIndex)
{
log_trace("Counting number of detected photons in module with index {}", pModuleIndex);
HitStats lHitsOfModule = mModuleHits[pModuleIndex];
Expand Down Expand Up @@ -310,6 +310,7 @@ std::vector<int> OMSimHitManager::calculateMultiplicity(const G4double pTimeWind

void OMSimHitManager::mergeThreadData()
{
log_trace("Merge thread data was called");
G4AutoLock lock(&mMutex);
if (mThreadData)
{
Expand Down
2 changes: 1 addition & 1 deletion doxygen_documentation/0_common.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Figure 4: <i>PMT response compared to measurement for different light sources. I

### Hit storage

The absorbed photon data is managed by the `OMSimHitManager` singleton. It maintains a vector of hit information (`HitStats` struct) for each sensitive detector. To analyze and export this data, use the `getSingleThreadHitsOfModule` method to retrieve data for the current thread, or `getHitsOfModule` to obtain merged data from all threads. Note that `getHitsOfModule` works only if `mergeThreadData` has been called at the end of the run. For analysis or storage at the end of an event, handle each thread separately as events end asynchronously. For practical examples, refer to the methods in `OMSimEffectiveAreaAnalysis` and `OMSimDecaysAnalysis`.
The absorbed photon data is managed by the `OMSimHitManager` singleton. It maintains a vector of hit information (`HitStats` struct) for each sensitive detector. To analyze and export this data, use the `OMSimHitManager::getSingleThreadHitsOfModule` method to retrieve data for the current thread, or `OMSimHitManager::getMergedHitsOfModule` to obtain merged data from all threads. Note that `OMSimHitManager::getMergedHitsOfModule` works only if `OMSimHitManager::mergeThreadData` has been called (happens at the end of the run when `OMSimRunActio::EndOfRunAction` is called). For analysis or storage at the end of an event, handle each thread separately as events end asynchronously. For practical examples, refer to the methods in `OMSimEffectiveAreaAnalysis` and `OMSimSNAnalysis::writeDataFile`.

An additional feature allows for the direct application of a QE cut. This ensures that only absorbed photons passing the QE test are retained in `OMSimHitManager`. To enable this feature, provide the "QE_cut" argument via the command line. In this case `OMSimSensitiveDetector::ProcessHits` will call `OMSimPMTResponse::passQE` and break early if it returns false, without storing the photon information.

Expand Down
2 changes: 1 addition & 1 deletion effective_area/include/OMSimEffectiveAreaAnalyisis.hh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public:
template <typename... Args>
void OMSimEffectiveAreaAnalyisis::writeScan(Args... args)
{
std::vector<double> lHits = OMSimHitManager::getInstance().countHits();
std::vector<double> lHits = OMSimHitManager::getInstance().countMergedHits();

std::fstream lDataFile;
lDataFile.open(mOutputFileName.c_str(), std::ios::out | std::ios::app);
Expand Down
2 changes: 2 additions & 0 deletions supernova/src/OMSimSNAnalysis.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ void OMSimSNAnalysis::writeDataFile()

lDatafile << lHitManager.getNumberOfModules() << "\t";

//write hit count for each module
for (int iModule = 0; iModule < lHitManager.getNumberOfModules(); iModule++)
{
G4double lNrHits = 0;
Expand All @@ -103,6 +104,7 @@ void OMSimSNAnalysis::writeDataFile()
lDatafile << lNrHits << "\t";
}

//write hit information
for (int iModule = 0; iModule < lHitManager.getNumberOfModules(); iModule++)
{
if (lHitManager.areThereHitsInModuleSingleThread(iModule))
Expand Down

0 comments on commit 9969fae

Please sign in to comment.