12#include "../Babayaga/Babayaga.h"
13#include "../Babayaga/BabayagaRandom.h"
14#include "BesKernel/IBesRndmGenSvc.h"
17#include "HepMC/GenEvent.h"
18#include "HepMC/GenVertex.h"
19#include "HepMC/GenParticle.h"
21#include "GaudiKernel/MsgStream.h"
22#include "GaudiKernel/ISvcLocator.h"
23#include "GaudiKernel/AlgFactory.h"
24#include "GaudiKernel/DataSvc.h"
25#include "GaudiKernel/SmartDataPtr.h"
27#include "GeneratorObject/McGenEvent.h"
28#include "CLHEP/Vector/LorentzVector.h"
29#include "cfortran/cfortran.h"
42 double phot[4][10][160001];
45#define MOMSET COMMON_BLOCK(MOMSET_DEF, momset)
51#define RADBB COMMON_BLOCK(RADBB_DEF, radbb)
58#define ISRPHOTONS COMMON_BLOCK(ISRPHOTONS_DEF, isrphotons)
65#define BEAMENERGY COMMON_BLOCK(BEAMENERGY_DEF, beamenergy)
71double thmin,thmax,emin,zmax,
egmin,thgmin,thgmax;
73#define EXPCUTS COMMON_BLOCK(EXPCUTS_DEF, expcuts)
81#define SWITCH COMMON_BLOCK(SWITCH_DEF,switchfsr)
88#define SWITCHARUN COMMON_BLOCK(SWITCHARUN_DEF,switcharun)
95#define CHANNEL COMMON_BLOCK(CHANNEL_DEF,channel)
102#define RESONANCES COMMON_BLOCK(RESONANCES_DEF,resonances)
109#define DECLAREINT COMMON_BLOCK(DECLAREINT_DEF,declareint)
116#define DECLARESTR COMMON_BLOCK(DECLARESTR_DEF,declarestr)
123 extern float flat_();
138#define BABAYAGA(NEVENTS) CCALLSFSUB1(BABAYAGA,babayaga,INT,NEVENTS)
144 declareProperty(
"Channel", m_Ich = 1);
145 declareProperty(
"Ebeam", m_Ebeam = 1.548);
146 declareProperty(
"MinThetaAngle", m_Thmin = 70);
147 declareProperty(
"MaxThetaAngle", m_Thmax = 178);
148 declareProperty(
"MinimumEnergy", m_Emin = 0.4);
149 declareProperty(
"MaximumAcollinearity", m_Zmax = 10);
150 declareProperty(
"RunningAlpha", m_Iarun = 1);
151 declareProperty(
"HadronicResonance", m_Ires = 0);
152 declareProperty(
"FSR_swich", m_on = 0);
153 declareProperty(
"MinEnerCutG", m_Egmin = 0.01);
154 declareProperty(
"MinAngCutG", m_Thgmin = 5);
155 declareProperty(
"MaxAngCutG", m_Thgmax = 21);
156 declareProperty(
"HBOOK", HN= 1);
157 declareProperty(
"PHCUT", m_PHCUT = 0);
158 declareProperty(
"CUTG", m_CUTG = 0);
159 declareProperty(
"CutNgam", m_CutNgam = 0);
160 declareProperty(
"CutEgam", m_CutEgam = 0);
165 MsgStream log(messageService(), name());
167 log << MSG::INFO <<
"Babayaga initialize" << endreq;
170 static const bool CREATEIFNOTTHERE(
true);
171 StatusCode RndmStatus = service(
"BesRndmGenSvc", p_BesRndmGenSvc, CREATEIFNOTTHERE);
172 if (!RndmStatus.isSuccess() || 0 == p_BesRndmGenSvc)
174 log << MSG::ERROR <<
" Could not initialize Random Number Service" << endreq;
177 CLHEP::HepRandomEngine* engine = p_BesRndmGenSvc->
GetEngine(
"Babayaga");
178 std::cout<<
"==============================="<<engine<<endl;
201 std::cout<<
"m_evtMax = "<<m_evtMax<<std::endl;
205 return StatusCode::SUCCESS;
211 MsgStream log(messageService(), name());
216 int pid1,pid2,pst1,pst2;
217 if(m_Ich==1) {pid1=11; pid2=-11; pst1=1;pst2=1;}
218 if(m_Ich==2) {pid1=13; pid2=-13; pst1=1;pst2=1;}
219 if(m_Ich==3) {pid1=22; pid2= 22; pst1=1;pst2=1;}
220 if(m_Ich==4) {pid1=-211; pid2= 211; pst1=1;pst2=1;}
223 GenEvent* evt =
new GenEvent(1,1);
225 GenVertex* prod_vtx =
new GenVertex();
227 evt->add_vertex( prod_vtx );
230 GenParticle* p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.p1[1][evtgen],
MOMSET.p1[2][evtgen],
233 p->suggest_barcode( ++npart );
234 prod_vtx->add_particle_in(p);
238 p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.q1[1][evtgen],
MOMSET.q1[2][evtgen],
242 p->suggest_barcode( ++npart );
243 prod_vtx->add_particle_in(p);
246 p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.p2[1][evtgen],
MOMSET.p2[2][evtgen],
249 p->suggest_barcode( ++npart );
250 prod_vtx->add_particle_out(p);
260 p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.q2[1][evtgen],
MOMSET.q2[2][evtgen],
263 p->suggest_barcode( ++npart );
264 prod_vtx->add_particle_out(p);
269 for (iphot=0; iphot<
ISRPHOTONS.ncqph[evtgen-1]; iphot++)
275 p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.phot[1][iphot][evtgen],
MOMSET.phot[2][iphot][evtgen],
276 MOMSET.phot[3][iphot][evtgen],
MOMSET.phot[0][iphot][evtgen]),
278 p->suggest_barcode( ++npart );
279 prod_vtx->add_particle_out(p);
286 if( log.level() < MSG::INFO )
292 SmartDataPtr<McGenEventCol> anMcCol(eventSvc(),
"/Event/Gen");
296 MsgStream log(messageService(), name());
297 log << MSG::INFO <<
"Add McGenEvent to existing collection" << endreq;
299 anMcCol->push_back(mcEvent);
306 mcColl->push_back(mcEvent);
307 StatusCode sc = eventSvc()->registerObject(
"/Event/Gen",mcColl);
308 if (sc != StatusCode::SUCCESS)
310 log << MSG::ERROR <<
"Could not register McGenEvent" << endreq;
314 return StatusCode::FAILURE;
322 return StatusCode::SUCCESS;
327 MsgStream log(messageService(), name());
329 strcpy(delcmd,
"cat ");
330 strcat(delcmd,
"CrossSection.txt");
333 std::cout<<
"BABAYAGA finalized" << endl;
334 return StatusCode::SUCCESS;
338 IProperty* appPropMgr=0;
340 serviceLocator()->getService(
"ApplicationMgr", IProperty::interfaceID(),
341 reinterpret_cast<IInterface*&
>( appPropMgr ));
342 if( status.isFailure() )
return status;
344 IntegerProperty evtMax(
"EvtMax",0);
345 status = appPropMgr->getProperty( &evtMax );
346 if (status.isFailure())
return status;
348 m_evtMax = evtMax.value();
#define BABAYAGA(NEVENTS)
#define COMMON_BLOCK_DEF(DEFINITION, NAME)
#define PROTOCCALLSFSUB1(UN, LN, T1)
ObjectVector< McGenEvent > McGenEventCol
static void setRandomEngine(CLHEP::HepRandomEngine *randomEngine)
Babayaga(const string &name, ISvcLocator *pSvcLocator)
virtual CLHEP::HepRandomEngine * GetEngine(const std::string &StreamName)=0
Interface to the CLHEP engine.