StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
photos_hepevt_example_interface.cxx
1 
7 #include <cstdlib>
8 #include "Photos/Photos.h"
9 #include "Photos/PhotosHEPEVTEvent.h"
10 using namespace Photospp;
11 
12 extern "C" {
13 
14  void photos_init_()
15  {
18 
19  // Turn on pair emission and turn off photon emission
20  // Note that this example loops over the same event until at least one
21  // particle is added, so uncommenting these two flags can be used
22  // to test if a pair is correctly emitted
23  //Photos::setPairEmission(true);
24  //Photos::setPhotonEmission(false);
25 
26  // Turn on NLO corrections
27  //Photos::setMeCorrectionWtForW(true);
28  //Photos::setMeCorrectionWtForZ(true);
29  }
30 
31  void photos_process_()
32  {
33  PhotosHEPEVTEvent *event = new PhotosHEPEVTEvent();
34 
36  //event->print();
37 
38  int part = event->getParticleCount();
39  int loop = 0;
40  while( event->getParticleCount() <= part && loop < 10000 ) {
41  event->process();
42  ++loop;
43  }
44 
45  if( loop >= 10000 ) {
46  printf("photos_hepevt_example: there is some technical problem - no particles generated after 10000 loops!\n");
47  exit(-1);
48  }
49  //event->print();
50 
52 
53  delete event;
54  }
55 
56  void photos_process_particle_(int *i)
57  {
58  PhotosHEPEVTEvent *event = new PhotosHEPEVTEvent();
59 
61  //event->print();
62 
63  PhotosParticle *p = event->getParticle(*i - 1);
64 
66  //event->print();
67 
69 
70  delete event;
71  }
72 
73  void photos_process_branch_(int *i)
74  {
75  PhotosHEPEVTEvent *event = new PhotosHEPEVTEvent();
76 
78  //event->print();
79 
80  PhotosParticle *p = event->getParticle(*i - 1);
81 
83  //event->print();
84 
86 
87  delete event;
88  }
89 }
static void initialize()
Definition: Photos.cxx:53
static void forceMassFromEventRecord(int pdgid)
Definition: Photos.cxx:452
static void read_event_from_HEPEVT(PhotosHEPEVTEvent *evt)
static void processParticle(PhotosParticle *p)
Definition: Photos.cxx:225
static void processBranch(PhotosParticle *p)
Definition: Photos.cxx:231
static void write_event_to_HEPEVT(PhotosHEPEVTEvent *evt)