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

#include <EeToeeV.h>

Inheritance diagram for EeToeeV:

Public Member Functions

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

Detailed Description

Definition at line 24 of file EeToeeV.h.

Constructor & Destructor Documentation

◆ EeToeeV()

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

Definition at line 84 of file EeToeeV.cxx.

85 : Algorithm( name, pSvcLocator ) {
86 declareProperty( "Ecms", m_Ecms = 3.65 ); // Ecm = sqrt(s) [GeV]
87 declareProperty( "Vector", m_vect = "phi" ); // Ecm = sqrt(s) [GeV]
88 declareProperty( "WriteMC", m_mctruth = 0 ); // Ecm = sqrt(s) [GeV]
89}

Referenced by EeToeeV().

Member Function Documentation

◆ execute()

StatusCode EeToeeV::execute ( )

Definition at line 173 of file EeToeeV.cxx.

173 {
174 MsgStream log( msgSvc(), name() );
175
176 int npart = 0;
177 int pid1, pid2, pid3, pid4, pst1, pst2;
178 pid1 = 11;
179 pid2 = -11;
180 pst1 = 1;
181 pst2 = 1; // 1: supose the Vector will decay in the BesEvtGen
182
183 if ( m_vect == "omega" ) { pid3 = 223; }
184 else if ( m_vect == "phi" ) { pid3 = 333; }
185 else if ( m_vect == "J/psi" ) { pid3 = 443; }
186 else if ( m_vect == "psi(2S)" ) { pid3 = 100443; }
187 else if ( m_vect == "psi(3770)" ) { pid3 = 30443; }
188 else if ( m_vect == "psi(4040)" ) { pid3 = 9000443; }
189 else if ( m_vect == "psi(4160)" ) { pid3 = 9010443; }
190 else if ( m_vect == "psi(4415)" ) { pid3 = 9020443; }
191
192 // Fill event information
193 GenEvent* evt = new GenEvent( 1, 1 );
194
195 GenVertex* prod_vtx = new GenVertex();
196 // prod_vtx->add_particle_out( p );
197 evt->add_vertex( prod_vtx );
198
199 // incoming beam e- HepLorentzVector(px,py,pz,energy) required!
200 GenParticle* p =
201 new GenParticle( CLHEP::HepLorentzVector( MOMSET.p1[1][evtgen], MOMSET.p1[2][evtgen],
202 MOMSET.p1[3][evtgen], MOMSET.p1[0][evtgen] ),
203 11, 3 );
204 p->suggest_barcode( ++npart );
205 prod_vtx->add_particle_in( p );
206
207 // std::cout<<"incoming beam e+"<<endl;
208 // incoming beam e+, e+ moving along the z-direction
209 p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.q1[1][evtgen], MOMSET.q1[2][evtgen],
210 MOMSET.q1[3][evtgen], MOMSET.q1[4][evtgen] ),
211 -11, 3 );
212
213 p->suggest_barcode( ++npart );
214 prod_vtx->add_particle_in( p );
215
216 // scattered lepton -
217 p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.p2[1][evtgen], MOMSET.p2[2][evtgen],
218 MOMSET.p2[3][evtgen], MOMSET.p2[0][evtgen] ),
219 pid1, pst1 );
220 p->suggest_barcode( ++npart );
221 prod_vtx->add_particle_out( p );
222
223 // scattered lepton +
224 p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.q2[1][evtgen], MOMSET.q2[2][evtgen],
225 MOMSET.q2[3][evtgen], MOMSET.q2[0][evtgen] ),
226 pid2, pst1 );
227 p->suggest_barcode( ++npart );
228 prod_vtx->add_particle_out( p );
229
230 // outgoing Vector
231 p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.q3[1][evtgen], MOMSET.q3[2][evtgen],
232 MOMSET.q3[3][evtgen], MOMSET.q3[0][evtgen] ),
233 pid3, pst2 );
234 p->suggest_barcode( ++npart );
235 prod_vtx->add_particle_out( p );
236
237 evtgen++;
238
239 if ( log.level() < MSG::INFO ) { evt->print(); }
240
241 // Check if the McCollection already exists
242 SmartDataPtr<McGenEventCol> anMcCol( eventSvc(), "/Event/Gen" );
243 if ( anMcCol != 0 )
244 {
245 // Add event to existing collection
246 MsgStream log( msgSvc(), name() );
247 log << MSG::INFO << "Add McGenEvent to existing collection" << endmsg;
248 McGenEvent* mcEvent = new McGenEvent( evt );
249 anMcCol->push_back( mcEvent );
250 }
251 else
252 {
253 // Create Collection and add to the transient store
254 // std::cout<<"I created McCollection "<<std::endl;
255 McGenEventCol* mcColl = new McGenEventCol;
256 McGenEvent* mcEvent = new McGenEvent( evt );
257 mcColl->push_back( mcEvent );
258 StatusCode sc = eventSvc()->registerObject( "/Event/Gen", mcColl );
259 if ( sc != StatusCode::SUCCESS )
260 {
261 log << MSG::ERROR << "Could not register McGenEvent" << endmsg;
262 delete mcColl;
263 delete evt;
264 delete mcEvent;
265 return StatusCode::FAILURE;
266 }
267 else
268 {
269 // log << MSG::INFO << "McGenEventCol created and " << npart <<" particles stored in
270 // McGenEvent" << endmsg;
271 }
272 }
273
274 return StatusCode::SUCCESS;
275}
#define MOMSET
Definition Babayaga.cxx:43
ObjectVector< McGenEvent > McGenEventCol
IMessageSvc * msgSvc()

◆ finalize()

StatusCode EeToeeV::finalize ( )

Definition at line 277 of file EeToeeV.cxx.

277 {
278 MsgStream log( msgSvc(), name() );
279 char delcmd[300];
280 strcpy( delcmd, "cat " );
281 strcat( delcmd, "fresult.dat" );
282 system( delcmd );
283
284 std::cout << "EeToeeV finalized" << endl;
285 return StatusCode::SUCCESS;
286}

◆ getMaxEvent()

StatusCode EeToeeV::getMaxEvent ( )

Definition at line 288 of file EeToeeV.cxx.

288 {
289 IProperty* appPropMgr = 0;
290 StatusCode status =
291 serviceLocator()->getService( "ApplicationMgr", IProperty::interfaceID(),
292 reinterpret_cast<IInterface*&>( appPropMgr ) );
293 if ( status.isFailure() ) return status;
294
295 IntegerProperty evtMax( "EvtMax", 0 );
296 status = appPropMgr->getProperty( &evtMax );
297 if ( status.isFailure() ) return status;
298
299 m_evtMax = evtMax.value();
300 return status;
301}

Referenced by initialize().

◆ initialize()

StatusCode EeToeeV::initialize ( )

Definition at line 91 of file EeToeeV.cxx.

91 {
92
93 MsgStream log( msgSvc(), name() );
94
95 log << MSG::INFO << "EeToeeV initialize" << endmsg;
96
97 // set Bes unified random engine
98 static const bool CREATEIFNOTTHERE( true );
99 StatusCode RndmStatus = service( "BesRndmGenSvc", p_BesRndmGenSvc, CREATEIFNOTTHERE );
100 if ( !RndmStatus.isSuccess() || 0 == p_BesRndmGenSvc )
101 {
102 log << MSG::ERROR << " Could not initialize Random Number Service" << endmsg;
103 return RndmStatus;
104 }
105 CLHEP::HepRandomEngine* engine = p_BesRndmGenSvc->GetEngine( "EeToeeV" );
106 std::cout << "===============================" << engine << endl;
108 // *****************
109 MCTRUTH.mccheck = m_mctruth;
110 BEAMENERGY.ecms = m_Ecms;
111 double mpar = 10.;
112 if ( m_vect == "omega" )
113 {
114 VECTOR.vct = 1;
115 mpar = 0.782;
116 }
117 else if ( m_vect == "phi" )
118 {
119 VECTOR.vct = 2;
120 mpar = 1.019;
121 }
122 else if ( m_vect == "J/psi" )
123 {
124 VECTOR.vct = 3;
125 mpar = 3.097;
126 }
127 else if ( m_vect == "psi(2S)" )
128 {
129 VECTOR.vct = 4;
130 mpar = 3.686;
131 }
132 else if ( m_vect == "psi(3770)" )
133 {
134 VECTOR.vct = 5;
135 mpar = 3.773;
136 }
137 else if ( m_vect == "psi(4040)" )
138 {
139 VECTOR.vct = 6;
140 mpar = 4.039;
141 }
142 else if ( m_vect == "psi(4160)" )
143 {
144 VECTOR.vct = 7;
145 mpar = 4.153;
146 }
147 else if ( m_vect == "psi(4415)" )
148 {
149 VECTOR.vct = 8;
150 mpar = 4.421;
151 }
152 else
153 {
154 std::cout << "EeToeeV::initialize() Bad vector " << std::endl;
155 abort();
156 }
157 if ( m_Ecms < mpar )
158 {
159 std::cout << "EeToeeV:initialize: the Ecms less than the vector mass" << std::endl;
160 abort();
161 }
162 // std::cout<<"m_Ires= "<<m_Ires<<endl;
163
164 getMaxEvent();
165 std::cout << "m_evtMax = " << m_evtMax << std::endl;
166 intxs_();
167 GEVENT( m_evtMax );
168
169 return StatusCode::SUCCESS;
170}
#define BEAMENERGY
Definition Babayaga.cxx:63
#define VECTOR
Definition EeToeeV.cxx:53
#define GEVENT(NEVENTS)
void intxs_()
#define MCTRUTH
static void setRandomEngine(CLHEP::HepRandomEngine *randomEngine)
StatusCode getMaxEvent()
Definition EeToeeV.cxx:288

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