156 {
157
158
159 ++m_events;
160
161 CLHEP::HepRandomEngine* engine = p_BesRndmGenSvc->
GetEngine(
"SINGLE");
162 const long*
s = engine->getSeeds();
163 m_seeds.clear();
164 m_seeds.push_back(
s[0]);
165 m_seeds.push_back(
s[1]);
166
167
168
169 double pt,phi,theta,E,px,py,pz,p;
170 switch(m_Emode){
171
173 pt = generateValue(m_PtGenMode,m_requestedPt, m_sigmaPt,
174 m_minPt, m_maxPt);
175 theta = generateValue(m_ThetaGenMode,m_requestedTheta, m_sigmaTheta,
176 m_minTheta, m_maxTheta);
177 phi = generateValue(m_PhiGenMode,m_requestedPhi, m_sigmaPhi,
178 m_minPhi, m_maxPhi);
179
180
181
185 m_fourMom.setVectM(CLHEP::Hep3Vector(px,py,pz),m_mass);
186 m_fourPos.set(m_requestedX,m_requestedY,m_requestedZ,m_requestedT);
187 return StatusCode::SUCCESS;
188
190 E = generateValue(m_EGenMode,m_requestedE, m_sigmaE,
191 m_minE, m_maxE);
192 theta = generateValue(m_ThetaGenMode,m_requestedTheta, m_sigmaTheta,
193 m_minTheta, m_maxTheta);
194 phi = generateValue(m_PhiGenMode,m_requestedPhi, m_sigmaPhi,
195 m_minPhi, m_maxPhi);
196
197
198
199 if(E*E-m_mass*m_mass < 0.){
200 MsgStream log(messageService(), name());
201 log << MSG::ERROR << "You have Generated a Tachyon!! Increase energy or change particle ID" << endreq;
202return StatusCode::FAILURE;
203 }
204 p=sqrt(E*E-m_mass*m_mass);
205 px = p*
sin(theta)*
cos(phi);
206 py = p*
sin(theta)*
sin(phi);
208
209 m_fourMom.setVectM(CLHEP::Hep3Vector(px,py,pz),m_mass);
210 m_fourPos.set(m_requestedX,m_requestedY,m_requestedZ,m_requestedT);
211 return StatusCode::SUCCESS;
212}
213 return StatusCode::SUCCESS;
214}
double tan(const BesAngle a)
double sin(const BesAngle a)
double cos(const BesAngle a)
virtual CLHEP::HepRandomEngine * GetEngine(const std::string &StreamName)=0
Interface to the CLHEP engine.