OMSim
Geant4 for IceCube optical module studies
OMSimHitManager Class Reference

Manages detected photon information. More...

Collaboration diagram for OMSimHitManager:
[legend]

Detailed Description

Stores, manages, and provides access information related to detected photons across multiple optical modules. The manager uses a global instance pattern, ensuring a unified access point for photon hit data. Its lifecycle is managed by the OMSim class.

The hits are stored using 'OMSimHitManager::appendHitInfo'. The analysis manager of each study is in charge of writing the stored information into a file (see for example 'OMSimEffectiveAreaAnalyisis::writeScan' or 'OMSimDecaysAnalysis::writeHitInformation'). If the simulation will continue after the data is written, do not forget calling 'OMSimHitManager::reset'!.

Classes

struct  ThreadLocalData
 

Public Member Functions

void appendHitInfo (G4int p_eventid, G4double pGlobalTime, G4double pLocalTime, G4double pTrackLength, G4double pEnergy, G4int pPMTHitNumber, G4ThreeVector pMomentumDirection, G4ThreeVector pGlobalPos, G4ThreeVector pLocalPos, G4double pDistance, OMSimPMTResponse::PMTPulse pResponse, G4int pModuleIndex=0)
 Appends hit information for a detected photon to the corresponding module's hit data. More...
 
void reset ()
 Deletes hit information in memory for all modules.
 
std::vector< double > countMergedHits (int pModuleIndex=0, bool pDEweight=false)
 Counts hits for a specified module. More...
 
void setNumberOfPMTs (int pNumberOfPMTs, int pModuleIndex=0)
 Stores the number of PMTs in a module for correct data handling. More...
 
HitStats getMergedHitsOfModule (int pModuleIndex=0)
 Retrieves the HitStats structure for the specified module, should be called after data between threads was merged. More...
 
HitStats getSingleThreadHitsOfModule (int pModuleIndex=0)
 Retrieves the HitStats structure for the specified module of single thread. More...
 
bool areThereHitsInModuleSingleThread (int pModuleIndex=0)
 
void sortHitStatsByTime (HitStats &pHits)
 Sorts the hit statistics by the hit time. More...
 
std::vector< int > calculateMultiplicity (const G4double pTimeWindow, int pModuleNumber=0)
 Calculates the multiplicity of hits within a specified time window for a given module. More...
 
G4int getNextDetectorIndex ()
 
G4int getNumberOfModules ()
 
void mergeThreadData ()
 

Static Public Member Functions

static void init ()
 Initializes the global instance of OMSimHitManager. More...
 
static void shutdown ()
 Deletes the global instance of OMSimHitManager. More...
 
static OMSimHitManagergetInstance ()
 

Public Attributes

std::map< G4int, HitStatsm_moduleHits
 Map of a HitStats containing hit information for each simulated optical module.
 

Private Member Functions

 OMSimHitManager (const OMSimHitManager &)=delete
 
OMSimHitManageroperator= (const OMSimHitManager &)=delete
 

Private Attributes

std::map< G4int, G4int > m_numberOfPMTs
 Map of number of PMTs in the used optical modules.
 
G4int m_currentIndex
 

Static Private Attributes

static G4Mutex m_mutex = G4Mutex()
 
static OMSimHitManagerm_instance = nullptr
 
static G4ThreadLocal ThreadLocalDatam_threadData = nullptr
 

Member Function Documentation

◆ appendHitInfo()

void OMSimHitManager::appendHitInfo ( G4int  p_eventid,
G4double  p_globalTime,
G4double  p_localTime,
G4double  p_trackLength,
G4double  p_energy,
G4int  p_PMTHitNumber,
G4ThreeVector  p_momentumDirection,
G4ThreeVector  p_globalPos,
G4ThreeVector  p_localPos,
G4double  p_distance,
OMSimPMTResponse::PMTPulse  p_response,
G4int  p_moduleNumber = 0 
)

This method appends hit information to the corresponding module's HitStats structure in the manager. If the specified module number is not yet in the manager, a new HitStats structure is created for it.

Parameters
p_globalTimeTime of detection.
p_localTimePhoton flight time.
p_trackLengthLength of the photon's path before hitting.
p_energyEnergy of the detected photon.
p_PMTHitNumberID of the PMT that detected the photon.
p_momentumDirectionMomentum direction of the photon at the time of detection.
p_globalPosGlobal position of the detected photon.
p_localPosLocal position of the detected photon within the PMT.
p_distanceDistance between generation and detection of photon.
p_responsePMT's p_response to the detected photon, encapsulated as a PMTPulse.
p_moduleNumberID of the module in which the photon was detected.

◆ calculateMultiplicity()

std::vector< int > OMSimHitManager::calculateMultiplicity ( const G4double  p_timeWindow,
int  p_moduleIndex = 0 
)

This method determines the multiplicity of hits for the specified optical module within a given time window. Multiplicity is defined as the number of PMTs detecting a hit within the time window. The result is a vector where each element represents the number of occurrences of a specific multiplicity.

For instance, if the resulting vector is [5, 3, 2], it means:

  • 5 occurrences of 1 PMT detecting a hit within the time window.
  • 3 occurrences of 2 PMTs detecting hits within the same window.
  • 2 occurrences of 3 PMTs detecting hits within the window.
Parameters
p_timeWindowThe time window within which to calculate the multiplicity (in seconds).
p_moduleIndexThe index of the module for which to calculate the multiplicity. Default is 0.
Returns
A vector containing the multiplicity data.

◆ countMergedHits()

std::vector< double > OMSimHitManager::countMergedHits ( int  p_moduleIndex = 0,
bool  p_getWeightedDE = false 
)
Parameters
p_moduleIndexIndex of the module for which to count hits. Default is 0.
p_getWeightedDEIf true, the counts are weighted with detection probability
Returns
A vector containing the hit count for each PMT in the specified module.

◆ getInstance()

OMSimHitManager & OMSimHitManager::getInstance ( )
static
Returns
A reference to the global OMSimHitManager instance.
Exceptions
assertif instance exists (i.e. if it was called before init() or after shutdown()).

◆ getMergedHitsOfModule()

HitStats OMSimHitManager::getMergedHitsOfModule ( int  p_moduleIndex = 0)
See also
mergeThreadData
Parameters
p_moduleIndexIndex of the module for which to retrieve hit statistics. Default is 0.
Returns
A HitStats structure containing hit information of specified module.

◆ getSingleThreadHitsOfModule()

HitStats OMSimHitManager::getSingleThreadHitsOfModule ( int  p_moduleIndex = 0)
Parameters
p_moduleIndexIndex of the module for which to retrieve hit statistics. Default is 0.
Returns
A HitStats structure containing hit information of specified module.

◆ init()

void OMSimHitManager::init ( )
static

This method is normally called in OMSim::initialiseSimulation.

◆ setNumberOfPMTs()

void OMSimHitManager::setNumberOfPMTs ( int  p_numberOfPMTs,
int  p_moduleIndex = 0 
)
Parameters
p_numberOfPMTsNr of PMTs in OM
p_moduleIndexModule index for which we are getting the information (default 0)

◆ shutdown()

void OMSimHitManager::shutdown ( )
static

This method is normally called in the destructor ~OMSim.

◆ sortHitStatsByTime()

void OMSimHitManager::sortHitStatsByTime ( HitStats p_hits)
Parameters
p_hitsThe hit statistics to be sorted.

The documentation for this class was generated from the following files: