BOSS 6.6.4.p01
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 37 of file AthenaHepMCtoG4EventAction.cpp.

37 :
38m_logLevel( int(MSG::INFO) ) {
39}

◆ AthenaHepMCtoG4EventAction() [2/2]

AthenaHepMCtoG4EventAction::AthenaHepMCtoG4EventAction ( int  level)

Definition at line 33 of file AthenaHepMCtoG4EventAction.cpp.

33 :
34 m_logLevel(level) {
35}

◆ ~AthenaHepMCtoG4EventAction()

AthenaHepMCtoG4EventAction::~AthenaHepMCtoG4EventAction ( )

Definition at line 41 of file AthenaHepMCtoG4EventAction.cpp.

41 {
42
43}

Member Function Documentation

◆ GeneratePrimaries()

void AthenaHepMCtoG4EventAction::GeneratePrimaries ( G4Event *  anEvent)

Definition at line 152 of file AthenaHepMCtoG4EventAction.cpp.

153{
154 if ( m_logLevel <= int(MSG::DEBUG) ) {
155 std::cout << "AthenaHepMCtoG4EventAction: - Generating Primaries"
156 << std::endl;
157 }
158
159
160 p_evt = (const HepMC::GenEvent *)(*p_evtCollItr);
161
162
163 if (p_evt == 0) {
164
165 if ( m_logLevel <= int(MSG::WARNING) ) {
166 std::cout << "AthenaHepMCtoG4EventAction: - HepMC ptr == null"
167 << std::endl;
168 }
169
170 return;
171
172 }
173
174 G4PrimaryVertex* vertex = new G4PrimaryVertex(0.,0.,0.,0.);
175
176 int n=0;
177 for ( HepMC::GenEvent::vertex_const_iterator v = p_evt->vertices_begin();
178 v != p_evt->vertices_end(); ++v ) {
179 bool IsGood=false;
180 for (HepMC::GenVertex::particle_iterator it=
181 (*v)->particles_begin(HepMC::children);
182 it!=(*v)->particles_end(HepMC::children);
183 it++) {
184
185 if (!(*it)->end_vertex() && (*it)->status()==1 ) {
186 IsGood=true;
187 break;
188 }
189 }
190
191 if (IsGood) {
192// std::cout << "found a good vertex, barcode: " << (*v)->barcode()
193// << std::endl;
194
195 for (HepMC::GenVertex::particle_iterator it=
196 (*v)->particles_begin(HepMC::children);
197 it!=(*v)->particles_end(HepMC::children);
198 it++) {
199
200 if ( (*it)->status() != 1) continue;
201
202 int pdgcode=(*it)->pdg_id();
203// GenVertex *dcy = (*it)->end_vertex();
204// std::cout << "found a good particle, barcode: " << (*it)->barcode()
205// << " pdg: " << pdgcode << " status: " << (*it)->status()
206// << " end: ";
207// if (dcy != 0) {
208// std::cout << dcy->barcode();
209// } else {
210// std::cout << "nil";
211// }
212// std::cout << std::endl;
213
214 const G4ThreeVector& p=(*it)->momentum();
215 G4PrimaryParticle *part;
216 if (pdgcode!=999) {
217 part=new G4PrimaryParticle (pdgcode,p.x()*GeV,p.y()*GeV,p.z()*GeV);
218 } else {
219 G4ParticleDefinition *pdef = G4Geantino::GeantinoDefinition();
220 part=new G4PrimaryParticle (pdef,p.x()*GeV,p.y()*GeV,p.z()*GeV);
221 }
222
223 vertex->SetPosition((*v)->position().x(),
224 (*v)->position().y(),
225 (*v)->position().z());
226 vertex->SetT0((*v)->position().t());
227
228 vertex->SetPrimary(part);
229
230 n++;
231 }
232 }
233 }
234 anEvent->AddPrimaryVertex(vertex);
235
236 if ( m_logLevel <= int(MSG::DEBUG) ) {
237 std::cout << "AthenaHepMCtoG4EventAction: - done. G4Event has "
238 << n << " particles. "
239 << std::endl;
240 }
241
242 p_evtCollItr++;
243
244}
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 48 of file AthenaHepMCtoG4EventAction.cpp.

48 {
49
50 if ( m_logLevel <= int(MSG::DEBUG) ) {
51 std::cout << "AthenaHepMCtoG4EventAction: - Setting HepMC Event ptr"
52 << std::endl;
53 }
54
55 // p_evt = p;
56 p_evtCollItr = p;
57
58}

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