BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EeTo4e Class Reference

#include <EeTo4e.h>

Inheritance diagram for EeTo4e:

Public Member Functions

 EeTo4e (const string &name, ISvcLocator *pSvcLocator)
StatusCode initialize ()
StatusCode execute ()
StatusCode finalize ()
StatusCode getMaxEvent ()

Detailed Description

Definition at line 19 of file EeTo4e.h.

Constructor & Destructor Documentation

◆ EeTo4e()

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

Definition at line 86 of file EeTo4e.cxx.

87 : Algorithm( name, pSvcLocator ) {
88 declareProperty( "Ecms", m_Ecms = 3.65 ); // Ecm = sqrt(s) [GeV]
89 declareProperty( "cosee", m_cosee = 0.93 );
90 declareProperty( "WriteMC",
91 m_mctruth = 0 ); // write out the MC truth of final state to "pdata1.dat"
92}

Referenced by EeTo4e().

Member Function Documentation

◆ execute()

StatusCode EeTo4e::execute ( )

Definition at line 126 of file EeTo4e.cxx.

126 {
127 MsgStream log( msgSvc(), name() );
128
129 int npart = 0;
130 int pid1, pid2, pid3, pid4, pst1, pst2;
131 pid1 = 11;
132 pid2 = -11;
133 pid3 = 11;
134 pid4 = -11;
135 pst1 = 1;
136 pst2 = 1;
137
138 // Fill event information
139 GenEvent* evt = new GenEvent( 1, 1 );
140
141 GenVertex* prod_vtx = new GenVertex();
142 // prod_vtx->add_particle_out( p );
143 evt->add_vertex( prod_vtx );
144
145 // incoming beam e- HepLorentzVector(px,py,pz,energy) required!
146 GenParticle* p =
147 new GenParticle( CLHEP::HepLorentzVector( MOMSET.p1[1][evtgen], MOMSET.p1[2][evtgen],
148 MOMSET.p1[3][evtgen], MOMSET.p1[0][evtgen] ),
149 11, 3 );
150 p->suggest_barcode( ++npart );
151 prod_vtx->add_particle_in( p );
152
153 // std::cout<<"incoming beam e+"<<endl;
154 // incoming beam e+, e+ moving along the z-direction
155 p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.q1[1][evtgen], MOMSET.q1[2][evtgen],
156 MOMSET.q1[3][evtgen], MOMSET.q1[4][evtgen] ),
157 -11, 3 );
158
159 p->suggest_barcode( ++npart );
160 prod_vtx->add_particle_in( p );
161
162 // scattered lepton +
163 p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.p2[1][evtgen], MOMSET.p2[2][evtgen],
164 MOMSET.p2[3][evtgen], MOMSET.p2[0][evtgen] ),
165 pid1, pst1 );
166 p->suggest_barcode( ++npart );
167 prod_vtx->add_particle_out( p );
168
169 // scattered lepton -
170 p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.q2[1][evtgen], MOMSET.q2[2][evtgen],
171 MOMSET.q2[3][evtgen], MOMSET.q2[0][evtgen] ),
172 pid2, pst2 );
173 p->suggest_barcode( ++npart );
174 prod_vtx->add_particle_out( p );
175
176 // outgoing pi+
177 p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.p3[1][evtgen], MOMSET.p3[2][evtgen],
178 MOMSET.p3[3][evtgen], MOMSET.p3[0][evtgen] ),
179 pid3, pst1 );
180 p->suggest_barcode( ++npart );
181 prod_vtx->add_particle_out( p );
182
183 // outgoing pi-
184 p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.q3[1][evtgen], MOMSET.q3[2][evtgen],
185 MOMSET.q3[3][evtgen], MOMSET.q3[0][evtgen] ),
186 pid4, pst2 );
187 p->suggest_barcode( ++npart );
188 prod_vtx->add_particle_out( p );
189
190 evtgen++;
191
192 if ( log.level() < MSG::INFO ) { evt->print(); }
193
194 // Check if the McCollection already exists
195 SmartDataPtr<McGenEventCol> anMcCol( eventSvc(), "/Event/Gen" );
196 if ( anMcCol != 0 )
197 {
198 // Add event to existing collection
199 MsgStream log( msgSvc(), name() );
200 log << MSG::INFO << "Add McGenEvent to existing collection" << endmsg;
201 McGenEvent* mcEvent = new McGenEvent( evt );
202 anMcCol->push_back( mcEvent );
203 }
204 else
205 {
206 // Create Collection and add to the transient store
207 McGenEventCol* mcColl = new McGenEventCol;
208 McGenEvent* mcEvent = new McGenEvent( evt );
209 mcColl->push_back( mcEvent );
210 StatusCode sc = eventSvc()->registerObject( "/Event/Gen", mcColl );
211 if ( sc != StatusCode::SUCCESS )
212 {
213 log << MSG::ERROR << "Could not register McGenEvent" << endmsg;
214 delete mcColl;
215 delete evt;
216 delete mcEvent;
217 return StatusCode::FAILURE;
218 }
219 else
220 {
221 // log << MSG::INFO << "McGenEventCol created and " << npart <<" particles stored in
222 // McGenEvent" << endmsg;
223 }
224 }
225
226 return StatusCode::SUCCESS;
227}
#define MOMSET
Definition Babayaga.cxx:43
ObjectVector< McGenEvent > McGenEventCol
IMessageSvc * msgSvc()

◆ finalize()

StatusCode EeTo4e::finalize ( )

Definition at line 229 of file EeTo4e.cxx.

229 {
230 MsgStream log( msgSvc(), name() );
231 char delcmd[300];
232 strcpy( delcmd, "cat " );
233 strcat( delcmd, "fresult.dat" );
234 system( delcmd );
235
236 std::cout << "EeTo4e finalized" << endl;
237 return StatusCode::SUCCESS;
238}

◆ getMaxEvent()

StatusCode EeTo4e::getMaxEvent ( )

Definition at line 240 of file EeTo4e.cxx.

240 {
241 IProperty* appPropMgr = 0;
242 StatusCode status =
243 serviceLocator()->getService( "ApplicationMgr", IProperty::interfaceID(),
244 reinterpret_cast<IInterface*&>( appPropMgr ) );
245 if ( status.isFailure() ) return status;
246
247 IntegerProperty evtMax( "EvtMax", 0 );
248 status = appPropMgr->getProperty( &evtMax );
249 if ( status.isFailure() ) return status;
250
251 m_evtMax = evtMax.value();
252 return status;
253}

Referenced by initialize().

◆ initialize()

StatusCode EeTo4e::initialize ( )

Definition at line 94 of file EeTo4e.cxx.

94 {
95
96 MsgStream log( msgSvc(), name() );
97
98 log << MSG::INFO << "EeTo4e initialize" << endmsg;
99
100 // set Bes unified random engine
101 static const bool CREATEIFNOTTHERE( true );
102 StatusCode RndmStatus = service( "BesRndmGenSvc", p_BesRndmGenSvc, CREATEIFNOTTHERE );
103 if ( !RndmStatus.isSuccess() || 0 == p_BesRndmGenSvc )
104 {
105 log << MSG::ERROR << " Could not initialize Random Number Service" << endmsg;
106 return RndmStatus;
107 }
108 CLHEP::HepRandomEngine* engine = p_BesRndmGenSvc->GetEngine( "EeTo4e" );
109 std::cout << "===============================" << engine << endl;
111 // *****************
112 MCTRUTH.mccheck = m_mctruth;
113 COSEE.setcos = m_cosee;
114 BEAMENERGY.ecms = m_Ecms;
115 // std::cout<<"m_Ires= "<<m_Ires<<endl;
116
117 getMaxEvent();
118 std::cout << "m_evtMax = " << m_evtMax << std::endl;
119 intxs_();
120 GEVENT( m_evtMax );
121
122 return StatusCode::SUCCESS;
123}
#define BEAMENERGY
Definition Babayaga.cxx:63
#define COSEE
Definition EeTo4e.cxx:55
#define GEVENT(NEVENTS)
void intxs_()
#define MCTRUTH
static void setRandomEngine(CLHEP::HepRandomEngine *randomEngine)
StatusCode getMaxEvent()
Definition EeTo4e.cxx:240

The documentation for this class was generated from the following files: