Skip to content

Commit 1c72164

Browse files
committed
Reverted back to the usage of the HerwigWrapper from HepMC
1 parent 2929bd9 commit 1c72164

File tree

7 files changed

+95
-94
lines changed

7 files changed

+95
-94
lines changed

Examples/fpmc-bare.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ using namespace std;
66

77
int main( int argc, char* argv[] )
88
{
9-
fpmc::Fpmc generator( argv[1] );
9+
fpmc::Fpmc gen( argv[1] );
1010

11-
generator.parameters().dump();
11+
gen.parameters().dump();
1212

13-
hwevnt_t ev;
1413
for( unsigned int evt = 0; evt < 10; ++evt ) {
1514
cout << "[FPMC] Processing event " << ( evt+1 ) << endl;
16-
generator.next( ev );
15+
gen.next();
16+
//hwevnt_;
1717
}
1818
return 0;
1919
}

Fpmc/Fpmc.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
#include "CLHEP/Random/JamesRandom.h"
1111
#include "CLHEP/Random/RandFlat.h"
1212

13-
#include "Fpmc/interface/herwig.h"
14-
#include "Fpmc/interface/fpmc.h"
15-
1613
#include "FpmcParameters.h"
1714

1815
#include <string>
@@ -34,7 +31,7 @@ namespace fpmc
3431
void initialise();
3532
double crossSection() const;
3633

37-
bool next( hwevnt_t& evt );
34+
bool next();
3835

3936
protected:
4037
void initHerwig();

Fpmc/FpmcParameters.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ namespace fpmc
112112

113113
//----- full common blocks population
114114

115-
void fetchHWPROC( hwproc_t& ) const;
116-
void fetchHWBMCH( hwbmch_t& ) const;
117-
void fetchHWPRAM( hwpram_t& ) const;
118-
void fetchHWPROP( hwprop_t& ) const;
119-
void fetchHWHARD( hwhard_t& ) const;
120-
void fetchHWPRCH( hwprch_t& ) const;
115+
void fetchHWPROC() const;
116+
void fetchHWBMCH() const;
117+
void fetchHWPRAM() const;
118+
void fetchHWPROP() const;
119+
void fetchHWHARD() const;
120+
void fetchHWPRCH() const;
121121
void fetchPRTYPE( prtype_t& ) const;
122122
void fetchXSECT( xsect_t& ) const;
123123
void fetchPDFS( pdfs_t& ) const;

Fpmc/interface/herwig.h

Lines changed: 40 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,45 @@
1-
#ifndef HERWIG_INC
2-
#define HERWIG_INC
1+
#include "HepMC/HerwigWrapper.h"
32

4-
//-------------------------HERWIG common block -------------------------------------
3+
#ifndef Fpmc_Herwig_h
4+
#define Fpmc_Herwig_h
55

66
static const int nmxres = 500;
7+
8+
extern "C"
9+
{
10+
void hwuidt_( int* iopt, int* ipdg, int* iwig, char nwig[8] );
11+
12+
extern struct {
13+
char AUTPDF[2][20];
14+
char BDECAY[4];
15+
} hwprch_;
16+
17+
//--- arrays for particle properties (NMXRES = max no of particles defined)
18+
extern struct {
19+
double RLTIM[nmxres+1], RMASS[nmxres+1], RSPIN[nmxres+1];
20+
int ICHRG[nmxres+1], IDPDG[nmxres+1],IFLAV[nmxres+1], NRES;
21+
int VTOCDK[nmxres+1], VTORDK[nmxres+1], QORQQB[nmxres+1], QBORQQ[nmxres+1]; // starting from 0...
22+
} hwprop_;
23+
24+
extern struct {
25+
double ASFIXD, CLQ[6][7], COSS, COSTH, CTMAX;
26+
double DISF[2][13], EMLST, EMMAX, EMMIN, EMPOW, EMSCA, EPOLN[3];
27+
double GCOEF[7], GPOLN;
28+
double OMEGA0, PHOMAS, PPOLN[3];
29+
double PTMAX, PTMIN, PTPOW;
30+
double Q2MAX, Q2MIN, Q2POW, Q2WWMN, Q2WWMX, QLIM;
31+
double SINS, THMAX, Y4JT, TMNISR, TQWT, XX[2], XLMIN, XXMIN;
32+
double YBMAX, YBMIN, YJMAX, YJMIN, YWWMAX, YWWMIN, WHMIN, ZJMAX, ZMXISR;
33+
int IAPHIG, IBRN[2], IBSH, ICO[10], IDCMF, IDN[10], IFLMAX, IFLMIN, IHPRO, IPRO;
34+
int MAPQ[6], MAXFL, BGSHAT, COLISR;
35+
int FSTEVT, FSTWGT, GENEV, HVFCEN, TPOL, DURHAM;
36+
} hwhard_;
37+
}
38+
39+
#endif
40+
/*
41+
//-------------------------HERWIG common block -------------------------------------
42+
743
static const int nmxsud = 1024; // max number of entries for Sudakov lookup table
844
static const int nmxcdk = 4000;
945
static const int nmxhep = 4000;
@@ -60,20 +96,6 @@ extern "C"
6096
} hwdspn_t;
6197
extern hwdspn_t hwdspn_;
6298
63-
typedef struct {
64-
char AUTPDF[2][20];
65-
char BDECAY[4];
66-
} hwprch_t;
67-
extern hwprch_t hwprch_;
68-
69-
//--- arrays for particle properties (NMXRES = max no of particles defined)
70-
typedef struct {
71-
double RLTIM[nmxres+1], RMASS[nmxres+1], RSPIN[nmxres+1];
72-
int ICHRG[nmxres+1], IDPDG[nmxres+1],IFLAV[nmxres+1], NRES;
73-
int VTOCDK[nmxres+1], VTORDK[nmxres+1], QORQQB[nmxres+1], QBORQQ[nmxres+1]; // starting from 0...
74-
} hwprop_t;
75-
extern hwprop_t hwprop_;
76-
7799
typedef struct {
78100
unsigned char RNAME[8][nmxres],TXNAME[37][2][nmxres];
79101
} hwunam_t;
@@ -132,21 +154,6 @@ extern "C"
132154
} hwbosc_t;
133155
extern hwbosc_t hwbosc_;
134156
135-
typedef struct {
136-
double ASFIXD, CLQ[6][7], COSS, COSTH, CTMAX;
137-
double DISF[2][13], EMLST, EMMAX, EMMIN, EMPOW, EMSCA, EPOLN[3];
138-
double GCOEF[7], GPOLN;
139-
double OMEGA0, PHOMAS, PPOLN[3];
140-
double PTMAX, PTMIN, PTPOW;
141-
double Q2MAX, Q2MIN, Q2POW, Q2WWMN, Q2WWMX, QLIM;
142-
double SINS, THMAX, Y4JT, TMNISR, TQWT, XX[2], XLMIN, XXMIN;
143-
double YBMAX, YBMIN, YJMAX, YJMIN, YWWMAX, YWWMIN, WHMIN, ZJMAX, ZMXISR;
144-
int IAPHIG, IBRN[2], IBSH, ICO[10], IDCMF, IDN[10], IFLMAX, IFLMIN, IHPRO, IPRO;
145-
int MAPQ[6], MAXFL, BGSHAT, COLISR;
146-
int FSTEVT, FSTWGT, GENEV, HVFCEN, TPOL, DURHAM;
147-
} hwhard_t;
148-
extern hwhard_t hwhard_;
149-
150157
//--- other HERWIG branching, event and hard subprocess common blocks
151158
typedef struct {
152159
double ANOMSC[2][2],HARDST,PTINT[2][3],XFACT;
@@ -288,4 +295,4 @@ extern "C"
288295
#endif
289296
//---------------------------------------------------------------
290297
291-
#endif
298+
#endif*/

Fpmc/src/Fpmc.cc

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ namespace fpmc
5050

5151
dbg_ << "Initializing HERWIG/FPMC" << std::endl;
5252

53-
params_.fetchHWBMCH( hwbmch_ );
54-
params_.fetchHWPROC( hwproc_ );
53+
params_.fetchHWBMCH();
54+
params_.fetchHWPROC();
5555
params_.fetchPRTYPE( prtype_ );
5656

5757
if ( debug_ ) {
@@ -68,12 +68,12 @@ std::cout << "aaaaaaaaaaa" << std::endl;
6868
//--- sets the input parameters
6969
hwigin();
7070

71-
for ( unsigned int i = 0; i < 500; ++i ) {
71+
/* for ( unsigned int i = 0; i < 500; ++i ) {
7272
std::cout << "hwprop for particle " << i << ": " << hwprop_.RLTIM[i] << "\t" << hwprop_.RMASS[i] << "\t" << hwprop_.RSPIN[i] << "\t" << hwprop_.ICHRG[i] << "\t" << hwprop_.IDPDG[i] << "\t" << hwprop_.IFLAV[i] << std::endl;
73-
}
73+
}*/
7474
// exit(0);
7575

76-
params_.fetchHWPRAM( hwpram_ );
76+
params_.fetchHWPRAM();
7777
hwpram_.IPRINT = herwigVerbosity_;
7878
hwpram_.EFFMIN = 1.e-6;
7979
hwpram_.LWSUD = 0; // don't write Sudakov form factors
@@ -94,18 +94,18 @@ std::cout << "aaaaaaaaaaa" << std::endl;
9494
hwevnt_.NRN[1] = seed1;
9595

9696
hwevnt_.MAXER = 100000000; // O(inf)
97-
hwdspn_.LWDEC = 0; // don't write three/four body decays
97+
// hwdspn_.LWDEC = 0; // don't write three/four body decays
9898
// (no fort.77 and fort.88 ...)
9999

100100
// Init LHAPDF glue
101-
params_.fetchHWPRCH( hwprch_ );
101+
params_.fetchHWPRCH();
102102

103103
hwevnt_.MAXPR = maxEventsToPrint_;
104104

105105
//--- feed the parameters from the steering card to the generator core
106106

107-
params_.fetchHWPROP( hwprop_ );
108-
params_.fetchHWHARD( hwhard_ );
107+
params_.fetchHWPROP();
108+
params_.fetchHWHARD();
109109

110110
params_.fetchXSECT( xsect_ );
111111
params_.fetchPDFS( pdfs_ );
@@ -132,10 +132,10 @@ std::cout << "--->" << std::endl;
132132
//--- call HWUSTA to make any particle stable
133133
int iopt = 1;
134134
int iwig = 0;
135-
unsigned char nwig[9] = " ";
135+
char nwig[9] = " ";
136136

137137
int ipdg = 111;
138-
hwuidt( &iopt, &ipdg, &iwig, nwig );
138+
hwuidt_( &iopt, &ipdg, &iwig, nwig );
139139
if ( ipdg ) hwusta(nwig, 1);
140140

141141
//--- initialize elementary process
@@ -160,7 +160,7 @@ std::cout << "--->" << std::endl;
160160
}
161161

162162
bool
163-
Fpmc::next( hwevnt_t& event )
163+
Fpmc::next()
164164
{
165165
if ( !initialised_ ) initialise();
166166

@@ -188,9 +188,7 @@ std::cout << "aaa" << std::endl;
188188
int init = 0;
189189
hwfxer( &init ); // fix event record (i.e. restore correct intermediate states)
190190

191-
event = hwevnt_;
192-
193-
if ( event.IERROR ) return false;
191+
if ( hwevnt_.IERROR ) return false;
194192

195193
//--- increment the events counter
196194
++event_;

Fpmc/src/FpmcParameters.cc

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -114,58 +114,58 @@ namespace fpmc
114114
}
115115

116116
void
117-
FpmcParameters::fetchHWBMCH( hwbmch_t& hwbmch ) const
117+
FpmcParameters::fetchHWBMCH() const
118118
{
119-
if ( has( "part1" ) ) getString( "part1" ).copy( hwbmch.PART1, 8 );
120-
if ( has( "part2" ) ) getString( "part2" ).copy( hwbmch.PART2, 8 );
119+
if ( has( "part1" ) ) getString( "part1" ).copy( hwbmch_.PART1, 8 );
120+
if ( has( "part2" ) ) getString( "part2" ).copy( hwbmch_.PART2, 8 );
121121
}
122122

123123
void
124-
FpmcParameters::fetchHWPROC( hwproc_t& hwproc ) const
124+
FpmcParameters::fetchHWPROC() const
125125
{
126126
hwproc.PBEAM1 = hwproc.PBEAM2 = sqrtS()/2.;
127-
if ( has( "iproc" ) ) hwproc.IPROC = processId();
128-
if ( has( "maxev" ) ) hwproc.MAXEV = getInt( "maxev" );
127+
if ( has( "iproc" ) ) hwproc_.IPROC = processId();
128+
if ( has( "maxev" ) ) hwproc_.MAXEV = getInt( "maxev" );
129129
}
130130

131131
void
132-
FpmcParameters::fetchHWPRAM( hwpram_t& hwpram ) const
132+
FpmcParameters::fetchHWPRAM() const
133133
{
134-
if ( has( "modpdf1" ) ) hwpram.MODPDF[0] = getInt( "modpdf1" );
135-
if ( has( "modpdf2" ) ) hwpram.MODPDF[1] = getInt( "modpdf2" );
134+
if ( has( "modpdf1" ) ) hwpram_.MODPDF[0] = getInt( "modpdf1" );
135+
if ( has( "modpdf2" ) ) hwpram_.MODPDF[1] = getInt( "modpdf2" );
136136
}
137137

138138
void
139-
FpmcParameters::fetchHWPRCH( hwprch_t& hwprch ) const
139+
FpmcParameters::fetchHWPRCH() const
140140
{
141-
if ( has( "autpdf1" ) ) getString( "autpdf1" ).copy( hwprch.AUTPDF[0], 8 );
142-
if ( has( "autpdf2" ) ) getString( "autpdf2" ).copy( hwprch.AUTPDF[1], 8 );
141+
if ( has( "autpdf1" ) ) getString( "autpdf1" ).copy( hwprch_.AUTPDF[0], 8 );
142+
if ( has( "autpdf2" ) ) getString( "autpdf2" ).copy( hwprch_.AUTPDF[1], 8 );
143143
}
144144

145145
void
146-
FpmcParameters::fetchHWPROP( hwprop_t& hwprop ) const
146+
FpmcParameters::fetchHWPROP() const
147147
{
148-
if ( has( "tmass" ) ) hwprop.RMASS[6] = hwprop.RMASS[12] = getFloat( "tmass" ); // top mass
149-
if ( has( "wmass" ) ) hwprop.RMASS[198] = hwprop.RMASS[199] = getFloat( "wmass" ); // W+/- mass
150-
if ( has( "hmass" ) ) hwprop.RMASS[201] = getFloat( "hmass" ); // higgs mass
151-
if ( has( "msb1" ) ) hwprop.RMASS[405] = getFloat( "msb1" ); // stop2 mass
152-
if ( has( "mst1" ) ) hwprop.RMASS[406] = getFloat( "mst1" ); // stop1 mass
148+
if ( has( "tmass" ) ) hwprop_.RMASS[6] = hwprop_.RMASS[12] = getFloat( "tmass" ); // top mass
149+
if ( has( "wmass" ) ) hwprop_.RMASS[198] = hwprop_.RMASS[199] = getFloat( "wmass" ); // W+/- mass
150+
if ( has( "hmass" ) ) hwprop_.RMASS[201] = getFloat( "hmass" ); // higgs mass
151+
if ( has( "msb1" ) ) hwprop_.RMASS[405] = getFloat( "msb1" ); // stop2 mass
152+
if ( has( "mst1" ) ) hwprop_.RMASS[406] = getFloat( "mst1" ); // stop1 mass
153153
}
154154

155155
void
156-
FpmcParameters::fetchHWHARD( hwhard_t& hwhard ) const
156+
FpmcParameters::fetchHWHARD() const
157157
{
158-
if ( has( "q2wwmn" ) ) hwhard.Q2WWMN = getFloat( "q2wwmn" );
159-
if ( has( "q2wwmx" ) ) hwhard.Q2WWMX = getFloat( "q2wwmx" );
158+
if ( has( "q2wwmn" ) ) hwhard_.Q2WWMN = getFloat( "q2wwmn" );
159+
if ( has( "q2wwmx" ) ) hwhard_.Q2WWMX = getFloat( "q2wwmx" );
160160
// beam momentum loss range
161-
if ( has( "ywwmin" ) ) hwhard.YWWMIN = getFloat( "ywwmin" );
162-
if ( has( "ywwmax" ) ) hwhard.YWWMAX = getFloat( "ywwmax" );
161+
if ( has( "ywwmin" ) ) hwhard_.YWWMIN = getFloat( "ywwmin" );
162+
if ( has( "ywwmax" ) ) hwhard_.YWWMAX = getFloat( "ywwmax" );
163163
// central products rapidity, pt, and mass cuts
164-
if ( has( "yjmin" ) ) hwhard.YJMIN = getFloat( "yjmin" );
165-
if ( has( "yjmax" ) ) hwhard.YJMAX = getFloat( "yjmax" );
166-
if ( has( "ptmin" ) ) hwhard.PTMIN = getFloat( "ptmin" );
167-
if ( has( "ptmax" ) ) hwhard.PTMAX = getFloat( "ptmax" );
168-
if ( has( "emmin" ) ) hwhard.EMMIN = getFloat( "emmin" );
164+
if ( has( "yjmin" ) ) hwhard_.YJMIN = getFloat( "yjmin" );
165+
if ( has( "yjmax" ) ) hwhard_.YJMAX = getFloat( "yjmax" );
166+
if ( has( "ptmin" ) ) hwhard_.PTMIN = getFloat( "ptmin" );
167+
if ( has( "ptmax" ) ) hwhard_.PTMAX = getFloat( "ptmax" );
168+
if ( has( "emmin" ) ) hwhard_.EMMIN = getFloat( "emmin" );
169169
}
170170

171171
void

Fpmc/src/HepMCWrapper.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ namespace fpmc
2121
{
2222
//----- start by generating the next event with FPMC
2323

24-
hwevnt_t last_evt;
25-
if ( !Fpmc::next( last_evt ) ) return 0;
26-
if ( last_evt.IERROR ) return 0;
24+
if ( !Fpmc::next() ) return 0;
25+
if ( hwevnt_.IERROR ) return 0;
2726

2827
#ifdef HEPMC_VERSION2
2928
hepMCEvt_ = std::make_shared<HepMC::GenEvent>( *conv_.read_next_event() );
@@ -37,7 +36,7 @@ namespace fpmc
3736
hepMCEvt_->set_signal_process_id( params_.processId() );
3837
hepMCEvt_->set_event_scale( -1. );
3938
#endif
40-
hepMCEvt_->weights().push_back( last_evt.EVWGT );
39+
hepMCEvt_->weights().push_back( hwevnt_.EVWGT );
4140

4241
#ifdef HEPMC_VERSION2
4342
HepMC::PdfInfo pdfInfo;

0 commit comments

Comments
 (0)