EeTo4e Class Reference

#include <EeTo4e.h>

List of all members.

Public Member Functions

 EeTo4e (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
IBesRndmGenSvcp_BesRndmGenSvc


Detailed Description

Definition at line 25 of file EeTo4e.h.


Constructor & Destructor Documentation

EeTo4e::EeTo4e ( const string name,
ISvcLocator *  pSvcLocator 
)

Definition at line 91 of file EeTo4e.cxx.

References m_cosee, m_Ecms, and m_mctruth.

00091                                                           :Algorithm( name, pSvcLocator )
00092 {
00093   declareProperty("Ecms", m_Ecms = 3.65); // Ecm = sqrt(s) [GeV]
00094   declareProperty("cosee", m_cosee = 0.93); 
00095   declareProperty("WriteMC", m_mctruth = 0); //write out the MC truth of final state to "pdata1.dat"
00096 }


Member Function Documentation

StatusCode EeTo4e::execute (  ) 

Definition at line 130 of file EeTo4e.cxx.

References calibUtil::ERROR, Bes_Common::INFO, and MOMSET.

00131 { 
00132   MsgStream log(messageService(), name());
00133 
00134 
00135   int npart = 0;
00136   int pid1,pid2,pid3,pid4,pst1,pst2;
00137   pid1 = 11;
00138   pid2 =-11;
00139   pid3 = 11;
00140   pid4 =-11;
00141   pst1 = 1;
00142   pst2 = 1;
00143 
00144 
00145 
00146   // Fill event information
00147   GenEvent* evt = new GenEvent(1,1);
00148 
00149   GenVertex* prod_vtx = new GenVertex();
00150 //  prod_vtx->add_particle_out( p );
00151   evt->add_vertex( prod_vtx );
00152                           
00153   // incoming beam e- HepLorentzVector(px,py,pz,energy) required!
00154   GenParticle* p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.p1[1][evtgen],  MOMSET.p1[2][evtgen], 
00155                                                       MOMSET.p1[3][evtgen],  MOMSET.p1[0][evtgen]),
00156                                                       11, 3); 
00157   p->suggest_barcode( ++npart );
00158   prod_vtx->add_particle_in(p);
00159 
00160 //  std::cout<<"incoming beam e+"<<endl;
00161   // incoming beam e+, e+ moving along the z-direction
00162   p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.q1[1][evtgen],  MOMSET.q1[2][evtgen],
00163                                          MOMSET.q1[3][evtgen],  MOMSET.q1[4][evtgen]),
00164                        -11, 3); 
00165 
00166   p->suggest_barcode( ++npart );
00167   prod_vtx->add_particle_in(p);
00168   
00169   // scattered lepton +
00170   p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.p2[1][evtgen],  MOMSET.p2[2][evtgen], 
00171                                          MOMSET.p2[3][evtgen],  MOMSET.p2[0][evtgen]),
00172                                          pid1,pst1); 
00173   p->suggest_barcode( ++npart );
00174   prod_vtx->add_particle_out(p);
00175  
00176   // scattered lepton -
00177   p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.q2[1][evtgen],  MOMSET.q2[2][evtgen],
00178                                          MOMSET.q2[3][evtgen],  MOMSET.q2[0][evtgen]),
00179                        pid2, pst2); 
00180   p->suggest_barcode( ++npart );
00181   prod_vtx->add_particle_out(p);
00182 
00183   // outgoing pi+
00184   p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.p3[1][evtgen],  MOMSET.p3[2][evtgen], 
00185                                          MOMSET.p3[3][evtgen],  MOMSET.p3[0][evtgen]),
00186                       pid3,pst1); 
00187   p->suggest_barcode( ++npart );
00188   prod_vtx->add_particle_out(p);
00189 
00190   //outgoing pi-
00191   p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.q3[1][evtgen],  MOMSET.q3[2][evtgen],
00192                                          MOMSET.q3[3][evtgen],  MOMSET.q3[0][evtgen]),
00193                        pid4, pst2); 
00194   p->suggest_barcode( ++npart );
00195   prod_vtx->add_particle_out(p);
00196 
00197 
00198   
00199   evtgen++;
00200 
00201   if( log.level() < MSG::INFO )
00202   {
00203     evt->print();  
00204   }
00205 
00206   // Check if the McCollection already exists
00207   SmartDataPtr<McGenEventCol> anMcCol(eventSvc(), "/Event/Gen");
00208   if (anMcCol!=0) 
00209   {
00210     // Add event to existing collection
00211     MsgStream log(messageService(), name());
00212     log << MSG::INFO << "Add McGenEvent to existing collection" << endreq;
00213     McGenEvent* mcEvent = new McGenEvent(evt);
00214     anMcCol->push_back(mcEvent);
00215   }
00216   else 
00217   {
00218     // Create Collection and add  to the transient store
00219     McGenEventCol *mcColl = new McGenEventCol;
00220     McGenEvent* mcEvent = new McGenEvent(evt);
00221     mcColl->push_back(mcEvent);
00222     StatusCode sc = eventSvc()->registerObject("/Event/Gen",mcColl);
00223     if (sc != StatusCode::SUCCESS) 
00224     {
00225       log << MSG::ERROR << "Could not register McGenEvent" << endreq;
00226       delete mcColl;
00227       delete evt;
00228       delete mcEvent;
00229       return StatusCode::FAILURE;
00230     }
00231     else 
00232     {
00233       //   log << MSG::INFO << "McGenEventCol created and " << npart <<" particles stored in McGenEvent" << endreq;
00234     }
00235   }
00236      
00237   return StatusCode::SUCCESS; 
00238 }

StatusCode EeTo4e::finalize (  ) 

Definition at line 240 of file EeTo4e.cxx.

00241 {
00242   MsgStream log(messageService(), name());
00243    char delcmd[300];
00244    strcpy(delcmd,"cat ");
00245    strcat(delcmd,"fresult.dat");
00246    system(delcmd);
00247 
00248   std::cout<< "EeTo4e finalized" << endl;
00249   return StatusCode::SUCCESS;
00250 }

StatusCode EeTo4e::getMaxEvent (  ) 

Definition at line 252 of file EeTo4e.cxx.

References m_evtMax.

Referenced by initialize().

00252                                {
00253   IProperty* appPropMgr=0;
00254   StatusCode status = 
00255     serviceLocator()->getService("ApplicationMgr", IProperty::interfaceID(),
00256                                  reinterpret_cast<IInterface*&>( appPropMgr ));
00257   if( status.isFailure() ) return status;
00258     
00259   IntegerProperty evtMax("EvtMax",0);
00260   status = appPropMgr->getProperty( &evtMax );
00261   if (status.isFailure()) return status;
00262   
00263   m_evtMax = evtMax.value();
00264   return status;
00265 }

StatusCode EeTo4e::initialize (  ) 

Definition at line 98 of file EeTo4e.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 EeTo4eRandom::setRandomEngine().

00098                              {
00099 
00100   MsgStream log(messageService(), name());
00101   
00102   log << MSG::INFO << "EeTo4e initialize" << endreq;
00103   
00104   //set Bes unified random engine
00105   static const bool CREATEIFNOTTHERE(true);
00106   StatusCode RndmStatus = service("BesRndmGenSvc", p_BesRndmGenSvc, CREATEIFNOTTHERE);
00107   if (!RndmStatus.isSuccess() || 0 == p_BesRndmGenSvc)
00108     {
00109       log << MSG::ERROR << " Could not initialize Random Number Service" << endreq;
00110       return RndmStatus;
00111     }
00112   CLHEP::HepRandomEngine* engine  = p_BesRndmGenSvc->GetEngine("EeTo4e");
00113   std::cout<<"==============================="<<engine<<endl;
00114   EeTo4eRandom::setRandomEngine(engine);
00115   //  *****************
00116   MCTRUTH.mccheck=m_mctruth;
00117   COSEE.setcos=m_cosee;
00118   BEAMENERGY.ecms=m_Ecms;
00119   //  std::cout<<"m_Ires= "<<m_Ires<<endl;
00120 
00121   getMaxEvent();
00122   std::cout<<"m_evtMax = "<<m_evtMax<<std::endl;
00123   intxs_();
00124   GEVENT(m_evtMax);
00125   
00126   return StatusCode::SUCCESS;
00127 }


Member Data Documentation

double EeTo4e::m_cosee [private]

Definition at line 38 of file EeTo4e.h.

Referenced by EeTo4e(), and initialize().

double EeTo4e::m_Ecms [private]

Definition at line 38 of file EeTo4e.h.

Referenced by EeTo4e(), and initialize().

int EeTo4e::m_evtMax [private]

Definition at line 37 of file EeTo4e.h.

Referenced by getMaxEvent(), and initialize().

int EeTo4e::m_mctruth [private]

Definition at line 37 of file EeTo4e.h.

Referenced by EeTo4e(), and initialize().

IBesRndmGenSvc* EeTo4e::p_BesRndmGenSvc [private]

Definition at line 40 of file EeTo4e.h.

Referenced by initialize().


Generated on Tue Nov 29 23:18:36 2016 for BOSS_7.0.2 by  doxygen 1.4.7