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")) {
32 edm::LogInfo(
"TotemTransport") <<
"=============================================================================\n"
33 <<
" Bulding LHC Proton transporter based on TOTEM model\n"
34 <<
"=============================================================================\n";
41 <<
" missing in file. Cannot proceed. ";
53 CLHEP::HepRandomEngine* _engine) {
58 for (HepMC::GenEvent::particle_const_iterator eventParticle = evt->particles_begin();
59 eventParticle != evt->particles_end();
61 if (!((*eventParticle)->status() == 1 && (*eventParticle)->pdg_id() == 2212))
64 if (!(fabs((*eventParticle)->momentum().eta()) >
etaCut_ && fabs((*eventParticle)->momentum().pz()) >
momentumCut_))
67 unsigned int line = (*eventParticle)->barcode();
69 if (gpart->pdg_id() != 2212)
71 if (gpart->status() != 1)
87 edm::LogInfo(
"TotemTransport") <<
"Starting proton transport using TOTEM method\n";
91 const HepMC::GenVertex* in_pos = in_trk->production_vertex();
92 const HepMC::FourVector in_mom = in_trk->momentum();
96 double in_position[3] = {in_pos->position().x(), in_pos->position().y(), in_pos->position().z()};
102 in_position[0] - in_position[2] * (in_mom.x() / in_mom.z() - fCrossingAngleX *
urad);
103 in_position[1] = in_position[1] - in_position[2] * (in_mom.y() / (in_mom.z()));
105 double in_momentum[3] = {in_mom.x(), in_mom.y(), in_mom.z()};
106 double out_position[3];
107 double out_momentum[3];
109 <<
" position: " << in_position[0] <<
", " << in_position[1] <<
", " << in_position[2]
110 <<
" momentum: " << in_momentum[0] <<
", " << in_momentum[1] <<
", " << in_momentum[2];
115 if (in_mom.z() > 0) {
125 bool invert_beam_coord_system =
129 in_position, in_momentum, out_position, out_momentum, invert_beam_coord_system, m_Zout_ - m_Zin_);
135 <<
"position: " << out_position[0] <<
", " << out_position[1] <<
", "
136 << out_position[2] <<
"momentum: " << out_momentum[0] <<
", " << out_momentum[1]
137 <<
", " << out_momentum[2];
139 if (out_position[0] * out_position[0] + out_position[1] * out_position[1] >
141 edm::LogInfo(
"TotemTransport") <<
"Proton ouside beampipe";
142 edm::LogInfo(
"TotemTransport") <<
"===== END Transport "
143 <<
"====================";
147 TVector3 out_pos(out_position[0] * meter, out_position[1] * meter, out_position[2] * meter);
148 TVector3 out_mom(out_momentum[0], out_momentum[1], out_momentum[2]);
151 LogDebug(
"TotemTransport") <<
"output -> position: ";
153 LogDebug(
"TotemTransport") <<
" momentum: ";
157 double px = -out_momentum[0];
158 double py = out_momentum[1];
162 TLorentzVector p_out(
px,
py, pz,
e);
163 double x1_ctpps = -out_position[0] * meter;
164 double y1_ctpps = out_position[1] * meter;
166 unsigned int line = in_trk->barcode();
169 LogDebug(
"TotemTransport") <<
"TotemTransport:filterPPS: barcode = " <<
line <<
" x= " << x1_ctpps
170 <<
" y= " << y1_ctpps;
181 TFile*
f = TFile::Open(
fileName.fullPath().c_str(),
"read");
186 edm::LogInfo(
"TotemTransport") <<
"Root file opened, pointer:" <<
f;