BOSS 7.0.1
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 ()
 
 EeTo4e (const string &name, ISvcLocator *pSvcLocator)
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 
StatusCode getMaxEvent ()
 

Detailed Description

Constructor & Destructor Documentation

◆ EeTo4e() [1/2]

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

Definition at line 91 of file EeTo4e.cxx.

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

◆ EeTo4e() [2/2]

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

Member Function Documentation

◆ execute() [1/2]

StatusCode EeTo4e::execute ( )

Definition at line 130 of file EeTo4e.cxx.

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

◆ execute() [2/2]

StatusCode EeTo4e::execute ( )

◆ finalize() [1/2]

StatusCode EeTo4e::finalize ( )

Definition at line 240 of file EeTo4e.cxx.

241{
242 MsgStream log(messageService(), name());
243 char delcmd[300];
244 strcpy(delcmd,"cat ");
245 strcat(delcmd,"fresult.dat");
246 system(delcmd);
247
248 std::cout<< "EeTo4e finalized" << endl;
249 return StatusCode::SUCCESS;
250}

◆ finalize() [2/2]

StatusCode EeTo4e::finalize ( )

◆ getMaxEvent() [1/2]

StatusCode EeTo4e::getMaxEvent ( )

Definition at line 252 of file EeTo4e.cxx.

252 {
253 IProperty* appPropMgr=0;
254 StatusCode status =
255 serviceLocator()->getService("ApplicationMgr", IProperty::interfaceID(),
256 reinterpret_cast<IInterface*&>( appPropMgr ));
257 if( status.isFailure() ) return status;
258
259 IntegerProperty evtMax("EvtMax",0);
260 status = appPropMgr->getProperty( &evtMax );
261 if (status.isFailure()) return status;
262
263 m_evtMax = evtMax.value();
264 return status;
265}

Referenced by initialize().

◆ getMaxEvent() [2/2]

StatusCode EeTo4e::getMaxEvent ( )

◆ initialize() [1/2]

StatusCode EeTo4e::initialize ( )

Definition at line 98 of file EeTo4e.cxx.

98 {
99
100 MsgStream log(messageService(), name());
101
102 log << MSG::INFO << "EeTo4e initialize" << endreq;
103
104 //set Bes unified random engine
105 static const bool CREATEIFNOTTHERE(true);
106 StatusCode RndmStatus = service("BesRndmGenSvc", p_BesRndmGenSvc, CREATEIFNOTTHERE);
107 if (!RndmStatus.isSuccess() || 0 == p_BesRndmGenSvc)
108 {
109 log << MSG::ERROR << " Could not initialize Random Number Service" << endreq;
110 return RndmStatus;
111 }
112 CLHEP::HepRandomEngine* engine = p_BesRndmGenSvc->GetEngine("EeTo4e");
113 std::cout<<"==============================="<<engine<<endl;
115 // *****************
116 MCTRUTH.mccheck=m_mctruth;
117 COSEE.setcos=m_cosee;
118 BEAMENERGY.ecms=m_Ecms;
119 // std::cout<<"m_Ires= "<<m_Ires<<endl;
120
121 getMaxEvent();
122 std::cout<<"m_evtMax = "<<m_evtMax<<std::endl;
123 intxs_();
124 GEVENT(m_evtMax);
125
126 return StatusCode::SUCCESS;
127}
#define BEAMENERGY
Definition: Babayaga.cxx:65
#define GEVENT(NEVENTS)
void intxs_()
static void setRandomEngine(CLHEP::HepRandomEngine *randomEngine)
StatusCode getMaxEvent()
Definition: EeTo4e.cxx:252
virtual CLHEP::HepRandomEngine * GetEngine(const std::string &StreamName)=0
Interface to the CLHEP engine.

◆ initialize() [2/2]

StatusCode EeTo4e::initialize ( )

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