BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
CosmicGun Class Reference

#include <CosmicGun.h>

Public Member Functions

HepLorentzVector GenerateEvent (void)
HepLorentzVector GenerateVertex (void)
void SetEnergyRange (float emin, float emax)
void SetCosCut (float ctcut)
void PrintLevel (int printevt, int printmod)
int GetMuonCharge (void)
float InitializeGenerator ()

Static Public Member Functions

static CosmicGunGetCosmicGun (void)

Detailed Description

Definition at line 6 of file CosmicGun.h.

Member Function Documentation

◆ GenerateEvent()

HepLorentzVector CosmicGun::GenerateEvent ( void )

Definition at line 103 of file CosmicGun.cxx.

103 {
104 int iacc = 0;
105
106 while ( iacc == 0 ) { cosgen_( &m_emin, &m_emax, &iacc ); }
107 m_event++;
108
109 float sinth = sqrt( 1 - pow( cosevt_.COSTH, 2 ) );
110 float e = cosevt_.ENER;
111 float px = cosevt_.ENER * sinth * sin( cosevt_.PHI );
112 float py = cosevt_.ENER * sinth * cos( cosevt_.PHI );
113 float pz = cosevt_.ENER * cosevt_.COSTH;
114 HepLorentzVector p( px, py, pz, e );
115
116 // if(m_event < m_printevt || m_event%m_printmod == 0)
117 if ( m_event < m_printevt )
118 {
119 std::cout << "CosmicGun::GenerateEvent: " << std::setw( 4 ) << m_event << " muon charge "
120 << std::setw( 2 ) << cosevt_.CHRG << " with momentum : " << p << std::endl;
121 }
122
123 return p;
124}
cosevt cosevt_
Definition CosmicGun.cxx:36
void cosgen_(float *emin, float *emax, int *iacc)
float CHRG
Definition CosmicGun.cxx:34
float COSTH
Definition CosmicGun.cxx:34
float PHI
Definition CosmicGun.cxx:34
float ENER
Definition CosmicGun.cxx:34

Referenced by CosmicGenerator::execute().

◆ GenerateVertex()

HepLorentzVector CosmicGun::GenerateVertex ( void )

◆ GetCosmicGun()

CosmicGun * CosmicGun::GetCosmicGun ( void )
static

Definition at line 49 of file CosmicGun.cxx.

49 {
50 if ( !mpointer ) mpointer = new CosmicGun();
51 return mpointer;
52}

Referenced by CosmicGenerator::execute(), and CosmicGenerator::initialize().

◆ GetMuonCharge()

int CosmicGun::GetMuonCharge ( void )

Definition at line 126 of file CosmicGun.cxx.

126{ return (int)cosevt_.CHRG; }

Referenced by CosmicGenerator::execute().

◆ InitializeGenerator()

float CosmicGun::InitializeGenerator ( )

Definition at line 79 of file CosmicGun.cxx.

79 {
80 std::cout << " CosmicGun::InitializeGenerator: E(min,max)=(" << m_emin << "," << m_emax
81 << ") GeV, and cos(ThetaCut)=" << m_coscut << std::endl;
82 cosipr_();
83 cosgin_();
84 cosmic2_();
85 return flxout_.FLUX2;
86}
void cosgin_(void)
void cosmic2_(void)
flxout flxout_
Definition CosmicGun.cxx:41
void cosipr_(void)
float FLUX2
Definition CosmicGun.cxx:39

Referenced by CosmicGenerator::initialize().

◆ PrintLevel()

void CosmicGun::PrintLevel ( int printevt,
int printmod )

Definition at line 88 of file CosmicGun.cxx.

88 {
89 if ( printevt >= 0 ) { m_printevt = printevt; }
90 else
91 {
92 std::cerr << "CosmicGun::PrintLevel - warning ignored input printevt = " << printevt
93 << std::endl;
94 }
95 if ( printmod >= 1 ) { m_printmod = printmod; }
96 else
97 {
98 std::cerr << "CosmicGun::PrintLevel - warning ignored input printmod = " << printmod
99 << std::endl;
100 }
101}

Referenced by CosmicGenerator::initialize().

◆ SetCosCut()

void CosmicGun::SetCosCut ( float ctcut)

Definition at line 144 of file CosmicGun.cxx.

144 {
145 m_coscut = ctcut;
146
147 coscut_.ctcut = m_coscut;
148}
coscut coscut_
Definition CosmicGun.cxx:31
float ctcut
Definition CosmicGun.cxx:29

Referenced by CosmicGenerator::initialize().

◆ SetEnergyRange()

void CosmicGun::SetEnergyRange ( float emin,
float emax )

Definition at line 128 of file CosmicGun.cxx.

128 {
129 if ( emin >= emax || emin < 0 )
130 {
131 std::cout << "Error input energy range : (" << emin << " - " << emax << ") - ignored "
132 << std::endl;
133 return;
134 }
135 m_emin = emin;
136 m_emax = emax;
137
138 genpar_.LEMIN = log10( m_emin );
139 genpar_.LEMAX = log10( m_emax );
140 genpar_.NBIN = 100;
142}
genpar genpar_
Definition CosmicGun.cxx:26
int NBIN
Definition CosmicGun.cxx:23
float LEMAX
Definition CosmicGun.cxx:22
float LEMIN
Definition CosmicGun.cxx:22
float LBINWID
Definition CosmicGun.cxx:22

Referenced by CosmicGenerator::initialize().


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