11#include "HepMC/GenEvent.h"
15#include "HepMC/HEPEVT_Wrapper.h"
16#include "HepMC/IO_HEPEVT.h"
18#include "GaudiKernel/MsgStream.h"
19#include "GaudiKernel/ISvcLocator.h"
20#include "GaudiKernel/AlgFactory.h"
21#include "GaudiKernel/DataSvc.h"
22#include "GaudiKernel/SmartDataPtr.h"
26#include "cfortran/cfortran.h"
33#define ISEEDC COMMON_BLOCK(ISEEDC_DEF,iseedc)
40#define FNAMES COMMON_BLOCK(FNAMES_DEF,fnames)
44 int NEVTOT,NTUNW,NSMALL,IPROC1,LUNOUT,
IDEBUG,LUN,NTRY;
46#define INPARC COMMON_BLOCK(INPARC_DEF,inparc)
52#define LUMINO COMMON_BLOCK( LUMINO_DEF,lumino)
57#define EVENUM COMMON_BLOCK(EVENUM_DEF,evenum)
60 double MAXESW,SUMW[5],MEANW[5],SUMW2[5],MAXW;
61 double SUMWC[5],MEANWC[5],SUMW2C[5];
63#define UNWEIT COMMON_BLOCK(UNWEIT_DEF,unweit)
68#define WEIGHTED COMMON_BLOCK(WEIGHTED_DEF,weighted)
73#define CFLAGS COMMON_BLOCK(CFLAGS_DEF,cflags)
77 float OM1MNE, OM1MXE, OM2MNE, OM2MXE,
80 W2MINE, W2MAXE, TKMINE, TKMAXE,
EBEAME, MAXESW;
82#define EXCUTS COMMON_BLOCK(EXCUTS_DEF, excuts)
88 float P[5][4000],V[5][4000];
90#define LUJETS COMMON_BLOCK(LUJETS_DEF,lujets)
94#define PRINTEVT() CCALLSFSUB0(PRINTEVT,printevt)
97#define INIRUN() CCALLSFSUB0(INIRUN,inirun)
100#define FINISH() CCALLSFSUB0(FINISH,finish)
103#define GENEVT() CCALLSFSUB0(GENEVT,genevt)
106#define GEN1EVT() CCALLSFSUB0(GEN1EVT,gen1evt)
109#define RDCUTS() CCALLSFSUB0( RDCUTS,rdcuts)
112#define SETDEF() CCALLSFSUB0( SETDEF,setdef)
115#define QCDSTA() CCALLSFSUB0( QCDSTA,qcdsta)
118#define DOCUTS() CCALLSFSUB0( DOCUTS,docuts)
121#define ESTMAXCS() CCALLSFSUB0( ESTMAXCS,estmaxcs)
124#define PRTCUT() CCALLSFSUB0( PRTCUT,prtcut)
127#define USRINI() CCALLSFSUB0( USRINI,usrini)
130#define USRHIS() CCALLSFSUB0( USRHIS,usrhis)
133#define USREND() CCALLSFSUB0( USREND,usrend)
136#define LUHEPC(ICONV) CCALLSFSUB1(LUHEPC, luhepc, INT, ICONV)
139#define HEPEVT_CLEAN() CCALLSFSUB0(HEPEVT_CLEAN, hepevt_clean)
142#define LULIST(ICONV) CCALLSFSUB1(LULIST, lulist, INT, ICONV)
145#define HEPEVT_PRINT() CCALLSFSUB0(HEPEVT_PRINT, hepevt_print)
148 extern void pygive_(
const char *cnfgstr,
int length);
154 declareProperty(
"InitialSeed",m_seed=1001);
155 declareProperty(
"CMEnergy", m_cmEnergy = 3.097);
156 declareProperty(
"MinimumW2",m_m2min=0.02);
157 declareProperty(
"Unweighted",m_unw=1);
158 declareProperty(
"CardFileName", m_fcard=
"BesTwogam.conf");
161 declareProperty(
"setPythiaPars", m_pypars);
165 MsgStream log(messageService(), name());
166 log << MSG::WARNING <<
"BesTwogam initialize" << endreq;
168 if(m_fcard.size()>254){
169 log << MSG::ERROR <<
"Too big name of BesTwogam card file" << endreq;
170 return StatusCode::FAILURE;
173 strcpy(
FNAMES.cardName,m_fcard.c_str());
174 FNAMES.i_cardName=m_fcard.size();
178 EXCUTS.EBEAME=0.5*m_cmEnergy;
190 for(
int i=0;i<m_pypars.size();i++){
191 pygive_(m_pypars[i].c_str(),strlen(m_pypars[i].c_str()));
193 return StatusCode::SUCCESS;
198 MsgStream log(messageService(), name());
199 log << MSG::INFO <<
"BesTwogam executing" << endreq;
200 HepMC::HEPEVT_Wrapper::set_max_number_entries(2000);
201 HepMC::HEPEVT_Wrapper::set_sizeof_real(8);
202 HepMC::IO_HEPEVT HepEvtIO;
207 log << MSG::ERROR<<
" BesTwogam: fail to generate good event"<<endl;
208 return StatusCode::FAILURE;
211 if( log.level() < MSG::INFO )
LULIST(1);
214 HepMC::GenEvent* evt = HepEvtIO.read_next_event();
215 evt->set_event_number(m_numberEvent);
216 evt->set_signal_process_id(1);
218 SmartDataPtr<McGenEventCol> anMcCol(eventSvc(),
"/Event/Gen");
221 MsgStream log(messageService(), name());
222 log << MSG::INFO <<
"Add McGenEvent to existing collection" << endreq;
224 anMcCol->push_back(mcEvent);
229 mcColl->push_back(mcEvent);
230 StatusCode sc = eventSvc()->registerObject(
"/Event/Gen",mcColl);
231 if (sc != StatusCode::SUCCESS) {
232 log << MSG::ERROR <<
"Could not register McGenEvent" << endreq;
236 return StatusCode::FAILURE;
239 return StatusCode::SUCCESS;
244 MsgStream log(messageService(), name());
245 log << MSG::INFO <<
"BesTwogam finalized" << endreq;
247 return StatusCode::SUCCESS;
#define FINISH(IN, SIGT, ER)
void pygive_(const char *cnfgstr, int length)
double P(RecMdcKalTrack *trk)
void pygive_(const char *cnfgstr, int length)
ObjectVector< McGenEvent > McGenEventCol
#define COMMON_BLOCK_DEF(DEFINITION, NAME)
#define PROTOCCALLSFSUB0(UN, LN)
#define PROTOCCALLSFSUB1(UN, LN, T1)
BesTwogam(const string &name, ISvcLocator *pSvcLocator)