3 #include <CLHEP/Random/RandGauss.h> 4 #include <CLHEP/Units/GlobalSystemOfUnits.h> 25 gpart = evt->barcode_to_particle(line);
27 direction = (gpart->momentum().pz() > 0) ? 1 : -1;
35 double time = (ddd * meter - gpart->production_vertex()->position().z() * mm);
43 LogDebug(
"ProtonTransportEventProcessing")
44 <<
"ProtonTransport:: x= " << (*(
m_xAtTrPoint.find(line))).second <<
"\n" 45 <<
"ProtonTransport:: y= " << (*(
m_yAtTrPoint.find(line))).second <<
"\n" 46 <<
"ProtonTransport:: z= " << ddd * direction *
m_to_mm <<
"\n" 47 <<
"ProtonTransport:: t= " <<
time;
49 TLorentzVector
const& p_out = (it).
second;
51 HepMC::GenVertex* vert =
new HepMC::GenVertex(HepMC::FourVector((*(
m_xAtTrPoint.find(line))).second,
54 time + time * 0.001));
57 vert->add_particle_in(gpart);
59 HepMC::FourVector(p_out.Px(), p_out.Py(), p_out.Pz(), p_out.E()), gpart->pdg_id(), 1, gpart->flow()));
60 evt->add_vertex(vert);
62 int ingoing = (*vert->particles_in_const_begin())->barcode();
63 int outgoing = (*vert->particles_out_const_begin())->barcode();
67 LogDebug(
"ProtonTransportEventProcessing") <<
"ProtonTransport:addPartToHepMC: LHCTransportLink " << theLink;
73 p_out.SetPx(p->momentum().px());
74 p_out.SetPy(p->momentum().py());
75 p_out.SetPz(p->momentum().pz());
76 p_out.SetE(p->momentum().e());
78 p->set_momentum(HepMC::FourVector(p_out.Px(), p_out.Py(), p_out.Pz(), p_out.E()));
81 double theta = p_out.Theta();
82 double thetax = atan(p_out.Px() / fabs(p_out.Pz()));
83 double thetay = atan(p_out.Py() / fabs(p_out.Pz()));
87 int direction = (p_out.Pz() > 0) ? 1 : -1;
97 double denergy = (double)CLHEP::RandGauss::shoot(
engine, 0.,
m_sig_E);
99 double s_theta =
sqrt(
pow(thetax + dtheta_x * urad, 2) +
pow(thetay + dtheta_y * urad, 2));
100 double s_phi = atan2(thetay + dtheta_y * urad, thetax + dtheta_x * urad);
104 p_out.SetPx((
double)p *
sin(s_theta) *
cos(s_phi));
105 p_out.SetPy((
double)p *
sin(s_theta) *
sin(s_phi));
106 p_out.SetPz((
double)p * (
cos(s_theta)) * direction);
double fPPSRegionStart_45
void ApplyBeamCorrection(HepMC::GenParticle *p)
std::map< unsigned int, TLorentzVector > m_beamPart
virtual ~ProtonTransport()
Sin< T >::type sin(const T &t)
std::map< unsigned int, double > m_yAtTrPoint
Geom::Theta< T > theta() const
std::vector< LHCTransportLink > m_CorrespondenceMap
std::map< unsigned int, double > m_xAtTrPoint
U second(std::pair< T, U > const &p)
double fPPSRegionStart_56
Cos< T >::type cos(const T &t)
void addPartToHepMC(HepMC::GenEvent *)
static const double m_to_mm
static const double ProtonMassSQ
Power< A, B >::type pow(const A &a, const B &b)
CLHEP::HepRandomEngine * engine