1 #include <CLHEP/Random/RandomEngine.h>
15 MinP(pset.getParameter<double>(
"MinP")),
16 MinP_CMS(pset.getParameter<double>(
"MinP_CMS")),
17 MaxP(pset.getParameter<double>(
"MaxP")),
18 MinT(pset.getParameter<double>(
"MinTheta")),
19 MaxT(pset.getParameter<double>(
"MaxTheta")),
20 MinPh(pset.getParameter<double>(
"MinPhi")),
21 MaxPh(pset.getParameter<double>(
"MaxPhi")),
22 MinS(pset.getParameter<double>(
"MinT0")),
23 MaxS(pset.getParameter<double>(
"MaxT0")),
24 ELSF(pset.getParameter<double>(
"ElossScaleFactor")),
25 RTarget(pset.getParameter<double>(
"RadiusOfTarget")),
26 ZTarget(pset.getParameter<double>(
"ZDistOfTarget")),
27 ZCTarget(pset.getParameter<double>(
"ZCentrOfTarget")),
28 TrackerOnly(pset.getParameter<bool>(
"TrackerOnly")),
29 MultiMuon(pset.getParameter<bool>(
"MultiMuon")),
30 MultiMuonFileName(pset.getParameter<std::string>(
"MultiMuonFileName")),
31 MultiMuonFileFirstEvent(pset.getParameter<int>(
"MultiMuonFileFirstEvent")),
32 MultiMuonNmin(pset.getParameter<int>(
"MultiMuonNmin")),
33 TIFOnly_constant(pset.getParameter<bool>(
"TIFOnly_constant")),
34 TIFOnly_linear(pset.getParameter<bool>(
"TIFOnly_linear")),
35 MTCCHalf(pset.getParameter<bool>(
"MTCCHalf")),
36 PlugVtx(pset.getParameter<double>(
"PlugVx")),
37 PlugVtz(pset.getParameter<double>(
"PlugVz")),
38 VarRhoAir(pset.getParameter<double>(
"RhoAir")),
39 VarRhoWall(pset.getParameter<double>(
"RhoWall")),
40 VarRhoRock(pset.getParameter<double>(
"RhoRock")),
41 VarRhoClay(pset.getParameter<double>(
"RhoClay")),
42 VarRhoPlug(pset.getParameter<double>(
"RhoPlug")),
43 ClayLayerWidth(pset.getParameter<double>(
"ClayWidth")),
44 MinEn(pset.getParameter<double>(
"MinEnu")),
45 MaxEn(pset.getParameter<double>(
"MaxEnu")),
46 NuPrdAlt(pset.getParameter<double>(
"NuProdAlt")),
47 AllMu(pset.getParameter<bool>(
"AcptAllMu")),
48 extCrossSect(pset.getUntrackedParameter<double>(
"crossSection", -1.)),
49 extFilterEff(pset.getUntrackedParameter<double>(
"filterEfficiency", -1.)),
50 cmVerbosity_(pset.getParameter<bool>(
"Verbosity"))
58 <<
"The RandomNumberProducer module requires the RandomNumberGeneratorService\n"
59 "which appears to be absent. Please add that service to your configuration\n"
60 "or remove the modules that require it." << std::endl;
103 produces<HepMCProduct>();
104 produces<GenEventInfoProduct>();
105 produces<GenRunInfoProduct, edm::InRun>();
119 double cs = CosMuoGen->getRate();
120 if (MultiMuon) genRunInfo->setInternalXSec(0.);
121 else genRunInfo->setInternalXSec(cs);
122 genRunInfo->setExternalXSecLO(extCrossSect);
123 genRunInfo->setFilterEfficiency(extFilterEff);
127 CosMuoGen->terminate();
136 CosMuoGen->nextEvent();
139 bool success = CosMuoGen->nextMultiEvent();
140 if (!success)
std::cout <<
"CosMuoGenProducer.cc: CosMuoGen->nextMultiEvent() failed!"
145 std::cout <<
"CosMuoGenSource.cc: CosMuoGen->EventWeight=" << CosMuoGen->EventWeight
146 <<
" CosMuoGen: Nmuons=" << CosMuoGen->Id_sf.size() << std::endl;
147 std::cout <<
"CosMuoGen->Id_at=" << CosMuoGen->Id_at
148 <<
" CosMuoGen->Vx_at=" << CosMuoGen->Vx_at
149 <<
" CosMuoGen->Vy_at=" << CosMuoGen->Vy_at
150 <<
" CosMuoGen->Vz_at=" << CosMuoGen->Vz_at
151 <<
" CosMuoGen->T0_at=" << CosMuoGen->T0_at << std::endl;
153 <<
" Py=" << CosMuoGen->Py_at
154 <<
" Pz=" << CosMuoGen->Pz_at << std::endl;
155 for (
unsigned int i=0;
i<CosMuoGen->Id_sf.size(); ++
i) {
156 std::cout <<
"Id_sf[" <<
i <<
"]=" << CosMuoGen->Id_sf[
i]
157 <<
" Vx_sf[" <<
i <<
"]=" << CosMuoGen->Vx_sf[
i]
158 <<
" Vy_sf=" << CosMuoGen->Vy_sf[
i]
159 <<
" Vz_sf=" << CosMuoGen->Vz_sf[
i]
160 <<
" T0_sf=" << CosMuoGen->T0_sf[
i]
161 <<
" Px_sf=" << CosMuoGen->Px_sf[
i]
162 <<
" Py_sf=" << CosMuoGen->Py_sf[
i]
163 <<
" Pz_sf=" << CosMuoGen->Pz_sf[
i] << std::endl;
164 std::cout <<
"phi_sf=" << atan2(CosMuoGen->Px_sf[
i],CosMuoGen->Pz_sf[
i]) << std::endl;
165 std::cout <<
"Id_ug[" <<
i <<
"]=" << CosMuoGen->Id_ug[
i]
166 <<
" Vx_ug[" <<
i <<
"]=" << CosMuoGen->Vx_ug[
i]
167 <<
" Vy_ug=" << CosMuoGen->Vy_ug[
i]
168 <<
" Vz_ug=" << CosMuoGen->Vz_ug[
i]
169 <<
" T0_ug=" << CosMuoGen->T0_ug[
i]
170 <<
" Px_ug=" << CosMuoGen->Px_ug[
i]
171 <<
" Py_ug=" << CosMuoGen->Py_ug[
i]
172 <<
" Pz_ug=" << CosMuoGen->Pz_ug[
i] << std::endl;
173 std::cout <<
"phi_ug=" << atan2(CosMuoGen->Px_ug[
i],CosMuoGen->Pz_ug[
i]) << std::endl;;
178 fEvt =
new HepMC::GenEvent();
180 HepMC::GenVertex* Vtx_at =
new HepMC::GenVertex(HepMC::FourVector(CosMuoGen->Vx_at,
185 HepMC::FourVector p_at(CosMuoGen->Px_at,CosMuoGen->Py_at,CosMuoGen->Pz_at,CosMuoGen->E_at);
188 Vtx_at->add_particle_in(Part_at);
192 for (
unsigned int i=0;
i<CosMuoGen->Id_sf.size(); ++
i) {
194 HepMC::FourVector p_sf(CosMuoGen->Px_sf[
i],CosMuoGen->Py_sf[
i],CosMuoGen->Pz_sf[
i],CosMuoGen->E_sf[
i]);
197 Vtx_at->add_particle_out(Part_sf_in);
199 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]));
203 Vtx_sf->add_particle_in(Part_sf_in);
204 Vtx_sf->add_particle_out(Part_sf_out);
206 fEvt->add_vertex(Vtx_sf);
208 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]));
210 HepMC::FourVector p_ug(CosMuoGen->Px_ug[
i],CosMuoGen->Py_ug[
i],CosMuoGen->Pz_ug[
i],CosMuoGen->E_ug[
i]);
214 Vtx_ug->add_particle_in(Part_sf_out);
215 Vtx_ug->add_particle_out(Part_ug);
217 fEvt->add_vertex(Vtx_ug);
221 fEvt->add_vertex(Vtx_at);
222 fEvt->set_signal_process_vertex(Vtx_at);
224 fEvt->set_event_number(e.
id().
event());
225 fEvt->set_signal_process_id(13);
227 fEvt->weights().push_back( CosMuoGen->EventWeight );
228 fEvt->weights().push_back( CosMuoGen->Trials );
231 if (cmVerbosity_) fEvt->print();
233 std::auto_ptr<HepMCProduct> CMProduct(
new HepMCProduct());
234 CMProduct->addHepMCData( fEvt );
void setZDistOfTarget(double Z)
EventNumber_t event() const
void initialize(CLHEP::HepRandomEngine *rng=0)
virtual void produce(Event &e, const EventSetup &es)
void setMinEnu(double MinEn)
auto_ptr< ClusterSequence > cs
void setTIFOnly_constant(bool TIF)
std::string MultiMuonFileName
void setNuProdAlt(double NuPrdAlt)
void setZCentrOfTarget(double Z)
void setRhoAir(double VarRhoAir)
virtual void endRun(Run &r, const EventSetup &es)
CosMuoGenProducer(const ParameterSet &)
void setRadiusOfTarget(double R)
void setNumberOfEvents(unsigned int N)
virtual ~CosMuoGenProducer()
int32_t MultiMuonFileFirstEvent
void setMultiMuonFileFirstEvent(int MultiMuFile1stEvt)
void setRhoPlug(double VarRhoPlug)
void setMinPhi(double Phi)
void setMaxPhi(double Phi)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
void clear(CLHEP::HepGenMatrix &m)
Helper function: Reset all elements of a matrix to 0.
void setMultiMuonNmin(int MultiMuNmin)
void setMinTheta(double Theta)
void setMaxEnu(double MaxEn)
void setMultiMuon(bool MultiMu)
CosmicMuonGenerator * CosMuoGen
void setClayWidth(double ClayLaeyrWidth)
void setAcptAllMu(bool AllMu)
void setPlugVz(double PlugVtz)
void setTIFOnly_linear(bool TIF)
void setMultiMuonFileName(std::string MultiMuonFileName)
void setMTCCHalf(bool MTCC)
void setMinP_CMS(double P)
void setElossScaleFactor(double ElossScaleFact)
void setMaxTheta(double Theta)
void put(std::auto_ptr< PROD > product)
Put a new product.
void setRhoWall(double VarRhoSWall)
void setPlugVx(double PlugVtx)
void setRhoRock(double VarRhoRock)
void setRhoClay(double VarRhoClay)
void setTrackerOnly(bool Tracker)