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

#include <AthenaHepMCtoG4EventAction.h>

Inheritance diagram for AthenaHepMCtoG4EventAction:

Public Member Functions

 AthenaHepMCtoG4EventAction ()
 AthenaHepMCtoG4EventAction (int)
 ~AthenaHepMCtoG4EventAction ()
void GeneratePrimaries (G4Event *anEvent)
void SetHepMCEvent (McEventCol::iterator)

Detailed Description

Definition at line 28 of file AthenaHepMCtoG4EventAction.h.

Constructor & Destructor Documentation

◆ AthenaHepMCtoG4EventAction() [1/2]

AthenaHepMCtoG4EventAction::AthenaHepMCtoG4EventAction ( )

Definition at line 35 of file AthenaHepMCtoG4EventAction.cpp.

35: m_logLevel( int( MSG::INFO ) ) {}

◆ AthenaHepMCtoG4EventAction() [2/2]

AthenaHepMCtoG4EventAction::AthenaHepMCtoG4EventAction ( int level)

Definition at line 33 of file AthenaHepMCtoG4EventAction.cpp.

33: m_logLevel( level ) {}

◆ ~AthenaHepMCtoG4EventAction()

AthenaHepMCtoG4EventAction::~AthenaHepMCtoG4EventAction ( )

Definition at line 37 of file AthenaHepMCtoG4EventAction.cpp.

37{}

Member Function Documentation

◆ GeneratePrimaries()

void AthenaHepMCtoG4EventAction::GeneratePrimaries ( G4Event * anEvent)

Definition at line 143 of file AthenaHepMCtoG4EventAction.cpp.

143 {
144 if ( m_logLevel <= int( MSG::DEBUG ) )
145 { std::cout << "AthenaHepMCtoG4EventAction: - Generating Primaries" << std::endl; }
146
147 p_evt = (const HepMC::GenEvent*)( *p_evtCollItr );
148
149 if ( p_evt == 0 )
150 {
151
152 if ( m_logLevel <= int( MSG::WARNING ) )
153 { std::cout << "AthenaHepMCtoG4EventAction: - HepMC ptr == null" << std::endl; }
154
155 return;
156 }
157
158 G4PrimaryVertex* vertex = new G4PrimaryVertex( 0., 0., 0., 0. );
159
160 int n = 0;
161 for ( HepMC::GenEvent::vertex_const_iterator v = p_evt->vertices_begin();
162 v != p_evt->vertices_end(); ++v )
163 {
164 bool IsGood = false;
165 for ( HepMC::GenVertex::particle_iterator it = ( *v )->particles_begin( HepMC::children );
166 it != ( *v )->particles_end( HepMC::children ); it++ )
167 {
168
169 if ( !( *it )->end_vertex() && ( *it )->status() == 1 )
170 {
171 IsGood = true;
172 break;
173 }
174 }
175
176 if ( IsGood )
177 {
178 // std::cout << "found a good vertex, barcode: " << (*v)->barcode()
179 // << std::endl;
180
181 for ( HepMC::GenVertex::particle_iterator it =
182 ( *v )->particles_begin( HepMC::children );
183 it != ( *v )->particles_end( HepMC::children ); it++ )
184 {
185
186 if ( ( *it )->status() != 1 ) continue;
187
188 int pdgcode = ( *it )->pdg_id();
189 // GenVertex *dcy = (*it)->end_vertex();
190 // std::cout << "found a good particle, barcode: " << (*it)->barcode()
191 // << " pdg: " << pdgcode << " status: " << (*it)->status()
192 // << " end: ";
193 // if (dcy != 0) {
194 // std::cout << dcy->barcode();
195 // } else {
196 // std::cout << "nil";
197 // }
198 // std::cout << std::endl;
199
200 const G4ThreeVector& p = ( *it )->momentum();
201 G4PrimaryParticle* part;
202 if ( pdgcode != 999 )
203 { part = new G4PrimaryParticle( pdgcode, p.x() * GeV, p.y() * GeV, p.z() * GeV ); }
204 else
205 {
206 G4ParticleDefinition* pdef = G4Geantino::GeantinoDefinition();
207 part = new G4PrimaryParticle( pdef, p.x() * GeV, p.y() * GeV, p.z() * GeV );
208 }
209
210 vertex->SetPosition( ( *v )->position().x(), ( *v )->position().y(),
211 ( *v )->position().z() );
212 vertex->SetT0( ( *v )->position().t() );
213
214 vertex->SetPrimary( part );
215
216 n++;
217 }
218 }
219 }
220 anEvent->AddPrimaryVertex( vertex );
221
222 if ( m_logLevel <= int( MSG::DEBUG ) )
223 {
224 std::cout << "AthenaHepMCtoG4EventAction: - done. G4Event has " << n << " particles. "
225 << std::endl;
226 }
227
228 p_evtCollItr++;
229}
const Int_t n
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Definition KarLud.h:35

◆ SetHepMCEvent()

void AthenaHepMCtoG4EventAction::SetHepMCEvent ( McEventCol::iterator p)

Definition at line 42 of file AthenaHepMCtoG4EventAction.cpp.

42 {
43
44 if ( m_logLevel <= int( MSG::DEBUG ) )
45 { std::cout << "AthenaHepMCtoG4EventAction: - Setting HepMC Event ptr" << std::endl; }
46
47 // p_evt = p;
48 p_evtCollItr = p;
49}

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