#include <CosMuoGenSource.h>
Public Member Functions | |
CosMuoGenSource (const ParameterSet &, const InputSourceDescription &) | |
void | endRun (Run &r) |
virtual | ~CosMuoGenSource () |
Private Member Functions | |
void | clear () |
virtual bool | produce (Event &e) |
Private Attributes | |
bool | AllMu |
double | ClayLayerWidth |
bool | cmVerbosity_ |
CosmicMuonGenerator * | CosMuoGen |
double | ELSF |
double | extCrossSect |
double | extFilterEff |
HepMC::GenEvent * | fEvt |
double | MaxEn |
double | MaxP |
double | MaxPh |
double | MaxS |
double | MaxT |
double | MinEn |
double | MinP |
double | MinP_CMS |
double | MinPh |
double | MinS |
double | MinT |
bool | MTCCHalf |
bool | MultiMuon |
int32_t | MultiMuonFileFirstEvent |
std::string | MultiMuonFileName |
int32_t | MultiMuonNmin |
double | NuPrdAlt |
double | PlugVtx |
double | PlugVtz |
int32_t | RanS |
double | RTarget |
bool | TIFOnly_constant |
bool | TIFOnly_linear |
bool | TrackerOnly |
double | VarRhoAir |
double | VarRhoClay |
double | VarRhoPlug |
double | VarRhoRock |
double | VarRhoWall |
double | ZCTarget |
double | ZTarget |
Definition at line 18 of file CosMuoGenSource.h.
edm::CosMuoGenSource::CosMuoGenSource | ( | const ParameterSet & | pset, |
const InputSourceDescription & | desc | ||
) |
Definition at line 12 of file CosMuoGenSource.cc.
References AllMu, ClayLayerWidth, CosMuoGen, ELSF, CosmicMuonGenerator::initialize(), MaxEn, MaxP, MaxPh, MaxS, MaxT, MinEn, MinP, MinP_CMS, MinPh, MinS, MinT, MTCCHalf, MultiMuon, MultiMuonFileFirstEvent, MultiMuonFileName, MultiMuonNmin, edm::ConfigurableInputSource::numberEventsInRun(), NuPrdAlt, PlugVtx, PlugVtz, RanS, RTarget, CosmicMuonGenerator::setAcptAllMu(), CosmicMuonGenerator::setClayWidth(), CosmicMuonGenerator::setElossScaleFactor(), CosmicMuonGenerator::setMaxEnu(), CosmicMuonGenerator::setMaxP(), CosmicMuonGenerator::setMaxPhi(), CosmicMuonGenerator::setMaxT0(), CosmicMuonGenerator::setMaxTheta(), CosmicMuonGenerator::setMinEnu(), CosmicMuonGenerator::setMinP(), CosmicMuonGenerator::setMinP_CMS(), CosmicMuonGenerator::setMinPhi(), CosmicMuonGenerator::setMinT0(), CosmicMuonGenerator::setMinTheta(), CosmicMuonGenerator::setMTCCHalf(), CosmicMuonGenerator::setMultiMuon(), CosmicMuonGenerator::setMultiMuonFileFirstEvent(), CosmicMuonGenerator::setMultiMuonFileName(), CosmicMuonGenerator::setMultiMuonNmin(), CosmicMuonGenerator::setNumberOfEvents(), CosmicMuonGenerator::setNuProdAlt(), CosmicMuonGenerator::setPlugVx(), CosmicMuonGenerator::setPlugVz(), CosmicMuonGenerator::setRadiusOfTarget(), CosmicMuonGenerator::setRanSeed(), CosmicMuonGenerator::setRhoAir(), CosmicMuonGenerator::setRhoClay(), CosmicMuonGenerator::setRhoPlug(), CosmicMuonGenerator::setRhoRock(), CosmicMuonGenerator::setRhoWall(), CosmicMuonGenerator::setTIFOnly_constant(), CosmicMuonGenerator::setTIFOnly_linear(), CosmicMuonGenerator::setTrackerOnly(), CosmicMuonGenerator::setZCentrOfTarget(), CosmicMuonGenerator::setZDistOfTarget(), TIFOnly_constant, TIFOnly_linear, TrackerOnly, VarRhoAir, VarRhoClay, VarRhoPlug, VarRhoRock, VarRhoWall, ZCTarget, and ZTarget.
: GeneratedInputSource(pset, desc ) , //RanS(pset.getParameter<int>("RanSeed", 123456)), //get seed now from Framework MinP(pset.getParameter<double>("MinP")), MinP_CMS(pset.getParameter<double>("MinP_CMS")), MaxP(pset.getParameter<double>("MaxP")), MinT(pset.getParameter<double>("MinTheta")), MaxT(pset.getParameter<double>("MaxTheta")), MinPh(pset.getParameter<double>("MinPhi")), MaxPh(pset.getParameter<double>("MaxPhi")), MinS(pset.getParameter<double>("MinT0")), MaxS(pset.getParameter<double>("MaxT0")), ELSF(pset.getParameter<double>("ElossScaleFactor")), RTarget(pset.getParameter<double>("RadiusOfTarget")), ZTarget(pset.getParameter<double>("ZDistOfTarget")), ZCTarget(pset.getParameter<double>("ZCentrOfTarget")), TrackerOnly(pset.getParameter<bool>("TrackerOnly")), MultiMuon(pset.getParameter<bool>("MultiMuon")), MultiMuonFileName(pset.getParameter<std::string>("MultiMuonFileName")), MultiMuonFileFirstEvent(pset.getParameter<int>("MultiMuonFileFirstEvent")), MultiMuonNmin(pset.getParameter<int>("MultiMuonNmin")), TIFOnly_constant(pset.getParameter<bool>("TIFOnly_constant")), TIFOnly_linear(pset.getParameter<bool>("TIFOnly_linear")), MTCCHalf(pset.getParameter<bool>("MTCCHalf")), PlugVtx(pset.getParameter<double>("PlugVx")), PlugVtz(pset.getParameter<double>("PlugVz")), VarRhoAir(pset.getParameter<double>("RhoAir")), VarRhoWall(pset.getParameter<double>("RhoWall")), VarRhoRock(pset.getParameter<double>("RhoRock")), VarRhoClay(pset.getParameter<double>("RhoClay")), VarRhoPlug(pset.getParameter<double>("RhoPlug")), ClayLayerWidth(pset.getParameter<double>("ClayWidth")), MinEn(pset.getParameter<double>("MinEnu")), MaxEn(pset.getParameter<double>("MaxEnu")), NuPrdAlt(pset.getParameter<double>("NuProdAlt")), AllMu(pset.getParameter<bool>("AcptAllMu")), extCrossSect(pset.getUntrackedParameter<double>("crossSection", -1.)), extFilterEff(pset.getUntrackedParameter<double>("filterEfficiency", -1.)), cmVerbosity_(pset.getParameter<bool>("Verbosity")) { //if not specified (i.e. negative) then use MinP also for MinP_CMS if(MinP_CMS < 0) MinP_CMS = MinP; //get seed now from Framework edm::Service<edm::RandomNumberGenerator> rng; RanS = rng->mySeed(); // set up the generator CosMuoGen = new CosmicMuonGenerator(); CosMuoGen->setNumberOfEvents(numberEventsInRun()); CosMuoGen->setRanSeed(RanS); CosMuoGen->setMinP(MinP); CosMuoGen->setMinP_CMS(MinP_CMS); CosMuoGen->setMaxP(MaxP); CosMuoGen->setMinTheta(MinT); CosMuoGen->setMaxTheta(MaxT); CosMuoGen->setMinPhi(MinPh); CosMuoGen->setMaxPhi(MaxPh); CosMuoGen->setMinT0(MinS); CosMuoGen->setMaxT0(MaxS); CosMuoGen->setElossScaleFactor(ELSF); CosMuoGen->setRadiusOfTarget(RTarget); CosMuoGen->setZDistOfTarget(ZTarget); CosMuoGen->setZCentrOfTarget(ZCTarget); CosMuoGen->setTrackerOnly(TrackerOnly); CosMuoGen->setMultiMuon(MultiMuon); CosMuoGen->setMultiMuonFileName(MultiMuonFileName); CosMuoGen->setMultiMuonFileFirstEvent(MultiMuonFileFirstEvent); CosMuoGen->setMultiMuonNmin(MultiMuonNmin); CosMuoGen->setTIFOnly_constant(TIFOnly_constant); CosMuoGen->setTIFOnly_linear(TIFOnly_linear); CosMuoGen->setMTCCHalf(MTCCHalf); CosMuoGen->setPlugVx(PlugVtx); CosMuoGen->setPlugVz(PlugVtz); CosMuoGen->setRhoAir(VarRhoAir); CosMuoGen->setRhoWall(VarRhoWall); CosMuoGen->setRhoRock(VarRhoRock); CosMuoGen->setRhoClay(VarRhoClay); CosMuoGen->setRhoPlug(VarRhoPlug); CosMuoGen->setClayWidth(ClayLayerWidth); CosMuoGen->setMinEnu(MinEn); CosMuoGen->setMaxEnu(MaxEn); CosMuoGen->setNuProdAlt(NuPrdAlt); CosMuoGen->setAcptAllMu(AllMu); CosMuoGen->initialize(); produces<HepMCProduct>(); // fEvt = new HepMC::GenEvent(); produces<GenRunInfoProduct, edm::InRun>(); }
edm::CosMuoGenSource::~CosMuoGenSource | ( | ) | [virtual] |
Definition at line 102 of file CosMuoGenSource.cc.
References hitfit::clear().
void edm::CosMuoGenSource::clear | ( | void | ) | [private] |
Definition at line 125 of file CosMuoGenSource.cc.
{}
void edm::CosMuoGenSource::endRun | ( | Run & | r | ) | [virtual] |
Reimplemented from edm::ConfigurableInputSource.
Definition at line 110 of file CosMuoGenSource.cc.
References fwrapper::cs, and edm::Run::put().
{ std::auto_ptr<GenRunInfoProduct> genRunInfo(new GenRunInfoProduct()); double cs = CosMuoGen->getRate(); // flux in Hz, not s^-1m^-2 genRunInfo->setInternalXSec(cs); genRunInfo->setExternalXSecLO(extCrossSect); genRunInfo->setFilterEfficiency(extFilterEff); r.put(genRunInfo); CosMuoGen->terminate(); }
bool edm::CosMuoGenSource::produce | ( | Event & | e | ) | [private, virtual] |
Implements edm::ConfigurableInputSource.
Definition at line 127 of file CosMuoGenSource.cc.
References gather_cfg::cout, Debug, event(), configurableAnalysis::GenParticle, i, edm::Event::put(), and summarizeEdmComparisonLogfiles::success.
{ // generate event if (!MultiMuon) { CosMuoGen->nextEvent(); } else { bool success = CosMuoGen->nextMultiEvent(); if (!success) return false; } if (Debug) { std::cout << "CosMuoGenSource.cc: CosMuoGen->EventWeight=" << CosMuoGen->EventWeight << " CosMuoGen: Nmuons=" << CosMuoGen->Id_sf.size() << std::endl; std::cout << "CosMuoGen->Id_at=" << CosMuoGen->Id_at << " CosMuoGen->Vx_at=" << CosMuoGen->Vx_at << " CosMuoGen->Vy_at=" << CosMuoGen->Vy_at << " CosMuoGen->Vz_at=" << CosMuoGen->Vz_at << " CosMuoGen->T0_at=" << CosMuoGen->T0_at << std::endl; std::cout << " Px=" << CosMuoGen->Px_at << " Py=" << CosMuoGen->Py_at << " Pz=" << CosMuoGen->Pz_at << std::endl; for (unsigned int i=0; i<CosMuoGen->Id_sf.size(); ++i) { std::cout << "Id_sf[" << i << "]=" << CosMuoGen->Id_sf[i] << " Vx_sf[" << i << "]=" << CosMuoGen->Vx_sf[i] << " Vy_sf=" << CosMuoGen->Vy_sf[i] << " Vz_sf=" << CosMuoGen->Vz_sf[i] << " T0_sf=" << CosMuoGen->T0_sf[i] << " Px_sf=" << CosMuoGen->Px_sf[i] << " Py_sf=" << CosMuoGen->Py_sf[i] << " Pz_sf=" << CosMuoGen->Pz_sf[i] << std::endl; std::cout << "phi_sf=" << atan2(CosMuoGen->Px_sf[i],CosMuoGen->Pz_sf[i]) << std::endl; std::cout << "Id_ug[" << i << "]=" << CosMuoGen->Id_ug[i] << " Vx_ug[" << i << "]=" << CosMuoGen->Vx_ug[i] << " Vy_ug=" << CosMuoGen->Vy_ug[i] << " Vz_ug=" << CosMuoGen->Vz_ug[i] << " T0_ug=" << CosMuoGen->T0_ug[i] << " Px_ug=" << CosMuoGen->Px_ug[i] << " Py_ug=" << CosMuoGen->Py_ug[i] << " Pz_ug=" << CosMuoGen->Pz_ug[i] << std::endl; std::cout << "phi_ug=" << atan2(CosMuoGen->Px_ug[i],CosMuoGen->Pz_ug[i]) << std::endl;; } } fEvt = new HepMC::GenEvent(); HepMC::GenVertex* Vtx_at = new HepMC::GenVertex(HepMC::FourVector(CosMuoGen->Vx_at, //[mm] CosMuoGen->Vy_at, //[mm] CosMuoGen->Vz_at, //[mm] CosMuoGen->T0_at)); //[mm] //cout << "CosMuoGenSource.cc: Vy_at=" << CosMuoGen->Vy_at << endl; HepMC::FourVector p_at(CosMuoGen->Px_at,CosMuoGen->Py_at,CosMuoGen->Pz_at,CosMuoGen->E_at); HepMC::GenParticle* Part_at = new HepMC::GenParticle(p_at,CosMuoGen->Id_at, 3);//Comment mother particle in Vtx_at->add_particle_in(Part_at); //loop here in case of multi muon events (else just one iteration) for (unsigned int i=0; i<CosMuoGen->Id_sf.size(); ++i) { HepMC::FourVector p_sf(CosMuoGen->Px_sf[i],CosMuoGen->Py_sf[i],CosMuoGen->Pz_sf[i],CosMuoGen->E_sf[i]); HepMC::GenParticle* Part_sf_in = new HepMC::GenParticle(p_sf,CosMuoGen->Id_sf[i], 3); //Comment daughter particle Vtx_at->add_particle_out(Part_sf_in); HepMC::GenVertex* Vtx_sf = new HepMC::GenVertex(HepMC::FourVector(CosMuoGen->Vx_sf[i], CosMuoGen->Vy_sf[i], CosMuoGen->Vz_sf[i], CosMuoGen->T0_sf[i])); //[mm] HepMC::GenParticle* Part_sf_out = new HepMC::GenParticle(p_sf,CosMuoGen->Id_sf[i], 3); //Comment daughter particle Vtx_sf->add_particle_in(Part_sf_in); Vtx_sf->add_particle_out(Part_sf_out); fEvt->add_vertex(Vtx_sf); //one per muon HepMC::GenVertex* Vtx_ug = new HepMC::GenVertex(HepMC::FourVector(CosMuoGen->Vx_ug[i], CosMuoGen->Vy_ug[i], CosMuoGen->Vz_ug[i], CosMuoGen->T0_ug[i])); //[mm] HepMC::FourVector p_ug(CosMuoGen->Px_ug[i],CosMuoGen->Py_ug[i],CosMuoGen->Pz_ug[i],CosMuoGen->E_ug[i]); HepMC::GenParticle* Part_ug = new HepMC::GenParticle(p_ug,CosMuoGen->Id_ug[i], 1);//Final state daughter particle Vtx_ug->add_particle_in(Part_sf_out); Vtx_ug->add_particle_out(Part_ug); fEvt->add_vertex(Vtx_ug); //one per muon } fEvt->add_vertex(Vtx_at); fEvt->set_signal_process_vertex(Vtx_at); fEvt->set_event_number(event()); fEvt->set_signal_process_id(13); fEvt->weights().push_back( CosMuoGen->EventWeight ); // just one event weight fEvt->weights().push_back( CosMuoGen->Trials ); // int Trials number (unweighted) if (cmVerbosity_) fEvt->print(); std::auto_ptr<HepMCProduct> CMProduct(new HepMCProduct()); CMProduct->addHepMCData( fEvt ); e.put(CMProduct); return true; }
bool edm::CosMuoGenSource::AllMu [private] |
Definition at line 71 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
double edm::CosMuoGenSource::ClayLayerWidth [private] |
Definition at line 64 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
bool edm::CosMuoGenSource::cmVerbosity_ [private] |
Definition at line 81 of file CosMuoGenSource.h.
Definition at line 78 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
double edm::CosMuoGenSource::ELSF [private] |
Definition at line 40 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
double edm::CosMuoGenSource::extCrossSect [private] |
Definition at line 74 of file CosMuoGenSource.h.
double edm::CosMuoGenSource::extFilterEff [private] |
Definition at line 75 of file CosMuoGenSource.h.
HepMC::GenEvent* edm::CosMuoGenSource::fEvt [private] |
Definition at line 80 of file CosMuoGenSource.h.
double edm::CosMuoGenSource::MaxEn [private] |
Definition at line 68 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
double edm::CosMuoGenSource::MaxP [private] |
Definition at line 33 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
double edm::CosMuoGenSource::MaxPh [private] |
Definition at line 37 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
double edm::CosMuoGenSource::MaxS [private] |
Definition at line 39 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
double edm::CosMuoGenSource::MaxT [private] |
Definition at line 35 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
double edm::CosMuoGenSource::MinEn [private] |
Definition at line 67 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
double edm::CosMuoGenSource::MinP [private] |
Definition at line 31 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
double edm::CosMuoGenSource::MinP_CMS [private] |
Definition at line 32 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
double edm::CosMuoGenSource::MinPh [private] |
Definition at line 36 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
double edm::CosMuoGenSource::MinS [private] |
Definition at line 38 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
double edm::CosMuoGenSource::MinT [private] |
Definition at line 34 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
bool edm::CosMuoGenSource::MTCCHalf [private] |
Definition at line 51 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
bool edm::CosMuoGenSource::MultiMuon [private] |
Definition at line 45 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
int32_t edm::CosMuoGenSource::MultiMuonFileFirstEvent [private] |
Definition at line 47 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
std::string edm::CosMuoGenSource::MultiMuonFileName [private] |
Definition at line 46 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
int32_t edm::CosMuoGenSource::MultiMuonNmin [private] |
Definition at line 48 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
double edm::CosMuoGenSource::NuPrdAlt [private] |
Definition at line 69 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
double edm::CosMuoGenSource::PlugVtx [private] |
Definition at line 55 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
double edm::CosMuoGenSource::PlugVtz [private] |
Definition at line 56 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
int32_t edm::CosMuoGenSource::RanS [private] |
Definition at line 30 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
double edm::CosMuoGenSource::RTarget [private] |
Definition at line 41 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
bool edm::CosMuoGenSource::TIFOnly_constant [private] |
Definition at line 49 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
bool edm::CosMuoGenSource::TIFOnly_linear [private] |
Definition at line 50 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
bool edm::CosMuoGenSource::TrackerOnly [private] |
Definition at line 44 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
double edm::CosMuoGenSource::VarRhoAir [private] |
Definition at line 59 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
double edm::CosMuoGenSource::VarRhoClay [private] |
Definition at line 62 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
double edm::CosMuoGenSource::VarRhoPlug [private] |
Definition at line 63 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
double edm::CosMuoGenSource::VarRhoRock [private] |
Definition at line 61 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
double edm::CosMuoGenSource::VarRhoWall [private] |
Definition at line 60 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
double edm::CosMuoGenSource::ZCTarget [private] |
Definition at line 43 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().
double edm::CosMuoGenSource::ZTarget [private] |
Definition at line 42 of file CosMuoGenSource.h.
Referenced by CosMuoGenSource().