4 #include <CLHEP/Random/RandGauss.h>
5 #include <CLHEP/Units/GlobalSystemOfUnits.h>
9 : verbosity_(iConfig.getParameter<bool>(
"Verbosity")),
10 bApplyZShift(iConfig.getParameter<bool>(
"ApplyZShift")),
11 useBeamPositionFromLHCInfo_(iConfig.getParameter<bool>(
"useBeamPositionFromLHCInfo")),
12 produceHitsRelativeToBeam_(iConfig.getParameter<bool>(
"produceHitsRelativeToBeam")),
13 fPPSRegionStart_45(iConfig.getParameter<double>(
"PPSRegionStart_45")),
14 fPPSRegionStart_56(iConfig.getParameter<double>(
"PPSRegionStart_56")),
15 beamEnergy_(iConfig.getParameter<double>(
"BeamEnergy")),
16 etaCut_(iConfig.getParameter<double>(
"EtaCut")),
17 momentumCut_(iConfig.getParameter<double>(
"MomentumCut")) {
22 p_out.SetPx(p->momentum().px());
23 p_out.SetPy(p->momentum().py());
24 p_out.SetPz(p->momentum().pz());
25 p_out.SetE(p->momentum().e());
27 p->set_momentum(HepMC::FourVector(p_out.Px(), p_out.Py(), p_out.Pz(), p_out.E()));
30 double theta = p_out.Theta();
31 double thetax = atan(p_out.Px() / fabs(p_out.Pz()));
32 double thetay = atan(p_out.Py() / fabs(p_out.Pz()));
36 int direction = (p_out.Pz() > 0) ? 1 : -1;
46 double denergy = (double)CLHEP::RandGauss::shoot(
engine_, 0.,
m_sig_E);
48 double s_theta =
sqrt(
pow(thetax + dtheta_x * urad, 2) +
pow(thetay + dtheta_y * urad, 2));
49 double s_phi = atan2(thetay + dtheta_y * urad, thetax + dtheta_x * urad);
53 p_out.SetPx((
double)p *
sin(s_theta) *
cos(s_phi));
54 p_out.SetPy((
double)p *
sin(s_theta) *
sin(s_phi));
55 p_out.SetPz((
double)p * (
cos(s_theta)) * direction);
69 gpart = in_evt->barcode_to_particle(line);
71 direction = (gpart->momentum().pz() > 0) ? 1 : -1;
76 double time = (ddd * meter - gpart->production_vertex()->position().z() * mm);
85 LogDebug(
"BaseProtonTransportEventProcessing")
86 <<
"BaseProtonTransport:: x= " << (*(
m_xAtTrPoint.find(line))).second <<
"\n"
87 <<
"BaseProtonTransport:: y= " << (*(
m_yAtTrPoint.find(line))).second <<
"\n"
88 <<
"BaseProtonTransport:: z= " << ddd * direction *
m_to_mm <<
"\n"
89 <<
"BaseProtonTransport:: t= " << time;
91 TLorentzVector
const& p_out = (it).
second;
93 HepMC::GenVertex* vert =
new HepMC::GenVertex(HepMC::FourVector((*(
m_xAtTrPoint.find(line))).second,
96 time + time * 0.001));
99 HepMC::FourVector(p_out.Px(), p_out.Py(), p_out.Pz(), p_out.E()), gpart->pdg_id(), 1, gpart->flow()));
100 evt->add_vertex(vert);
103 int outgoing = (*vert->particles_out_const_begin())->barcode();
107 LogDebug(
"BaseProtonTransportEventProcessing")
108 <<
"BaseProtonTransport:addPartToHepMC: LHCTransportLink " << theLink;
double fPPSRegionStart_45
BaseProtonTransport(const edm::ParameterSet &iConfig)
void setBeamEnergy(double e)
Sin< T >::type sin(const T &t)
Geom::Theta< T > theta() const
U second(std::pair< T, U > const &p)
double fCrossingAngleX_56
Cos< T >::type cos(const T &t)
double fPPSRegionStart_56
CLHEP::HepRandomEngine * engine_
std::map< unsigned int, double > m_xAtTrPoint
void ApplyBeamCorrection(HepMC::GenParticle *p)
static const double m_to_mm
std::map< unsigned int, TLorentzVector > m_beamPart
static const double ProtonMassSQ
std::map< unsigned int, double > m_yAtTrPoint
std::vector< LHCTransportLink > m_CorrespondenceMap
Power< A, B >::type pow(const A &a, const B &b)
void addPartToHepMC(const HepMC::GenEvent *, HepMC::GenEvent *)
double fCrossingAngleX_45