CMS 3D CMS Logo

FortranCallback.h
Go to the documentation of this file.
1 #ifndef gen_FortranCallback_h
2 #define gen_FortranCallback_h
3 
4 #include <boost/shared_ptr.hpp>
5 
7 
10 
11 namespace HepMC
12 {
13 class GenEvent;
14 }
15 
16 namespace gen {
17 
19  {
20 
21  public:
22 
23  static FortranCallback* getInstance() ;
24 
25  //void setLHEEvent(lhef::LHEEvent* lhev) { fPartonLevel = lhev; }
26  void setLHERunInfo( lhef::LHERunInfo* lheri ) { fRunBlock=lheri; }
27  void setLHEEvent( lhef::LHEEvent* lhee ) { fEventBlock=lhee; }
28 
29  void resetIterationsPerEvent() { fIterationsPerEvent = 0; }
30 
31  void fillHeader();
32  void fillEvent();
33 
34  int getIterationsPerEvent() const { return fIterationsPerEvent; }
35 
36  private:
37 
38  // ctor
39 
41 
42  // data member(s)
43 
47 
49 
50 
51  };
52 
53 // --** Implementation **---
54 
55 FortranCallback* FortranCallback::fInstance = nullptr;
56 
57 FortranCallback::FortranCallback()
58 // : fPartonLevel(0)
59  : fRunBlock(nullptr), fEventBlock(nullptr), fIterationsPerEvent(0)
60 {
61 }
62 
64 {
65  if ( fInstance == nullptr ) fInstance = new FortranCallback;
66  return fInstance;
67 }
68 
70 {
71 
72  if ( fRunBlock == nullptr ) return;
73 
74  //const lhef::HEPRUP* heprup = &(fRunBlock->heprup());
75  const lhef::HEPRUP* heprup = fRunBlock->getHEPRUP();
76 
78 
79  return;
80 
81 }
82 
84 {
85 
86  //if ( fPartonLevel == 0 ) return;
87  //const lhef::HEPEUP* hepeup = fPartonLevel->getHEPEUP();
88 
89  if ( fEventBlock == nullptr ) return;
90 
91  const lhef::HEPEUP* hepeup = fEventBlock->getHEPEUP();
92 
93  if (fIterationsPerEvent++)
94  {
95  hepeup_.nup = 0;
96  return;
97  }
98 
100 
101  return;
102 
103 }
104 
105 
106 } // end namespace
107 
108 #endif
109 
110 
111 
static void fillHeader(LHERunInfo::Header &header, const char *data, int len=-1)
Definition: LHEReader.cc:169
def fillEvent(tree, event)
Definition: ntuple.py:18
struct HEPEUP_ hepeup_
#define nullptr
void setLHERunInfo(lhef::LHERunInfo *lheri)
int getIterationsPerEvent() const
const HEPEUP * getHEPEUP() const
Definition: LHEEvent.h:41
static FortranCallback * fInstance
static void fillHEPEUP(const HEPEUP *hepeup)
lhef::LHERunInfo * fRunBlock
static FortranCallback * getInstance()
const HEPRUP * getHEPRUP() const
Definition: LHERunInfo.h:52
void setLHEEvent(lhef::LHEEvent *lhee)
lhef::LHEEvent * fEventBlock
static void fillHEPRUP(const HEPRUP *heprup)