16#include "HepMC/GenEvent.h"
17#include "HepMC/GenVertex.h"
18#include "HepMC/GenParticle.h"
19#include "CLHEP/Vector/LorentzVector.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"
29#include "CLHEP/Random/RandomEngine.h"
31#include "cfortran/cfortran.h"
46 declareProperty(
"InitialSeed", m_initSeed = 0);
48 declareProperty(
"InitialEvents", m_nm = 50000 );
49 declareProperty(
"NLO", m_nlo = 1 );
50 declareProperty(
"SoftPhotonCutoff", m_w = 0.0001 );
51 declareProperty(
"Channel", m_pion = 0 );
55 declareProperty(
"FSR", m_fsr = 1 );
56 declareProperty(
"FSRNLO", m_fsrnlo = 1 );
57 declareProperty(
"NarrowRes", m_NarrowRes = 1 );
58 declareProperty(
"KaonFormfactor", m_FF_Kaon = 1 );
59 declareProperty(
"VacuumPolarization", m_ivac = 0 );
61 declareProperty(
"PionFormfactor", m_FF_Pion = 0 );
62 declareProperty(
"F0model", m_f0_model = 0 );
64 declareProperty(
"Ecm", m_E = 3.097 );
65 declareProperty(
"CutTotalInvMass", m_q2min = 0.0 );
66 declareProperty(
"CutHadInvMass", m_q2_min_c = 0.0447 );
67 declareProperty(
"MaxHadInvMass", m_q2_max_c = 1.06 );
68 declareProperty(
"MinPhotonEnergy", m_gmin = 0.05 );
69 declareProperty(
"MinPhotonAngle", m_phot1cut = 0.0 );
70 declareProperty(
"MaxPhotonAngle", m_phot2cut = 180.0 );
71 declareProperty(
"MinHadronsAngle", m_pi1cut = 0.0 );
72 declareProperty(
"MaxHadronsAngle", m_pi2cut = 180.0 );
79 MsgStream log(messageService(), name());
81 log << MSG::INFO <<
"Phokhara initialize" << endreq;
89 static const bool CREATEIFNOTTHERE(
true);
90 StatusCode RndmStatus = service(
"BesRndmGenSvc", p_BesRndmGenSvc, CREATEIFNOTTHERE);
91 if (!RndmStatus.isSuccess() || 0 == p_BesRndmGenSvc)
93 log << MSG::ERROR <<
" Could not initialize Random Number Service" << endreq;
98 HepRandomEngine* engine = p_BesRndmGenSvc->
GetEngine(
"PHOKHARA");
99 const long*
s = engine->getSeeds();
103 log << MSG::INFO <<
"Set initial seed " << m_initSeed << endreq;
128 FLAGS.fsrnlo = m_fsrnlo;
131 FLAGS.FF_pion = m_FF_Pion;
132 FLAGS.f0_model = m_f0_model;
133 FLAGS.FF_kaon = m_FF_Kaon;
134 FLAGS.narr_res = m_NarrowRes;
139 CUTS.q2min = m_q2min;
140 CUTS.q2_min_c = m_q2_min_c;
141 CUTS.q2_max_c = m_q2_max_c;
143 CUTS.phot1cut = m_phot1cut;
144 CUTS.phot2cut = m_phot2cut;
145 CUTS.pi1cut = m_pi1cut;
146 CUTS.pi2cut = m_pi2cut;
150 cout <<
"-------------------------------------------------------------" << endl;
152 cout <<
" PHOKHARA 7.0 : e^+ e^- -> mu^+ mu^- gamma" << endl;
153 else if (
FLAGS.pion == 1)
154 cout <<
" PHOKHARA 7.0: e^+ e^- -> pi^+ pi^- gamma" << endl;
155 else if (
FLAGS.pion == 2)
156 cout <<
" PHOKHARA 7.0: e^+ e^- -> pi^+ pi^- 2pi^0 gamma" << endl;
157 else if (
FLAGS.pion == 3)
158 cout <<
" PHOKHARA 7.0: e^+ e^- -> 2pi^+ 2pi^- gamma" << endl;
159 else if (
FLAGS.pion == 4)
160 cout <<
" PHOKHARA 7.0: e^+ e^- -> p pbar gamma" << endl;
161 else if (
FLAGS.pion == 5)
162 cout <<
" PHOKHARA 7.0: e^+ e^- -> n nbar gamma" << endl;
163 else if (
FLAGS.pion == 6)
164 cout <<
" PHOKHARA 7.0: e^+ e^- -> K^+ K^- gamma" << endl;
165 else if (
FLAGS.pion == 7)
166 cout <<
" PHOKHARA 7.0: e^+ e^- -> K_0 K_0bar gamma" << endl;
167 else if (
FLAGS.pion == 8)
168 cout <<
" PHOKHARA 7.0: e^+ e^- -> pi^+ pi^- pi^0 gamma" << endl;
169 else if (
FLAGS.pion == 9) {
170 cout <<
"PHOKHARA 7.0 : e^+ e^- ->" << endl;
171 cout <<
" Lambda (-> pi^- p) Lambda bar (-> pi^+ pbar) gamma" << endl;
173 cout <<
" PHOKHARA 7.0: not yet implemented" << endl;
176 cout <<
"--------------------------------------------------------------" << endl;
177 printf(
" %s %f %s\n",
"cms total energy = ",sqrt(
CTES.Sp),
" GeV ");
179 if((
CUTS.gmin/2.0/
CTES.ebeam) < 0.0098){
180 cerr <<
" minimal missing energy set to small" << endl;
183 printf(
" %s %f %s\n",
"minimal tagged photon energy = ",
CUTS.gmin,
" GeV ");
184 printf(
" %s %f,%f\n",
"angular cuts on tagged photon = ",
CUTS.phot1cut,
CUTS.phot2cut);
198 printf(
" %s %f,%f\n",
"angular cuts on muons = ",
CUTS.pi1cut,
CUTS.pi2cut);
199 else if (
FLAGS.pion == 4)
200 printf(
" %s %f,%f\n",
"angular cuts on protons = ",
CUTS.pi1cut,
CUTS.pi2cut);
201 else if (
FLAGS.pion == 5)
202 printf(
" %s %f,%f\n",
"angular cuts on neutrons = ",
CUTS.pi1cut,
CUTS.pi2cut);
203 else if ((
FLAGS.pion == 6)||(
FLAGS.pion == 7))
204 printf(
" %s %f,%f\n",
"angular cuts on kaons = ",
CUTS.pi1cut,
CUTS.pi2cut);
205 else if (
FLAGS.pion == 9)
206 printf(
" %s %f,%f\n",
"angular cuts on pions and protons = ",
CUTS.pi1cut,
CUTS.pi2cut);
208 printf(
" %s %f,%f\n",
"angular cuts on pions = ",
CUTS.pi1cut,
CUTS.pi2cut);
212 printf(
" %s %f %s\n",
"min. muons-tagged photon inv.mass^2 = ",
CUTS.q2min,
" GeV^2");
213 else if (
FLAGS.pion == 4)
214 printf(
" %s %f %s\n",
"min. protons-tagged photon inv.mass^2 = ",
CUTS.q2min,
" GeV^2" );
215 else if (
FLAGS.pion == 5)
216 printf(
" %s %f %s\n",
"min. neutrons-tagged photon inv.mass^2 = ",
CUTS.q2min,
" GeV^2" );
217 else if ((
FLAGS.pion == 6)||(
FLAGS.pion == 7))
218 printf(
" %s %f %s\n",
"min. kaons-tagged photon inv.mass^2 = ",
CUTS.q2min,
" GeV^2" );
219 else if (
FLAGS.pion == 9)
220 printf(
" %s %f %s\n",
" min. lambdas-tagged photon inv.mass^2 = ",
CUTS.q2min,
" GeV^2" );
222 printf(
" %s %f %s\n",
"min. pions-tagged photon inv.mass^2 = ",
CUTS.q2min,
" GeV^2" );
239 else if (
FLAGS.pion == 1)
241 else if (
FLAGS.pion == 2)
243 else if (
FLAGS.pion == 3)
245 else if (
FLAGS.pion == 4)
247 else if (
FLAGS.pion == 5)
249 else if (
FLAGS.pion == 6)
251 else if (
FLAGS.pion == 7)
253 else if (
FLAGS.pion == 8)
255 else if (
FLAGS.pion == 9)
261 if (
CUTS.q2_max_c < qqmax)
266 qqmin =
CUTS.q2_min_c;
268 cerr <<
"------------------------------" << endl;
269 cerr <<
" Q^2_min TOO SMALL" << endl;
270 cerr <<
" Q^2_min CHANGED BY PHOKHARA = " << qqmin <<
" GeV^2" << endl;
271 cerr <<
"------------------------------" << endl;
275 cerr <<
" Q^2_max to small " << endl;
276 cerr <<
" Q^2_max = " << qqmax << endl;
277 cerr <<
" Q^2_min = " << qqmin << endl;
282 if (
FLAGS.pion == 0) {
283 printf(
" %s %f %s\n",
"minimal muon-pair invariant mass^2 = ", qqmin,
" GeV^2");
284 printf(
" %s %f %s\n",
"maximal muon-pair invariant mass^2 = ", qqmax,
" GeV^2");
285 }
else if (
FLAGS.pion == 1) {
286 printf(
" %s %f %s\n",
"minimal pion-pair invariant mass^2 = ", qqmin,
" GeV^2");
287 printf(
" %s %f %s\n",
"maximal pion-pair invariant mass^2 = ", qqmax,
" GeV^2");
288 }
else if (
FLAGS.pion == 4) {
289 printf(
" %s %f %s\n",
"minimal proton-pair invariant mass^2 = ", qqmin,
" GeV^2");
290 printf(
" %s %f %s\n",
"maximal proton-pair invariant mass^2 = ", qqmax,
" GeV^2");
291 }
else if (
FLAGS.pion == 5) {
292 printf(
" %s %f %s\n",
"minimal neutron-pair invariant mass^2 = ", qqmin,
" GeV^2");
293 printf(
" %s %f %s\n",
"maximal neutron-pair invariant mass^2 = ", qqmax,
" GeV^2");
294 }
else if ((
FLAGS.pion == 6) || (
FLAGS.pion == 7)) {
295 printf(
" %s %f %s\n",
"minimal kaon-pair invariant mass^2 = ", qqmin,
" GeV^2");
296 printf(
" %s %f %s\n",
"maximal kaon-pair invariant mass^2 = ", qqmax,
" GeV^2");
297 }
else if(
FLAGS.pion == 8){
298 printf(
" %s %f %s\n",
"minimal three-pion invariant mass^2 = ", qqmin,
" GeV^2");
299 printf(
" %s %f %s\n",
"maximal three-pion invariant mass^2 = ", qqmax,
" GeV^2");
300 }
else if(
FLAGS.pion == 9){
301 printf(
" %s %f %s\n",
"minimal lambda-pair invariant mass^2 = ", qqmin,
" GeV^2");
302 printf(
" %s %f %s\n",
"maximal lambda-pair invariant mass^2 = ", qqmax,
" GeV^2");
304 printf(
" %s %f %s\n",
"minimal four-pion invariant mass^2 = ", qqmin,
" GeV^2" );
305 printf(
" %s %f %s\n",
"maximal four-pion invariant mass^2 = ", qqmax,
" GeV^2");
308 if (
FLAGS.nlo == 0) {
309 cout <<
"Born" << endl;
310 if(
FLAGS.fsrnlo != 0){
311 cerr <<
"WRONG FSRNLO flag - only fsrnlo=0 allowed for Born" << endl;
317 cerr <<
"WRONG NLO flag - only Born allowed for Lambdas"<< endl;
318 cerr <<
"If you feel that you need NLO"<< endl;
319 cerr <<
"please contact the authors"<< endl;
323 if (
FLAGS.nlo == 1) printf(
" %s %f\n",
"NLO: soft photon cutoff w = ",
CUTS.w);
329 || (
FLAGS.fsr == 0) || (
FLAGS.fsrnlo == 0))) {
330 cerr <<
"WRONG combination of FSR, FSRNLO flags" <<endl;
336 cout <<
"ISR only" << endl;
337 else if (
FLAGS.fsr == 1)
338 cout <<
"ISR+FSR" << endl;
339 else if (
FLAGS.fsr == 2) {
341 cout <<
"ISR+INT+FSR" << endl;
343 cerr <<
"WRONG FSR flag: interference is included only for nlo=0" << endl;
348 cerr <<
"WRONG FSR flag" <<
FLAGS.fsr << endl;
352 if(
FLAGS.fsrnlo == 1)
353 cout <<
"IFSNLO included" << endl;
358 cout <<
"ISR only" << endl;
360 cerr <<
"FSR is implemented only for pi+pi-, mu+mu- and K+K- modes" << endl;
367 cout <<
"Vacuum polarization is NOT included" << endl;}
368 else if(
FLAGS.ivac == 1){
369 cout <<
"Vacuum polarization by Fred Jegerlehner (http://www-com.physik.hu-berlin.de/fjeger/alphaQEDn.uu)" << endl;}
370 else if(
FLAGS.ivac == 2){
371 cout <<
"Vacuum polarization (VP_HLMNT_v1_3nonr) by Daisuke Nomura and Thomas Teubner" << endl;}
373 cout <<
"WRONG vacuum polarization switch" << endl;
379 if(
FLAGS.FF_pion == 0)
380 cout <<
"Kuhn-Santamaria PionFormFactor" << endl;
381 else if(
FLAGS.FF_pion == 1)
382 cout <<
"Gounaris-Sakurai PionFormFactor old" << endl;
383 else if(
FLAGS.FF_pion == 2)
384 cout <<
"Gounaris-Sakurai PionFormFactor new" << endl;
386 cout <<
"WRONG PionFormFactor switch" << endl;
391 if(
FLAGS.f0_model == 0)
392 cout <<
"f0+f0(600): K+K- model" << endl;
393 else if(
FLAGS.f0_model == 1)
394 cout <<
"f0+f0(600): \"no structure\" model" << endl;
395 else if(
FLAGS.f0_model == 2)
396 cout <<
"NO f0+f0(600)" << endl;
397 else if(
FLAGS.f0_model == 3)
398 cout <<
"only f0, KLOE: Cesare Bini-private communication" << endl;
400 cout <<
"WRONG f0+f0(600) switch" << endl;
408 if(
FLAGS.FF_kaon == 0)
409 cout <<
"constrained KaonFormFactor" << endl;
410 else if(
FLAGS.FF_kaon == 1) {
411 cout <<
"unconstrained KaonFormFactor" << endl;}
412 else if(
FLAGS.FF_kaon == 2) {
413 cout <<
"Kuhn-Khodjamirian-Bruch KaonFormFactor" << endl;}
415 cout <<
"WRONG KaonFormFactor switch" << endl;
421 if(
FLAGS.narr_res == 1){
422 cout <<
"THE NARROW RESONANCE J/PSI INCLUDED" << endl;}
423 else if(
FLAGS.narr_res == 2){
424 cout <<
"THE NARROW RESONANCE PSI(2S) INCLUDED" << endl;}
425 else if(
FLAGS.narr_res != 0){
426 cout <<
"wrong flag narr_res: only 0, 1 or 2 allowed" << endl;
432 cout <<
"--------------------------------------------------------------" << endl;
436 for( i = 0; i<2; i++)
453 for(j = 1; j <= m_nm; j++)
459 GEN_1PH(1,qqmin,qqmax,cos1min,cos1max,cos3min,cos3max);
463 GEN_2PH(1,qqmin,cos1min,cos1max,cos2min,cos2max,cos3min,cos3max);
495 return StatusCode::SUCCESS;
500 MsgStream log(messageService(), name());
504 tr_old[0] = (int)
MAXIMA.tr[0];
505 tr_old[1] = (
int)
MAXIMA.tr[1];
507 while( ntrials < 10000)
515 GEN_1PH(2,qqmin,qqmax,cos1min,cos1max,cos3min,cos3max);
519 GEN_2PH(2,qqmin,cos1min,cos1max,cos2min,cos2max,cos3min,cos3max);
522 if( ((
int)
MAXIMA.tr[0]+(
int)
MAXIMA.tr[1]) > (tr_old[0]+tr_old[1]) )
525 return StatusCode::SUCCESS;
530 log << MSG::FATAL <<
"Could not satisfy cuts after " << ntrials <<
"trials. Terminate." << endreq;
532 return StatusCode::FAILURE;
538 MsgStream log(messageService(), name());
542 GenEvent* evt =
new GenEvent(1,1);
544 GenVertex* prod_vtx =
new GenVertex();
546 evt->add_vertex( prod_vtx );
549 GenParticle* p =
new GenParticle( CLHEP::HepLorentzVector(
CTES.momenta[1][0],
CTES.momenta[2][0],
CTES.momenta[3][0],
CTES.momenta[0][0] ), -11, 3);
550 p->suggest_barcode( ++npart );
551 prod_vtx->add_particle_in(p);
554 p =
new GenParticle( CLHEP::HepLorentzVector(
CTES.momenta[1][1],
CTES.momenta[2][1],
CTES.momenta[3][1],
CTES.momenta[0][1] ), 11, 3);
555 p->suggest_barcode( ++npart );
556 prod_vtx->add_particle_in(p);
560 p =
new GenParticle( CLHEP::HepLorentzVector(
CTES.momenta[1][2],
CTES.momenta[2][2],
CTES.momenta[3][2],
CTES.momenta[0][2] ), 22, 1);
561 p->suggest_barcode( ++npart );
562 prod_vtx->add_particle_out(p);
564 if(
CTES.momenta[0][3] != 0 )
566 p =
new GenParticle( CLHEP::HepLorentzVector(
CTES.momenta[1][3],
CTES.momenta[2][3],
CTES.momenta[3][3],
CTES.momenta[0][3] ), 22, 1);
567 p->suggest_barcode( ++npart );
568 prod_vtx->add_particle_out(p);
572 if (
FLAGS.pion == 0) {
574 p =
new GenParticle( CLHEP::HepLorentzVector(
CTES.momenta[1][5],
CTES.momenta[2][5],
CTES.momenta[3][5],
CTES.momenta[0][5] ), -13, 1);
575 p->suggest_barcode( ++npart );
576 prod_vtx->add_particle_out(p);
578 p =
new GenParticle( CLHEP::HepLorentzVector(
CTES.momenta[1][6],
CTES.momenta[2][6],
CTES.momenta[3][6],
CTES.momenta[0][6] ), 13, 1);
579 p->suggest_barcode( ++npart );
580 prod_vtx->add_particle_out(p);
583 if (
FLAGS.pion == 1) {
585 p =
new GenParticle( CLHEP::HepLorentzVector(
CTES.momenta[1][5],
CTES.momenta[2][5],
CTES.momenta[3][5],
CTES.momenta[0][5] ),211, 1);
586 p->suggest_barcode( ++npart );
587 prod_vtx->add_particle_out(p);
589 p =
new GenParticle( CLHEP::HepLorentzVector(
CTES.momenta[1][6],
CTES.momenta[2][6],
CTES.momenta[3][6],
CTES.momenta[0][6] ), -211, 1);
590 p->suggest_barcode( ++npart );
591 prod_vtx->add_particle_out(p);
594 if (
FLAGS.pion == 2) {
596 p =
new GenParticle( CLHEP::HepLorentzVector(
CTES.momenta[1][5],
CTES.momenta[2][5],
CTES.momenta[3][5],
CTES.momenta[0][5] ),111, 1);
597 p->suggest_barcode( ++npart );
598 prod_vtx->add_particle_out(p);
600 p =
new GenParticle( CLHEP::HepLorentzVector(
CTES.momenta[1][6],
CTES.momenta[2][6],
CTES.momenta[3][6],
CTES.momenta[0][6] ), 111, 1);
601 p->suggest_barcode( ++npart );
602 prod_vtx->add_particle_out(p);
604 p =
new GenParticle( CLHEP::HepLorentzVector(
CTES.momenta[1][7],
CTES.momenta[2][7],
CTES.momenta[3][7],
CTES.momenta[0][7] ),-211, 1);
605 p->suggest_barcode( ++npart );
606 prod_vtx->add_particle_out(p);
608 p =
new GenParticle( CLHEP::HepLorentzVector(
CTES.momenta[1][8],
CTES.momenta[2][8],
CTES.momenta[3][8],
CTES.momenta[0][8] ), 211, 1);
609 p->suggest_barcode( ++npart );
610 prod_vtx->add_particle_out(p);
613 if (
FLAGS.pion == 3) {
615 p =
new GenParticle( CLHEP::HepLorentzVector(
CTES.momenta[1][5],
CTES.momenta[2][5],
CTES.momenta[3][5],
CTES.momenta[0][5] ),211, 1);
616 p->suggest_barcode( ++npart );
617 prod_vtx->add_particle_out(p);
619 p =
new GenParticle( CLHEP::HepLorentzVector(
CTES.momenta[1][6],
CTES.momenta[2][6],
CTES.momenta[3][6],
CTES.momenta[0][6] ), -211, 1);
620 p->suggest_barcode( ++npart );
621 prod_vtx->add_particle_out(p);
623 p =
new GenParticle( CLHEP::HepLorentzVector(
CTES.momenta[1][7],
CTES.momenta[2][7],
CTES.momenta[3][7],
CTES.momenta[0][7] ),-211, 1);
624 p->suggest_barcode( ++npart );
625 prod_vtx->add_particle_out(p);
627 p =
new GenParticle( CLHEP::HepLorentzVector(
CTES.momenta[1][8],
CTES.momenta[2][8],
CTES.momenta[3][8],
CTES.momenta[0][8] ), 211, 1);
628 p->suggest_barcode( ++npart );
629 prod_vtx->add_particle_out(p);
632 if (
FLAGS.pion == 4) {
634 p =
new GenParticle( CLHEP::HepLorentzVector(
CTES.momenta[1][5],
CTES.momenta[2][5],
CTES.momenta[3][5],
CTES.momenta[0][5] ),-2212, 1);
635 p->suggest_barcode( ++npart );
636 prod_vtx->add_particle_out(p);
638 p =
new GenParticle( CLHEP::HepLorentzVector(
CTES.momenta[1][6],
CTES.momenta[2][6],
CTES.momenta[3][6],
CTES.momenta[0][6] ), 2212, 1);
639 p->suggest_barcode( ++npart );
640 prod_vtx->add_particle_out(p);
643 if (
FLAGS.pion == 5) {
645 p =
new GenParticle( CLHEP::HepLorentzVector(
CTES.momenta[1][5],
CTES.momenta[2][5],
CTES.momenta[3][5],
CTES.momenta[0][5] ),-2112, 1);
646 p->suggest_barcode( ++npart );
647 prod_vtx->add_particle_out(p);
649 p =
new GenParticle( CLHEP::HepLorentzVector(
CTES.momenta[1][6],
CTES.momenta[2][6],
CTES.momenta[3][6],
CTES.momenta[0][6] ), 2112, 1);
650 p->suggest_barcode( ++npart );
651 prod_vtx->add_particle_out(p);
654 if (
FLAGS.pion == 6) {
656 p =
new GenParticle( CLHEP::HepLorentzVector(
CTES.momenta[1][5],
CTES.momenta[2][5],
CTES.momenta[3][5],
CTES.momenta[0][5] ),321, 1);
657 p->suggest_barcode( ++npart );
658 prod_vtx->add_particle_out(p);
660 p =
new GenParticle( CLHEP::HepLorentzVector(
CTES.momenta[1][6],
CTES.momenta[2][6],
CTES.momenta[3][6],
CTES.momenta[0][6] ), -321, 1);
661 p->suggest_barcode( ++npart );
662 prod_vtx->add_particle_out(p);
665 if (
FLAGS.pion == 7) {
667 p =
new GenParticle( CLHEP::HepLorentzVector(
CTES.momenta[1][5],
CTES.momenta[2][5],
CTES.momenta[3][5],
CTES.momenta[0][5] ), 311, 1);
668 p->suggest_barcode( ++npart );
669 prod_vtx->add_particle_out(p);
671 p =
new GenParticle( CLHEP::HepLorentzVector(
CTES.momenta[1][6],
CTES.momenta[2][6],
CTES.momenta[3][6],
CTES.momenta[0][6] ), -311, 1);
672 p->suggest_barcode( ++npart );
673 prod_vtx->add_particle_out(p);
676 if (
FLAGS.pion == 8) {
678 p =
new GenParticle( CLHEP::HepLorentzVector(
CTES.momenta[1][5],
CTES.momenta[2][5],
CTES.momenta[3][5],
CTES.momenta[0][5] ), 211, 1);
679 p->suggest_barcode( ++npart );
680 prod_vtx->add_particle_out(p);
682 p =
new GenParticle( CLHEP::HepLorentzVector(
CTES.momenta[1][6],
CTES.momenta[2][6],
CTES.momenta[3][6],
CTES.momenta[0][6] ), -211, 1);
683 p->suggest_barcode( ++npart );
684 prod_vtx->add_particle_out(p);
686 p =
new GenParticle( CLHEP::HepLorentzVector(
CTES.momenta[1][7],
CTES.momenta[2][7],
CTES.momenta[3][7],
CTES.momenta[0][7] ), 111, 1);
687 p->suggest_barcode( ++npart );
688 prod_vtx->add_particle_out(p);
691 if (
FLAGS.pion == 9) {
693 p =
new GenParticle( CLHEP::HepLorentzVector(
CTES.momenta[1][5],
CTES.momenta[2][5],
CTES.momenta[3][5],
CTES.momenta[0][5] ), -3122, 2);
694 p->suggest_barcode( ++npart );
695 prod_vtx->add_particle_out(p);
697 p =
new GenParticle( CLHEP::HepLorentzVector(
CTES.momenta[1][6],
CTES.momenta[2][6],
CTES.momenta[3][6],
CTES.momenta[0][6] ), 3122, 2);
698 p->suggest_barcode( ++npart );
699 prod_vtx->add_particle_out(p);
701 p =
new GenParticle( CLHEP::HepLorentzVector(
CTES.momenta[1][7],
CTES.momenta[2][7],
CTES.momenta[3][7],
CTES.momenta[0][7] ), 211, 1);
702 p->suggest_barcode( ++npart );
703 prod_vtx->add_particle_out(p);
705 p =
new GenParticle( CLHEP::HepLorentzVector(
CTES.momenta[1][8],
CTES.momenta[2][8],
CTES.momenta[3][8],
CTES.momenta[0][8] ), -2212, 1);
706 p->suggest_barcode( ++npart );
707 prod_vtx->add_particle_out(p);
709 p =
new GenParticle( CLHEP::HepLorentzVector(
CTES.momenta[1][9],
CTES.momenta[2][9],
CTES.momenta[3][9],
CTES.momenta[0][9] ), -211, 1);
710 p->suggest_barcode( ++npart );
711 prod_vtx->add_particle_out(p);
713 p =
new GenParticle( CLHEP::HepLorentzVector(
CTES.momenta[1][10],
CTES.momenta[2][10],
CTES.momenta[3][10],
CTES.momenta[0][10] ), 2212, 1);
714 p->suggest_barcode( ++npart );
715 prod_vtx->add_particle_out(p);
718 if( log.level() < MSG::INFO )
724 SmartDataPtr<McGenEventCol> anMcCol(eventSvc(),
"/Event/Gen");
728 MsgStream log(messageService(), name());
729 log << MSG::INFO <<
"Add McGenEvent to existing collection" << endreq;
731 anMcCol->push_back(mcEvent);
738 mcColl->push_back(mcEvent);
739 StatusCode sc = eventSvc()->registerObject(
"/Event/Gen",mcColl);
740 if (sc != StatusCode::SUCCESS)
742 log << MSG::ERROR <<
"Could not register McGenEvent" << endreq;
746 return StatusCode::FAILURE;
750 log << MSG::INFO <<
"McGenEventCol created and " << npart <<
" particles stored in McGenEvent" << endreq;
754 return StatusCode::SUCCESS;
760 MsgStream log(messageService(), name());
767 if (
FLAGS.nlo == 0) {
776 sigma = sigma1+sigma2;
777 dsigm = sqrt(dsigm1*dsigm1 + dsigm2*dsigm2);
781 cout <<
"-------------------------------------------------------------" << endl;
782 cout <<
" PHOKHARA 7.0 Final Statistics " << endl;
783 cout <<
"-------------------------------------------------------------" << endl;
784 cout << int(
MAXIMA.tr[0]+
MAXIMA.tr[1]) <<
" total events accepted of " << endl;
785 cout << int(ievent) <<
" total events generated" << endl;
786 cout << int(
MAXIMA.tr[0]) <<
" one photon events accepted of " << endl;
787 cout << int(
MAXIMA.count[0]) <<
" events generated" << endl;
788 cout << int(
MAXIMA.tr[1]) <<
" two photon events accepted of " << endl;
789 cout << int(
MAXIMA.count[1]) <<
" events generated" << endl;
791 if (
FLAGS.nlo != 0) cout <<
"sigma1(nbarn) = " << sigma1 <<
" +- " << dsigm1 << endl;
792 if (
FLAGS.nlo != 0) cout <<
"sigma2(nbarn) = " << sigma2 <<
" +- " << dsigm2 << endl;
793 cout <<
"sigma (nbarn) = " << sigma <<
" +- " << dsigm << endl;
795 cout <<
"maximum1 = " <<
MAXIMA.gross[0] <<
" minimum1 = " <<
MAXIMA.klein[0] << endl;
796 cout <<
"Mmax1 = " <<
MAXIMA.Mmax[0] << endl;
797 cout <<
"maximum2 = " <<
MAXIMA.gross[1] <<
" minimum2 = " <<
MAXIMA.klein[1] << endl;
798 cout <<
"Mmax2 = " <<
MAXIMA.Mmax[1] << endl;
799 cout <<
"-------------------------------------------------------------" << endl;
801 log << MSG::INFO <<
"Phokhara finalized" << endreq;
803 return StatusCode::SUCCESS;
double cos(const BesAngle a)
#define RLXDINIT(LUXURY, SEED)
#define GEN_1PH(I, QQMIN, QQMAX, COS1MIN, COS1MAX, COS3MIN, COS3MAX)
#define GEN_2PH(I, QQMIN, COS1MIN, COS1MAX, COS2MIN, COS2MAX, COS3MIN, COS3MAX)
ObjectVector< McGenEvent > McGenEventCol
manage multiple CLHEP random engines as named streams
virtual CLHEP::HepRandomEngine * GetEngine(const std::string &StreamName)=0
Interface to the CLHEP engine.
Phokhara(const string &name, ISvcLocator *pSvcLocator)
StatusCode storeParticles()