3 #include <CLHEP/Units/GlobalSystemOfUnits.h> 4 #include <CLHEP/Random/RandGauss.h> 5 #include "TLorentzVector.h" 43 <<
"=============================================================================\n" 44 <<
" Bulding LHC Proton transporter based on TOTEM model\n" 45 <<
"=============================================================================\n";
67 for (HepMC::GenEvent::particle_const_iterator eventParticle =evt->particles_begin(); eventParticle != evt->particles_end(); ++eventParticle ) {
68 if (!((*eventParticle)->status() == 1 && (*eventParticle)->pdg_id()==2212 ))
continue;
69 unsigned int line = (*eventParticle)->barcode();
71 if ( gpart->pdg_id()!=2212 )
continue;
72 if ( gpart->status()!=1 )
continue;
83 edm::LogInfo(
"ProtonTransport")<<
"Starting proton transport using TOTEM method\n";
86 const HepMC::GenVertex* in_pos = in_trk->production_vertex();
87 const HepMC::FourVector in_mom = in_trk->momentum();
93 (in_pos->position().z()-
fVtxMeanZ*cm) / meter};
97 in_position[0] = in_position[0]+(
tan((
long double)fCrossingAngle*
urad)-((
long double)in_mom.x())/((
long double)in_mom.z()))*in_position[2];
98 in_position[1] = in_position[1]-((
long double)in_mom.y())/((
long double)in_mom.z())*in_position[2];
101 double in_momentum[3] = {in_mom.x(), in_mom.y() , in_mom.z()};
102 double out_position[3];
103 double out_momentum[3];
104 edm::LogInfo(
"ProtonTransport") <<
"before transport ->" <<
105 " position: " << in_position[0] <<
", " << in_position[1] <<
", " << in_position[2] <<
106 " momentum: " << in_momentum[0] <<
", " << in_momentum[1] <<
", " << in_momentum[2];
112 bool invert_beam_coord_system=
true;
114 bool tracked = approximator_->
Transport_m_GeV(in_position, in_momentum, out_position, out_momentum, invert_beam_coord_system,
m_Zout_ -
m_Zin_);
116 if (!tracked)
return false;
118 edm::LogInfo(
"ProtonTransport") <<
"after transport -> " <<
119 "position: " << out_position[0] <<
", " << out_position[1] <<
", " << out_position[2] <<
120 "momentum: " << out_momentum[0] <<
", " << out_momentum[1] <<
", " << out_momentum[2];
122 if (out_position[0] * out_position[0] + out_position[1] * out_position[1] >
124 edm::LogInfo(
"ProtonTransport") <<
"Proton ouside beampipe";
125 edm::LogInfo(
"ProtonTransport") <<
"===== END Transport " <<
"====================";
129 TVector3 out_pos(out_position[0] * meter, out_position[1] * meter, out_position[2] * meter);
130 TVector3 out_mom(out_momentum[0], out_momentum[1], out_momentum[2]);
131 edm::LogInfo(
"TotemRPProtonTransportModel") <<
"output -> " <<
"position: ";out_pos.Print();
132 edm::LogInfo(
"TotemRPProtonTransportModel") <<
" momentum: ";out_mom.Print();
133 double px = -out_momentum[0];
134 double py = out_momentum[1];
135 double pz = out_momentum[2];
137 TLorentzVector p_out(px,py,pz,e);
138 double x1_ctpps = -out_position[0]*meter;
139 double y1_ctpps = -out_position[1]*meter;
141 unsigned int line = in_trk->barcode();
144 "ProtonTransport:filterPPS: barcode = " << line <<
" x= "<< x1_ctpps <<
" y= " << y1_ctpps;
154 TFile *
f = TFile::Open(
fileName.fullPath().c_str(),
"read");
159 edm::LogInfo(
"TotemRPProtonTransportSetup") <<
"Root file opened, pointer:" <<
f;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
double fPPSRegionStart_45
void ApplyBeamCorrection(HepMC::GenParticle *p)
edm::ParameterSet m_parameters
double m_model_ip_150_l_zmax
double m_model_ip_150_l_zmin
std::map< unsigned int, TLorentzVector > m_beamPart
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::map< unsigned int, double > m_yAtTrPoint
~TotemTransport() override
std::string m_model_ip_150_r_name
LHCOpticsApproximator * m_aprox_ip_150_l
std::map< unsigned int, double > m_xAtTrPoint
std::string m_model_ip_150_l_name
double fPPSRegionStart_56
std::string m_model_root_file_l
Tan< T >::type tan(const T &t)
double m_model_ip_150_r_zmin
Class finds the parametrisation of MADX proton transport and transports the protons according to it 5...
bool transportProton(const HepMC::GenParticle *)
void addPartToHepMC(HepMC::GenEvent *)
std::string m_model_root_file_r
double m_beampipe_aperture_radius
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
double m_model_ip_150_r_zmax
CLHEP::HepRandomEngine * engine