4 #include <CLHEP/Random/RandGauss.h>
5 #include <CLHEP/Units/GlobalSystemOfUnits.h>
8 : verbosity_(iConfig.getParameter<bool>(
"Verbosity")),
9 bApplyZShift_(iConfig.getParameter<bool>(
"ApplyZShift")),
10 useBeamPositionFromLHCInfo_(iConfig.getParameter<bool>(
"useBeamPositionFromLHCInfo")),
11 produceHitsRelativeToBeam_(iConfig.getParameter<bool>(
"produceHitsRelativeToBeam")),
12 fPPSRegionStart_45_(iConfig.getParameter<double>(
"PPSRegionStart_45")),
13 fPPSRegionStart_56_(iConfig.getParameter<double>(
"PPSRegionStart_56")),
14 etaCut_(iConfig.getParameter<double>(
"EtaCut")),
15 momentumCut_(iConfig.getParameter<double>(
"MomentumCut")),
16 beamEnergy_(iConfig.getParameter<double>(
"BeamEnergy")) {
24 p_out.SetPx(p->momentum().px());
25 p_out.SetPy(p->momentum().py());
26 p_out.SetPz(p->momentum().pz());
27 p_out.SetE(p->momentum().e());
29 p->set_momentum(HepMC::FourVector(p_out.Px(), p_out.Py(), p_out.Pz(), p_out.E()));
33 double thetax = atan(p_out.Px() / fabs(p_out.Pz()));
34 double thetay = atan(p_out.Py() / fabs(p_out.Pz()));
38 int direction = (p_out.Pz() > 0) ? 1 : -1;
47 double s_theta =
std::sqrt(
pow(thetax + dtheta_x * urad, 2) +
std::pow(thetay + dtheta_y * urad, 2));
48 double s_phi = std::atan2(thetay + dtheta_y * urad, thetax + dtheta_x * urad);
53 p_out.SetPx(p * sint *
std::cos(s_phi));
54 p_out.SetPy(p * sint *
std::sin(s_phi));
55 p_out.SetPz(p *
std::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;
BaseProtonTransport(const edm::ParameterSet &iConfig)
double fCrossingAngleX_56_
Sin< T >::type sin(const T &t)
virtual ~BaseProtonTransport()
double fCrossingAngleX_45_
U second(std::pair< T, U > const &p)
double fPPSRegionStart_56_
Cos< T >::type cos(const T &t)
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
double fPPSRegionStart_45_
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 *)