12#include "../Babayaga/Babayaga.h"
13#include "../Babayaga/BabayagaRandom.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"
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)
52#define ISRPHOTONS COMMON_BLOCK(ISRPHOTONS_DEF, isrphotons)
59#define BEAMENERGY COMMON_BLOCK(BEAMENERGY_DEF, beamenergy)
65double thmin,thmax,emin,zmax,
egmin,thgmin,thgmax;
67#define EXPCUTS COMMON_BLOCK(EXPCUTS_DEF, expcuts)
75#define SWITCH COMMON_BLOCK(SWITCH_DEF,switchfsr)
82#define SWITCHARUN COMMON_BLOCK(SWITCHARUN_DEF,switcharun)
89#define CHANNEL COMMON_BLOCK(CHANNEL_DEF,channel)
96#define RESONANCES COMMON_BLOCK(RESONANCES_DEF,resonances)
103#define DECLAREINT COMMON_BLOCK(DECLAREINT_DEF,declareint)
110#define DECLARESTR COMMON_BLOCK(DECLARESTR_DEF,declarestr)
117 extern float flat_();
132#define BABAYAGA(NEVENTS) CCALLSFSUB1(BABAYAGA,babayaga,INT,NEVENTS)
138 declareProperty(
"Channel", m_Ich = 1);
139 declareProperty(
"Ebeam", m_Ebeam = 1.548);
140 declareProperty(
"MinThetaAngle", m_Thmin = 70);
141 declareProperty(
"MaxThetaAngle", m_Thmax = 178);
142 declareProperty(
"MinimumEnergy", m_Emin = 0.4);
143 declareProperty(
"MaximumAcollinearity", m_Zmax = 10);
144 declareProperty(
"RunningAlpha", m_Iarun = 1);
145 declareProperty(
"HadronicResonance", m_Ires = 0);
146 declareProperty(
"FSR_swich", m_on = 0);
147 declareProperty(
"MinEnerCutG", m_Egmin = 0.01);
148 declareProperty(
"MinAngCutG", m_Thgmin = 5);
149 declareProperty(
"MaxAngCutG", m_Thgmax = 21);
150 declareProperty(
"HBOOK", HN= 1);
151 declareProperty(
"PHCUT", m_PHCUT = 0);
152 declareProperty(
"CUTG", m_CUTG = 0);
157 MsgStream log(messageService(), name());
159 log << MSG::INFO <<
"Babayaga initialize" << endreq;
162 static const bool CREATEIFNOTTHERE(
true);
163 StatusCode RndmStatus = service(
"BesRndmGenSvc", p_BesRndmGenSvc, CREATEIFNOTTHERE);
164 if (!RndmStatus.isSuccess() || 0 == p_BesRndmGenSvc)
166 log << MSG::ERROR <<
" Could not initialize Random Number Service" << endreq;
169 CLHEP::HepRandomEngine* engine = p_BesRndmGenSvc->
GetEngine(
"Babayaga");
170 std::cout<<
"==============================="<<engine<<endl;
193 std::cout<<
"m_evtMax = "<<m_evtMax<<std::endl;
197 return StatusCode::SUCCESS;
203 MsgStream log(messageService(), name());
208 int pid1,pid2,pst1,pst2;
209 if(m_Ich==1) {pid1=11; pid2=-11; pst1=1;pst2=1;}
210 if(m_Ich==2) {pid1=13; pid2=-13; pst1=1;pst2=1;}
211 if(m_Ich==3) {pid1=22; pid2= 22; pst1=1;pst2=1;}
212 if(m_Ich==4) {pid1=-211; pid2= 211; pst1=1;pst2=1;}
215 GenEvent* evt =
new GenEvent(1,1);
217 GenVertex* prod_vtx =
new GenVertex();
219 evt->add_vertex( prod_vtx );
222 GenParticle* p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.p1[1][evtgen],
MOMSET.p1[2][evtgen],
225 p->suggest_barcode( ++npart );
226 prod_vtx->add_particle_in(p);
230 p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.q1[1][evtgen],
MOMSET.q1[2][evtgen],
234 p->suggest_barcode( ++npart );
235 prod_vtx->add_particle_in(p);
238 p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.p2[1][evtgen],
MOMSET.p2[2][evtgen],
241 p->suggest_barcode( ++npart );
242 prod_vtx->add_particle_out(p);
252 p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.q2[1][evtgen],
MOMSET.q2[2][evtgen],
255 p->suggest_barcode( ++npart );
256 prod_vtx->add_particle_out(p);
261 for (iphot=0; iphot<
ISRPHOTONS.ncqph[evtgen-1]; iphot++)
267 p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.phot[1][iphot][evtgen],
MOMSET.phot[2][iphot][evtgen],
268 MOMSET.phot[3][iphot][evtgen],
MOMSET.phot[0][iphot][evtgen]),
270 p->suggest_barcode( ++npart );
271 prod_vtx->add_particle_out(p);
278 if( log.level() < MSG::INFO )
284 SmartDataPtr<McGenEventCol> anMcCol(eventSvc(),
"/Event/Gen");
288 MsgStream log(messageService(), name());
289 log << MSG::INFO <<
"Add McGenEvent to existing collection" << endreq;
291 anMcCol->push_back(mcEvent);
298 mcColl->push_back(mcEvent);
299 StatusCode sc = eventSvc()->registerObject(
"/Event/Gen",mcColl);
300 if (sc != StatusCode::SUCCESS)
302 log << MSG::ERROR <<
"Could not register McGenEvent" << endreq;
306 return StatusCode::FAILURE;
314 return StatusCode::SUCCESS;
319 MsgStream log(messageService(), name());
321 strcpy(delcmd,
"cat ");
322 strcat(delcmd,
"CrossSection.txt");
325 std::cout<<
"BABAYAGA finalized" << endl;
326 return StatusCode::SUCCESS;
330 IProperty* appPropMgr=0;
332 serviceLocator()->getService(
"ApplicationMgr", IProperty::interfaceID(),
333 reinterpret_cast<IInterface*&
>( appPropMgr ));
334 if( status.isFailure() )
return status;
336 IntegerProperty evtMax(
"EvtMax",0);
337 status = appPropMgr->getProperty( &evtMax );
338 if (status.isFailure())
return status;
340 m_evtMax = evtMax.value();
#define BABAYAGA(NEVENTS)
ObjectVector< McGenEvent > McGenEventCol
#define COMMON_BLOCK_DEF(DEFINITION, NAME)
#define PROTOCCALLSFSUB1(UN, LN, T1)
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.