106Bhlumi::Bhlumi(
const string& name, ISvcLocator* pSvcLocator):Algorithm( name, pSvcLocator )
108 declareProperty(
"CMEnergy", m_cmEnergy = 3.097);
109 declareProperty(
"AngleMode", m_angleMode = 0);
111 declareProperty(
"MinThetaAngle", m_minThetaAngle = 0.24);
112 declareProperty(
"MaxThetaAngle", m_maxThetaAngle = 0.58);
113 declareProperty(
"SoftPhotonCut", m_infraredCut = 1E-4);
121 MsgStream log(messageService(), name());
123 log << MSG::INFO <<
"Bhlumi initialize" << endreq;
125 static const bool CREATEIFNOTTHERE(
true);
126 StatusCode RndmStatus = service(
"BesRndmGenSvc", p_BesRndmGenSvc, CREATEIFNOTTHERE);
127 if (!RndmStatus.isSuccess() || 0 == p_BesRndmGenSvc)
129 log << MSG::ERROR <<
" Could not initialize Random Number Service" << endreq;
132 CLHEP::HepRandomEngine* engine = p_BesRndmGenSvc->
GetEngine(
"Bhlumi");
133 engine->showStatus();
158 int KeyOpt =1000*KeyGen +100*KeyRem +10*KeyWgt +KeyRnd;
166 int KeyRad =1000*KeyZet +10*KeyMod +KeyPia;
170 double CmsEne = m_cmEnergy;
172 double th1,th2,thmin,thmax;
174 th1 = m_minThetaAngle;
175 th2 = m_maxThetaAngle;
178 if(thmin<0.||thmax>3.1415926) {
179 log << MSG::WARNING <<
"input angles exceed range (0~pi), so effect will be unprospectable" << endreq;
180 return StatusCode::FAILURE;
183 else if(m_angleMode==1){
184 th1 = m_minThetaAngle*3.1415926/180.;
185 th2 = m_maxThetaAngle*3.1415926/180.;
190 else if(m_angleMode==2){
191 th1 = acos(max(m_minThetaAngle,m_maxThetaAngle));
192 th2 = acos(min(m_minThetaAngle,m_maxThetaAngle));
198 log << MSG::FATAL <<
"unknown angle mode!" << endreq;
199 return StatusCode::FAILURE;
201 if(thmin<0.||thmax>3.1415926) {
202 log << MSG::FATAL <<
"input angles exceed range (0~pi), unprospectable" << endreq;
203 return StatusCode::FAILURE;
205 else if(thmin>thmax) {
206 log << MSG::FATAL <<
"thmin>thmax, unprospectable" << endreq;
207 return StatusCode::FAILURE;
209 if(KeyWgt == 2) thmin=th1;
210 xpar[1]= CmsEne*CmsEne*(1-
cos(thmin))/2;
211 xpar[2]= CmsEne*CmsEne*(1-
cos(thmax))/2;
212 xpar[3]= m_infraredCut;
218 return StatusCode::SUCCESS;
223 MsgStream log(messageService(), name());
224 log << MSG::INFO <<
"Bhlumi executing" << endreq;
229 if( log.level() < MSG::INFO )
239 GenEvent* evt =
new GenEvent(1,1);
241 GenVertex* prod_vtx =
new GenVertex();
243 evt->add_vertex( prod_vtx );
246 GenParticle* p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.p1[0],
MOMSET.p1[1],
249 p->suggest_barcode( ++npart );
250 prod_vtx->add_particle_in(p);
255 p->suggest_barcode( ++npart );
256 prod_vtx->add_particle_in(p);
259 p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.p2[0],
MOMSET.p2[1],
262 p->suggest_barcode( ++npart );
263 prod_vtx->add_particle_out(p);
268 p->suggest_barcode( ++npart );
269 prod_vtx->add_particle_out(p);
272 for (iphot=0; iphot<
MOMSET.nphot; iphot++)
275 p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.phot[0][iphot],
MOMSET.phot[1][iphot],
278 p->suggest_barcode( ++npart );
279 prod_vtx->add_particle_out(p);
282 if( log.level() < MSG::INFO )
288 SmartDataPtr<McGenEventCol> anMcCol(eventSvc(),
"/Event/Gen");
292 MsgStream log(messageService(), name());
293 log << MSG::INFO <<
"Add McGenEvent to existing collection" << endreq;
295 anMcCol->push_back(mcEvent);
302 mcColl->push_back(mcEvent);
303 StatusCode sc = eventSvc()->registerObject(
"/Event/Gen",mcColl);
304 if (sc != StatusCode::SUCCESS)
306 log << MSG::ERROR <<
"Could not register McGenEvent" << endreq;
310 return StatusCode::FAILURE;
314 log << MSG::INFO <<
"McGenEventCol created and " << npart <<
" particles stored in McGenEvent" << endreq;
336 return StatusCode::SUCCESS;