BOSS 7.0.2
BESIII Offline Software System
Loading...
Searching...
No Matches
Eepipi Class Reference

#include <Eepipi.h>

+ Inheritance diagram for Eepipi:

Public Member Functions

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

Detailed Description

Constructor & Destructor Documentation

◆ Eepipi() [1/2]

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

Definition at line 90 of file Eepipi/Eepipi-00-00-06/src/Eepipi.cxx.

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

◆ Eepipi() [2/2]

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

Member Function Documentation

◆ execute() [1/2]

StatusCode Eepipi::execute ( )

Definition at line 129 of file Eepipi/Eepipi-00-00-06/src/Eepipi.cxx.

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

◆ execute() [2/2]

StatusCode Eepipi::execute ( )

◆ finalize() [1/2]

StatusCode Eepipi::finalize ( )

Definition at line 239 of file Eepipi/Eepipi-00-00-06/src/Eepipi.cxx.

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

◆ finalize() [2/2]

StatusCode Eepipi::finalize ( )

◆ getMaxEvent() [1/2]

StatusCode Eepipi::getMaxEvent ( )

Definition at line 251 of file Eepipi/Eepipi-00-00-06/src/Eepipi.cxx.

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

Referenced by initialize().

◆ getMaxEvent() [2/2]

StatusCode Eepipi::getMaxEvent ( )

◆ initialize() [1/2]

StatusCode Eepipi::initialize ( )

Definition at line 97 of file Eepipi/Eepipi-00-00-06/src/Eepipi.cxx.

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

◆ initialize() [2/2]

StatusCode Eepipi::initialize ( )

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