8#include "BesBdkRc/BesBdkRc.h"
9#include "BesBdkRc/BesBdkRcRandom.h"
12#include "HepMC/GenEvent.h"
14#include "HepMC/HEPEVT_Wrapper.h"
15#include "HepMC/IO_HEPEVT.h"
16#include "HepMC/GenEvent.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"
23#include "BesKernel/IBesRndmGenSvc.h"
25#include "GeneratorObject/McGenEvent.h"
26#include "cfortran/cfortran.h"
33 double EB,W2MIN,K0,KS,EWE;
35#define INPUT COMMON_BLOCK(INPUT_DEF,input)
41#define PCONST COMMON_BLOCK(PCONST_DEF, pconst)
47#define FINCUT COMMON_BLOCK(FINCUT_DEF, fincut)
51 float W2MINR,
EBEAM, MAXESW, KZERO;
55#define LOCALC COMMON_BLOCK(LOCALC_DEF, localc)
62#define COLCHC COMMON_BLOCK(COLCHC_DEF, colchc)
68#define DELPHC COMMON_BLOCK(DELPHC_DEF, delphc)
76#define XSECTC COMMON_BLOCK(XSECTC_DEF, xsectc)
82#define FLAGS COMMON_BLOCK(FLAGS_DEF, flags)
88 float P[5][4000],V[5][4000];
90#define LUJETS COMMON_BLOCK(LUJETS_DEF,lujets)
94#define LUHEPC(ICONV) CCALLSFSUB1(LUHEPC, luhepc, INT, ICONV)
97#define LULIST(ICONV) CCALLSFSUB1(LULIST, lulist, INT, ICONV)
100#define HEPEVT_CLEAN() CCALLSFSUB0(HEPEVT_CLEAN, hepevt_clean)
103#define HEPEVT_PRINT() CCALLSFSUB0(HEPEVT_PRINT, hepevt_print)
106#define BDKRC(IDUMP) CCALLSFSUB1(BDKRC, bdkrc, INT, IDUMP)
109#define FINISH(IN,SIGT,ER) CCALLSFSUB3(FINISH,finish,PINT,PDOUBLE,PDOUBLE,IN,SIGT,ER)
112#define RLUXGO(lux,ISEED,K1,K2) CCALLSFSUB4(RLUXGO,rluxgo,INT,INT,INT,INT,lux,ISEED,K1,K2)
115#define GEN_INIT() CCALLSFSUB0(GEN_INIT, gen_init)
118#define GEN1EVT() CCALLSFSUB0(GEN1EVT, gen1evt)
121 extern float flat_();
129BesBdkRc::BesBdkRc(
const string& name, ISvcLocator* pSvcLocator):Algorithm( name, pSvcLocator )
132 declareProperty(
"CMEnergy", m_CMEnergy = 3.097);
133 declareProperty(
"W2min",m_w2min=0.02);
134 declareProperty(
"EstimatedMaxWeight", m_ewe=2.5);
135 declareProperty(
"SoftPhotonMaxEnergy", m_kzero=0.002);
142 declareProperty(
"MaxNTry", m_maxNTry);
143 declareProperty(
"FinalState", m_ifinal);
144 declareProperty(
"MinTheta",m_tcmin);
145 declareProperty(
"MinMomentum",m_pcmin);
153 MsgStream log(messageService(), name());
154 log << MSG::WARNING <<
"BesBdkRc initialize" << endreq;
156 static const bool CREATEIFNOTTHERE(
true);
157 StatusCode RndmStatus = service(
"BesRndmGenSvc", p_BesRndmGenSvc, CREATEIFNOTTHERE);
158 if (!RndmStatus.isSuccess() || 0 == p_BesRndmGenSvc)
160 log << MSG::ERROR <<
" Could not initialize Random Number Service" << endreq;
163 CLHEP::HepRandomEngine* engine = p_BesRndmGenSvc->
GetEngine(
"BesBdkRc");
164 engine->showStatus();
170 FINCUT.TCHMIN=m_tcmin*toRad;
178 INPUT.EB=0.5*m_CMEnergy;
181 LOCALC.EBEAM=0.5*m_CMEnergy;
185 for(
int i=0; i<6;i++)
LOCALC.QMASS[i]=qmass[i];
189 return StatusCode::SUCCESS;
194 MsgStream log(messageService(), name());
195 log << MSG::INFO <<
"BesBdkRc executing" << endreq;
196 HepMC::HEPEVT_Wrapper::set_max_number_entries(2000);
197 HepMC::HEPEVT_Wrapper::set_sizeof_real(8);
198 HepMC::IO_HEPEVT HepEvtIO;
203 if(
FLAGS.GOODEVT!=1){
204 log << MSG::ERROR<<
" BesBdkRc: fail to generate good event"<<endl;
205 return StatusCode::FAILURE;
209 if( log.level() < MSG::INFO )
LULIST(1);
212 HepMC::GenEvent* evt = HepEvtIO.read_next_event();
213 evt->set_event_number(m_numberEvent);
214 evt->set_signal_process_id(1);
217 SmartDataPtr<McGenEventCol> anMcCol(eventSvc(),
"/Event/Gen");
220 MsgStream log(messageService(), name());
221 log << MSG::INFO <<
"Add McGenEvent to existing collection" << endreq;
223 anMcCol->push_back(mcEvent);
228 mcColl->push_back(mcEvent);
229 StatusCode sc = eventSvc()->registerObject(
"/Event/Gen",mcColl);
230 if (sc != StatusCode::SUCCESS) {
231 log << MSG::ERROR <<
"Could not register McGenEvent" << endreq;
235 return StatusCode::FAILURE;
241 return StatusCode::SUCCESS;
246 MsgStream log(messageService(), name());
247 log << MSG::INFO <<
"BesBdkRc finalized" << endreq;
260 efferr=sqrt(effcut*(1.0-effcut)/
float(
XSECTC.NEVUNW));
261 cscuterr = sqrt(cstot*efferr*cstot*efferr + effcut*effcut*cserr*cserr);
263 printf(
"BDKRC SUMMARY: Cross section after user cuts= %G +- %G nb\n",cscut,cscuterr);
264 printf(
" Cut acceptance = %G +- %G \n",effcut,efferr);
265 return StatusCode::SUCCESS;
#define RLUXGO(lux, ISEED, K1, K2)
#define FINISH(IN, SIGT, ER)
double P(RecMdcKalTrack *trk)
#define PROTOCCALLSFSUB3(UN, LN, T1, T2, T3)
#define COMMON_BLOCK_DEF(DEFINITION, NAME)
#define PROTOCCALLSFSUB4(UN, LN, T1, T2, T3, T4)
#define PROTOCCALLSFSUB0(UN, LN)
#define PROTOCCALLSFSUB1(UN, LN, T1)
ObjectVector< McGenEvent > McGenEventCol
static void setRandomEngine(CLHEP::HepRandomEngine *randomEngine)
BesBdkRc(const std::string &name, ISvcLocator *pSvcLocator)
virtual CLHEP::HepRandomEngine * GetEngine(const std::string &StreamName)=0
Interface to the CLHEP engine.