~alifson/chiralityflow/trunk

« back to all changes in this revision

Viewing changes to Template/NLO/MCatNLO/HWPPAnalyzer/HepMCFortran.cc

  • Committer: andrew.lifson at lu
  • Date: 2021-09-01 15:34:39 UTC
  • Revision ID: andrew.lifson@thep.lu.se-20210901153439-7fasjhav4cp4m88r
testing a new repository of a madgraph folder

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- C++ -*-
 
2
//
 
3
// This is the implementation of the non-inlined, non-templated member
 
4
// functions of the HepMCFortran class.
 
5
//
 
6
 
 
7
#include "HepMCFortran.h"
 
8
#include "ThePEG/PDT/EnumParticles.h"
 
9
#include "ThePEG/Repository/EventGenerator.h"
 
10
#include "ThePEG/EventRecord/Event.h"
 
11
#include "ThePEG/Interface/ClassDocumentation.h"
 
12
#include "ThePEG/Config/HepMCHelper.h"
 
13
 
 
14
#include "HepMC/IO_HEPEVT.h"
 
15
#include "HepMC/HEPEVT_Wrapper.h"
 
16
#include "HepMC/IO_BaseClass.h"
 
17
 
 
18
using namespace Herwig;
 
19
using namespace MCatNLO;
 
20
 
 
21
extern "C" {
 
22
    extern struct {
 
23
       double EVWGT;
 
24
    } cevwgt_;
 
25
}
 
26
#define cevwgt cevwgt_
 
27
 
 
28
extern "C" { 
 
29
  //void foranalysis_(); 
 
30
  void hwabeg_();
 
31
  void hwaend_();
 
32
  void hwanal_();
 
33
 
 
34
}
 
35
 
 
36
void HepMCFortran::analyze(tEventPtr event, long ieve, int loop, int state) {
 
37
  AnalysisHandler::analyze(event, ieve, loop, state);
 
38
 
 
39
  //define the IO_HEPEVT
 
40
  _hepevtio = new HepMC::IO_HEPEVT;
 
41
  
 
42
  //choose units to be GeV and MM
 
43
  Energy eUnit; Length lUnit;
 
44
  eUnit = GeV; lUnit = millimeter;
 
45
 
 
46
  //convert the event from the Herwig++ format to the HepMC format and write it to the common block
 
47
  HepMC::GenEvent * hepevtf = HepMCConverter<HepMC::GenEvent>::convert(*event, false,eUnit, lUnit);
 
48
  _hepevtio->write_event(hepevtf); 
 
49
  //event weight
 
50
  cevwgt.EVWGT=hepevtf->weights()[0];
 
51
  
 
52
  
 
53
  //call the FORTRAN analysis for this event (see example file foranalysis.f)
 
54
  //foranalysis_();
 
55
  hwanal_();
 
56
 
 
57
  return;
 
58
  
 
59
}
 
60
 
 
61
IBPtr HepMCFortran::clone() const {
 
62
  return new_ptr(*this);
 
63
}
 
64
 
 
65
IBPtr HepMCFortran::fullclone() const {
 
66
  return new_ptr(*this);
 
67
}
 
68
 
 
69
NoPIOClassDescription<HepMCFortran> HepMCFortran::initHepMCFortran;
 
70
// Definition of the static class description member.
 
71
 
 
72
void HepMCFortran::Init() {
 
73
 
 
74
  static ClassDocumentation<HepMCFortran> documentation
 
75
    ("There is no documentation for the HepMCFortran class");
 
76
 
 
77
}
 
78
 
 
79
void HepMCFortran::dofinish() {
 
80
  AnalysisHandler::dofinish();
 
81
 
 
82
  hwaend_();
 
83
 
 
84
}
 
85
 
 
86
void HepMCFortran::doinitrun() {
 
87
  AnalysisHandler::doinitrun();
 
88
 
 
89
  hwabeg_();
 
90
 
 
91
}