105KKMC::
KKMC(const
std::
string& name, ISvcLocator* pSvcLocator) : Algorithm(name, pSvcLocator)
110 m_kkseed.push_back(123456);
111 m_kkseed.push_back(1);
112 m_kkseed.push_back(0);
115 declareProperty(
"NumberOfEventPrinted", m_numberEventPrint=100);
116 declareProperty(
"InitializedSeed", m_kkseed);
117 declareProperty(
"CMSEnergy", m_cmsEnergy = 3.773);
118 declareProperty(
"ReadMeasuredEcms", m_RdMeasuredEcms =
false);
119 declareProperty(
"BeamEnergySpread", m_cmsEnergySpread = 0.0013);
120 declareProperty(
"GenerateResonance", m_generateResonance =
true);
121 declareProperty(
"GenerateContinuum", m_generateContinuum =
true);
122 declareProperty(
"GenerateDownQuark", m_generateDownQuark =
true);
123 declareProperty(
"GenerateUpQuark", m_generateUpQuark =
true);
124 declareProperty(
"GenerateStrangeQuark", m_generateStrangeQuark =
true);
125 declareProperty(
"GenerateCharmQuark", m_generateCharmQuark =
true);
126 declareProperty(
"GenerateBottomQuark", m_generateBottomQuark =
false);
127 declareProperty(
"GenerateMuonPair", m_generateMuonPair =
true);
128 declareProperty(
"GenerateTauPair", m_generateTauPair =
true);
129 declareProperty(
"GenerateRho", m_generateRho =
true);
130 declareProperty(
"GenerateOmega", m_generateOmega =
true);
131 declareProperty(
"GeneratePhi", m_generatePhi =
true);
132 declareProperty(
"GenerateJPsi", m_generateJPsi =
true);
133 declareProperty(
"GeneratePsiPrime", m_generatePsiPrime =
true);
134 declareProperty(
"GeneratePsi3770", m_generatePsi3770 =
true);
135 declareProperty(
"GeneratePsi4030", m_generatePsi4030 =
true);
136 declareProperty(
"GeneratePsi4160", m_generatePsi4160 =
true);
137 declareProperty(
"GeneratePsi4415", m_generatePsi4415 =
true);
138 declareProperty(
"GeneratePsi4260", m_generatePsi4260 =
true);
139 declareProperty(
"ThresholdCut", m_DdbarCutPsi3770 = -3.0);
140 declareProperty(
"TagISR", m_isrtag =
false);
141 declareProperty(
"TagFSR", m_fsrtag =
false);
142 declareProperty(
"ModeIndexExpXS", m_ich = -10);
144 declareProperty(
"IHVP", m_ihvp= 1);
148 m_paramRho.clear(); m_paramRho.push_back(0.77457e0); m_paramRho.push_back(147.65e-3); m_paramRho.push_back(6.89e-6);
149 m_paramRh2.clear(); m_paramRh2.push_back(1.465e0); m_paramRh2.push_back(310e-3); m_paramRh2.push_back(0.0e-6);
150 m_paramRh3.clear(); m_paramRh3.push_back(1.700e0); m_paramRh3.push_back(240e-3); m_paramRh3.push_back(0.0e-6);
151 m_paramOme.clear(); m_paramOme.push_back(0.78194e0);m_paramOme.push_back(8.41e-3);m_paramOme.push_back(0.60e-6);
152 m_paramOm2.clear(); m_paramOm2.push_back(1.419e0);m_paramOm2.push_back(174e-3);m_paramOm2.push_back(0.00e-6);
153 m_paramOm3.clear(); m_paramOm3.push_back(1.649e0);m_paramOm3.push_back(220e-3);m_paramOm3.push_back(0.00e-6);
154 m_paramPhi.clear(); m_paramPhi.push_back(1.01942e0);m_paramPhi.push_back(4.46e-3);m_paramPhi.push_back(1.33e-6);
155 m_paramPh2.clear(); m_paramPh2.push_back(1.680e0);m_paramPh2.push_back(150e-3);m_paramPh2.push_back(0.00e-6);
156 m_paramPsi.clear(); m_paramPsi.push_back(3.096916e0);m_paramPsi.push_back(0.0929e-3);m_paramPsi.push_back(5.40e-6);
157 m_paramPs2.clear(); m_paramPs2.push_back(3.686109e0);m_paramPs2.push_back(0.304e-3);m_paramPs2.push_back(2.12e-6);
158 m_paramPs3.clear(); m_paramPs3.push_back(3.77315e0);m_paramPs3.push_back(27.2e-3);m_paramPs3.push_back(0.26e-6);
159 m_paramPs4.clear(); m_paramPs4.push_back(4.039e0);m_paramPs4.push_back(80e-3);m_paramPs4.push_back(0.86e-6);
160 m_paramPs5.clear(); m_paramPs5.push_back(4.153e0);m_paramPs5.push_back(103e-3);m_paramPs5.push_back(0.83e-6);
161 m_paramPs6.clear(); m_paramPs6.push_back(4.421e0);m_paramPs6.push_back(62e-3);m_paramPs6.push_back(0.58e-6);
162 m_paramPs7.clear(); m_paramPs7.push_back(4.263e0);m_paramPs7.push_back(95e-3);m_paramPs7.push_back(0.47e-6);
163 m_paramPs8.clear(); m_paramPs8.push_back(3.872e0);m_paramPs8.push_back(100e-3);m_paramPs8.push_back(0.00e-6);
164 m_paramUps.clear(); m_paramUps.push_back(9.46030e0); m_paramUps.push_back(0.0525e-3); m_paramUps.push_back(1.32e-6);
165 m_paramUp2.clear(); m_paramUp2.push_back(10.02326e0); m_paramUp2.push_back(0.044e-3); m_paramUp2.push_back(0.52e-6);
166 m_paramUp3.clear(); m_paramUp3.push_back(10.3552e0); m_paramUp3.push_back(0.026e-3); m_paramUp3.push_back(0.00e-6);
167 m_paramUp4.clear(); m_paramUp4.push_back(10.580e0); m_paramUp4.push_back(14e-3); m_paramUp4.push_back(0.248e-6);
168 m_paramUp5.clear(); m_paramUp5.push_back(10.865e0); m_paramUp5.push_back(110e-3); m_paramUp5.push_back(0.31e-6);
169 m_paramUp6.clear(); m_paramUp6.push_back(11.019); m_paramUp6.push_back(79e-3); m_paramUp6.push_back(0.13e-6);
170 m_paramZeta.clear(); m_paramZeta.push_back(91.1876e0); m_paramZeta.push_back(2.4952e0); m_paramZeta.push_back(0.08391e0);
171 m_paramW.clear(); m_paramW.push_back(80.43); m_paramW.push_back(2.11e0);
173 declareProperty(
"ResParameterRho", m_paramRho);
174 declareProperty(
"ResParameterRh2", m_paramRh2);
175 declareProperty(
"ResParameterRh3", m_paramRh3);
176 declareProperty(
"ResParameterOme", m_paramOme);
177 declareProperty(
"ResParameterOm2", m_paramOm2);
178 declareProperty(
"ResParameterOm3", m_paramOm3);
179 declareProperty(
"ResParameterPhi", m_paramPhi);
180 declareProperty(
"ResParameterPh2", m_paramPh2);
181 declareProperty(
"ResParameterPsi", m_paramPsi);
182 declareProperty(
"ResParameterPs2", m_paramPs2);
183 declareProperty(
"ResParameterPs3", m_paramPs3);
184 declareProperty(
"ResParameterPs4", m_paramPs4);
185 declareProperty(
"ResParameterPs5", m_paramPs5);
186 declareProperty(
"ResParameterPs6", m_paramPs6);
187 declareProperty(
"ResParameterPs7", m_paramPs7);
188 declareProperty(
"ResParameterPs8", m_paramPs8);
189 declareProperty(
"ResParameterUps", m_paramUps);
190 declareProperty(
"ResParameterUp2", m_paramUp2);
191 declareProperty(
"ResParameterUp3", m_paramUp3);
192 declareProperty(
"ResParameterUp4", m_paramUp4);
193 declareProperty(
"ResParameterUp5", m_paramUp5);
194 declareProperty(
"ResParameterUp6", m_paramUp6);
195 declareProperty(
"ResParameterZeta", m_paramZeta);
196 declareProperty(
"ResParameterW", m_paramW);
199 declareProperty(
"Psi3770toNonDDb", m_ps3toNonDDb = 0.0);
200 declareProperty(
"Psi3770RatioOfD0toDp", m_ps3D0toDp = 0.563);
202 declareProperty(
"Psi4030toD0D0b", m_ps4toD0D0b = 0.0227);
203 declareProperty(
"Psi4030toDpDm", m_ps4toDpDm = 0.0167);
204 declareProperty(
"Psi4030toDsDs", m_ps4toDsDs = 0.0383);
205 declareProperty(
"Psi4030toD0D0Star", m_ps4toD0D0Star = 0.2952);
206 declareProperty(
"Psi4030toDpDmStar", m_ps4toDpDmStar = 0.2764);
207 declareProperty(
"Psi4030toD0StarD0Star", m_ps4toD0StarD0Star=0.2476);
208 declareProperty(
"Psi4030toDpStarDmStar", m_ps4toDpStarDmStar=0.1041);
210 declareProperty(
"Psi4160toD0D0b", m_ps5toD0D0b = 0.0190);
211 declareProperty(
"Psi4160toDpDm", m_ps5toDpDm = 0.0180);
212 declareProperty(
"Psi4160toDsDs", m_ps5toDsDs = 0.0488);
213 declareProperty(
"Psi4160toD0D0Star", m_ps5toD0D0Star = 0.1248);
214 declareProperty(
"Psi4160toDpDmStar", m_ps5toDpDmStar = 0.1240);
215 declareProperty(
"Psi4160toDsDsStar", m_ps5toDsDsStar = 0.0820);
216 declareProperty(
"Psi4160toD0StarD0Star", m_ps5toD0StarD0Star=0.3036);
217 declareProperty(
"Psi4160toDpStarDmStar", m_ps5toDpStarDmStar=0.2838);
220 m_beam1PolVec.clear(); m_beam2PolVec.clear();
221 declareProperty(
"Beam1PolVec", m_beam1PolVec);
222 declareProperty(
"Beam2PolVec", m_beam2PolVec);
224 declareProperty(
"ParticleDecayThroughEvtGen", m_evtGenDecay =
true);
225 declareProperty(
"RadiationCorrection", m_radiationCorrection =
true);
228 declareProperty(
"setPythiaPars", m_pypars);
233 MsgStream log(
msgSvc(), name());
235 log << MSG::INFO <<
"KKMC in initialize()" << endreq;
238 static const bool CREATEIFNOTTHERE(
true);
239 StatusCode RndmStatus = service(
"BesRndmGenSvc", p_BesRndmGenSvc, CREATEIFNOTTHERE);
240 if (!RndmStatus.isSuccess() || 0 == p_BesRndmGenSvc)
242 log << MSG::ERROR <<
" Could not initialize Random Number Service" << endreq;
245 CLHEP::HepRandomEngine* engine = p_BesRndmGenSvc->
GetEngine(
"KKMC");
248 if(m_ich == -2 || m_ich>=0 ) {
249 m_generatePsi4260 =
true;
251 m_generatePsiPrime = 0;
252 m_generatePsi3770 = 0;
253 m_generatePsi4030 = 0;
254 m_generatePsi4160 = 0;
255 m_generatePsi4415 = 0;
259 xwpar[0] = m_cmsEnergy;
260 xwpar[1] = m_cmsEnergySpread;
265 if(m_beam1PolVec.size()==3){
266 xwpar[61]=m_beam1PolVec[0];
267 xwpar[62]=m_beam1PolVec[1];
268 xwpar[63]=m_beam1PolVec[2];
272 if(m_beam2PolVec.size()==3){
273 xwpar[64]=m_beam2PolVec[0];
274 xwpar[65]=m_beam2PolVec[1];
275 xwpar[66]=m_beam2PolVec[2];
279 if(m_generateResonance)
284 if(m_generateContinuum )
289 if(m_generateDownQuark)
294 if(m_generateUpQuark)
299 if(m_generateStrangeQuark)
304 if(m_generateCharmQuark)
309 if(m_generateBottomQuark)
315 if(m_generateMuonPair)
320 if(m_generateTauPair)
325 if(m_generateRho) keyuds |= 1;
326 if(m_generateOmega) keyuds |= 2;
327 if(m_generatePhi) keyuds |= 4;
330 if(m_generateJPsi) keycharm |= 1;
331 if(m_generatePsiPrime) keycharm |= 2;
332 if(m_generatePsi3770) keycharm |= 4;
333 if(m_generatePsi4030) keycharm |= 8;
334 if(m_generatePsi4160) keycharm |= 16;
335 if(m_generatePsi4415) keycharm |= 32;
336 if(m_generatePsi4260) keycharm |= 64;
340 for(
int i = 0; i < 3; i++) xwpar[offset+i] = m_paramRho[i];
342 for(
int i = 0; i < 3; i++) xwpar[offset+i] = m_paramRh2[i];
344 for(
int i = 0; i < 3; i++) xwpar[offset+i] = m_paramRh3[i];
346 for(
int i = 0; i < 3; i++) xwpar[offset+i] = m_paramOme[i];
348 for(
int i = 0; i < 3; i++) xwpar[offset+i] = m_paramOm2[i];
350 for(
int i = 0; i < 3; i++) xwpar[offset+i] = m_paramOm3[i];
352 for(
int i = 0; i < 3; i++) xwpar[offset+i] = m_paramPhi[i];
354 for(
int i = 0; i < 3; i++) xwpar[offset+i] = m_paramPh2[i];
356 for(
int i = 0; i < 3; i++) xwpar[offset+i] = m_paramPsi[i];
358 for(
int i = 0; i < 3; i++) xwpar[offset+i] = m_paramPs2[i];
360 for(
int i = 0; i < 3; i++) xwpar[offset+i] = m_paramPs3[i];
362 for(
int i = 0; i < 3; i++) xwpar[offset+i] = m_paramPs4[i];
364 for(
int i = 0; i < 3; i++) xwpar[offset+i] = m_paramPs5[i];
366 for(
int i = 0; i < 3; i++) xwpar[offset+i] = m_paramPs6[i];
368 for(
int i = 0; i < 3; i++) xwpar[offset+i] = m_paramPs7[i];
370 for(
int i = 0; i < 3; i++) xwpar[offset+i] = m_paramPs8[i];
372 for(
int i = 0; i < 3; i++) xwpar[offset+i] = m_paramUps[i];
374 for(
int i = 0; i < 3; i++) xwpar[offset+i] = m_paramUp2[i];
376 for(
int i = 0; i < 3; i++) xwpar[offset+i] = m_paramUp3[i];
378 for(
int i = 0; i < 3; i++) xwpar[offset+i] = m_paramUp4[i];
380 for(
int i = 0; i < 3; i++) xwpar[offset+i] = m_paramUp5[i];
382 for(
int i = 0; i < 3; i++) xwpar[offset+i] = m_paramUp6[i];
384 for(
int i = 0; i < 3; i++) xwpar[offset+i] = m_paramZeta[i];
386 for(
int i = 0; i < 2; i++) xwpar[offset+i] = m_paramW[i];
389 xwpar[3001] = keyuds + 0.0;
390 xwpar[3002] = keycharm + 0.0;
394 xwpar[offset + 0] = m_ps3toNonDDb;
395 xwpar[offset + 1] = m_ps3D0toDp;
396 DDBARMASS.ddbarmassCUT= m_DdbarCutPsi3770;
404 xwpar[offset + 0] = m_ps4toD0D0b;
405 xwpar[offset + 1] = m_ps4toDpDm;
406 xwpar[offset + 2] = m_ps4toDsDs;
407 xwpar[offset + 3] = m_ps4toD0D0Star;
408 xwpar[offset + 4] = m_ps4toDpDmStar;
409 xwpar[offset + 5] = m_ps4toD0StarD0Star;
410 xwpar[offset + 6] = m_ps4toDpStarDmStar;
413 xwpar[offset + 0] = m_ps5toD0D0b;
414 xwpar[offset + 1] = m_ps5toDpDm;
415 xwpar[offset + 2] = m_ps5toDsDs;
416 xwpar[offset + 3] = m_ps5toD0D0Star;
417 xwpar[offset + 4] = m_ps5toDpDmStar;
418 xwpar[offset + 5] = m_ps5toDsDsStar;
419 xwpar[offset + 6] = m_ps5toD0StarD0Star;
420 xwpar[offset + 7] = m_ps5toDpStarDmStar;
422 if(!m_radiationCorrection) {
432 for(
int i=0;i<m_pypars.size();i++){
433 pygive_(m_pypars[i].c_str(),strlen(m_pypars[i].c_str()));
444 HepMC::HEPEVT_Wrapper::set_sizeof_real(8);
445 HepMC::HEPEVT_Wrapper::set_sizeof_int(4);
446 HepMC::HEPEVT_Wrapper::set_max_number_entries(4000);
451 if(m_RdMeasuredEcms){
452 StatusCode status=serviceLocator()->service(
"MeasuredEcmsSvc", ecmsSvc,
true);
453 if(!status.isSuccess()){
454 std::cout<<
"ERROR: Can not initial the IMeasuredEcmsSvc right"<<std::endl;
460 log <<MSG::INFO<<
"Finish KKMC initialize()" <<endreq;
461 return StatusCode::SUCCESS;
465 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
466 int runNo=eventHeader->runNumber();
467 int event=eventHeader->eventNumber();
469 if(
runNo != 0 &&
runNo != m_runNo){m_runNo=
runNo;newRunFlag =
true;}
else{newRunFlag=
false;}
474 if(m_RdMeasuredEcms&& newRunFlag){
479 double dbEcms=ecmsSvc->
getEcms();
480 std::cout<<
"INFO: Read the MeasuredEcms: "<<dbEcms<<
" GeV"<<std::endl;
482 xwpar[0] = m_cmsEnergy;
488 MsgStream log(
msgSvc(), name());
490 log << MSG::INFO <<
"KKMC in execute()" << endreq;
493 HepMC::IO_HEPEVT HepEvtIO;
502 }
while (KeySkip != 0 || iflag ==0);
511 int Pos1, Pos2, KFfin, Nhep;
517 if(Pos2 > Posn) Posn = Pos2;
519 if(KFfin < 10) Posn = Posn + 1;
521 for(
int ip = Posn; ip <= Nhep; ip++)
PHOTOS(ip);
529 if(m_numberEvent <= m_numberEventPrint)
PYLIST(1);
530 log << MSG::INFO <<
" " <<m_numberEvent<<
"th event was generated !!" <<endreq;
534 HepMC::GenEvent* evt = HepEvtIO.read_next_event();
535 evt->set_event_number(m_numberEvent);
536 evt->set_signal_process_id(1);
540 SmartDataPtr<McGenEventCol> anMcCol(eventSvc(),
"/Event/Gen");
543 MsgStream log(messageService(), name());
544 log << MSG::INFO <<
"Add McGenEvent to existing collection" << endreq;
546 anMcCol->push_back(mcEvent);
551 mcColl->push_back(mcEvent);
552 StatusCode sc = eventSvc()->registerObject(
"/Event/Gen",mcColl);
553 if (sc != StatusCode::SUCCESS) {
554 log << MSG::ERROR <<
"Could not register McGenEvent" << endreq;
558 return StatusCode::FAILURE;
567 return StatusCode::SUCCESS;