1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
#ifndef gen_FortranCallback_h
#define gen_FortranCallback_h
#include "SimDataFormats/GeneratorProducts/interface/LHECommonBlocks.h"
#include "GeneratorInterface/LHEInterface/interface/LHERunInfo.h"
#include "GeneratorInterface/LHEInterface/interface/LHEEvent.h"
namespace HepMC {
class GenEvent;
}
namespace gen {
class FortranCallback {
public:
static FortranCallback* getInstance();
//void setLHEEvent(lhef::LHEEvent* lhev) { fPartonLevel = lhev; }
void setLHERunInfo(lhef::LHERunInfo* lheri) { fRunBlock = lheri; }
void setLHEEvent(lhef::LHEEvent* lhee) { fEventBlock = lhee; }
void resetIterationsPerEvent() { fIterationsPerEvent = 0; }
void fillHeader();
void fillEvent();
int getIterationsPerEvent() const { return fIterationsPerEvent; }
private:
// ctor
FortranCallback();
// data member(s)
lhef::LHERunInfo* fRunBlock;
lhef::LHEEvent* fEventBlock;
int fIterationsPerEvent;
static FortranCallback* fInstance;
};
// --** Implementation **---
inline FortranCallback::FortranCallback()
// : fPartonLevel(0)
: fRunBlock(nullptr), fEventBlock(nullptr), fIterationsPerEvent(0) {}
inline void FortranCallback::fillHeader() {
if (fRunBlock == nullptr)
return;
//const lhef::HEPRUP* heprup = &(fRunBlock->heprup());
const lhef::HEPRUP* heprup = fRunBlock->getHEPRUP();
lhef::CommonBlocks::fillHEPRUP(heprup);
return;
}
inline void FortranCallback::fillEvent() {
//if ( fPartonLevel == 0 ) return;
//const lhef::HEPEUP* hepeup = fPartonLevel->getHEPEUP();
if (fEventBlock == nullptr)
return;
const lhef::HEPEUP* hepeup = fEventBlock->getHEPEUP();
if (fIterationsPerEvent++) {
hepeup_.nup = 0;
return;
}
lhef::CommonBlocks::fillHEPEUP(hepeup);
return;
}
} // namespace gen
#endif
|