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")) {
35 edm::LogInfo(
"TotemTransport") <<
"=============================================================================\n"
36 <<
" Bulding LHC Proton transporter based on TOTEM model\n"
37 <<
"=============================================================================\n";
44 <<
" missing in file. Cannot proceed. ";
56 CLHEP::HepRandomEngine* _engine) {
61 for (HepMC::GenEvent::particle_const_iterator eventParticle = evt->particles_begin();
62 eventParticle != evt->particles_end();
64 if (!((*eventParticle)->status() == 1 && (*eventParticle)->pdg_id() == 2212))
67 if (!(fabs((*eventParticle)->momentum().eta()) >
etaCut_ && fabs((*eventParticle)->momentum().pz()) >
momentumCut_))
70 unsigned int line = (*eventParticle)->barcode();
72 if (gpart->pdg_id() != 2212)
74 if (gpart->status() != 1)
90 edm::LogInfo(
"TotemTransport") <<
"Starting proton transport using TOTEM method\n";
94 const HepMC::GenVertex* in_pos = in_trk->production_vertex();
95 const HepMC::FourVector in_mom = in_trk->momentum();
99 double in_position[3] = {(in_pos->position().x() -
fVtxMeanX * cm) / meter +
fBeamXatIP * mm / meter,
101 (in_pos->position().z() -
fVtxMeanZ * cm) / meter};
105 in_position[0] = in_position[0] +
106 (
tan((
long double)fCrossingAngle *
urad) - ((
long double)in_mom.x()) / ((
long double)in_mom.z())) *
108 in_position[1] = in_position[1] - ((
long double)in_mom.y()) / ((
long double)in_mom.z()) * in_position[2];
111 double in_momentum[3] = {in_mom.x(), in_mom.y(), in_mom.z()};
112 double out_position[3];
113 double out_momentum[3];
115 <<
" position: " << in_position[0] <<
", " << in_position[1] <<
", " << in_position[2]
116 <<
" momentum: " << in_momentum[0] <<
", " << in_momentum[1] <<
", " << in_momentum[2];
121 if (in_mom.z() > 0) {
131 bool invert_beam_coord_system =
135 in_position, in_momentum, out_position, out_momentum, invert_beam_coord_system, m_Zout_ - m_Zin_);
141 <<
"position: " << out_position[0] <<
", " << out_position[1] <<
", "
142 << out_position[2] <<
"momentum: " << out_momentum[0] <<
", " << out_momentum[1]
143 <<
", " << out_momentum[2];
145 if (out_position[0] * out_position[0] + out_position[1] * out_position[1] >
147 edm::LogInfo(
"TotemTransport") <<
"Proton ouside beampipe";
148 edm::LogInfo(
"TotemTransport") <<
"===== END Transport "
149 <<
"====================";
153 TVector3 out_pos(out_position[0] * meter, out_position[1] * meter, out_position[2] * meter);
154 TVector3 out_mom(out_momentum[0], out_momentum[1], out_momentum[2]);
157 LogDebug(
"TotemTransport") <<
"output -> position: ";
159 LogDebug(
"TotemTransport") <<
" momentum: ";
163 double px = -out_momentum[0];
164 double py = out_momentum[1];
168 TLorentzVector p_out(
px,
py, pz,
e);
169 double x1_ctpps = -out_position[0] * meter;
170 double y1_ctpps = out_position[1] * meter;
172 unsigned int line = in_trk->barcode();
175 LogDebug(
"TotemTransport") <<
"TotemTransport:filterPPS: barcode = " <<
line <<
" x= " << x1_ctpps
176 <<
" y= " << y1_ctpps;
187 TFile*
f = TFile::Open(
fileName.fullPath().c_str(),
"read");
192 edm::LogInfo(
"TotemTransport") <<
"Root file opened, pointer:" <<
f;