#include <Eepipi.h>
Public Member Functions | |
Eepipi (const string &name, ISvcLocator *pSvcLocator) | |
StatusCode | initialize () |
StatusCode | execute () |
StatusCode | finalize () |
StatusCode | getMaxEvent () |
Private Attributes | |
int | m_evtMax |
int | m_mctruth |
double | m_Ecms |
double | m_cosee |
IBesRndmGenSvc * | p_BesRndmGenSvc |
Definition at line 25 of file Eepipi.h.
Eepipi::Eepipi | ( | const string & | name, | |
ISvcLocator * | pSvcLocator | |||
) |
Definition at line 90 of file Eepipi.cxx.
References m_Ecms, and m_mctruth.
00090 :Algorithm( name, pSvcLocator ) 00091 { 00092 declareProperty("Ecms", m_Ecms = 3.65); // Ecm = sqrt(s) [GeV] 00093 // declareProperty("cosee", m_cosee = 0.99); // set costheta for e+ e- in final state 00094 declareProperty("WriteMC", m_mctruth = 0); //write out the MC truth of final state to "pdata1.dat" 00095 }
StatusCode Eepipi::execute | ( | ) |
Definition at line 129 of file Eepipi.cxx.
References calibUtil::ERROR, Bes_Common::INFO, and MOMSET.
00130 { 00131 MsgStream log(messageService(), name()); 00132 00133 00134 int npart = 0; 00135 int pid1,pid2,pid3,pid4,pst1,pst2; 00136 pid1 = 11; 00137 pid2 =-11; 00138 pid3 = 211; 00139 pid4 =-211; 00140 pst1 = 1; 00141 pst2 = 1; 00142 00143 00144 00145 // Fill event information 00146 GenEvent* evt = new GenEvent(1,1); 00147 00148 GenVertex* prod_vtx = new GenVertex(); 00149 // prod_vtx->add_particle_out( p ); 00150 evt->add_vertex( prod_vtx ); 00151 00152 // incoming beam e- HepLorentzVector(px,py,pz,energy) required! 00153 GenParticle* p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.p1[1][evtgen], MOMSET.p1[2][evtgen], 00154 MOMSET.p1[3][evtgen], MOMSET.p1[0][evtgen]), 00155 11, 3); 00156 p->suggest_barcode( ++npart ); 00157 prod_vtx->add_particle_in(p); 00158 00159 // std::cout<<"incoming beam e+"<<endl; 00160 // incoming beam e+, e+ moving along the z-direction 00161 p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.q1[1][evtgen], MOMSET.q1[2][evtgen], 00162 MOMSET.q1[3][evtgen], MOMSET.q1[4][evtgen]), 00163 -11, 3); 00164 00165 p->suggest_barcode( ++npart ); 00166 prod_vtx->add_particle_in(p); 00167 00168 // scattered lepton + 00169 p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.p2[1][evtgen], MOMSET.p2[2][evtgen], 00170 MOMSET.p2[3][evtgen], MOMSET.p2[0][evtgen]), 00171 pid1,pst1); 00172 p->suggest_barcode( ++npart ); 00173 prod_vtx->add_particle_out(p); 00174 00175 // scattered lepton - 00176 p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.q2[1][evtgen], MOMSET.q2[2][evtgen], 00177 MOMSET.q2[3][evtgen], MOMSET.q2[0][evtgen]), 00178 pid2, pst2); 00179 p->suggest_barcode( ++npart ); 00180 prod_vtx->add_particle_out(p); 00181 00182 // outgoing pi+ 00183 p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.p3[1][evtgen], MOMSET.p3[2][evtgen], 00184 MOMSET.p3[3][evtgen], MOMSET.p3[0][evtgen]), 00185 pid3,pst1); 00186 p->suggest_barcode( ++npart ); 00187 prod_vtx->add_particle_out(p); 00188 00189 //outgoing pi- 00190 p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.q3[1][evtgen], MOMSET.q3[2][evtgen], 00191 MOMSET.q3[3][evtgen], MOMSET.q3[0][evtgen]), 00192 pid4, pst2); 00193 p->suggest_barcode( ++npart ); 00194 prod_vtx->add_particle_out(p); 00195 00196 00197 00198 evtgen++; 00199 00200 if( log.level() < MSG::INFO ) 00201 { 00202 evt->print(); 00203 } 00204 00205 // Check if the McCollection already exists 00206 SmartDataPtr<McGenEventCol> anMcCol(eventSvc(), "/Event/Gen"); 00207 if (anMcCol!=0) 00208 { 00209 // Add event to existing collection 00210 MsgStream log(messageService(), name()); 00211 log << MSG::INFO << "Add McGenEvent to existing collection" << endreq; 00212 McGenEvent* mcEvent = new McGenEvent(evt); 00213 anMcCol->push_back(mcEvent); 00214 } 00215 else 00216 { 00217 // Create Collection and add to the transient store 00218 McGenEventCol *mcColl = new McGenEventCol; 00219 McGenEvent* mcEvent = new McGenEvent(evt); 00220 mcColl->push_back(mcEvent); 00221 StatusCode sc = eventSvc()->registerObject("/Event/Gen",mcColl); 00222 if (sc != StatusCode::SUCCESS) 00223 { 00224 log << MSG::ERROR << "Could not register McGenEvent" << endreq; 00225 delete mcColl; 00226 delete evt; 00227 delete mcEvent; 00228 return StatusCode::FAILURE; 00229 } 00230 else 00231 { 00232 // log << MSG::INFO << "McGenEventCol created and " << npart <<" particles stored in McGenEvent" << endreq; 00233 } 00234 } 00235 00236 return StatusCode::SUCCESS; 00237 }
StatusCode Eepipi::finalize | ( | ) |
Definition at line 239 of file Eepipi.cxx.
00240 { 00241 MsgStream log(messageService(), name()); 00242 char delcmd[300]; 00243 strcpy(delcmd,"cat "); 00244 strcat(delcmd,"fresult.dat"); 00245 system(delcmd); 00246 00247 std::cout<< "Eepipi finalized" << endl; 00248 return StatusCode::SUCCESS; 00249 }
StatusCode Eepipi::getMaxEvent | ( | ) |
Definition at line 251 of file Eepipi.cxx.
References m_evtMax.
Referenced by initialize().
00251 { 00252 IProperty* appPropMgr=0; 00253 StatusCode status = 00254 serviceLocator()->getService("ApplicationMgr", IProperty::interfaceID(), 00255 reinterpret_cast<IInterface*&>( appPropMgr )); 00256 if( status.isFailure() ) return status; 00257 00258 IntegerProperty evtMax("EvtMax",0); 00259 status = appPropMgr->getProperty( &evtMax ); 00260 if (status.isFailure()) return status; 00261 00262 m_evtMax = evtMax.value(); 00263 return status; 00264 }
StatusCode Eepipi::initialize | ( | ) |
Definition at line 97 of file Eepipi.cxx.
References BEAMENERGY, COSEE, calibUtil::ERROR, IBesRndmGenSvc::GetEngine(), getMaxEvent(), GEVENT, Bes_Common::INFO, intxs_(), m_cosee, m_Ecms, m_evtMax, m_mctruth, MCTRUTH, p_BesRndmGenSvc, and EepipiRandom::setRandomEngine().
00097 { 00098 00099 MsgStream log(messageService(), name()); 00100 00101 log << MSG::INFO << "Eepipi initialize" << endreq; 00102 00103 //set Bes unified random engine 00104 static const bool CREATEIFNOTTHERE(true); 00105 StatusCode RndmStatus = service("BesRndmGenSvc", p_BesRndmGenSvc, CREATEIFNOTTHERE); 00106 if (!RndmStatus.isSuccess() || 0 == p_BesRndmGenSvc) 00107 { 00108 log << MSG::ERROR << " Could not initialize Random Number Service" << endreq; 00109 return RndmStatus; 00110 } 00111 CLHEP::HepRandomEngine* engine = p_BesRndmGenSvc->GetEngine("Eepipi"); 00112 std::cout<<"==============================="<<engine<<endl; 00113 EepipiRandom::setRandomEngine(engine); 00114 // ***************** 00115 MCTRUTH.mccheck=m_mctruth; 00116 BEAMENERGY.ecms=m_Ecms; 00117 COSEE.setcos=m_cosee; 00118 // std::cout<<"m_Ires= "<<m_Ires<<endl; 00119 00120 getMaxEvent(); 00121 std::cout<<"m_evtMax = "<<m_evtMax<<std::endl; 00122 intxs_(); 00123 GEVENT(m_evtMax); 00124 00125 return StatusCode::SUCCESS; 00126 }
double Eepipi::m_cosee [private] |
double Eepipi::m_Ecms [private] |
int Eepipi::m_evtMax [private] |
int Eepipi::m_mctruth [private] |
IBesRndmGenSvc* Eepipi::p_BesRndmGenSvc [private] |