#include <Bhlumi.h>
Public Member Functions | |
Bhlumi (const std::string &name, ISvcLocator *pSvcLocator) | |
StatusCode | initialize () |
StatusCode | execute () |
StatusCode | finalize () |
Private Attributes | |
double | xpar [100] |
int | npar [100] |
IBesRndmGenSvc * | p_BesRndmGenSvc |
int | m_angleMode |
double | m_cmEnergy |
double | m_minThetaAngle |
double | m_maxThetaAngle |
double | m_infraredCut |
std::vector< int > | m_initSeed |
Definition at line 25 of file Bhlumi.h.
Bhlumi::Bhlumi | ( | const std::string & | name, | |
ISvcLocator * | pSvcLocator | |||
) |
StatusCode Bhlumi::execute | ( | ) |
Definition at line 221 of file Bhlumi.cxx.
References BHLUMI, DUMPS, calibUtil::ERROR, Bes_Common::INFO, MOMSET, npar, and xpar.
00222 { 00223 MsgStream log(messageService(), name()); 00224 log << MSG::INFO << "Bhlumi executing" << endreq; 00225 00226 00227 BHLUMI( 0,xpar,npar); 00228 00229 if( log.level() < MSG::INFO ) 00230 { 00231 DUMPS(6); 00232 // dump output to file 00233 // DUMPS(16); 00234 } 00235 00236 int npart = 0; 00237 00238 // Fill event information 00239 GenEvent* evt = new GenEvent(1,1); 00240 00241 GenVertex* prod_vtx = new GenVertex(); 00242 // prod_vtx->add_particle_out( p ); 00243 evt->add_vertex( prod_vtx ); 00244 00245 // incoming beam e+ 00246 GenParticle* p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.p1[0], MOMSET.p1[1], 00247 MOMSET.p1[2], MOMSET.p1[3]), 00248 -11, 3); 00249 p->suggest_barcode( ++npart ); 00250 prod_vtx->add_particle_in(p); 00251 00252 // incoming beam e- 00253 p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.q1[0], MOMSET.q1[1], MOMSET.q1[2], MOMSET.q1[3]), 00254 11, 3); 00255 p->suggest_barcode( ++npart ); 00256 prod_vtx->add_particle_in(p); 00257 00258 // scattered e+ 00259 p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.p2[0], MOMSET.p2[1], 00260 MOMSET.p2[2], MOMSET.p2[3]), 00261 -11, 1); 00262 p->suggest_barcode( ++npart ); 00263 prod_vtx->add_particle_out(p); 00264 00265 // scattered e- 00266 p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.q2[0], MOMSET.q2[1], MOMSET.q2[2], MOMSET.q2[3]), 00267 11, 1); 00268 p->suggest_barcode( ++npart ); 00269 prod_vtx->add_particle_out(p); 00270 00271 int iphot=0; 00272 for (iphot=0; iphot<MOMSET.nphot; iphot++) 00273 { 00274 // gamma 00275 p = new GenParticle( CLHEP::HepLorentzVector( MOMSET.phot[0][iphot], MOMSET.phot[1][iphot], 00276 MOMSET.phot[2][iphot], MOMSET.phot[3][iphot]), 00277 22, 1); 00278 p->suggest_barcode( ++npart ); 00279 prod_vtx->add_particle_out(p); 00280 } 00281 00282 if( log.level() < MSG::INFO ) 00283 { 00284 evt->print(); 00285 } 00286 00287 // Check if the McCollection already exists 00288 SmartDataPtr<McGenEventCol> anMcCol(eventSvc(), "/Event/Gen"); 00289 if (anMcCol!=0) 00290 { 00291 // Add event to existing collection 00292 MsgStream log(messageService(), name()); 00293 log << MSG::INFO << "Add McGenEvent to existing collection" << endreq; 00294 McGenEvent* mcEvent = new McGenEvent(evt); 00295 anMcCol->push_back(mcEvent); 00296 } 00297 else 00298 { 00299 // Create Collection and add to the transient store 00300 McGenEventCol *mcColl = new McGenEventCol; 00301 McGenEvent* mcEvent = new McGenEvent(evt); 00302 mcColl->push_back(mcEvent); 00303 StatusCode sc = eventSvc()->registerObject("/Event/Gen",mcColl); 00304 if (sc != StatusCode::SUCCESS) 00305 { 00306 log << MSG::ERROR << "Could not register McGenEvent" << endreq; 00307 delete mcColl; 00308 delete evt; 00309 delete mcEvent; 00310 return StatusCode::FAILURE; 00311 } 00312 else 00313 { 00314 log << MSG::INFO << "McGenEventCol created and " << npart <<" particles stored in McGenEvent" << endreq; 00315 } 00316 } 00317 00318 // retrieve event from Transient Store (Storegate) 00319 /* SmartDataPtr<McGenEventCol> McEvtColl(eventSvc(), "/Event/Gen"); 00320 if ( McEvtColl == 0 ) 00321 { 00322 log << MSG::ERROR << "Could not retrieve McGenEventCollection" << endreq; 00323 return StatusCode::FAILURE; 00324 }; 00325 00326 McGenEventCol::iterator mcItr; 00327 for( mcItr = McEvtColl->begin(); mcItr != McEvtColl->end(); mcItr++ ) 00328 { 00329 HepMC::GenEvent* hEvt = (*mcItr)->getGenEvt(); 00330 // MeVToGeV( hEvt ); 00331 // callEvtGen( hEvt ); 00332 // GeVToMeV( hEvt ); 00333 }; 00334 */ 00335 00336 return StatusCode::SUCCESS; 00337 }
StatusCode Bhlumi::finalize | ( | ) |
Definition at line 339 of file Bhlumi.cxx.
References BHLUMI, Bes_Common::INFO, npar, and xpar.
00340 { 00341 MsgStream log(messageService(), name()); 00342 00343 BHLUMI( 2,xpar,npar); 00344 00345 log << MSG::INFO << "Bhlumi finalized" << endreq; 00346 00347 return StatusCode::SUCCESS; 00348 }
StatusCode Bhlumi::initialize | ( | ) |
Definition at line 119 of file Bhlumi.cxx.
References BHLUMI, cos(), calibUtil::ERROR, Bes_Common::FATAL, IBesRndmGenSvc::GetEngine(), GLIMIT, Bes_Common::INFO, m_angleMode, m_cmEnergy, m_infraredCut, m_maxThetaAngle, m_minThetaAngle, max, min, npar, p_BesRndmGenSvc, BhlumiRandom::setRandomEngine(), Bes_Common::WARNING, and xpar.
00119 { 00120 00121 MsgStream log(messageService(), name()); 00122 00123 log << MSG::INFO << "Bhlumi initialize" << endreq; 00124 00125 static const bool CREATEIFNOTTHERE(true); 00126 StatusCode RndmStatus = service("BesRndmGenSvc", p_BesRndmGenSvc, CREATEIFNOTTHERE); 00127 if (!RndmStatus.isSuccess() || 0 == p_BesRndmGenSvc) 00128 { 00129 log << MSG::ERROR << " Could not initialize Random Number Service" << endreq; 00130 return RndmStatus; 00131 } 00132 CLHEP::HepRandomEngine* engine = p_BesRndmGenSvc->GetEngine("Bhlumi"); 00133 engine->showStatus(); 00134 BhlumiRandom::setRandomEngine(engine); 00135 00136 GLIMIT(50000); 00137 00147 00148 00149 00150 00151 int KeyGen = 3; // ! Multiphoton Bhlumi 00152 int KeyRem = 1; // ! No remooval of photons below epsCM 00153 KeyRem = 0; // ! Remooval of photons below epsCM, Necessary for Z!!! 00155 int KeyWgt = 2; // ! weighted events, with t generation down to zero 00156 KeyWgt = 0; // ! WT=1 events, for detector simulation 00157 int KeyRnd = 1; // ! RANMAR random numbers 00158 int KeyOpt =1000*KeyGen +100*KeyRem +10*KeyWgt +KeyRnd; 00161 int KeyPia = 0; // ! Vacuum polarization OFF 00162 int KeyMod = 2; // ! Matrix element default version 4.x 00163 KeyPia = 2; // ! Vacuum polarization ON 00164 int KeyZet = 0; // ! Z contribution OFF 00165 KeyZet = 1; // ! Z contribution ON 00166 int KeyRad =1000*KeyZet +10*KeyMod +KeyPia; 00168 npar[0]= KeyOpt; 00169 npar[1]= KeyRad; 00170 double CmsEne = m_cmEnergy; 00171 xpar[0]= CmsEne; 00172 double th1,th2,thmin,thmax; 00173 if(m_angleMode==0){ 00174 th1 = m_minThetaAngle; // ! Detector range ThetaMin [rad] 00175 th2 = m_maxThetaAngle; // ! Detector range ThetaMax [rad] 00176 thmin = 0.7*th1; // ! thmin has to be lower than th1 00177 thmax = 2.0*th2; // ! thmax has to be higher than th2 00178 if(thmin<0.||thmax>3.1415926) { 00179 log << MSG::WARNING << "input angles exceed range (0~pi), so effect will be unprospectable" << endreq; 00180 return StatusCode::FAILURE; 00181 } 00182 } 00183 else if(m_angleMode==1){ 00184 th1 = m_minThetaAngle*3.1415926/180.; 00185 th2 = m_maxThetaAngle*3.1415926/180.; 00186 // not multiply 0.7(2.0) coefficient while large angle 00187 thmin = th1; 00188 thmax = th2; 00189 } 00190 else if(m_angleMode==2){ 00191 th1 = acos(max(m_minThetaAngle,m_maxThetaAngle)); 00192 th2 = acos(min(m_minThetaAngle,m_maxThetaAngle)); 00193 // not multiply 0.7(2.0) coefficient while large angle 00194 thmin = th1; 00195 thmax = th2; 00196 } 00197 else{ 00198 log << MSG::FATAL << "unknown angle mode!" << endreq; 00199 return StatusCode::FAILURE; 00200 } 00201 if(thmin<0.||thmax>3.1415926) { 00202 log << MSG::FATAL << "input angles exceed range (0~pi), unprospectable" << endreq; 00203 return StatusCode::FAILURE; 00204 } 00205 else if(thmin>thmax) { 00206 log << MSG::FATAL << "thmin>thmax, unprospectable" << endreq; 00207 return StatusCode::FAILURE; 00208 } 00209 if(KeyWgt == 2) thmin=th1; // ! Because generation below th1 is on!!! 00210 xpar[1]= CmsEne*CmsEne*(1-cos(thmin))/2; // ! TransMin [GeV**2] 00211 xpar[2]= CmsEne*CmsEne*(1-cos(thmax))/2; // ! TransMax [GeV**2] 00212 xpar[3]= m_infraredCut; // ! Infrared cut on photon energy 00213 00214 // MARINI(m_initSeed[0], m_initSeed[1], m_initSeed[2]); 00215 00216 BHLUMI(-1,xpar,npar); 00217 00218 return StatusCode::SUCCESS; 00219 }
int Bhlumi::m_angleMode [private] |
double Bhlumi::m_cmEnergy [private] |
double Bhlumi::m_infraredCut [private] |
std::vector<int> Bhlumi::m_initSeed [private] |
double Bhlumi::m_maxThetaAngle [private] |
double Bhlumi::m_minThetaAngle [private] |
int Bhlumi::npar[100] [private] |
IBesRndmGenSvc* Bhlumi::p_BesRndmGenSvc [private] |
double Bhlumi::xpar[100] [private] |