8#include "BesTwogam/BesTwogam.h"
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"
24#include "GeneratorObject/McGenEvent.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)
149 declareProperty(
"InitialSeed",m_seed=1001);
150 declareProperty(
"CMEnergy", m_cmEnergy = 3.097);
151 declareProperty(
"MinimumW2",m_m2min=0.02);
152 declareProperty(
"Unweighted",m_unw=1);
153 declareProperty(
"CardFileName", m_fcard=
"BesTwogam.conf");
157 MsgStream log(messageService(), name());
158 log << MSG::WARNING <<
"BesTwogam initialize" << endreq;
160 if(m_fcard.size()>254){
161 log << MSG::ERROR <<
"Too big name of BesTwogam card file" << endreq;
162 return StatusCode::FAILURE;
165 strcpy(
FNAMES.cardName,m_fcard.c_str());
166 FNAMES.i_cardName=m_fcard.size();
170 EXCUTS.EBEAME=0.5*m_cmEnergy;
181 return StatusCode::SUCCESS;
186 MsgStream log(messageService(), name());
187 log << MSG::INFO <<
"BesTwogam executing" << endreq;
188 HepMC::HEPEVT_Wrapper::set_max_number_entries(2000);
189 HepMC::HEPEVT_Wrapper::set_sizeof_real(8);
190 HepMC::IO_HEPEVT HepEvtIO;
195 log << MSG::ERROR<<
" BesTwogam: fail to generate good event"<<endl;
196 return StatusCode::FAILURE;
199 if( log.level() < MSG::INFO )
LULIST(1);
202 HepMC::GenEvent* evt = HepEvtIO.read_next_event();
203 evt->set_event_number(m_numberEvent);
204 evt->set_signal_process_id(1);
206 SmartDataPtr<McGenEventCol> anMcCol(eventSvc(),
"/Event/Gen");
209 MsgStream log(messageService(), name());
210 log << MSG::INFO <<
"Add McGenEvent to existing collection" << endreq;
212 anMcCol->push_back(mcEvent);
217 mcColl->push_back(mcEvent);
218 StatusCode sc = eventSvc()->registerObject(
"/Event/Gen",mcColl);
219 if (sc != StatusCode::SUCCESS) {
220 log << MSG::ERROR <<
"Could not register McGenEvent" << endreq;
224 return StatusCode::FAILURE;
227 return StatusCode::SUCCESS;
232 MsgStream log(messageService(), name());
233 log << MSG::INFO <<
"BesTwogam finalized" << endreq;
235 return StatusCode::SUCCESS;
#define FINISH(IN, SIGT, ER)
double P(RecMdcKalTrack *trk)
#define COMMON_BLOCK_DEF(DEFINITION, NAME)
#define PROTOCCALLSFSUB0(UN, LN)
#define PROTOCCALLSFSUB1(UN, LN, T1)
ObjectVector< McGenEvent > McGenEventCol
BesTwogam(const string &name, ISvcLocator *pSvcLocator)