CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
KKMC.cxx
Go to the documentation of this file.
1//#include "HepMC/HEPEVT_Wrapper.h"
2#include "HepMC/IO_HEPEVT.h"
3//#include "HepMC/IO_Ascii.h"
4#include "HepMC/GenEvent.h"
5
6#include "GaudiKernel/MsgStream.h"
7#include "GaudiKernel/ISvcLocator.h"
8#include "GaudiKernel/AlgFactory.h"
9#include "GaudiKernel/DataSvc.h"
10#include "GaudiKernel/SmartDataPtr.h"
11
12#include "KKMC/KKMC.h"
13#include "KKMC/KKMCRandom.h"
14#include "KKMC/ReadEb.h"
17#include "cfortran/cfortran.h"
18
20
21
22PROTOCCALLSFSUB3(PSEUMAR_INITIALIZE, pseumar_initialize, INT, INT, INT)
23#define PSEUMAR_INITIALIZE(ijklin, ntot1n, ntot2n) CCALLSFSUB3(PSEUMAR_INITIALIZE, pseumar_initialize, INT, INT, INT, ijklin, ntot1n, ntot2n);
24
25PROTOCCALLSFSUB1(WHYM_SETDEF, whym_setdef, DOUBLEV)
26#define WHYM_SETDEF(XPAR) CCALLSFSUB1(WHYM_SETDEF, whym_setdef, DOUBLEV, XPAR);
28#define MY_PYUPD() CCALLSFSUB0(MY_PYUPD, my_pyupd);
29
30PROTOCCALLSFSUB1(KK2F_INITIALIZE, kk2f_initialize, DOUBLEV)
31#define KK2F_INITIALIZE(XPAR) CCALLSFSUB1(KK2F_INITIALIZE, kk2f_initialize, DOUBLEV, XPAR);
32
33PROTOCCALLSFSUB0(HEPEVT_CLEAN, hepevt_clean)
34#define HEPEVT_CLEAN() CCALLSFSUB0(HEPEVT_CLEAN, hepevt_clean);
36#define KK2F_MAKE() CCALLSFSUB0(KK2F_MAKE, kk2f_make);
37
38PROTOCCALLSFSUB1(KK2F_GETKEYSKIP, kk2f_getkeyskip, PINT)
39#define KK2F_GETKEYSKIP(KEY) CCALLSFSUB1(KK2F_GETKEYSKIP, kk2f_getkeyskip,PINT, KEY);
40
41PROTOCCALLSFSUB1(PSIPP_DDBARCUT, psipp_ddbarcut, PINT)
42#define PSIPP_DDBARCUT(KEY) CCALLSFSUB1(PSIPP_DDBARCUT, psipp_ddbarcut, PINT, KEY);
43
44PROTOCCALLSFSUB0(KK2F_FINALIZE, kk2f_finalize)
45#define KK2F_FINALIZE() CCALLSFSUB0(KK2F_FINALIZE, kk2f_finalize);
46PROTOCCALLSFSUB2(KK2F_GETXSECMC,kk2f_getxsecmc,PDOUBLE, PDOUBLE)
47#define KK2F_GETXSECMC(xsecpb, xerrpb) CCALLSFSUB2(KK2F_GETXSECMC, kk2f_getxsecmc, PDOUBLE, PDOUBLE, xsecpb, xerrpb);
48
49PROTOCCALLSFSUB1(PYLIST, pylist, INT)
50#define PYLIST(LIST) CCALLSFSUB1(PYLIST, pylist, INT, LIST);
51
52PROTOCCALLSFSUB1(PYHEPC, pyhepc, INT)
53#define PYHEPC(ICONV) CCALLSFSUB1(PYHEPC, pyhepc, INT, ICONV);
54
55PROTOCCALLSFSUB1(KK2F_SETEVTGENINTERFACE,kk2f_setevtgeninterface, INT)
56#define KK2F_SETEVTGENINTERFACE(KEY) CCALLSFSUB1(KK2F_SETEVTGENINTERFACE,kk2f_setevtgeninterface, INT, KEY);
57PROTOCCALLSFSUB1(KK2F_GETEVTGENINTERFACE,kk2f_getevtgeninterface, PINT)
58#define KK2F_GETEVTGENINTERFACE(KEY) CCALLSFSUB1(KK2F_GETEVTGENINTERFACE,kk2f_getevtgeninterface, PINT, KEY);
59
60PROTOCCALLSFSUB1(HEPEVT_NUMHEP, hepevt_numhep, PINT)
61#define HEPEVT_NUMHEP(Nhep) CCALLSFSUB1(HEPEVT_NUMHEP, hepevt_numhep, PINT, Nhep);
62PROTOCCALLSFSUB1(HEPEVT_GETF,hepevt_getf, PINT)
63#define HEPEVT_GETF(POS) CCALLSFSUB1(HEPEVT_GETF, hepevt_getf,PINT, POS);
64PROTOCCALLSFSUB1(HEPEVT_GETFBAR,hepevt_getfbar, PINT)
65#define HEPEVT_GETFBAR(POS) CCALLSFSUB1(HEPEVT_GETFBAR, hepevt_getfbar,PINT, POS);
66PROTOCCALLSFSUB1(HEPEVT_GETKFFIN,hepevt_getkffin, PINT)
67#define HEPEVT_GETKFFIN(KFIN) CCALLSFSUB1(HEPEVT_GETKFFIN, hepevt_getkffin,PINT, KFIN);
68PROTOCCALLSFSUB1(HEPEVT_SETPHOTOSFLAGTRUE, hepevt_setphotosflagtrue, INT)
69#define HEPEVT_SETPHOTOSFLAGTRUE(IP) CCALLSFSUB1(HEPEVT_SETPHOTOSFLAGTRUE, hepevt_setphotosflagtrue, INT, IP);
70PROTOCCALLSFSUB1(PHOTOS, photos, INT)
71#define PHOTOS(IP) CCALLSFSUB1(PHOTOS, photos, INT, IP);
73#define PHOINI() CCALLSFSUB0(PHOINI, phoini);
74
75PROTOCCALLSFSUB0(TURNOFFTAUDECAY, turnofftaudecay)
76#define TURNOFFTAUDECAY() CCALLSFSUB0(TURNOFFTAUDECAY, turnofftaudecay);
77
78PROTOCCALLSFSUB2(PYUPDA, pyupda, INT, INT)
79#define PYUPDA(MUPDA, LFN) CCALLSFSUB2(PYUPDA, pyupda, INT, INT, MUPDA, LFN);
80
81typedef struct {
82 double ddbarmassCUT;
83 } DDBAR_DEF;
84#define DDBARMASS COMMON_BLOCK(DDBAR_DEF, ddbarmass)
86
87typedef struct {
88 int isrtag,fsrtag;
90#define PHOTONTAG COMMON_BLOCK(PHOTONTAG_DEF,photontag)
92
93typedef struct {
94 int ich;
95 } MODEXS_DEF;
96#define MODEXS COMMON_BLOCK(MODEXS_DEF, modexs)
98
99extern "C" {
100 extern void pygive_(const char *cnfgstr,int length);
101}
102
103using namespace HepMC;
104int KKMC::m_runNo=0;
105
106KKMC::KKMC(const std::string& name, ISvcLocator* pSvcLocator) : Algorithm(name, pSvcLocator)
107{
108 m_numberEvent = 0;
109
110 m_kkseed.clear();
111 m_kkseed.push_back(123456);
112 m_kkseed.push_back(1);
113 m_kkseed.push_back(0);
114
115
116 declareProperty("NumberOfEventPrinted", m_numberEventPrint=100);
117 declareProperty("InitializedSeed", m_kkseed);
118 declareProperty("CMSEnergy", m_cmsEnergy = 3.773);
119 declareProperty("ReadEcmsFromDB", m_ReadEcmsFromDB = false);
120 declareProperty("BeamEnergySpread", m_cmsEnergySpread = 0.0013); //it should be beam energy spread,pingrg-2009-09-24
121 declareProperty("GenerateResonance", m_generateResonance = true);
122 declareProperty("GenerateContinuum", m_generateContinuum = true);
123 declareProperty("GenerateDownQuark", m_generateDownQuark = true);
124 declareProperty("GenerateUpQuark", m_generateUpQuark = true);
125 declareProperty("GenerateStrangeQuark", m_generateStrangeQuark = true);
126 declareProperty("GenerateCharmQuark", m_generateCharmQuark = true);
127 declareProperty("GenerateBottomQuark", m_generateBottomQuark = false);
128 declareProperty("GenerateMuonPair", m_generateMuonPair = true);
129 declareProperty("GenerateTauPair", m_generateTauPair = true);
130 declareProperty("GenerateRho", m_generateRho = true);
131 declareProperty("GenerateOmega", m_generateOmega = true);
132 declareProperty("GeneratePhi", m_generatePhi = true);
133 declareProperty("GenerateJPsi", m_generateJPsi = true);
134 declareProperty("GeneratePsiPrime", m_generatePsiPrime = true);
135 declareProperty("GeneratePsi3770", m_generatePsi3770 = true);
136 declareProperty("GeneratePsi4030", m_generatePsi4030 = true);
137 declareProperty("GeneratePsi4160", m_generatePsi4160 = true);
138 declareProperty("GeneratePsi4415", m_generatePsi4415 = true);
139 declareProperty("GeneratePsi4260", m_generatePsi4260 = true);
140 declareProperty("ThresholdCut", m_DdbarCutPsi3770 = -3.0); //generate DDbar decay, pingrg-2009-10-14
141 declareProperty("TagISR", m_isrtag = false); //Tag ISR photon, false: ID=22, true: ID=-22, pingrg-2010-6-30
142 declareProperty("TagFSR", m_fsrtag = false); //Tag FSR photon, false: ID=22, true: ID=-22, pingrg-2010-6-30
143 declareProperty("ModeIndexExpXS", m_ich = -10); //mode index using the measured cross section
144
145 m_paramRho.clear(); m_paramRho.push_back(0.77457e0); m_paramRho.push_back(147.65e-3); m_paramRho.push_back(6.89e-6);
146 m_paramRh2.clear(); m_paramRh2.push_back(1.465e0); m_paramRh2.push_back(310e-3); m_paramRh2.push_back(0.0e-6);
147 m_paramRh3.clear(); m_paramRh3.push_back(1.700e0); m_paramRh3.push_back(240e-3); m_paramRh3.push_back(0.0e-6);
148 m_paramOme.clear(); m_paramOme.push_back(0.78194e0);m_paramOme.push_back(8.41e-3);m_paramOme.push_back(0.60e-6);
149 m_paramOm2.clear(); m_paramOm2.push_back(1.419e0);m_paramOm2.push_back(174e-3);m_paramOm2.push_back(0.00e-6);
150 m_paramOm3.clear(); m_paramOm3.push_back(1.649e0);m_paramOm3.push_back(220e-3);m_paramOm3.push_back(0.00e-6);
151 m_paramPhi.clear(); m_paramPhi.push_back(1.01942e0);m_paramPhi.push_back(4.46e-3);m_paramPhi.push_back(1.33e-6);
152 m_paramPh2.clear(); m_paramPh2.push_back(1.680e0);m_paramPh2.push_back(150e-3);m_paramPh2.push_back(0.00e-6);
153 m_paramPsi.clear(); m_paramPsi.push_back(3.096916e0);m_paramPsi.push_back(0.0929e-3);m_paramPsi.push_back(5.40e-6);
154 m_paramPs2.clear(); m_paramPs2.push_back(3.686109e0);m_paramPs2.push_back(0.304e-3);m_paramPs2.push_back(2.12e-6);
155 m_paramPs3.clear(); m_paramPs3.push_back(3.77315e0);m_paramPs3.push_back(27.2e-3);m_paramPs3.push_back(0.26e-6);
156 m_paramPs4.clear(); m_paramPs4.push_back(4.039e0);m_paramPs4.push_back(80e-3);m_paramPs4.push_back(0.86e-6);
157 m_paramPs5.clear(); m_paramPs5.push_back(4.153e0);m_paramPs5.push_back(103e-3);m_paramPs5.push_back(0.83e-6);
158 m_paramPs6.clear(); m_paramPs6.push_back(4.421e0);m_paramPs6.push_back(62e-3);m_paramPs6.push_back(0.58e-6);
159 m_paramPs7.clear(); m_paramPs7.push_back(4.263e0);m_paramPs7.push_back(95e-3);m_paramPs7.push_back(0.47e-6);
160 m_paramPs8.clear(); m_paramPs8.push_back(3.872e0);m_paramPs8.push_back(100e-3);m_paramPs8.push_back(0.00e-6);
161 m_paramUps.clear(); m_paramUps.push_back(9.46030e0); m_paramUps.push_back(0.0525e-3); m_paramUps.push_back(1.32e-6);
162 m_paramUp2.clear(); m_paramUp2.push_back(10.02326e0); m_paramUp2.push_back(0.044e-3); m_paramUp2.push_back(0.52e-6);
163 m_paramUp3.clear(); m_paramUp3.push_back(10.3552e0); m_paramUp3.push_back(0.026e-3); m_paramUp3.push_back(0.00e-6);
164 m_paramUp4.clear(); m_paramUp4.push_back(10.580e0); m_paramUp4.push_back(14e-3); m_paramUp4.push_back(0.248e-6);
165 m_paramUp5.clear(); m_paramUp5.push_back(10.865e0); m_paramUp5.push_back(110e-3); m_paramUp5.push_back(0.31e-6);
166 m_paramUp6.clear(); m_paramUp6.push_back(11.019); m_paramUp6.push_back(79e-3); m_paramUp6.push_back(0.13e-6);
167 m_paramZeta.clear(); m_paramZeta.push_back(91.1876e0); m_paramZeta.push_back(2.4952e0); m_paramZeta.push_back(0.08391e0);
168 m_paramW.clear(); m_paramW.push_back(80.43); m_paramW.push_back(2.11e0);
169
170 declareProperty("ResParameterRho", m_paramRho);
171 declareProperty("ResParameterRh2", m_paramRh2);
172 declareProperty("ResParameterRh3", m_paramRh3);
173 declareProperty("ResParameterOme", m_paramOme);
174 declareProperty("ResParameterOm2", m_paramOm2);
175 declareProperty("ResParameterOm3", m_paramOm3);
176 declareProperty("ResParameterPhi", m_paramPhi);
177 declareProperty("ResParameterPh2", m_paramPh2);
178 declareProperty("ResParameterPsi", m_paramPsi);
179 declareProperty("ResParameterPs2", m_paramPs2);
180 declareProperty("ResParameterPs3", m_paramPs3);
181 declareProperty("ResParameterPs4", m_paramPs4);
182 declareProperty("ResParameterPs5", m_paramPs5);
183 declareProperty("ResParameterPs6", m_paramPs6);
184 declareProperty("ResParameterPs7", m_paramPs7);
185 declareProperty("ResParameterPs8", m_paramPs8);
186 declareProperty("ResParameterUps", m_paramUps);
187 declareProperty("ResParameterUp2", m_paramUp2);
188 declareProperty("ResParameterUp3", m_paramUp3);
189 declareProperty("ResParameterUp4", m_paramUp4);
190 declareProperty("ResParameterUp5", m_paramUp5);
191 declareProperty("ResParameterUp6", m_paramUp6);
192 declareProperty("ResParameterZeta", m_paramZeta);
193 declareProperty("ResParameterW", m_paramW);
194
195 // psi(3770) decay
196 declareProperty("Psi3770toNonDDb", m_ps3toNonDDb = 0.0);
197 declareProperty("Psi3770RatioOfD0toDp", m_ps3D0toDp = 0.563);
198 // psi(4030) decay
199 declareProperty("Psi4030toD0D0b", m_ps4toD0D0b = 0.0227);
200 declareProperty("Psi4030toDpDm", m_ps4toDpDm = 0.0167);
201 declareProperty("Psi4030toDsDs", m_ps4toDsDs = 0.0383);
202 declareProperty("Psi4030toD0D0Star", m_ps4toD0D0Star = 0.2952);
203 declareProperty("Psi4030toDpDmStar", m_ps4toDpDmStar = 0.2764);
204 declareProperty("Psi4030toD0StarD0Star", m_ps4toD0StarD0Star=0.2476);
205 declareProperty("Psi4030toDpStarDmStar", m_ps4toDpStarDmStar=0.1041);
206 // psi(4160) decay
207 declareProperty("Psi4160toD0D0b", m_ps5toD0D0b = 0.0190);
208 declareProperty("Psi4160toDpDm", m_ps5toDpDm = 0.0180);
209 declareProperty("Psi4160toDsDs", m_ps5toDsDs = 0.0488);
210 declareProperty("Psi4160toD0D0Star", m_ps5toD0D0Star = 0.1248);
211 declareProperty("Psi4160toDpDmStar", m_ps5toDpDmStar = 0.1240);
212 declareProperty("Psi4160toDsDsStar", m_ps5toDsDsStar = 0.0820);
213 declareProperty("Psi4160toD0StarD0Star", m_ps5toD0StarD0Star=0.3036);
214 declareProperty("Psi4160toDpStarDmStar", m_ps5toDpStarDmStar=0.2838);
215 // interface to EvtGen
216 declareProperty("ParticleDecayThroughEvtGen", m_evtGenDecay = true);
217 declareProperty("RadiationCorrection", m_radiationCorrection = true);
218 //interface set pythia pars
219 m_pypars.clear();
220 declareProperty("setPythiaPars", m_pypars);
221}
222
223StatusCode KKMC::initialize() {
224
225 MsgStream log(msgSvc(), name());
226
227 log << MSG::INFO << "KKMC in initialize()" << endreq;
228
229 //set Bes unified random engine
230 static const bool CREATEIFNOTTHERE(true);
231 StatusCode RndmStatus = service("BesRndmGenSvc", p_BesRndmGenSvc, CREATEIFNOTTHERE);
232 if (!RndmStatus.isSuccess() || 0 == p_BesRndmGenSvc)
233 {
234 log << MSG::ERROR << " Could not initialize Random Number Service" << endreq;
235 return RndmStatus;
236 }
237 CLHEP::HepRandomEngine* engine = p_BesRndmGenSvc->GetEngine("KKMC");
239 //---
240 if(m_ich == -2 || m_ich>=50 ) {// ISR exclusive default set particle as Psi(4260)
241 m_generatePsi4260 = true;
242 m_generateJPsi = 0;
243 m_generatePsiPrime = 0;
244 m_generatePsi3770 = 0;
245 m_generatePsi4030 = 0;
246 m_generatePsi4160 = 0;
247 m_generatePsi4415 = 0;
248 }
249
250 WHYM_SETDEF(xwpar);
251 xwpar[0] = m_cmsEnergy; // c.m.s energy
252 xwpar[1] = m_cmsEnergySpread; // energy spread of c.m.s.
253 xwpar[3] = 6.0; // fortran output unit
254
255 if(m_generateResonance) // flag indicate to generate Resonance data
256 xwpar[12] = 1.0;
257 else
258 xwpar[12] = 0.0;
259
260 if(m_generateContinuum ) // generate continuum
261 xwpar[3000] = 1.0;
262 else
263 xwpar[3000] = 0.0;
264
265 if(m_generateDownQuark) // d quark production
266 xwpar[400] = 1.0;
267 else
268 xwpar[400] = 0.0;
269
270 if(m_generateUpQuark) // u quark production
271 xwpar[401] = 1.0;
272 else
273 xwpar[401] = 0.0;
274
275 if(m_generateStrangeQuark) // s quark production
276 xwpar[402] = 1.0;
277 else
278 xwpar[402] = 0.0;
279
280 if(m_generateCharmQuark) // c quark production
281 xwpar[403] = 1.0;
282 else
283 xwpar[403] = 0.0;
284
285 if(m_generateBottomQuark) // b quark production
286 xwpar[404] = 1.0;
287 else
288 xwpar[404] = 0.0;
289
290
291 if(m_generateMuonPair) // e+ e- --> mu+ mu-
292 xwpar[412] = 1.0;
293 else
294 xwpar[412] = 0.0;
295
296 if(m_generateTauPair) // e+ e- --> tau+ tau-
297 xwpar[414] = 1.0;
298 else
299 xwpar[414] = 0.0;
300 int keyuds = 0;
301 if(m_generateRho) keyuds |= 1;
302 if(m_generateOmega) keyuds |= 2;
303 if(m_generatePhi) keyuds |= 4;
304
305 int keycharm = 0;
306 if(m_generateJPsi) keycharm |= 1;
307 if(m_generatePsiPrime) keycharm |= 2;
308 if(m_generatePsi3770) keycharm |= 4;
309 if(m_generatePsi4030) keycharm |= 8;
310 if(m_generatePsi4160) keycharm |= 16;
311 if(m_generatePsi4415) keycharm |= 32;
312 if(m_generatePsi4260) keycharm |= 64;
313
314 // resonant parameters
315 int offset = 3100;
316 for(int i = 0; i < 3; i++) xwpar[offset+i] = m_paramRho[i];
317 offset = offset + 3;
318 for(int i = 0; i < 3; i++) xwpar[offset+i] = m_paramRh2[i];
319 offset = offset + 3;
320 for(int i = 0; i < 3; i++) xwpar[offset+i] = m_paramRh3[i];
321 offset = offset + 3;
322 for(int i = 0; i < 3; i++) xwpar[offset+i] = m_paramOme[i];
323 offset = offset + 3;
324 for(int i = 0; i < 3; i++) xwpar[offset+i] = m_paramOm2[i];
325 offset = offset + 3;
326 for(int i = 0; i < 3; i++) xwpar[offset+i] = m_paramOm3[i];
327 offset = offset + 3;
328 for(int i = 0; i < 3; i++) xwpar[offset+i] = m_paramPhi[i];
329 offset = offset + 3;
330 for(int i = 0; i < 3; i++) xwpar[offset+i] = m_paramPh2[i];
331 offset = offset + 3;
332 for(int i = 0; i < 3; i++) xwpar[offset+i] = m_paramPsi[i];
333 offset = offset + 3;
334 for(int i = 0; i < 3; i++) xwpar[offset+i] = m_paramPs2[i];
335 offset = offset + 3;
336 for(int i = 0; i < 3; i++) xwpar[offset+i] = m_paramPs3[i];
337 offset = offset + 3;
338 for(int i = 0; i < 3; i++) xwpar[offset+i] = m_paramPs4[i];
339 offset = offset + 3;
340 for(int i = 0; i < 3; i++) xwpar[offset+i] = m_paramPs5[i];
341 offset = offset + 3;
342 for(int i = 0; i < 3; i++) xwpar[offset+i] = m_paramPs6[i];
343 offset = offset + 3;
344 for(int i = 0; i < 3; i++) xwpar[offset+i] = m_paramPs7[i];
345 offset = offset + 3;
346 for(int i = 0; i < 3; i++) xwpar[offset+i] = m_paramPs8[i];
347 offset = offset + 3;
348 for(int i = 0; i < 3; i++) xwpar[offset+i] = m_paramUps[i];
349 offset = offset + 3;
350 for(int i = 0; i < 3; i++) xwpar[offset+i] = m_paramUp2[i];
351 offset = offset + 3;
352 for(int i = 0; i < 3; i++) xwpar[offset+i] = m_paramUp3[i];
353 offset = offset + 3;
354 for(int i = 0; i < 3; i++) xwpar[offset+i] = m_paramUp4[i];
355 offset = offset + 3;
356 for(int i = 0; i < 3; i++) xwpar[offset+i] = m_paramUp5[i];
357 offset = offset + 3;
358 for(int i = 0; i < 3; i++) xwpar[offset+i] = m_paramUp6[i];
359 offset = offset + 3;
360 for(int i = 0; i < 3; i++) xwpar[offset+i] = m_paramZeta[i];
361 offset = offset + 3;
362 for(int i = 0; i < 2; i++) xwpar[offset+i] = m_paramW[i];
363 // offset = offset + 2;
364
365 xwpar[3001] = keyuds + 0.0;
366 xwpar[3002] = keycharm + 0.0;
367
368 // psi(3770) decay
369 offset = 3200;
370 xwpar[offset + 0] = m_ps3toNonDDb;
371 xwpar[offset + 1] = m_ps3D0toDp;
372 DDBARMASS.ddbarmassCUT= m_DdbarCutPsi3770;
373 MODEXS.ich = m_ich;
374 //tag ISR or FSR photon
375 if(m_isrtag){PHOTONTAG.isrtag=1;} else {PHOTONTAG.isrtag=0;}
376 if(m_fsrtag){PHOTONTAG.fsrtag=1;} else {PHOTONTAG.fsrtag=0;}
377
378 // psi(4030) decay
379 offset = 3210;
380 xwpar[offset + 0] = m_ps4toD0D0b;
381 xwpar[offset + 1] = m_ps4toDpDm;
382 xwpar[offset + 2] = m_ps4toDsDs;
383 xwpar[offset + 3] = m_ps4toD0D0Star;
384 xwpar[offset + 4] = m_ps4toDpDmStar;
385 xwpar[offset + 5] = m_ps4toD0StarD0Star;
386 xwpar[offset + 6] = m_ps4toDpStarDmStar;
387 // psi(4160) decay
388 offset = 3220;
389 xwpar[offset + 0] = m_ps5toD0D0b;
390 xwpar[offset + 1] = m_ps5toDpDm;
391 xwpar[offset + 2] = m_ps5toDsDs;
392 xwpar[offset + 3] = m_ps5toD0D0Star;
393 xwpar[offset + 4] = m_ps5toDpDmStar;
394 xwpar[offset + 5] = m_ps5toDsDsStar;
395 xwpar[offset + 6] = m_ps5toD0StarD0Star;
396 xwpar[offset + 7] = m_ps5toDpStarDmStar;
397
398 if(!m_radiationCorrection) {
399 xwpar[19] = 0;
400 xwpar[20] = 0;
401 xwpar[26] = 0;
402 }
403
404
405 KK2F_INITIALIZE(xwpar);
406 MY_PYUPD();
407 PYUPDA(1, 22);
408 //for pythia parameter tunning,pingrg-2013-6-9
409 for(int i=0;i<m_pypars.size();i++){
410 pygive_(m_pypars[i].c_str(),strlen(m_pypars[i].c_str()));
411 }
412
413 if(m_evtGenDecay) {
416 } else {
418 PHOINI();
419 }
420
421 HepMC::HEPEVT_Wrapper::set_sizeof_real(8);
422 HepMC::HEPEVT_Wrapper::set_sizeof_int(4);
423 HepMC::HEPEVT_Wrapper::set_max_number_entries(4000);
424 // std::cout << "max entries = " << HepMC::HEPEVT_Wrapper::max_number_entries() <<std::endl;
425 // std::cout << "size of real = " << HepMC::HEPEVT_Wrapper::sizeof_real() <<std::endl;
426
427
428 log <<MSG::INFO<< "Finish KKMC initialize()" <<endreq;
429 return StatusCode::SUCCESS;
430}
431
432StatusCode KKMC::execute() {
433 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
434 int runNo=eventHeader->runNumber();
435 int event=eventHeader->eventNumber();
436 bool newRunFlag=0;
437 if(runNo != 0 && runNo != m_runNo){m_runNo=runNo;newRunFlag = true;}else{newRunFlag=false;}
438
439 //std::cout<<"runNo= "<<runNo<<" m_runNo "<<m_runNo<<" newRunFlag= "<<newRunFlag<<std::endl;
440
441 if(m_ReadEcmsFromDB && newRunFlag){// using cms energy of beam read from database
442 runNo = std::abs(runNo);
443 ReadEb theEb(runNo);
444 double dbEcms = theEb.getEcms();
445 double dbXangle = theEb.getXangle();
446 m_cmsEnergy = dbEcms; //*cos(dbXangle); //here the dbEcms is the enegy in the center-mass system of psi"
447 std::cout<<"The beam energy is "<<dbEcms<<", set for RunNo "<<runNo<<std::endl;
448 xwpar[0] = m_cmsEnergy;
449 KK2F_INITIALIZE(xwpar);
450 }
451 MsgStream log(msgSvc(), name());
452
453 log << MSG::INFO << "KKMC in execute()" << endreq;
454
455
456 HepMC::IO_HEPEVT HepEvtIO;
457
458
459 int KeySkip,iflag;
460 do {
461 HEPEVT_CLEAN();
462 KK2F_MAKE();
463 KK2F_GETKEYSKIP(KeySkip);
464 PSIPP_DDBARCUT(iflag);
465 } while (KeySkip != 0 || iflag ==0);
466
467 int KeyInter;
468 KK2F_GETEVTGENINTERFACE(KeyInter);
469
470 // PSIPP_DDBARCUT(iflag);
471 // if(iflag == 0) {return StatusCode::SUCCESS;}
472
473 if(KeyInter == 0) { // make photos correction
474 int Pos1, Pos2, KFfin, Nhep;
475 HEPEVT_NUMHEP(Nhep);
476 HEPEVT_GETF(Pos1);
477 HEPEVT_GETFBAR(Pos2);
478 HEPEVT_GETKFFIN(KFfin);
479 int Posn = Pos1;
480 if(Pos2 > Posn) Posn = Pos2;
481 Posn = Posn + 1;
482 if(KFfin < 10) Posn = Posn + 1;
483 for(int ip = Posn; ip <= Nhep; ip++) HEPEVT_SETPHOTOSFLAGTRUE(ip);
484 for(int ip = Posn; ip <= Nhep; ip++) PHOTOS(ip);
485 PYHEPC(2);
486 }
487
488 //sleep(5);
489
490 m_numberEvent += 1;
491
492 if(m_numberEvent <= m_numberEventPrint) PYLIST(1);
493 log << MSG::INFO <<" " <<m_numberEvent<<"th event was generated !!" <<endreq;
494
495 PYHEPC(1);
496
497 HepMC::GenEvent* evt = HepEvtIO.read_next_event();
498 evt->set_event_number(m_numberEvent);
499 evt->set_signal_process_id(1);
500 // evt->print();
501
502 // Check if the McCollection already exists
503 SmartDataPtr<McGenEventCol> anMcCol(eventSvc(), "/Event/Gen");
504 if (anMcCol!=0) {
505 // Add event to existing collection
506 MsgStream log(messageService(), name());
507 log << MSG::INFO << "Add McGenEvent to existing collection" << endreq;
508 McGenEvent* mcEvent = new McGenEvent(evt);
509 anMcCol->push_back(mcEvent);
510 } else {
511 // Create Collection and add to the transient store
512 McGenEventCol *mcColl = new McGenEventCol;
513 McGenEvent* mcEvent = new McGenEvent(evt);
514 mcColl->push_back(mcEvent);
515 StatusCode sc = eventSvc()->registerObject("/Event/Gen",mcColl);
516 if (sc != StatusCode::SUCCESS) {
517 log << MSG::ERROR << "Could not register McGenEvent" << endreq;
518 delete mcColl;
519 delete evt;
520 delete mcEvent;
521 return StatusCode::FAILURE;
522 } else {
523 // log << MSG::INFO << "McGenEventCol created and " << npart <<" particles stored in McGenEvent" << endreq;
524 }
525 }
526
527
528
529
530 return StatusCode::SUCCESS;
531
532}
533
534StatusCode KKMC::finalize() {
535
536 MsgStream log(msgSvc(), name());
537
538 log << MSG::INFO << "KKMC in finalize()" << endreq;
539
541 double xSecPb, xErrPb;
542 KK2F_GETXSECMC(xSecPb, xErrPb);
543
544 log << MSG::INFO << "Total MC Xsec = " << xSecPb << " +/- " << xErrPb << endreq;
545 return StatusCode::SUCCESS;
546}
547
548
#define HEPEVT_CLEAN()
Definition: BesBdkRc.cxx:100
double length
int runNo
void pygive_(const char *cnfgstr, int length)
#define MY_PYUPD()
Definition: KKMC.cxx:28
#define PYHEPC(ICONV)
Definition: KKMC.cxx:53
#define PSIPP_DDBARCUT(KEY)
Definition: KKMC.cxx:42
#define KK2F_SETEVTGENINTERFACE(KEY)
Definition: KKMC.cxx:56
#define PHOINI()
Definition: KKMC.cxx:73
#define KK2F_GETEVTGENINTERFACE(KEY)
Definition: KKMC.cxx:58
#define WHYM_SETDEF(XPAR)
Definition: KKMC.cxx:26
#define HEPEVT_GETKFFIN(KFIN)
Definition: KKMC.cxx:67
#define DDBARMASS
Definition: KKMC.cxx:84
void pygive_(const char *cnfgstr, int length)
#define PSEUMAR_INITIALIZE(ijklin, ntot1n, ntot2n)
Definition: KKMC.cxx:23
#define PYLIST(LIST)
Definition: KKMC.cxx:50
#define KK2F_GETXSECMC(xsecpb, xerrpb)
Definition: KKMC.cxx:47
#define PHOTONTAG
Definition: KKMC.cxx:90
#define PYUPDA(MUPDA, LFN)
Definition: KKMC.cxx:79
#define KK2F_FINALIZE()
Definition: KKMC.cxx:45
#define HEPEVT_NUMHEP(Nhep)
Definition: KKMC.cxx:61
#define KK2F_MAKE()
Definition: KKMC.cxx:36
#define KK2F_GETKEYSKIP(KEY)
Definition: KKMC.cxx:39
#define HEPEVT_GETF(POS)
Definition: KKMC.cxx:63
#define MODEXS
Definition: KKMC.cxx:96
#define KK2F_INITIALIZE(XPAR)
Definition: KKMC.cxx:31
#define HEPEVT_SETPHOTOSFLAGTRUE(IP)
Definition: KKMC.cxx:69
#define TURNOFFTAUDECAY()
Definition: KKMC.cxx:76
#define HEPEVT_GETFBAR(POS)
Definition: KKMC.cxx:65
#define HEPEVT_CLEAN()
Definition: KKMC.cxx:34
#define PHOTOS(IP)
Definition: KKMC.cxx:71
ObjectVector< McGenEvent > McGenEventCol
Definition: McGenEvent.h:39
IMessageSvc * msgSvc()
#define PROTOCCALLSFSUB3(UN, LN, T1, T2, T3)
Definition: cfortran.h:1005
#define COMMON_BLOCK_DEF(DEFINITION, NAME)
Definition: cfortran.h:271
#define PROTOCCALLSFSUB2(UN, LN, T1, T2)
Definition: cfortran.h:1003
#define PROTOCCALLSFSUB0(UN, LN)
Definition: cfortran.h:1082
#define PROTOCCALLSFSUB1(UN, LN, T1)
Definition: cfortran.h:1001
virtual CLHEP::HepRandomEngine * GetEngine(const std::string &StreamName)=0
Interface to the CLHEP engine.
static void setRandomEngine(CLHEP::HepRandomEngine *randomEngine)
Definition: KKMCRandom.cxx:32
KKMC(const std::string &name, ISvcLocator *pSvcLocator)
Definition: KKMC.cxx:106
StatusCode initialize()
Definition: KKMC.cxx:223
StatusCode finalize()
Definition: KKMC.cxx:534
StatusCode execute()
Definition: KKMC.cxx:432
Definition: ReadEb.h:17
double getXangle()
Definition: ReadEb.h:36
double getEcms()
Definition: ReadEb.h:35
double ddbarmassCUT
Definition: KKMC.cxx:82
int ich
Definition: KKMC.cxx:94
int fsrtag
Definition: KKMC.cxx:88