#include <SingleParticleGun.h>
Inheritance diagram for SingleParticleGun:
Public Member Functions | |
SingleParticleGun (const std::string &name, ISvcLocator *pSvcLocator) | |
virtual | ~SingleParticleGun () |
virtual StatusCode | genInitialize () |
virtual StatusCode | callGenerator () |
virtual StatusCode | genFinalize () |
virtual StatusCode | fillEvt (GenEvent *evt) |
StatusCode | initialize () |
StatusCode | execute () |
StatusCode | finalize () |
virtual StatusCode | genuserInitialize () |
Protected Member Functions | |
void | StripPartonsInit (void) |
void | StripPartons (GenEvent *evt) |
Protected Attributes | |
bool | m_fixedMode |
double | m_meanInteractions |
int | m_randomSeed |
std::vector< int > | m_AllPartons |
std::vector< int > | m_StripVector |
bool | m_StripPartonSwitch |
CLHEP::HepRandomEngine * | m_pRandomEngine |
CLHEP::RandPoisson * | m_pPoissonGenerator |
HepPDT::ParticleDataTable * | m_particleTable |
Private Member Functions | |
double | generateValue (int mode, double val, double sigma, double min, double max) |
Private Attributes | |
double | m_requestedPt |
double | m_requestedPhi |
double | m_requestedE |
double | m_requestedTheta |
double | m_requestedX |
double | m_requestedY |
double | m_requestedZ |
double | m_requestedT |
double | m_minPt |
double | m_minE |
double | m_minTheta |
double | m_minPhi |
double | m_maxE |
double | m_maxPt |
double | m_maxTheta |
double | m_maxPhi |
double | m_sigmaPt |
double | m_sigmaE |
double | m_sigmaTheta |
double | m_sigmaPhi |
int | m_PtGenMode |
int | m_EGenMode |
int | m_ThetaGenMode |
int | m_PhiGenMode |
int | m_pdgCode |
int | m_Emode |
int | m_events |
IBesRndmGenSvc * | p_BesRndmGenSvc |
std::vector< long int > | m_seeds |
double | m_mass |
CLHEP::HepLorentzVector | m_fourMom |
CLHEP::HepLorentzVector | m_fourPos |
Definition at line 42 of file SingleParticleGun.h.
SingleParticleGun::SingleParticleGun | ( | const std::string & | name, | |
ISvcLocator * | pSvcLocator | |||
) |
Definition at line 33 of file SingleParticleGun.cxx.
References SingleParticleGunGenMode::FixedMode, m_EGenMode, m_Emode, m_maxE, m_maxPhi, m_maxPt, m_maxTheta, m_minE, m_minPhi, m_minPt, m_minTheta, m_pdgCode, m_PhiGenMode, m_PtGenMode, m_requestedE, m_requestedPhi, m_requestedPt, m_requestedT, m_requestedTheta, m_requestedX, m_requestedY, m_requestedZ, m_sigmaE, m_sigmaPhi, m_sigmaPt, m_sigmaTheta, m_ThetaGenMode, pi, and SingleEnergyMode::PtMode.
00034 : GenModule(name,pSvcLocator) 00035 { 00036 //-------------------------------------------------------------------------- 00037 declareProperty("Mode",m_Emode = SingleEnergyMode::PtMode); 00038 // in PtMode user specifies Pt theta and phi 00039 // in EMode user specifies E, theta and phi 00040 // defaults are set so that something is always generated 00041 00042 declareProperty("Pt",m_requestedPt = 5.0); 00043 declareProperty("E",m_requestedE = 5.0); 00044 declareProperty("Phi",m_requestedPhi = 0.0); 00045 declareProperty("Theta",m_requestedTheta = 3.14/4.0); 00046 00047 declareProperty("VertexX",m_requestedX = 0.0); 00048 declareProperty("VertexY",m_requestedY = 0.0); 00049 declareProperty("VertexZ",m_requestedZ = 0.0); 00050 declareProperty("Time",m_requestedT = 0.0); 00051 00052 declareProperty("MinPt",m_minPt = 1.); 00053 declareProperty("MinE",m_minE = 1.); 00054 declareProperty("MinTheta",m_minTheta = 0.); 00055 declareProperty("MinPhi",m_minPhi = 0.); 00056 00057 declareProperty("MaxPt",m_maxPt = 100.); 00058 declareProperty("MaxE",m_maxE = 100.); 00059 declareProperty("MaxTheta",m_maxTheta=CLHEP::pi); 00060 declareProperty("MaxPhi",m_maxPhi = CLHEP::twopi); 00061 00062 declareProperty("SigmaPt",m_sigmaPt = 0.1); 00063 declareProperty("SigmaE",m_sigmaE = 0.1); 00064 00065 declareProperty("SigmaTheta",m_sigmaTheta= 0.1); 00066 declareProperty("SigmaPhi",m_sigmaPhi = 0.1); 00067 00068 declareProperty("ModePt",m_PtGenMode = SingleParticleGunGenMode::FixedMode); 00069 declareProperty("ModeE",m_EGenMode = SingleParticleGunGenMode::FixedMode); 00070 declareProperty("ModeTheta",m_ThetaGenMode=SingleParticleGunGenMode::FixedMode); 00071 00072 declareProperty("ModePhi",m_PhiGenMode=SingleParticleGunGenMode::FixedMode); 00073 // specifies type of distribution 00074 00075 declareProperty("PdgCode",m_pdgCode=211); 00076 }
SingleParticleGun::~SingleParticleGun | ( | ) | [virtual] |
Definition at line 79 of file SingleParticleGun.cxx.
00079 { 00080 //-------------------------------------------------------------------------- 00081 // if(m_pFlatGenerator) delete m_pFlatGenerator; 00082 // if(m_pGaussGenerator) delete m_pGaussGenerator; 00083 }
StatusCode SingleParticleGun::callGenerator | ( | ) | [virtual] |
Reimplemented from GenModule.
Definition at line 156 of file SingleParticleGun.cxx.
References cos(), SingleEnergyMode::EMode, calibUtil::ERROR, generateValue(), IBesRndmGenSvc::GetEngine(), m_EGenMode, m_Emode, m_events, m_fourMom, m_fourPos, m_mass, m_maxE, m_maxPhi, m_maxPt, m_maxTheta, m_minE, m_minPhi, m_minPt, m_minTheta, m_PhiGenMode, m_PtGenMode, m_requestedE, m_requestedPhi, m_requestedPt, m_requestedT, m_requestedTheta, m_requestedX, m_requestedY, m_requestedZ, m_seeds, m_sigmaE, m_sigmaPhi, m_sigmaPt, m_sigmaTheta, m_ThetaGenMode, p_BesRndmGenSvc, SingleEnergyMode::PtMode, s, sin(), and tan().
00156 { 00157 //--------------------------------------------------------------------------- 00158 00159 ++m_events; 00160 // Save the random number seeds in the event 00161 CLHEP::HepRandomEngine* engine = p_BesRndmGenSvc->GetEngine("SINGLE"); 00162 const long* s = engine->getSeeds(); 00163 m_seeds.clear(); 00164 m_seeds.push_back(s[0]); 00165 m_seeds.push_back(s[1]); 00166 00167 // Generate values for pt, theta and phi 00168 // 00169 double pt,phi,theta,E,px,py,pz,p; 00170 switch(m_Emode){ 00171 00172 case SingleEnergyMode::PtMode: 00173 pt = generateValue(m_PtGenMode,m_requestedPt, m_sigmaPt, 00174 m_minPt, m_maxPt); 00175 theta = generateValue(m_ThetaGenMode,m_requestedTheta, m_sigmaTheta, 00176 m_minTheta, m_maxTheta); 00177 phi = generateValue(m_PhiGenMode,m_requestedPhi, m_sigmaPhi, 00178 m_minPhi, m_maxPhi); 00179 00180 // Transform to x,y,z coordinates 00181 // 00182 px = pt*cos(phi); 00183 py = pt*sin(phi); 00184 pz = pt/tan(theta); 00185 m_fourMom.setVectM(CLHEP::Hep3Vector(px,py,pz),m_mass); 00186 m_fourPos.set(m_requestedX,m_requestedY,m_requestedZ,m_requestedT); 00187 return StatusCode::SUCCESS; 00188 00189 case SingleEnergyMode::EMode: 00190 E = generateValue(m_EGenMode,m_requestedE, m_sigmaE, 00191 m_minE, m_maxE); 00192 theta = generateValue(m_ThetaGenMode,m_requestedTheta, m_sigmaTheta, 00193 m_minTheta, m_maxTheta); 00194 phi = generateValue(m_PhiGenMode,m_requestedPhi, m_sigmaPhi, 00195 m_minPhi, m_maxPhi); 00196 00197 // Transform to x,y,z coordinates 00198 // 00199 if(E*E-m_mass*m_mass < 0.){ 00200 MsgStream log(messageService(), name()); 00201 log << MSG::ERROR << "You have Generated a Tachyon!! Increase energy or change particle ID" << endreq; 00202 return StatusCode::FAILURE; 00203 } 00204 p=sqrt(E*E-m_mass*m_mass); 00205 px = p*sin(theta)*cos(phi); 00206 py = p*sin(theta)*sin(phi); 00207 pz = p*cos(theta); 00208 00209 m_fourMom.setVectM(CLHEP::Hep3Vector(px,py,pz),m_mass); 00210 m_fourPos.set(m_requestedX,m_requestedY,m_requestedZ,m_requestedT); 00211 return StatusCode::SUCCESS; 00212 } 00213 return StatusCode::SUCCESS; 00214 }
StatusCode GenModule::execute | ( | ) | [inherited] |
Definition at line 125 of file GenModule.cxx.
References Bes_Common::DEBUG, calibUtil::ERROR, GenModule::fillEvt(), genRecEmupikp::i, Bes_Common::INFO, GenModule::m_fixedMode, GenModule::m_meanInteractions, GenModule::m_pPoissonGenerator, GenModule::m_StripPartonSwitch, and GenModule::StripPartons().
00125 { 00126 //--------------------------------------------------------------------------- 00127 00128 int numToGenerate; 00129 StatusCode status; 00130 00131 MsgStream log(messageService(), name()); 00132 00133 log << MSG::DEBUG << "GenModule::execute()" << endreq; 00134 00135 // Decide how many interactions to generate 00136 if(m_fixedMode) { 00137 numToGenerate = (int) m_meanInteractions; 00138 } 00139 else { 00140 numToGenerate = m_pPoissonGenerator->fire(); 00141 } 00142 00143 // Generate as many interactions as requested 00144 for(int i=0; i<numToGenerate; i++) { 00145 00146 // Call the code that generates an event 00147 status = this->callGenerator(); 00148 00149 // Create the MC event and send the GeneratorEvent stored in it to fillEvt 00150 GenEvent* evt = new GenEvent(1,1); 00151 status = this->fillEvt(evt); 00152 00153 // Strip out the requested partons here. 00154 if (m_StripPartonSwitch) StripPartons(evt); 00155 00156 // Check if the McCollection already exists 00157 SmartDataPtr<McGenEventCol> anMcCol(eventSvc(), "/Event/Gen"); 00158 if (anMcCol!=0) { 00159 // Add event to existing collection 00160 MsgStream log(messageService(), name()); 00161 log << MSG::INFO << "Add McGenEvent to existing collection" << endreq; 00162 McGenEvent* mcEvent = new McGenEvent(evt); 00163 anMcCol->push_back(mcEvent); 00164 } 00165 else { 00166 // Create Collection and add to the transient store 00167 McGenEventCol *mcColl = new McGenEventCol; 00168 McGenEvent* mcEvent = new McGenEvent(evt); 00169 mcColl->push_back(mcEvent); 00170 00171 StatusCode sc = eventSvc()->registerObject("/Event/Gen",mcColl); 00172 00173 if (sc != StatusCode::SUCCESS) { 00174 MsgStream log(messageService(), name()); 00175 log << MSG::ERROR << "Could not register McGenEvent" << endreq; 00176 delete mcColl; 00177 delete evt; 00178 delete mcEvent; 00179 return StatusCode::FAILURE; 00180 } 00181 else { 00182 // std::cout << " McGenEventCol made and stored" << std::endl; 00183 } 00184 00185 } 00186 } 00187 00188 // now call the incident service and set the signal. 00189 IIncidentSvc *incSvc; 00190 service("IncidentSvc",incSvc); 00191 incSvc->fireIncident( Incident( name(), "McGenEvent Generated") ); 00192 00193 return status; 00194 }
StatusCode SingleParticleGun::fillEvt | ( | GenEvent * | evt | ) | [virtual] |
Reimplemented from GenModule.
Definition at line 223 of file SingleParticleGun.cxx.
References m_events, m_fourMom, m_fourPos, m_pdgCode, m_seeds, and SINGLE.
00223 { 00224 //--------------------------------------------------------------------------- 00225 // Note: The vertex is owned by the event so the event is responsible 00226 // for deleting its memory 00227 evt->set_event_number(m_events); // Set the event number 00228 GenVertex* v1 = new GenVertex(m_fourPos); 00229 00230 std::cout << " SingleParticleGun::fillEvt --> " <<std::endl; 00231 std::cout << " Event number:: " << m_events << std::endl; 00232 std::cout << " vertex.x = " << m_fourPos.x() 00233 << " vertex.y = " << m_fourPos.y() 00234 << " vertex.z = " << m_fourPos.z() 00235 << " vertex.t = " << m_fourPos.t() << std::endl; 00236 00237 std::cout << " momentum.x = " << m_fourMom.x() 00238 << " momentum.y = " << m_fourMom.y() 00239 << " momentum.z = " << m_fourMom.z() 00240 << " momentum.t = " << m_fourMom.t() << std::endl; 00241 00242 evt->add_vertex( v1 ); 00243 00244 00245 v1->add_particle_out( new GenParticle( m_fourMom, m_pdgCode,1) ); 00246 00247 std::cout << " particles_size = " << evt->particles_size() 00248 << " vertices_size = " << evt->vertices_size() 00249 << std::endl; 00250 00251 evt->set_signal_process_id(SINGLE); 00252 evt->set_random_states(m_seeds); 00253 00254 return StatusCode::SUCCESS; 00255 }
StatusCode GenModule::finalize | ( | ) | [inherited] |
Definition at line 197 of file GenModule.cxx.
References GenModule::genFinalize().
00197 { 00198 //--------------------------------------------------------------------------- 00199 00200 StatusCode status = this->genFinalize(); 00201 00202 return status; 00203 }
double SingleParticleGun::generateValue | ( | int | mode, | |
double | val, | |||
double | sigma, | |||
double | min, | |||
double | max | |||
) | [private] |
Definition at line 258 of file SingleParticleGun.cxx.
References calibUtil::ERROR, SingleParticleGunGenMode::FixedMode, SingleParticleGunGenMode::FlatMode, SingleParticleGunGenMode::GaussMode, IBesRndmGenSvc::GetEngine(), genRecEmupikp::i, and p_BesRndmGenSvc.
Referenced by callGenerator().
00259 { 00260 //--------------------------------------------------------------------------- 00261 double tmp; 00262 int i = 0; 00263 CLHEP::HepRandomEngine* engine = p_BesRndmGenSvc->GetEngine("SINGLE"); 00264 const int maxtries = 100; 00265 switch (mode) { 00266 case SingleParticleGunGenMode::FixedMode: 00267 return val; 00268 case SingleParticleGunGenMode::GaussMode: 00269 tmp = max+1.0; 00270 i = 0; 00271 do{ 00272 // tmp = m_pGaussGenerator->fire((HepDouble) val,(HepDouble) sigma); 00273 tmp = CLHEP::RandGauss::shoot(engine, (HepDouble) val,(HepDouble) sigma); 00274 i++; 00275 } while ( (tmp<min) || (tmp > max) && (i < maxtries)); 00276 if(i>maxtries) { 00277 MsgStream log(messageService(), name()); 00278 log << MSG::ERROR << "Cant generate value in range (min, max) " 00279 << val << "\t" << min << "\t" << max << endreq; 00280 } 00281 return tmp; 00282 case SingleParticleGunGenMode::FlatMode: 00283 // tmp = m_pFlatGenerator->fire((HepDouble) min,(HepDouble) max); 00284 tmp = CLHEP::RandFlat::shoot(engine, (HepDouble) min,(HepDouble) max); 00285 return tmp; 00286 default: 00287 MsgStream log(messageService(), name()); 00288 log << MSG::ERROR << "Unknown Generation Mode" << endreq; 00289 return 0.; 00290 } 00291 }
StatusCode SingleParticleGun::genFinalize | ( | ) | [virtual] |
Reimplemented from GenModule.
Definition at line 217 of file SingleParticleGun.cxx.
00217 { 00218 //--------------------------------------------------------------------------- 00219 return StatusCode::SUCCESS; 00220 }
StatusCode SingleParticleGun::genInitialize | ( | ) | [virtual] |
Reimplemented from GenModule.
Definition at line 86 of file SingleParticleGun.cxx.
References abs, SingleEnergyMode::EMode, calibUtil::ERROR, SingleParticleGunGenMode::FixedMode, m_EGenMode, m_Emode, m_events, m_mass, m_maxE, m_maxPhi, m_maxPt, m_maxTheta, m_minE, m_minPhi, m_minPt, m_minTheta, GenModule::m_particleTable, m_pdgCode, m_PhiGenMode, m_PtGenMode, m_requestedE, m_requestedPhi, m_requestedPt, m_requestedTheta, m_ThetaGenMode, p_BesRndmGenSvc, and SingleEnergyMode::PtMode.
00086 { 00087 //--------------------------------------------------------------------------- 00088 00089 // Create the flat and gaussian generators 00090 // 00091 00092 MsgStream log(messageService(), name()); 00093 00094 static const bool CREATEIFNOTTHERE(true); 00095 StatusCode RndmStatus = service("BesRndmGenSvc", p_BesRndmGenSvc, CREATEIFNOTTHERE); 00096 if (!RndmStatus.isSuccess() || 0 == p_BesRndmGenSvc) 00097 { 00098 log << MSG::ERROR << " Could not initialize Random Number Service" << endreq; 00099 return RndmStatus; 00100 } 00101 00102 // Get the mass of the particle to be generated 00103 // 00104 const HepPDT::ParticleData* particle = m_particleTable->particle(HepPDT::ParticleID(abs(m_pdgCode))); 00105 m_mass = particle->mass().value(); 00106 00107 // 00108 // Make sure the parameters are in a sensible range... 00109 // 00110 switch (m_Emode){ 00111 case SingleEnergyMode::PtMode: 00112 if(!m_PtGenMode && (m_minPt > m_requestedPt || m_maxPt < m_requestedPt) 00113 || m_maxPt < m_minPt ) { 00114 log << MSG:: ERROR << " Pt min and max out of range. \n" << 00115 " Will set Pt mode to Fixed!!!" << endreq; 00116 m_PtGenMode = SingleParticleGunGenMode::FixedMode; 00117 } 00118 if(!m_ThetaGenMode && (m_minTheta > m_requestedTheta || m_maxTheta < m_requestedTheta) 00119 || m_maxTheta < m_minTheta ) { 00120 log << MSG:: ERROR << " Theta min and max out of range. \n" << 00121 " Will set Theta mode to Fixed!!!" << endreq; 00122 m_ThetaGenMode = SingleParticleGunGenMode::FixedMode; 00123 } 00124 if(!m_PhiGenMode && (m_minPhi > m_requestedPhi || m_maxPhi < m_requestedPhi) 00125 || m_maxPhi < m_minPhi ) { 00126 log << MSG:: ERROR << " Phi min and max out of range. \n" << 00127 " Will set Phi mode to Fixed!!!" << endreq; 00128 m_PhiGenMode = SingleParticleGunGenMode::FixedMode; 00129 } 00130 break; 00131 case SingleEnergyMode::EMode: 00132 if(!m_EGenMode && (m_minE > m_requestedE || m_maxE < m_requestedE) 00133 || m_maxE < m_minE ) { 00134 log << MSG:: ERROR << " E min and max out of range. \n" << 00135 " Will set E mode to Fixed!!!" << endreq; 00136 m_EGenMode = SingleParticleGunGenMode::FixedMode; 00137 } 00138 if(!m_ThetaGenMode && (m_minTheta > m_requestedTheta || m_maxTheta < m_requestedTheta) 00139 || m_maxTheta < m_minTheta ) { 00140 log << MSG:: ERROR << " Theta min and max out of range. \n" << 00141 " Will set Theta mode to Fixed!!!" << endreq; 00142 m_ThetaGenMode = SingleParticleGunGenMode::FixedMode; 00143 } 00144 if(!m_PhiGenMode && (m_minPhi > m_requestedPhi || m_maxPhi < m_requestedPhi) 00145 || m_maxPhi < m_minPhi ) { 00146 log << MSG:: ERROR << " Phi min and max out of range. \n" << 00147 " Will set Phi mode to Fixed!!!" << endreq; 00148 m_PhiGenMode = SingleParticleGunGenMode::FixedMode; 00149 }break; 00150 } 00151 m_events = 0; 00152 return StatusCode::SUCCESS; 00153 }
StatusCode GenModule::genuserInitialize | ( | ) | [virtual, inherited] |
Definition at line 212 of file GenModule.cxx.
Referenced by GenModule::initialize().
00212 { 00213 //--------------------------------------------------------------------------- 00214 return StatusCode::SUCCESS; 00215 }
StatusCode GenModule::initialize | ( | ) | [inherited] |
Definition at line 63 of file GenModule.cxx.
References calibUtil::ERROR, GenModule::genInitialize(), GenModule::genuserInitialize(), Bes_Common::INFO, GenModule::m_fixedMode, GenModule::m_meanInteractions, GenModule::m_particleTable, GenModule::m_pPoissonGenerator, GenModule::m_pRandomEngine, GenModule::m_randomSeed, GenModule::m_StripPartonSwitch, GenModule::m_StripVector, and GenModule::StripPartonsInit().
00063 { 00064 //--------------------------------------------------------------------------- 00065 00066 // Inform the user what the mode and conditions are: 00067 MsgStream log(messageService(), name()); 00068 00069 // Initialize StripPartons variables 00070 if (m_StripVector[0] > 0) { 00071 StripPartonsInit(); 00072 } else { 00073 m_StripPartonSwitch = false; 00074 m_StripVector.clear(); 00075 } 00076 00077 00078 // Get the Particle Properties Service 00079 IPartPropSvc* p_PartPropSvc; 00080 //static const bool CREATEIFNOTTHERE(true); 00081 //StatusCode PartPropStatus = service("PartPropSvc", p_PartPropSvc, CREATEIFNOTTHERE); 00082 StatusCode PartPropStatus = service("PartPropSvc", p_PartPropSvc); 00083 if (!PartPropStatus.isSuccess() || 0 == p_PartPropSvc) { 00084 log << MSG::ERROR << " Could not initialize Particle Properties Service" << endreq; 00085 return PartPropStatus; 00086 } 00087 00088 m_particleTable = p_PartPropSvc->PDT(); 00089 00090 m_pRandomEngine = new CLHEP::Ranlux64Engine(m_randomSeed); 00091 00092 if(m_fixedMode) { 00093 if(m_meanInteractions == 1.0) { 00094 log << MSG::INFO << "Standard Initialization: Single Interaction Mode " 00095 << endreq; 00096 } 00097 else { 00098 log << MSG::INFO << "Fixed Number of Interactions per Event is: " 00099 << m_meanInteractions << endreq; 00100 } 00101 } 00102 else { 00103 m_pPoissonGenerator = new CLHEP::RandPoisson(*m_pRandomEngine, 00104 m_meanInteractions); 00105 00106 log << MSG::INFO << 00107 "Poisson Distribution of Interactions per Event with Mean: " 00108 << m_meanInteractions << endreq; 00109 } 00110 // Initialize the generator itself 00111 StatusCode status = this->genInitialize(); 00112 if (status.isFailure()) { 00113 log << MSG::ERROR << "Could not initialize Generator properly" << endreq; 00114 return status; 00115 } 00116 StatusCode status1 = this->genuserInitialize(); 00117 if (status1.isFailure()) { 00118 log << MSG::ERROR << "Could not initialize user part properly" << endreq; 00119 return status1; 00120 } 00121 return status; 00122 }
void GenModule::StripPartons | ( | GenEvent * | evt | ) | [protected, inherited] |
Definition at line 274 of file GenModule.cxx.
References GenModule::m_StripVector.
Referenced by GenModule::execute().
00275 { 00276 // for ( HepMC::GenEvent::particle_iterator p = evt->particles_begin(); 00277 // p != evt->particles_end(); ++p ) 00278 // { 00279 // // std::cout << " PDG, BAR " << (*p)->pdg_id() << " " << (*p)->barcode() << std::endl; 00280 // if ( std::find(m_StripVector.begin(), 00281 // m_StripVector.end(), 00282 // (*p)->pdg_id()) != m_StripVector.end() ) 00283 // { 00284 // // std::cout << " REMOVING " << (*p)->pdg_id() << " " << (*p)->barcode() << std::endl; 00285 // HepMC::GenVertex* pvtx = (*p)->production_vertex(); 00286 // HepMC::GenVertex* evtx = (*p)->end_vertex(); 00287 // if (pvtx) pvtx->remove_particle(*p); 00288 // if (evtx) evtx->remove_particle(*p); 00289 // delete *p; 00290 // } 00291 00292 // } 00293 00294 // Loop on all vertices of the event and remove the particle from the vertex 00295 for ( HepMC::GenEvent::vertex_iterator vtx = evt->vertices_begin(); 00296 vtx != evt->vertices_end(); ++vtx ) { 00297 // Loop on all children particles and remove the ones that should be stripped out 00298 for ( HepMC::GenVertex::particle_iterator p = (*vtx)-> particles_begin(HepMC::children); 00299 p != (*vtx)->particles_end(HepMC::children); 00300 ++p ){ 00301 if ( std::find(m_StripVector.begin(), 00302 m_StripVector.end(), 00303 (*p)->pdg_id()) != m_StripVector.end() ) { 00304 if ( (*p)->end_vertex() ) (*p)->end_vertex()->remove_particle(*p); 00305 if ( (*p)->production_vertex() ) (*p)->production_vertex()->remove_particle(*p); 00306 delete *p; 00307 } 00308 } 00309 // Loop on all parents particles and remove the ones that should be stripped out 00310 for ( HepMC::GenVertex::particle_iterator p = (*vtx)-> particles_begin(HepMC::parents); 00311 p != (*vtx)->particles_end(HepMC::parents); 00312 ++p ) { 00313 if ( std::find(m_StripVector.begin(), 00314 m_StripVector.end(), 00315 (*p)->pdg_id()) != m_StripVector.end() ) { 00316 if ( (*p)->end_vertex() ) (*p)->end_vertex()->remove_particle(*p); 00317 if ( (*p)->production_vertex() ) (*p)->production_vertex()->remove_particle(*p); 00318 delete *p; 00319 } 00320 } 00321 } 00322 }
void GenModule::StripPartonsInit | ( | void | ) | [protected, inherited] |
Definition at line 236 of file GenModule.cxx.
References genRecEmupikp::i, Bes_Common::INFO, GenModule::m_AllPartons, GenModule::m_StripPartonSwitch, and GenModule::m_StripVector.
Referenced by GenModule::initialize().
00237 { 00238 MsgStream log(messageService(), name()); 00239 00240 for (int i = 1; i < 9; ++i) { m_AllPartons.push_back(i); m_AllPartons.push_back(-i); } // Quarks 00241 m_AllPartons.push_back(21); // gluon 00242 00243 m_StripPartonSwitch = true; 00244 m_StripVector.erase(m_StripVector.begin(), m_StripVector.begin()+1); 00245 // When the user specifies only the StripPartonSwitch or gives a Particle Code 00246 // which is NOT a parton then strip ALL partons 00247 if (m_StripVector.size() == 0) { 00248 log << MSG::INFO << " !!!! NO SPECIFIC PARTON FOR STRIPOUT WAS REQUESTED => STRIPOUT ALL " 00249 << endreq; 00250 m_StripVector = m_AllPartons; 00251 } else { 00252 bool value_ok = true; 00253 std::vector<int>::const_iterator i = m_StripVector.begin(); 00254 do { 00255 if ( std::find(m_AllPartons.begin(), 00256 m_AllPartons.end(), 00257 *i) == m_AllPartons.end() ) value_ok = false; 00258 ++i; 00259 } while (i != m_StripVector.end() && value_ok); 00260 if (!value_ok) { 00261 log << MSG::INFO << " !!!! ILEGAL PDG-ID FOR STRIPOUT WAS REQUESTED => STRIPOUT ALL " 00262 << endreq; 00263 m_StripVector = m_AllPartons; 00264 } 00265 } 00266 log << MSG::INFO << " THE FOLLOWING PARTON(S) WILL BE STRIPED OUT "; 00267 for (std::vector<int>::const_iterator ip = m_StripVector.begin(); ip != m_StripVector.end(); ++ip) 00268 log << *ip << " "; 00269 log << endreq; 00270 00271 }
std::vector<int> GenModule::m_AllPartons [protected, inherited] |
int SingleParticleGun::m_EGenMode [private] |
Definition at line 74 of file SingleParticleGun.h.
Referenced by callGenerator(), genInitialize(), and SingleParticleGun().
int SingleParticleGun::m_Emode [private] |
Definition at line 78 of file SingleParticleGun.h.
Referenced by callGenerator(), genInitialize(), and SingleParticleGun().
int SingleParticleGun::m_events [private] |
Definition at line 80 of file SingleParticleGun.h.
Referenced by callGenerator(), fillEvt(), and genInitialize().
bool GenModule::m_fixedMode [protected, inherited] |
Definition at line 57 of file GenModule.h.
Referenced by GenModule::execute(), GenModule::GenModule(), and GenModule::initialize().
CLHEP::HepLorentzVector SingleParticleGun::m_fourMom [private] |
CLHEP::HepLorentzVector SingleParticleGun::m_fourPos [private] |
double SingleParticleGun::m_mass [private] |
Definition at line 86 of file SingleParticleGun.h.
Referenced by callGenerator(), and genInitialize().
double SingleParticleGun::m_maxE [private] |
Definition at line 65 of file SingleParticleGun.h.
Referenced by callGenerator(), genInitialize(), and SingleParticleGun().
double SingleParticleGun::m_maxPhi [private] |
Definition at line 68 of file SingleParticleGun.h.
Referenced by callGenerator(), genInitialize(), and SingleParticleGun().
double SingleParticleGun::m_maxPt [private] |
Definition at line 66 of file SingleParticleGun.h.
Referenced by callGenerator(), genInitialize(), and SingleParticleGun().
double SingleParticleGun::m_maxTheta [private] |
Definition at line 67 of file SingleParticleGun.h.
Referenced by callGenerator(), genInitialize(), and SingleParticleGun().
double GenModule::m_meanInteractions [protected, inherited] |
Definition at line 58 of file GenModule.h.
Referenced by GenModule::execute(), GenModule::GenModule(), and GenModule::initialize().
double SingleParticleGun::m_minE [private] |
Definition at line 62 of file SingleParticleGun.h.
Referenced by callGenerator(), genInitialize(), and SingleParticleGun().
double SingleParticleGun::m_minPhi [private] |
Definition at line 64 of file SingleParticleGun.h.
Referenced by callGenerator(), genInitialize(), and SingleParticleGun().
double SingleParticleGun::m_minPt [private] |
Definition at line 61 of file SingleParticleGun.h.
Referenced by callGenerator(), genInitialize(), and SingleParticleGun().
double SingleParticleGun::m_minTheta [private] |
Definition at line 63 of file SingleParticleGun.h.
Referenced by callGenerator(), genInitialize(), and SingleParticleGun().
HepPDT::ParticleDataTable* GenModule::m_particleTable [protected, inherited] |
Definition at line 73 of file GenModule.h.
Referenced by genInitialize(), and GenModule::initialize().
int SingleParticleGun::m_pdgCode [private] |
Definition at line 77 of file SingleParticleGun.h.
Referenced by fillEvt(), genInitialize(), and SingleParticleGun().
int SingleParticleGun::m_PhiGenMode [private] |
Definition at line 76 of file SingleParticleGun.h.
Referenced by callGenerator(), genInitialize(), and SingleParticleGun().
CLHEP::RandPoisson* GenModule::m_pPoissonGenerator [protected, inherited] |
Definition at line 68 of file GenModule.h.
Referenced by GenModule::execute(), GenModule::initialize(), and GenModule::~GenModule().
CLHEP::HepRandomEngine* GenModule::m_pRandomEngine [protected, inherited] |
Definition at line 67 of file GenModule.h.
Referenced by GenModule::initialize(), and GenModule::~GenModule().
int SingleParticleGun::m_PtGenMode [private] |
Definition at line 73 of file SingleParticleGun.h.
Referenced by callGenerator(), genInitialize(), and SingleParticleGun().
int GenModule::m_randomSeed [protected, inherited] |
Definition at line 59 of file GenModule.h.
Referenced by GenModule::GenModule(), and GenModule::initialize().
double SingleParticleGun::m_requestedE [private] |
Definition at line 55 of file SingleParticleGun.h.
Referenced by callGenerator(), genInitialize(), and SingleParticleGun().
double SingleParticleGun::m_requestedPhi [private] |
Definition at line 54 of file SingleParticleGun.h.
Referenced by callGenerator(), genInitialize(), and SingleParticleGun().
double SingleParticleGun::m_requestedPt [private] |
Definition at line 53 of file SingleParticleGun.h.
Referenced by callGenerator(), genInitialize(), and SingleParticleGun().
double SingleParticleGun::m_requestedT [private] |
Definition at line 60 of file SingleParticleGun.h.
Referenced by callGenerator(), and SingleParticleGun().
double SingleParticleGun::m_requestedTheta [private] |
Definition at line 56 of file SingleParticleGun.h.
Referenced by callGenerator(), genInitialize(), and SingleParticleGun().
double SingleParticleGun::m_requestedX [private] |
Definition at line 57 of file SingleParticleGun.h.
Referenced by callGenerator(), and SingleParticleGun().
double SingleParticleGun::m_requestedY [private] |
Definition at line 58 of file SingleParticleGun.h.
Referenced by callGenerator(), and SingleParticleGun().
double SingleParticleGun::m_requestedZ [private] |
Definition at line 59 of file SingleParticleGun.h.
Referenced by callGenerator(), and SingleParticleGun().
std::vector<long int> SingleParticleGun::m_seeds [private] |
double SingleParticleGun::m_sigmaE [private] |
Definition at line 70 of file SingleParticleGun.h.
Referenced by callGenerator(), and SingleParticleGun().
double SingleParticleGun::m_sigmaPhi [private] |
Definition at line 72 of file SingleParticleGun.h.
Referenced by callGenerator(), and SingleParticleGun().
double SingleParticleGun::m_sigmaPt [private] |
Definition at line 69 of file SingleParticleGun.h.
Referenced by callGenerator(), and SingleParticleGun().
double SingleParticleGun::m_sigmaTheta [private] |
Definition at line 71 of file SingleParticleGun.h.
Referenced by callGenerator(), and SingleParticleGun().
bool GenModule::m_StripPartonSwitch [protected, inherited] |
Definition at line 62 of file GenModule.h.
Referenced by GenModule::execute(), GenModule::initialize(), and GenModule::StripPartonsInit().
std::vector<int> GenModule::m_StripVector [protected, inherited] |
Definition at line 61 of file GenModule.h.
Referenced by GenModule::GenModule(), GenModule::initialize(), GenModule::StripPartons(), and GenModule::StripPartonsInit().
int SingleParticleGun::m_ThetaGenMode [private] |
Definition at line 75 of file SingleParticleGun.h.
Referenced by callGenerator(), genInitialize(), and SingleParticleGun().
IBesRndmGenSvc* SingleParticleGun::p_BesRndmGenSvc [private] |
Definition at line 83 of file SingleParticleGun.h.
Referenced by callGenerator(), generateValue(), and genInitialize().