List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Attributes | Private Member Functions | Private Attributes
CachedShowerRegeneratorOG::CachedShowerRegenerator Class Reference

Shower unthinning. More...

#include <CachedShowerRegenerator.h>

Inheritance diagram for CachedShowerRegeneratorOG::CachedShowerRegenerator:
Inheritance graph
[legend]

Public Types

enum  ResultFlag { eSuccess, eFailure, eBreakLoop, eContinueLoop }
 Flag returned by module methods to the RunController. More...
 
enum  VersionInfoType {
  eFilename = 1, eRevisionNumber = 2, eDate = 3, eTime = 4,
  eLastEditor = 5
}
 Different types of version info that can be retrieved from GetVersionInfo. More...
 

Public Member Functions

 CachedShowerRegenerator ()
 
VModule::ResultFlag Finish ()
 Finish: invoked at end of the run (NOT end of the event) More...
 
utl::StopwatchGetStopwatch ()
 
const utl::StopwatchGetStopwatch () const
 
std::string GetVersionInfo (const VersionInfoType v) const
 Retrieve different sorts of module version info. More...
 
VModule::ResultFlag Init ()
 Initialize: invoked at beginning of run (NOT beginning of event) More...
 
void InitTiming ()
 
VModule::ResultFlag Run (evt::Event &event)
 Run: invoked once per event. More...
 
ResultFlag RunWithTiming (evt::Event &event)
 

Static Public Member Functions

static std::string GetResultFlagByName (const ResultFlag flag)
 

Protected Types

enum  InfoLevel { eInfoNone = 0, eInfoFinal = 1, eInfoIntermediate = 2, eInfoDebug = 3 }
 

Protected Attributes

int fInfoLevel = 0
 

Private Member Functions

void InitNewShower (evt::Event &event)
 
bool IsParticleEnergyLow (const int type, const double energy) const
 
void OutputStats (evt::Event &event)
 
 REGISTER_MODULE ("CachedShowerRegeneratorOG", CachedShowerRegenerator)
 

Private Attributes

double fDeltaPhi = 0
 
double fDeltaROverR = 0
 
double fElectronEnergyCut = 0
 
double fHadronEnergyCut = 0
 
double fHorizontalParticleCut = 0
 
double fInnerRadiusCut = 0
 
bool fLimitParticlesPerCycle = false
 
double fLogGaussSmearingWidth = 0
 
double fMARTARadius = 0
 
double fMesonEnergyCut = 0
 
double fMuonEnergyCut = 0
 
double fMuonWeightScale = 1
 
double fOuterRadiusCut = 1e6*utl::km
 
unsigned int fParticlesPerCycle = 0
 
double fPhiGranularity = 0
 
double fPhotonEnergyCut = 0
 
utl::RandomEngine::RandomEngineTypefRandomEngine = nullptr
 
double fRGranularity = 0
 
utl::ShadowPtr< ShowerDatafShowerData
 
bool fSimulateMARTA = false
 
bool fSimulateUMD = false
 
double fUMDMaxRadius = 0
 
double fUMDTightRadius = 0
 
bool fUseStationPositionMatrix = true
 
bool fUseWeightDependentResamplingArea = true
 
bool fUseWeightedStationSimulation = false
 
unsigned int fWeightedStationSimulationParticleLimit = 0
 
double fWeightedStationSimulationThinningFactor = 0.5
 

Detailed Description

Shower unthinning.

This modules takes weighted particles from a shower simulation programs, regenerates particles with unity weight, and injects particles them in to stations for simulation. The algorithm is based on the technique described in GAP-2000-025.

In order to avoide excessive memory consumption in cases where the shower core is very close to a tank, this module supports a limit on the maximum number of particles which can be simulated in one pass (described in more detail below).

There are a number of things you can control from the configuration file:

Limiting the number of particles per cycle

Analysis applications using the offline framework are usually set up as a sequence of modules, in which each physics module does some job, then passes control to the next module in the sequence. The most simple-minded way to simulate the detector response to a simulated shower using this approach would be to use a sequence fragment something like this:

  <module> EventFileReader   </module>  <!-- read sim shower -->
  <module> EventGenerator    </module>  <!-- situate shower somewhere on array -->
  <module> ShowerRegenerator </module>  <!-- unthin shower and inject particles in tanks -->
  <module> TankSimulator     </module>  <!-- simulate each tank in event-->
  <!-- other simulation modules -->

In the third step in this sequence, the ShowerRegenerator has to loop through all particles in the shower and all the candidate stations, and must fill the sevt::StationSimData object of each sevt::Station with a list of all the particles that need to be simulated for that sevt::Station. A problem can sometimes occur for cases in which the shower core lands near a station, since the huge numbers of particles injected into this station may consume a lot of memory, and in some cases may cause the program to crash.

This problem can usually be solved in by stepping through the shower regenerator and tank simulator modules several times and limiting the number of particles simulated in each pass. This works since the tank response is "linear": injecting 2 particles into a tank and simulating them yields the same result as injecting and simulating the first particle, then injecting and simulating the second. In this approach, the modules sequence fragment looks like:

  <module> EventFileReader </module>
  <module> EventGenerator  </module>
  <loop numTimes="unbounded" save="no">
    <module> CachedShowerRegenerator </module>
    <module> TankSimulator           </module>
  </loop>
  <!-- other simulation modules -->

The CachedShowerRegenerator (renamed to distinguish it from the ShowerRegenerator in the previous sequence example) then unthins and injects a limited number of particles before passing control to the TankSimulator. When the TankSimulator is done, it returns control to the CachedShowerRegenerator, which picks up where it left off in the list of shower particles. When CachedShowerRegenerator reaches the end of the shower particles, it throws a fwk::VModule::eBreakLoop instruction to the fwk::RunController, which ends the regeneration/tank simulation step. Note that the save="no" attribute in the <loop> tag ensures that the CachedShowerRegenerator receives the event in the state in which it was left by the previous pass through the TankSimulator.

The limit on the number of particles processed in one pass through the loop is set using the <LimitParticlesPerCycle> element. For example:

<LimitParticlesPerCycle use="yes"> 100000 </LimitParticlesPerCycle>

will limit the memory footprint to about 300 Mb. Note that this limit is enabled by setting the use attribute to "yes" and disabled by setting it to "no". If use="no", there will be no limit on the number of particles simulated in one cycle, and consequently there will be just one pass through the loop.

This method has some shortcomings. It is important to note that the limits on particles per cycle is a limit on weithted particles, not on particles which have been assigned unity-weight by the regeneration algorithm. In fact, it can sometimes happen that particles with extremely high weights can defeat the protections normally afforded by this method. It can also sometimes happen that showers contain particles with trajectories nearly parallel to the ground plane, in which case the resampling algorithm will project an essentially infinite shadow of the side wall of the tank, and thereby generate a vast number of particles. Since the method of limiting particles per cycle only applies a limit before resampling, such cases may cause the program to run for a long time, or to crash.

The CachedShowerRegenerator config file contains an element :

<NumberOfRegenerationsLimit> 100000000 </NumberOfRegenerationsLimit>

(or similar) which you can set to cause the CachedShowerRegenerator to issues a warning if a particle is regenerated to produce more than the number of particles specified in the element.

Cuts on minimum and maximum radii for unthinning

If necessary, you can tell the CachedShowerRegenerator to disregard particles that fall inside a minimum radial distance to the shower axis, or outside a maximum radial distance to the shower axis. For example,

  <DistanceCuts>
    <InnerRadiusCut unit="m"  use="yes"> 250.0 </InnerRadiusCut>
    <OuterRadiusCut unit="km" use="yes"> 100.0 </OuterRadiusCut>
  </DistanceCuts>

will cause the CachedShowerRegenerator to only consider particles between 250 m and 100 km from the shower axis. You can switch off the cuts entirely by setting the use="no" attribute in the appropriate tag.

Note that even if you switch off these cuts, there may still be some minimum and maximum radii cuts imposed by the generator-level shower simulation program (eg. Aires, Corsika). Information on generator-level radii cuts can be extracted from evt::ShowerSimData::GetMinRadiusCut() and evt::ShowerSimData::GetMaxRadiusCut(). Furthermore, the EventGeneratorOG::EventGenerator module identifies any sevt::Station which falls inside the minimum radius cut (projected onto the ground) by setting sevt::StationSimData::IsInsideMinRadius() to true.

Energy cuts

Particles with energies below a minimum value can be removed from the shower by setting cuts the EnergyCuts element. For example:

  <EnergyCuts>
    <ElectronEnergyCut unit="MeV"> 1.0  </ElectronEnergyCut>
    <MuonEnergyCut unit="MeV">     10.0 </MuonEnergyCut>
    <PhotonEnergyCut unit="MeV">   1.0  </PhotonEnergyCut>
    <HadronEnergyCut unit="MeV">   10.0 </HadronEnergyCut>
    <MesonEnergyCut unit="MeV">    10.0 </MesonEnergyCut>
  </EnergyCuts>

Algorithm Parameters

The size of the sampling region is set in the AlgorithmParameters element. Here is an example:

  <AlgorithmParameters>
    <DeltaROverR> 0.1 </DeltaOverR>  <!-- dimensionless (dR/R) -->
    <DeltaPhi unit="radian"> 0.15 </DeltaPhi>
  </AlgorithmParameters>

See Figure 1 of GAP-2000-025 for a definition of the sampling region in terms of these AlgorithmParameters .

Author
Troy Porter
Darko Veberic
Tom Paul
Date
31 May 2006

Definition at line 81 of file CachedShowerRegeneratorOG/CachedShowerRegenerator.h.

Member Enumeration Documentation

enum fwk::VModule::InfoLevel
protectedinherited
Enumerator
eInfoNone 
eInfoFinal 
eInfoIntermediate 
eInfoDebug 

Definition at line 125 of file VModule.h.

enum fwk::VModule::ResultFlag
inherited

Flag returned by module methods to the RunController.

Enumerator
eSuccess 

Report success to RunController.

eFailure 

Report failure to RunController, causing RunController to terminate execution.

eBreakLoop 

Break current loop. It works for nested loops too!

eContinueLoop 

Skip remaining modules in the current loop and continue with next iteration of the loop.

Definition at line 60 of file VModule.h.

Different types of version info that can be retrieved from GetVersionInfo.

Enumerator
eFilename 
eRevisionNumber 
eDate 
eTime 
eLastEditor 

Definition at line 110 of file VModule.h.

Constructor & Destructor Documentation

CachedShowerRegeneratorOG::CachedShowerRegenerator::CachedShowerRegenerator ( )
inline

Member Function Documentation

VModule::ResultFlag CachedShowerRegeneratorOG::CachedShowerRegenerator::Finish ( )
inlinevirtual

Finish: invoked at end of the run (NOT end of the event)

This method is for things that should be done at the end of the run (for example, closing files or writing out histograms) {You must override this method in your concrete module}

Implements fwk::VModule.

Definition at line 87 of file CachedShowerRegeneratorOG/CachedShowerRegenerator.h.

References fwk::VModule::eSuccess.

std::string fwk::VModule::GetResultFlagByName ( const ResultFlag  flag)
staticinherited
utl::Stopwatch& fwk::VModule::GetStopwatch ( )
inlineinherited

Definition at line 106 of file VModule.h.

References fwk::VModule::fStopwatch.

const utl::Stopwatch& fwk::VModule::GetStopwatch ( ) const
inlineinherited

Definition at line 107 of file VModule.h.

References fwk::VModule::fStopwatch.

std::string fwk::VModule::GetVersionInfo ( const VersionInfoType  v) const
inherited
VModule::ResultFlag CachedShowerRegeneratorOG::CachedShowerRegenerator::Init ( )
virtual

Initialize: invoked at beginning of run (NOT beginning of event)

This method is for things that should be done once at the beginning of a run (for example, booking histograms, performing calculations that need to be done only once, initializing parameters) {You must override this method in your concrete module}

Implements fwk::VModule.

Definition at line 171 of file CachedShowerRegeneratorOG/CachedShowerRegenerator.cc.

References utl::abs(), ERROR, io::eSuccess, utl::Branch::GetChild(), utl::Branch::GetData(), utl::Branch::GetTopBranch(), INFO, km, max, and WARNING.

void CachedShowerRegeneratorOG::CachedShowerRegenerator::InitNewShower ( evt::Event event)
private
void fwk::VModule::InitTiming ( )
inlineinherited

Definition at line 95 of file VModule.h.

References fwk::VModule::fStopwatch, and utl::Stopwatch::Reset().

bool CachedShowerRegeneratorOG::CachedShowerRegenerator::IsParticleEnergyLow ( const int  type,
const double  energy 
) const
inlineprivate
void CachedShowerRegeneratorOG::CachedShowerRegenerator::OutputStats ( evt::Event event)
private
CachedShowerRegeneratorOG::CachedShowerRegenerator::REGISTER_MODULE ( "CachedShowerRegeneratorOG"  ,
CachedShowerRegenerator   
)
private
VModule::ResultFlag CachedShowerRegeneratorOG::CachedShowerRegenerator::Run ( evt::Event event)
virtual
ResultFlag fwk::VModule::RunWithTiming ( evt::Event event)
inlineinherited

Member Data Documentation

double CachedShowerRegeneratorOG::CachedShowerRegenerator::fDeltaPhi = 0
private
double CachedShowerRegeneratorOG::CachedShowerRegenerator::fDeltaROverR = 0
private
double CachedShowerRegeneratorOG::CachedShowerRegenerator::fElectronEnergyCut = 0
private
double CachedShowerRegeneratorOG::CachedShowerRegenerator::fHadronEnergyCut = 0
private
double CachedShowerRegeneratorOG::CachedShowerRegenerator::fHorizontalParticleCut = 0
private
int fwk::VModule::fInfoLevel = 0
protectedinherited
double CachedShowerRegeneratorOG::CachedShowerRegenerator::fInnerRadiusCut = 0
private
bool CachedShowerRegeneratorOG::CachedShowerRegenerator::fLimitParticlesPerCycle = false
private
double CachedShowerRegeneratorOG::CachedShowerRegenerator::fLogGaussSmearingWidth = 0
private
double CachedShowerRegeneratorOG::CachedShowerRegenerator::fMARTARadius = 0
private
double CachedShowerRegeneratorOG::CachedShowerRegenerator::fMesonEnergyCut = 0
private
double CachedShowerRegeneratorOG::CachedShowerRegenerator::fMuonEnergyCut = 0
private
double CachedShowerRegeneratorOG::CachedShowerRegenerator::fMuonWeightScale = 1
private
double CachedShowerRegeneratorOG::CachedShowerRegenerator::fOuterRadiusCut = 1e6*utl::km
private
unsigned int CachedShowerRegeneratorOG::CachedShowerRegenerator::fParticlesPerCycle = 0
private
double CachedShowerRegeneratorOG::CachedShowerRegenerator::fPhiGranularity = 0
private
double CachedShowerRegeneratorOG::CachedShowerRegenerator::fPhotonEnergyCut = 0
private
utl::RandomEngine::RandomEngineType* CachedShowerRegeneratorOG::CachedShowerRegenerator::fRandomEngine = nullptr
private
double CachedShowerRegeneratorOG::CachedShowerRegenerator::fRGranularity = 0
private
utl::ShadowPtr<ShowerData> CachedShowerRegeneratorOG::CachedShowerRegenerator::fShowerData
private
bool CachedShowerRegeneratorOG::CachedShowerRegenerator::fSimulateMARTA = false
private
bool CachedShowerRegeneratorOG::CachedShowerRegenerator::fSimulateUMD = false
private
double CachedShowerRegeneratorOG::CachedShowerRegenerator::fUMDMaxRadius = 0
private
double CachedShowerRegeneratorOG::CachedShowerRegenerator::fUMDTightRadius = 0
private
bool CachedShowerRegeneratorOG::CachedShowerRegenerator::fUseStationPositionMatrix = true
private
bool CachedShowerRegeneratorOG::CachedShowerRegenerator::fUseWeightDependentResamplingArea = true
private
bool CachedShowerRegeneratorOG::CachedShowerRegenerator::fUseWeightedStationSimulation = false
private
unsigned int CachedShowerRegeneratorOG::CachedShowerRegenerator::fWeightedStationSimulationParticleLimit = 0
private
double CachedShowerRegeneratorOG::CachedShowerRegenerator::fWeightedStationSimulationThinningFactor = 0.5
private

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

, generated on Tue Sep 26 2023.