#include <Babayaga.h>
Public Member Functions | |
Babayaga (const string &name, ISvcLocator *pSvcLocator) | |
StatusCode | initialize () |
StatusCode | execute () |
StatusCode | finalize () |
StatusCode | getMaxEvent () |
Private Attributes | |
int | m_Int |
int | m_Ich |
int | m_Iarun |
int | m_Ires |
int | m_on |
int | m_evtMax |
int | HN |
int | m_INTUPLE |
int | m_PHCUT |
int | m_CUTG |
double | m_Ebeam |
double | m_Thmin |
double | m_Thmax |
double | m_Emin |
double | m_Zmax |
double | m_Egmin |
double | m_Thgmin |
double | m_Thgmax |
double | m_CutNgam |
double | m_CutEgam |
IBesRndmGenSvc * | p_BesRndmGenSvc |
Definition at line 26 of file Babayaga.h.
Babayaga::Babayaga | ( | const string & | name, | |
ISvcLocator * | pSvcLocator | |||
) |
Definition at line 141 of file Babayaga.cxx.
References HN, m_CutEgam, m_CUTG, m_CutNgam, m_Ebeam, m_Egmin, m_Emin, m_Iarun, m_Ich, m_Ires, m_on, m_PHCUT, m_Thgmax, m_Thgmin, m_Thmax, m_Thmin, and m_Zmax.
00141 :Algorithm( name, pSvcLocator ) 00142 { 00143 // declareProperty("Seed", m_Int = 62341342); // seed for random number generator 00144 declareProperty("Channel", m_Ich = 1); // 1: e+e-->e+e-;2:e+e_->mu+mu-;3:e+e-->gamma gamma;4:e+e--->pi+pi- 00145 declareProperty("Ebeam", m_Ebeam = 1.548); // Ecm = 2*Ebeam [GeV] 00146 declareProperty("MinThetaAngle", m_Thmin = 70); // [degree] 00147 declareProperty("MaxThetaAngle", m_Thmax = 178); // [degree] 00148 declareProperty("MinimumEnergy", m_Emin = 0.4); // Minimum Energy(GeV) 00149 declareProperty("MaximumAcollinearity", m_Zmax = 10); //Maximum acollinearity (degree) 00150 declareProperty("RunningAlpha", m_Iarun = 1); //running alpha, 0=off, 1=on 00151 declareProperty("HadronicResonance", m_Ires = 0); //hadronic resoances for ICH=1 or 2 00152 declareProperty("FSR_swich", m_on = 0); // FSR switch for ICH=2 ( 0=off, 1=on) 00153 declareProperty("MinEnerCutG", m_Egmin = 0.01); // minimum energy for CUTG=Y (GeV) 00154 declareProperty("MinAngCutG", m_Thgmin = 5); // minimum angle for cuts =Y (deg.) 00155 declareProperty("MaxAngCutG", m_Thgmax = 21); //maximum angle for CUTG=Y (deg.) 00156 declareProperty("HBOOK", HN= 1); //INTUPLE: if events have to be stored (1/0) 00157 declareProperty("PHCUT", m_PHCUT = 0); //PHCUT: to avoid double counting when ICH = 3 (1/0), for other channels, it set as 0 by default 00158 declareProperty("CUTG", m_CUTG = 0); //CUTG: explicit cuts on the generated photons (1/0) 00159 declareProperty("CutNgam", m_CutNgam = 0); //mininum number of ISR photon cut on Radiative Bhabha events 00160 declareProperty("CutEgam", m_CutEgam = 0); //in GeV, mininum energy of ISR photon cut on Radiative Bhabha events 00161 }
StatusCode Babayaga::execute | ( | ) |
Definition at line 209 of file Babayaga.cxx.
References calibUtil::ERROR, Bes_Common::INFO, ISRPHOTONS, m_Ich, and MOMSET.
00210 { 00211 MsgStream log(messageService(), name()); 00212 // log << MSG::INFO << "BABAYAGA executing" << endreq; 00213 // std::cout<<"BABAYAGA begin executing"<<std::endl; 00214 00215 int npart = 0; 00216 int pid1,pid2,pst1,pst2; 00217 if(m_Ich==1) {pid1=11; pid2=-11; pst1=1;pst2=1;} 00218 if(m_Ich==2) {pid1=13; pid2=-13; pst1=1;pst2=1;} 00219 if(m_Ich==3) {pid1=22; pid2= 22; pst1=1;pst2=1;} 00220 if(m_Ich==4) {pid1=-211; pid2= 211; pst1=1;pst2=1;} 00221 00222 // Fill event information 00223 GenEvent* evt = new GenEvent(1,1); 00224 00225 GenVertex* prod_vtx = new GenVertex(); 00226 // prod_vtx->add_particle_out( p ); 00227 evt->add_vertex( prod_vtx ); 00228 00229 // incoming beam e- HepLorentzVector(px,py,pz,energy) required! 00230 GenParticle* p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.p1[1][evtgen], MOMSET.p1[2][evtgen], 00231 MOMSET.p1[3][evtgen], MOMSET.p1[0][evtgen]), 00232 11, 3); 00233 p->suggest_barcode( ++npart ); 00234 prod_vtx->add_particle_in(p); 00235 00236 // std::cout<<"incoming beam e+"<<endl; 00237 // incoming beam e+, e+ moving along the z-direction 00238 p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.q1[1][evtgen], MOMSET.q1[2][evtgen], 00239 MOMSET.q1[3][evtgen], MOMSET.q1[4][evtgen]), 00240 -11, 3); 00241 00242 p->suggest_barcode( ++npart ); 00243 prod_vtx->add_particle_in(p); 00244 00245 // scattered lepton + 00246 p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.p2[1][evtgen], MOMSET.p2[2][evtgen], 00247 MOMSET.p2[3][evtgen], MOMSET.p2[0][evtgen]), 00248 pid1,pst1); 00249 p->suggest_barcode( ++npart ); 00250 prod_vtx->add_particle_out(p); 00251 00252 // debuging pingrg 00253 // std::cout<<"evtgen= "<<evtgen<<std::endl; 00254 //std::cout<<"b:e-: "<<MOMSET.p1[0][evtgen]<<"; "<< MOMSET.p1[1][evtgen]<<"; "<<MOMSET.p1[2][evtgen]<<"; "<< MOMSET.p1[3][evtgen]<<std::endl; 00255 //std::cout<<"b:e+: "<<MOMSET.q1[0][evtgen]<<"; "<< MOMSET.q1[1][evtgen]<<"; "<<MOMSET.q1[2][evtgen]<<"; "<< MOMSET.q1[3][evtgen]<<std::endl; 00256 //std::cout<<"e-: "<<MOMSET.p2[0][evtgen]<<"; "<< MOMSET.p2[1][evtgen]<<"; "<<MOMSET.p2[2][evtgen]<<"; "<< MOMSET.p2[3][evtgen]<<std::endl; 00257 //std::cout<<"e+: "<<MOMSET.q2[0][evtgen]<<"; "<< MOMSET.q2[1][evtgen]<<"; "<<MOMSET.q2[2][evtgen]<<"; "<< MOMSET.q2[3][evtgen]<<std::endl; 00258 00259 // scattered lepton - 00260 p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.q2[1][evtgen], MOMSET.q2[2][evtgen], 00261 MOMSET.q2[3][evtgen], MOMSET.q2[0][evtgen]), 00262 pid2, pst2); 00263 p->suggest_barcode( ++npart ); 00264 prod_vtx->add_particle_out(p); 00265 00266 00267 int iphot=0; 00268 // std::cout<<"evtgen, ncqph[events#] "<<evtgen<<"; "<<ISRPHOTONS.ncqph[evtgen-1]<<std::endl; 00269 for (iphot=0; iphot<ISRPHOTONS.ncqph[evtgen-1]; iphot++) 00270 { 00271 // debuging, pingrg 00272 // std::cout<<"evtgen, iphot= "<<evtgen<<"; "<<iphot<<std::endl; 00273 //std::cout<<MOMSET.phot[0][iphot][evtgen]<<", "<<MOMSET.phot[1][iphot][evtgen]<<", "<<MOMSET.phot[2][iphot][evtgen]<<", "<<MOMSET.phot[3][iphot][evtgen]<<std::endl; 00274 00275 p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.phot[1][iphot][evtgen], MOMSET.phot[2][iphot][evtgen], 00276 MOMSET.phot[3][iphot][evtgen], MOMSET.phot[0][iphot][evtgen]), 00277 22, 1); 00278 p->suggest_barcode( ++npart ); 00279 prod_vtx->add_particle_out(p); 00280 00281 } 00282 00283 00284 evtgen++; 00285 00286 if( log.level() < MSG::INFO ) 00287 { 00288 evt->print(); 00289 } 00290 00291 // Check if the McCollection already exists 00292 SmartDataPtr<McGenEventCol> anMcCol(eventSvc(), "/Event/Gen"); 00293 if (anMcCol!=0) 00294 { 00295 // Add event to existing collection 00296 MsgStream log(messageService(), name()); 00297 log << MSG::INFO << "Add McGenEvent to existing collection" << endreq; 00298 McGenEvent* mcEvent = new McGenEvent(evt); 00299 anMcCol->push_back(mcEvent); 00300 } 00301 else 00302 { 00303 // Create Collection and add to the transient store 00304 McGenEventCol *mcColl = new McGenEventCol; 00305 McGenEvent* mcEvent = new McGenEvent(evt); 00306 mcColl->push_back(mcEvent); 00307 StatusCode sc = eventSvc()->registerObject("/Event/Gen",mcColl); 00308 if (sc != StatusCode::SUCCESS) 00309 { 00310 log << MSG::ERROR << "Could not register McGenEvent" << endreq; 00311 delete mcColl; 00312 delete evt; 00313 delete mcEvent; 00314 return StatusCode::FAILURE; 00315 } 00316 else 00317 { 00318 // log << MSG::INFO << "McGenEventCol created and " << npart <<" particles stored in McGenEvent" << endreq; 00319 } 00320 } 00321 00322 return StatusCode::SUCCESS; 00323 }
StatusCode Babayaga::finalize | ( | ) |
Definition at line 325 of file Babayaga.cxx.
00326 { 00327 MsgStream log(messageService(), name()); 00328 char delcmd[300]; 00329 strcpy(delcmd,"cat "); 00330 strcat(delcmd,"CrossSection.txt"); 00331 system(delcmd); 00332 00333 std::cout<< "BABAYAGA finalized" << endl; 00334 return StatusCode::SUCCESS; 00335 }
StatusCode Babayaga::getMaxEvent | ( | ) |
Definition at line 337 of file Babayaga.cxx.
References m_evtMax.
Referenced by initialize().
00337 { 00338 IProperty* appPropMgr=0; 00339 StatusCode status = 00340 serviceLocator()->getService("ApplicationMgr", IProperty::interfaceID(), 00341 reinterpret_cast<IInterface*&>( appPropMgr )); 00342 if( status.isFailure() ) return status; 00343 00344 IntegerProperty evtMax("EvtMax",0); 00345 status = appPropMgr->getProperty( &evtMax ); 00346 if (status.isFailure()) return status; 00347 00348 m_evtMax = evtMax.value(); 00349 return status; 00350 }
StatusCode Babayaga::initialize | ( | ) |
Definition at line 163 of file Babayaga.cxx.
References BABAYAGA, BEAMENERGY, CHANNEL, DECLAREINT, DECLARESTR, calibUtil::ERROR, EXPCUTS, IBesRndmGenSvc::GetEngine(), getMaxEvent(), HN, Bes_Common::INFO, m_CUTG, m_Ebeam, m_Egmin, m_Emin, m_evtMax, m_Iarun, m_Ich, m_Int, m_Ires, m_on, m_PHCUT, m_Thgmax, m_Thgmin, m_Thmax, m_Thmin, m_Zmax, p_BesRndmGenSvc, RESONANCES, BabayagaRandom::setRandomEngine(), SWITCH, and SWITCHARUN.
00163 { 00164 00165 MsgStream log(messageService(), name()); 00166 00167 log << MSG::INFO << "Babayaga initialize" << endreq; 00168 00169 //set Bes unified random engine 00170 static const bool CREATEIFNOTTHERE(true); 00171 StatusCode RndmStatus = service("BesRndmGenSvc", p_BesRndmGenSvc, CREATEIFNOTTHERE); 00172 if (!RndmStatus.isSuccess() || 0 == p_BesRndmGenSvc) 00173 { 00174 log << MSG::ERROR << " Could not initialize Random Number Service" << endreq; 00175 return RndmStatus; 00176 } 00177 CLHEP::HepRandomEngine* engine = p_BesRndmGenSvc->GetEngine("Babayaga"); 00178 std::cout<<"==============================="<<engine<<endl; 00179 BabayagaRandom::setRandomEngine(engine); 00180 // ***************** 00181 00182 if(HN==1) {DECLARESTR.tuple='Y';} else DECLARESTR.tuple='N'; 00183 if(m_PHCUT==1){ DECLARESTR.phcut='Y';} else DECLARESTR.cutg='N'; 00184 if(m_CUTG ==1){ DECLARESTR.cutg='Y';} else DECLARESTR.cutg='N'; 00185 CHANNEL.ich = m_Ich; 00186 BEAMENERGY.ebeam=m_Ebeam; 00187 EXPCUTS.thmin=m_Thmin; 00188 EXPCUTS.thmax=m_Thmax; 00189 EXPCUTS.emin =m_Emin; 00190 EXPCUTS.zmax=m_Zmax; 00191 SWITCHARUN.iarun=m_Iarun; 00192 RESONANCES.ires =m_Ires; 00193 SWITCH.on =m_on; 00194 EXPCUTS.egmin=m_Egmin; 00195 EXPCUTS.thgmin=m_Thgmin; 00196 EXPCUTS.thgmax=m_Thgmax; 00197 00198 // std::cout<<"m_Ires= "<<m_Ires<<endl; 00199 00200 getMaxEvent(); 00201 std::cout<<"m_evtMax = "<<m_evtMax<<std::endl; 00202 DECLAREINT.seed=m_Int; 00203 BABAYAGA(m_evtMax); 00204 00205 return StatusCode::SUCCESS; 00206 }
int Babayaga::HN [private] |
double Babayaga::m_CutEgam [private] |
int Babayaga::m_CUTG [private] |
double Babayaga::m_CutNgam [private] |
double Babayaga::m_Ebeam [private] |
double Babayaga::m_Egmin [private] |
double Babayaga::m_Emin [private] |
int Babayaga::m_evtMax [private] |
int Babayaga::m_Iarun [private] |
int Babayaga::m_Ich [private] |
int Babayaga::m_Int [private] |
int Babayaga::m_INTUPLE [private] |
Definition at line 39 of file Babayaga.h.
int Babayaga::m_Ires [private] |
int Babayaga::m_on [private] |
int Babayaga::m_PHCUT [private] |
double Babayaga::m_Thgmax [private] |
double Babayaga::m_Thgmin [private] |
double Babayaga::m_Thmax [private] |
double Babayaga::m_Thmin [private] |
double Babayaga::m_Zmax [private] |
IBesRndmGenSvc* Babayaga::p_BesRndmGenSvc [private] |