3 #include <CLHEP/Units/GlobalSystemOfUnits.h>
4 #include <CLHEP/Random/RandGauss.h>
5 #include "TLorentzVector.h"
12 m_model_ip_150_r_name(iConfig.getParameter<std::
string>(
"Model_IP_150_R_Name")),
13 m_model_ip_150_l_name(iConfig.getParameter<std::
string>(
"Model_IP_150_L_Name")),
14 m_beampipe_aperture_radius(iConfig.getParameter<double>(
"BeampipeApertureRadius")) {
30 edm::LogInfo(
"TotemTransport") <<
"=============================================================================\n"
31 <<
" Bulding LHC Proton transporter based on TOTEM model\n"
32 <<
"=============================================================================\n";
39 <<
" missing in file. Cannot proceed. ";
51 CLHEP::HepRandomEngine* _engine) {
56 for (HepMC::GenEvent::particle_const_iterator eventParticle = evt->particles_begin();
57 eventParticle != evt->particles_end();
59 if (!((*eventParticle)->status() == 1 && (*eventParticle)->pdg_id() == 2212))
62 if (!(fabs((*eventParticle)->momentum().eta()) >
etaCut_ && fabs((*eventParticle)->momentum().pz()) >
momentumCut_))
65 unsigned int line = (*eventParticle)->barcode();
67 if (gpart->pdg_id() != 2212)
69 if (gpart->status() != 1)
85 edm::LogInfo(
"TotemTransport") <<
"Starting proton transport using TOTEM method\n";
89 const HepMC::GenVertex* in_pos = in_trk->production_vertex();
90 const HepMC::FourVector in_mom = in_trk->momentum();
94 double in_position[3] = {in_pos->position().x(), in_pos->position().y(), in_pos->position().z()};
100 in_position[0] - in_position[2] * (in_mom.x() / in_mom.z() - fCrossingAngleX *
urad);
101 in_position[1] = in_position[1] - in_position[2] * (in_mom.y() / (in_mom.z()));
103 double in_momentum[3] = {in_mom.x(), in_mom.y(), in_mom.z()};
104 double out_position[3];
105 double out_momentum[3];
107 <<
" position: " << in_position[0] <<
", " << in_position[1] <<
", " << in_position[2]
108 <<
" momentum: " << in_momentum[0] <<
", " << in_momentum[1] <<
", " << in_momentum[2];
113 if (in_mom.z() > 0) {
123 bool invert_beam_coord_system =
127 in_position, in_momentum, out_position, out_momentum, invert_beam_coord_system, m_Zout_ - m_Zin_);
133 <<
"position: " << out_position[0] <<
", " << out_position[1] <<
", "
134 << out_position[2] <<
"momentum: " << out_momentum[0] <<
", " << out_momentum[1]
135 <<
", " << out_momentum[2];
137 if (out_position[0] * out_position[0] + out_position[1] * out_position[1] >
139 edm::LogInfo(
"TotemTransport") <<
"Proton ouside beampipe";
140 edm::LogInfo(
"TotemTransport") <<
"===== END Transport "
141 <<
"====================";
145 TVector3 out_pos(out_position[0] * meter, out_position[1] * meter, out_position[2] * meter);
146 TVector3 out_mom(out_momentum[0], out_momentum[1], out_momentum[2]);
149 LogDebug(
"TotemTransport") <<
"output -> position: ";
151 LogDebug(
"TotemTransport") <<
" momentum: ";
155 double px = -out_momentum[0];
156 double py = out_momentum[1];
160 TLorentzVector p_out(px, py, pz, e);
161 double x1_ctpps = -out_position[0] * meter;
162 double y1_ctpps = out_position[1] * meter;
164 unsigned int line = in_trk->barcode();
167 LogDebug(
"TotemTransport") <<
"TotemTransport:filterPPS: barcode = " << line <<
" x= " << x1_ctpps
168 <<
" y= " << y1_ctpps;
179 TFile*
f = TFile::Open(
fileName.fullPath().c_str(),
"read");
184 edm::LogInfo(
"TotemTransport") <<
"Root file opened, pointer:" <<
f;
double fPPSRegionStart_45
std::string beam1Filename_
std::string beam2Filename_
bool Transport_m_GeV(double in_pos[3], double in_momentum[3], double out_pos[3], double out_momentum[3], bool check_apertures, double z2_z1_dist) const
pos, momentum: x,y,z; pos in m, momentum in GeV/c
std::string m_model_ip_150_r_name
Log< level::Error, false > LogError
LHCOpticsApproximator * m_aprox_ip_150_l
std::string m_model_ip_150_l_name
double fCrossingAngleX_56
TotemTransport(const edm::ParameterSet &ps)
Class finds the parametrisation of MADX proton transport and transports the protons according to it 5...
double fPPSRegionStart_56
CLHEP::HepRandomEngine * engine_
Log< level::Info, false > LogInfo
bool transportProton(const HepMC::GenParticle *)
T getParameter(std::string const &) const
std::map< unsigned int, double > m_xAtTrPoint
void ApplyBeamCorrection(HepMC::GenParticle *p)
double m_beampipe_aperture_radius
std::map< unsigned int, TLorentzVector > m_beamPart
LHCOpticsApproximator * ReadParameterization(const std::string &, const std::string &)
LHCOpticsApproximator * m_aprox_ip_150_r
void process(const HepMC::GenEvent *ev, const edm::EventSetup &es, CLHEP::HepRandomEngine *engine) override
static const double ProtonMassSQ
std::map< unsigned int, double > m_yAtTrPoint
double fCrossingAngleX_45