BOSS 7.1.1
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 25 of file EeToeeV.h.

Constructor & Destructor Documentation

◆ EeToeeV()

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

Definition at line 90 of file EeToeeV.cxx.

90 :Algorithm( name, pSvcLocator )
91{
92 declareProperty("Ecms", m_Ecms = 3.65); // Ecm = sqrt(s) [GeV]
93 declareProperty("Vector", m_vect = "phi"); // Ecm = sqrt(s) [GeV]
94 declareProperty("WriteMC", m_mctruth = 0); // Ecm = sqrt(s) [GeV]
95}

Member Function Documentation

◆ execute()

StatusCode EeToeeV::execute ( )

Definition at line 160 of file EeToeeV.cxx.

161{
162 MsgStream log(messageService(), name());
163
164
165 int npart = 0;
166 int pid1,pid2,pid3,pid4,pst1,pst2;
167 pid1 = 11;
168 pid2 =-11;
169 pst1 = 1;
170 pst2 = 1; //1: supose the Vector will decay in the BesEvtGen
171
172 if(m_vect=="omega"){
173 pid3=223;
174 }else if(m_vect=="phi"){
175 pid3=333;
176 }else if(m_vect=="J/psi"){
177 pid3=443;
178 }else if(m_vect=="psi(2S)"){
179 pid3=100443;
180 }else if(m_vect=="psi(3770)"){
181 pid3=30443;
182 }else if(m_vect=="psi(4040)"){
183 pid3=9000443;
184 }else if(m_vect=="psi(4160)"){
185 pid3=9010443;
186 }else if(m_vect=="psi(4415)"){
187 pid3=9020443;
188 }
189
190 // Fill event information
191 GenEvent* evt = new GenEvent(1,1);
192
193 GenVertex* prod_vtx = new GenVertex();
194// prod_vtx->add_particle_out( p );
195 evt->add_vertex( prod_vtx );
196
197 // incoming beam e- HepLorentzVector(px,py,pz,energy) required!
198 GenParticle* p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.p1[1][evtgen], MOMSET.p1[2][evtgen],
199 MOMSET.p1[3][evtgen], MOMSET.p1[0][evtgen]),
200 11, 3);
201 p->suggest_barcode( ++npart );
202 prod_vtx->add_particle_in(p);
203
204// std::cout<<"incoming beam e+"<<endl;
205 // incoming beam e+, e+ moving along the z-direction
206 p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.q1[1][evtgen], MOMSET.q1[2][evtgen],
207 MOMSET.q1[3][evtgen], MOMSET.q1[4][evtgen]),
208 -11, 3);
209
210 p->suggest_barcode( ++npart );
211 prod_vtx->add_particle_in(p);
212
213 // scattered lepton -
214 p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.p2[1][evtgen], MOMSET.p2[2][evtgen],
215 MOMSET.p2[3][evtgen], MOMSET.p2[0][evtgen]),
216 pid1,pst1);
217 p->suggest_barcode( ++npart );
218 prod_vtx->add_particle_out(p);
219
220 // scattered lepton +
221 p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.q2[1][evtgen], MOMSET.q2[2][evtgen],
222 MOMSET.q2[3][evtgen], MOMSET.q2[0][evtgen]),
223 pid2, pst1);
224 p->suggest_barcode( ++npart );
225 prod_vtx->add_particle_out(p);
226
227 // outgoing Vector
228 p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.q3[1][evtgen], MOMSET.q3[2][evtgen],
229 MOMSET.q3[3][evtgen], MOMSET.q3[0][evtgen]),
230 pid3,pst2);
231 p->suggest_barcode( ++npart );
232 prod_vtx->add_particle_out(p);
233
234 evtgen++;
235
236 if( log.level() < MSG::INFO )
237 {
238 evt->print();
239 }
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(messageService(), name());
247 log << MSG::INFO << "Add McGenEvent to existing collection" << endreq;
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" << endreq;
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 McGenEvent" << endreq;
270 }
271 }
272
273 return StatusCode::SUCCESS;
274}
#define MOMSET
Definition Babayaga.cxx:45
ObjectVector< McGenEvent > McGenEventCol
Definition McGenEvent.h:39

◆ finalize()

StatusCode EeToeeV::finalize ( )

Definition at line 276 of file EeToeeV.cxx.

277{
278 MsgStream log(messageService(), 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 100 of file EeToeeV.cxx.

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

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