13 MinP(pset.getParameter<double>(
"MinP")),
14 MinP_CMS(pset.getParameter<double>(
"MinP_CMS")),
15 MaxP(pset.getParameter<double>(
"MaxP")),
16 MinT(pset.getParameter<double>(
"MinTheta")),
17 MaxT(pset.getParameter<double>(
"MaxTheta")),
18 MinPh(pset.getParameter<double>(
"MinPhi")),
19 MaxPh(pset.getParameter<double>(
"MaxPhi")),
20 MinS(pset.getParameter<double>(
"MinT0")),
21 MaxS(pset.getParameter<double>(
"MaxT0")),
22 ELSF(pset.getParameter<double>(
"ElossScaleFactor")),
23 RTarget(pset.getParameter<double>(
"RadiusOfTarget")),
24 ZTarget(pset.getParameter<double>(
"ZDistOfTarget")),
25 ZCTarget(pset.getParameter<double>(
"ZCentrOfTarget")),
26 TrackerOnly(pset.getParameter<
bool>(
"TrackerOnly")),
27 MultiMuon(pset.getParameter<
bool>(
"MultiMuon")),
28 MultiMuonFileName(pset.getParameter<
std::
string>(
"MultiMuonFileName")),
29 MultiMuonFileFirstEvent(pset.getParameter<
int>(
"MultiMuonFileFirstEvent")),
30 MultiMuonNmin(pset.getParameter<
int>(
"MultiMuonNmin")),
31 TIFOnly_constant(pset.getParameter<
bool>(
"TIFOnly_constant")),
32 TIFOnly_linear(pset.getParameter<
bool>(
"TIFOnly_linear")),
33 MTCCHalf(pset.getParameter<
bool>(
"MTCCHalf")),
34 PlugVtx(pset.getParameter<double>(
"PlugVx")),
35 PlugVtz(pset.getParameter<double>(
"PlugVz")),
36 VarRhoAir(pset.getParameter<double>(
"RhoAir")),
37 VarRhoWall(pset.getParameter<double>(
"RhoWall")),
38 VarRhoRock(pset.getParameter<double>(
"RhoRock")),
39 VarRhoClay(pset.getParameter<double>(
"RhoClay")),
40 VarRhoPlug(pset.getParameter<double>(
"RhoPlug")),
41 ClayLayerWidth(pset.getParameter<double>(
"ClayWidth")),
42 MinEn(pset.getParameter<double>(
"MinEnu")),
43 MaxEn(pset.getParameter<double>(
"MaxEnu")),
44 NuPrdAlt(pset.getParameter<double>(
"NuProdAlt")),
45 AllMu(pset.getParameter<
bool>(
"AcptAllMu")),
46 extCrossSect(pset.getUntrackedParameter<double>(
"crossSection", -1.)),
47 extFilterEff(pset.getUntrackedParameter<double>(
"filterEfficiency", -1.)),
48 cmVerbosity_(pset.getParameter<
bool>(
"Verbosity")),
55 CosMuoGen = std::make_unique<CosmicMuonGenerator>();
94 produces<HepMCProduct>(
"unsmeared");
95 produces<GenEventInfoProduct>();
96 produces<GenRunInfoProduct, edm::Transition::EndRun>();
108 CosMuoGen->initialize(randomEngineSentry.randomEngine());
117 if (
MultiMuon) genRunInfo->setInternalXSec(0.);
118 else genRunInfo->setInternalXSec(cs);
139 if (!success)
std::cout <<
"CosMuoGenProducer.cc: CosMuoGen->nextMultiEvent() failed!" 144 std::cout <<
"CosMuoGenProducer.cc: CosMuoGen->EventWeight=" <<
CosMuoGen->EventWeight
145 <<
" CosMuoGen: Nmuons=" <<
CosMuoGen->Id_sf.size() << std::endl;
147 <<
" CosMuoGen->Vx_at=" <<
CosMuoGen->Vx_at
148 <<
" CosMuoGen->Vy_at=" <<
CosMuoGen->Vy_at
149 <<
" CosMuoGen->Vz_at=" <<
CosMuoGen->Vz_at
150 <<
" CosMuoGen->T0_at=" <<
CosMuoGen->T0_at << std::endl;
153 <<
" Pz=" <<
CosMuoGen->Pz_at << std::endl;
154 for (
unsigned int i=0;
i<
CosMuoGen->Id_sf.size(); ++
i) {
162 <<
" Pz_sf=" <<
CosMuoGen->Pz_sf[
i] << std::endl;
171 <<
" Pz_ug=" <<
CosMuoGen->Pz_ug[
i] << std::endl;
177 auto fEvt = std::make_unique<HepMC::GenEvent>();
179 HepMC::GenVertex* Vtx_at =
new HepMC::GenVertex(HepMC::FourVector(
CosMuoGen->Vx_at,
187 Vtx_at->add_particle_in(Part_at);
191 for (
unsigned int i=0;
i<
CosMuoGen->Id_sf.size(); ++
i) {
196 Vtx_at->add_particle_out(Part_sf_in);
202 Vtx_sf->add_particle_in(Part_sf_in);
203 Vtx_sf->add_particle_out(Part_sf_out);
205 fEvt->add_vertex(Vtx_sf);
213 Vtx_ug->add_particle_in(Part_sf_out);
214 Vtx_ug->add_particle_out(Part_ug);
216 fEvt->add_vertex(Vtx_ug);
220 fEvt->add_vertex(Vtx_at);
221 fEvt->set_signal_process_vertex(Vtx_at);
223 fEvt->set_event_number(e.
id().
event());
224 fEvt->set_signal_process_id(13);
226 fEvt->weights().push_back(
CosMuoGen->EventWeight );
227 fEvt->weights().push_back(
CosMuoGen->Trials );
236 std::unique_ptr<HepMCProduct> CMProduct(
new HepMCProduct());
237 CMProduct->addHepMCData( fEvt.release() );
EventNumber_t event() const
void endRunProduce(Run &r, const EventSetup &es) override
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
std::string MultiMuonFileName
LuminosityBlockIndex index() const
unique_ptr< ClusterSequence > cs
std::unique_ptr< CosmicMuonGenerator > CosMuoGen
CosMuoGenProducer(const ParameterSet &)
int32_t MultiMuonFileFirstEvent
void produce(Event &e, const EventSetup &es) override
void beginLuminosityBlock(LuminosityBlock const &, EventSetup const &) override
~CosMuoGenProducer() override
void put(std::unique_ptr< PROD > product)
Put a new product.
StreamID streamID() const