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