FairShip
Loading...
Searching...
No Matches
SHiP::Generator Class Referenceabstract

#include <Generator.h>

Inheritance diagram for SHiP::Generator:
[legend]
Collaboration diagram for SHiP::Generator:
[legend]

Public Member Functions

 Generator ()=default
 ~Generator () override
virtual Bool_t Init (const char *, int)=0
virtual Bool_t Init (const char *)=0
virtual Bool_t Init (const std::vector< std::string > &inFiles, int startNumber)
virtual Bool_t Init (const std::vector< std::string > &inFiles)
virtual void UseExternalFile (std::string x, Int_t i)
virtual void UseExternalFile (std::vector< std::string > &inFiles, Int_t i)
void SetMaxTheta (Double_t thetaX, Double_t thetaY)
Int_t nrOfGeoRejections () const
Long64_t GetCounter (const std::string &name) const
void SetCounter (const std::string &name, Long64_t value)
void IncrementCounter (const std::string &name, Long64_t delta=1)

Protected Member Functions

bool IsInVesselAcceptance (Double_t px, Double_t py, Double_t pz) const

Protected Attributes

std::optional< std::string > fextFile
Int_t firstEvent = 0
Double_t fMaxThetaX = 0
Double_t fMaxThetaY = 0
bool fUseVesselAcceptance = false
Int_t fnGeoRejects = 0
std::unordered_map< std::string, int64_t > fCounters

Detailed Description

Definition at line 19 of file Generator.h.

Constructor & Destructor Documentation

◆ Generator()

SHiP::Generator::Generator ( )
default

◆ ~Generator()

SHiP::Generator::~Generator ( )
overridedefault

Member Function Documentation

◆ GetCounter()

Long64_t SHiP::Generator::GetCounter ( const std::string & name) const
inline

Definition at line 58 of file Generator.h.

58 {
59 auto it = fCounters.find(name);
60 return it == fCounters.end() ? 0 : it->second;
61 }
std::unordered_map< std::string, int64_t > fCounters
Definition Generator.h:82

◆ IncrementCounter()

void SHiP::Generator::IncrementCounter ( const std::string & name,
Long64_t delta = 1 )
inline

Definition at line 65 of file Generator.h.

◆ Init() [1/4]

◆ Init() [2/4]

◆ Init() [3/4]

virtual Bool_t SHiP::Generator::Init ( const std::vector< std::string > & inFiles)
inlinevirtual

Reimplemented in CosmicsGenerator, DPPythia8Generator, EvtCalcGenerator, FixedTargetGenerator, GenieGenerator, HNLPythia8Generator, MuDISGenerator, MuonBackGenerator, NewMuDISGenerator, NtupleGenerator, ParticleGunGenerator, Pythia8Generator, SHiP::TTreeGenerator, and tPythia6Generator.

Definition at line 33 of file Generator.h.

33 {
34 LOG(warning) << "Multiple input files not implemented for this generator "
35 "- only taking the first!";
36 return Init(inFiles.at(0).c_str(), 0);
37 };
virtual Bool_t Init(const char *, int)=0

◆ Init() [4/4]

virtual Bool_t SHiP::Generator::Init ( const std::vector< std::string > & inFiles,
int startNumber )
inlinevirtual

Reimplemented in CosmicsGenerator, DPPythia8Generator, EvtCalcGenerator, FixedTargetGenerator, GenieGenerator, HNLPythia8Generator, MuDISGenerator, MuonBackGenerator, NewMuDISGenerator, NtupleGenerator, ParticleGunGenerator, Pythia8Generator, SHiP::TTreeGenerator, and tPythia6Generator.

Definition at line 27 of file Generator.h.

28 {
29 LOG(warning) << "Multiple input files not implemented for this generator "
30 "- only taking the first!";
31 return Init(inFiles.at(0).c_str(), startNumber);
32 };

◆ IsInVesselAcceptance()

bool SHiP::Generator::IsInVesselAcceptance ( Double_t px,
Double_t py,
Double_t pz ) const
inlineprotected

Definition at line 70 of file Generator.h.

70 {
71 if (!fUseVesselAcceptance) return true;
72 if (pz <= 0) return false;
73 return std::abs(px / pz) < fMaxThetaX && std::abs(py / pz) < fMaxThetaY;
74 }
Double_t fMaxThetaX
Definition Generator.h:78
bool fUseVesselAcceptance
Definition Generator.h:80
Double_t fMaxThetaY
Definition Generator.h:79

◆ nrOfGeoRejections()

Int_t SHiP::Generator::nrOfGeoRejections ( ) const
inline

Definition at line 57 of file Generator.h.

57{ return fnGeoRejects; }
Int_t fnGeoRejects
Definition Generator.h:81

◆ SetCounter()

void SHiP::Generator::SetCounter ( const std::string & name,
Long64_t value )
inline

Definition at line 62 of file Generator.h.

62 {
63 fCounters[name] = value;
64 }

◆ SetMaxTheta()

void SHiP::Generator::SetMaxTheta ( Double_t thetaX,
Double_t thetaY )
inline

Set maximum allowed slopes |px/pz| and |py/pz| for vessel acceptance. Parameters are tan(theta), not angle in radians.

Definition at line 52 of file Generator.h.

52 {
53 fMaxThetaX = thetaX;
54 fMaxThetaY = thetaY;
56 };

◆ UseExternalFile() [1/2]

virtual void SHiP::Generator::UseExternalFile ( std::string x,
Int_t i )
inlinevirtual

Definition at line 39 of file Generator.h.

39 {
40 fextFile = std::move(x);
41 firstEvent = i;
42 };
std::optional< std::string > fextFile
Definition Generator.h:76
int i
Definition ShipAna.py:108

◆ UseExternalFile() [2/2]

virtual void SHiP::Generator::UseExternalFile ( std::vector< std::string > & inFiles,
Int_t i )
inlinevirtual

Definition at line 44 of file Generator.h.

44 {
45 LOG(warning) << "Multiple external files not implemented for this "
46 "generator - only taking the first!";
47 UseExternalFile(inFiles.at(0).c_str(), i);
48 }
virtual void UseExternalFile(std::string x, Int_t i)
Definition Generator.h:39

Member Data Documentation

◆ fCounters

std::unordered_map<std::string, int64_t> SHiP::Generator::fCounters
protected

Definition at line 82 of file Generator.h.

◆ fextFile

std::optional<std::string> SHiP::Generator::fextFile
protected

Definition at line 76 of file Generator.h.

◆ firstEvent

Int_t SHiP::Generator::firstEvent = 0
protected

Definition at line 77 of file Generator.h.

◆ fMaxThetaX

Double_t SHiP::Generator::fMaxThetaX = 0
protected

Definition at line 78 of file Generator.h.

◆ fMaxThetaY

Double_t SHiP::Generator::fMaxThetaY = 0
protected

Definition at line 79 of file Generator.h.

◆ fnGeoRejects

Int_t SHiP::Generator::fnGeoRejects = 0
protected

Definition at line 81 of file Generator.h.

◆ fUseVesselAcceptance

bool SHiP::Generator::fUseVesselAcceptance = false
protected

Definition at line 80 of file Generator.h.


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