CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
TotemTransport Class Reference

#include <TotemTransport.h>

Inheritance diagram for TotemTransport:
ProtonTransport

Public Member Functions

void process (const HepMC::GenEvent *ev, const edm::EventSetup &es, CLHEP::HepRandomEngine *engine) override
 
 TotemTransport (const edm::ParameterSet &ps, bool verbosity)
 
 TotemTransport ()
 
 ~TotemTransport () override
 
- Public Member Functions inherited from ProtonTransport
void addPartToHepMC (HepMC::GenEvent *)
 
void ApplyBeamCorrection (HepMC::GenParticle *p)
 
void ApplyBeamCorrection (TLorentzVector &p)
 
void clear ()
 
std::vector< LHCTransportLink > & getCorrespondenceMap ()
 
 ProtonTransport ()
 
virtual ~ProtonTransport ()
 

Private Member Functions

LHCOpticsApproximatorReadParameterization (const std::string &, const std::string &)
 
bool transportProton (const HepMC::GenParticle *)
 

Private Attributes

LHCOpticsApproximatorm_aprox_ip_150_l = 0
 
LHCOpticsApproximatorm_aprox_ip_150_r = 0
 
double m_beampipe_aperture_radius
 
double m_fEtacut
 
double m_fMomentumMin
 
std::string m_model_ip_150_l_name
 
double m_model_ip_150_l_zmax
 
double m_model_ip_150_l_zmin
 
std::string m_model_ip_150_r_name
 
double m_model_ip_150_r_zmax
 
double m_model_ip_150_r_zmin
 
std::string m_model_root_file_l
 
std::string m_model_root_file_r
 
edm::FileInPath m_opticsFileBeam1_
 
edm::FileInPath m_opticsFileBeam2_
 
edm::ParameterSet m_parameters
 
edm::ESHandle< ParticleDataTablem_pdt
 
edm::EDGetTokenT< edm::HepMCProductm_protonsToken_
 
bool m_verbosity
 
double m_Zin_
 
double m_Zout_
 

Additional Inherited Members

- Protected Types inherited from ProtonTransport
enum  TransportMode { TransportMode::HECTOR, TransportMode::TOTEM }
 
- Protected Attributes inherited from ProtonTransport
bool bApplyZShift
 
CLHEP::HepRandomEngine * engine
 
double fBeamEnergy
 
double fBeamMomentum
 
double fBeamXatIP
 
double fBeamYatIP
 
double fCrossingAngle_45
 
double fCrossingAngle_56
 
double fPPSRegionStart_45
 
double fPPSRegionStart_56
 
double fVtxMeanX
 
double fVtxMeanY
 
double fVtxMeanZ
 
std::map< unsigned int, TLorentzVector > m_beamPart
 
std::vector< LHCTransportLinkm_CorrespondenceMap
 
double m_sig_E
 
double m_sigmaSTX
 
double m_sigmaSTY
 
double m_sigmaSX
 
double m_sigmaSY
 
bool m_verbosity
 
std::map< unsigned int, double > m_xAtTrPoint
 
std::map< unsigned int, double > m_yAtTrPoint
 
TransportMode MODE
 
int NEvent
 

Detailed Description

Definition at line 24 of file TotemTransport.h.

Constructor & Destructor Documentation

TotemTransport::TotemTransport ( const edm::ParameterSet ps,
bool  verbosity 
)

Definition at line 15 of file TotemTransport.cc.

References ProtonTransport::bApplyZShift, cmsRelvalreport::exit, ProtonTransport::fBeamEnergy, ProtonTransport::fBeamMomentum, ProtonTransport::fBeamXatIP, ProtonTransport::fBeamYatIP, ProtonTransport::fCrossingAngle_45, ProtonTransport::fCrossingAngle_56, ProtonTransport::fPPSRegionStart_45, ProtonTransport::fPPSRegionStart_56, ProtonTransport::fVtxMeanX, ProtonTransport::fVtxMeanY, ProtonTransport::fVtxMeanZ, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), m_aprox_ip_150_l, m_aprox_ip_150_r, m_model_ip_150_l_name, m_model_ip_150_l_zmax, m_model_ip_150_r_name, m_model_ip_150_r_zmax, m_model_root_file_l, m_model_root_file_r, m_parameters, ProtonTransport::m_sig_E, ProtonTransport::m_sigmaSTX, ProtonTransport::m_sigmaSTY, ProtonTransport::MODE, ProtonMassSQ, ReadParameterization(), mathSSE::sqrt(), and ProtonTransport::TOTEM.

15  :ProtonTransport(),
16  m_parameters(iConfig.getParameter<edm::ParameterSet>("BeamProtTransportSetup")),
17  m_verbosity(iConfig.getParameter<bool>("Verbosity")),
22  m_model_ip_150_r_zmin(m_parameters.getParameter<double>("Model_IP_150_R_Zmin")),
23  m_model_ip_150_r_zmax(m_parameters.getParameter<double>("Model_IP_150_R_Zmax")),
24  m_model_ip_150_l_zmin(m_parameters.getParameter<double>("Model_IP_150_L_Zmin")),
25  m_model_ip_150_l_zmax(m_parameters.getParameter<double>("Model_IP_150_L_Zmax")),
26  m_beampipe_aperture_radius(m_parameters.getParameter<double>("BeampipeApertureRadius"))
27 {
28  fBeamEnergy= m_parameters.getParameter<double>("sqrtS");
29  m_sigmaSTX = m_parameters.getParameter<double>("beamDivergenceX");
30  m_sigmaSTY = m_parameters.getParameter<double>("beamDivergenceY");
31  m_sig_E = m_parameters.getParameter<double>("beamEnergyDispersion");
32  fCrossingAngle_45 = m_parameters.getParameter<double>("halfCrossingAngleSector45");
33  fCrossingAngle_56 = m_parameters.getParameter<double>("halfCrossingAngleSector56");
34  fVtxMeanX = iConfig.getParameter<double>("VtxMeanX");
35  fVtxMeanY = iConfig.getParameter<double>("VtxMeanY");
36  fVtxMeanZ = iConfig.getParameter<double>("VtxMeanZ");
39  bApplyZShift = m_parameters.getParameter<bool>("ApplyZShift");
40 
42  edm::LogInfo("ProtonTransport")
43  <<"=============================================================================\n"
44  <<" Bulding LHC Proton transporter based on TOTEM model\n"
45  <<"=============================================================================\n";
46 
48 
51 
54 
55  if (m_aprox_ip_150_r == nullptr || m_aprox_ip_150_l == nullptr) {
56  edm::LogError("ProtonTransport") << "Parameterisation "
57  << m_model_ip_150_r_name << " or " << m_model_ip_150_l_name << " missing in file. Cannot proceed. ";
58  exit(1);
59  }
60  edm::LogInfo("TotemRPProtonTransportSetup") <<
61  "Parameterizations read from file, pointers:" << m_aprox_ip_150_r << " " << m_aprox_ip_150_l << " ";
62 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
double fPPSRegionStart_45
edm::ParameterSet m_parameters
double m_model_ip_150_l_zmax
double m_model_ip_150_l_zmin
TransportMode MODE
std::string m_model_ip_150_r_name
double fCrossingAngle_45
LHCOpticsApproximator * m_aprox_ip_150_l
double fCrossingAngle_56
std::string m_model_ip_150_l_name
T sqrt(T t)
Definition: SSEVec.h:18
double fPPSRegionStart_56
std::string m_model_root_file_l
double m_model_ip_150_r_zmin
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
static const double ProtonMassSQ
double m_model_ip_150_r_zmax
TotemTransport::TotemTransport ( )
TotemTransport::~TotemTransport ( )
override

Definition at line 11 of file TotemTransport.cc.

References ProtonTransport::clear().

12 {
13  this->clear();
14 }

Member Function Documentation

void TotemTransport::process ( const HepMC::GenEvent ev,
const edm::EventSetup es,
CLHEP::HepRandomEngine *  engine 
)
overridevirtual

Adds the stable protons from the event ev to a beamline

Implements ProtonTransport.

Definition at line 63 of file TotemTransport.cc.

References ProtonTransport::addPartToHepMC(), ProtonTransport::engine, GenParticle::GenParticle, mps_splice::line, ProtonTransport::m_beamPart, and transportProton().

64 {
65  engine=_engine;
66 
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();
70  HepMC::GenParticle * gpart = (*eventParticle);
71  if ( gpart->pdg_id()!=2212 ) continue; // only transport stable protons
72  if ( gpart->status()!=1 /*&& gpart->status()<83 */) continue;
73  if ( m_beamPart.find(line) != m_beamPart.end() ) continue;
74 
75 
76  transportProton(gpart);
77 
78  }
79  addPartToHepMC(const_cast<HepMC::GenEvent*>(evt));
80 }
std::map< unsigned int, TLorentzVector > m_beamPart
bool transportProton(const HepMC::GenParticle *)
void addPartToHepMC(HepMC::GenEvent *)
CLHEP::HepRandomEngine * engine
LHCOpticsApproximator * TotemTransport::ReadParameterization ( const std::string &  m_model_name,
const std::string &  rootfile 
)
private

Definition at line 151 of file TotemTransport.cc.

References f, and MillePedeFileConverter_cfg::fileName.

Referenced by TotemTransport().

152 {
154  TFile *f = TFile::Open(fileName.fullPath().c_str(), "read");
155  if (!f) {
156  edm::LogError("TotemRPProtonTransportSetup") << "File " << fileName << " not found. Exiting.";
157  return nullptr;
158  }
159  edm::LogInfo("TotemRPProtonTransportSetup") << "Root file opened, pointer:" << f;
160 
161  // read parametrization
162  LHCOpticsApproximator* aprox = (LHCOpticsApproximator *) f->Get(m_model_name.c_str());
163  f->Close();
164  return aprox;
165 }
double f[11][100]
Class finds the parametrisation of MADX proton transport and transports the protons according to it 5...
bool TotemTransport::transportProton ( const HepMC::GenParticle *  in_trk)
private

Definition at line 81 of file TotemTransport.cc.

References ProtonTransport::ApplyBeamCorrection(), MillePedeFileConverter_cfg::e, ProtonTransport::fBeamXatIP, ProtonTransport::fBeamYatIP, ProtonTransport::fCrossingAngle_45, ProtonTransport::fCrossingAngle_56, ProtonTransport::fVtxMeanX, ProtonTransport::fVtxMeanY, ProtonTransport::fVtxMeanZ, mps_splice::line, LogDebug, m_aprox_ip_150_l, m_aprox_ip_150_r, ProtonTransport::m_beamPart, m_beampipe_aperture_radius, m_model_ip_150_l_zmax, m_model_ip_150_l_zmin, m_model_ip_150_r_zmax, m_model_ip_150_r_zmin, m_verbosity, ProtonTransport::m_xAtTrPoint, ProtonTransport::m_yAtTrPoint, m_Zin_, m_Zout_, ProtonMassSQ, mathSSE::sqrt(), funct::tan(), LHCOpticsApproximator::Transport_m_GeV(), and urad.

Referenced by process().

82 {
83  edm::LogInfo("ProtonTransport")<<"Starting proton transport using TOTEM method\n";
84  ApplyBeamCorrection(const_cast<HepMC::GenParticle*>(in_trk));
85 
86  const HepMC::GenVertex* in_pos = in_trk->production_vertex();
87  const HepMC::FourVector in_mom = in_trk->momentum();
88 //
89 // ATTENTION: HepMC uses mm, vertex config of CMS uses cm and SimTransport uses mm
90 //
91  double in_position[3] = {(in_pos->position().x()-fVtxMeanX*cm) / meter+fBeamXatIP*mm/meter,
92  (in_pos->position().y()-fVtxMeanY*cm) / meter+fBeamYatIP*mm/meter,
93  (in_pos->position().z()-fVtxMeanZ*cm) / meter}; // move to z=0 if configured below
94 
95 // (bApplyZShift) -- The TOTEM parameterization requires the shift to z=0
96  double fCrossingAngle = (in_mom.z()>0)?fCrossingAngle_45:-fCrossingAngle_56;
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];
99  in_position[2] = 0.;
100 //
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];
107 
108  LHCOpticsApproximator* approximator_= nullptr;
109  if (in_mom.z()>0) {approximator_ = m_aprox_ip_150_l; m_Zin_ = m_model_ip_150_l_zmin; m_Zout_ = m_model_ip_150_l_zmax;}
111 
112  bool invert_beam_coord_system=true; // it doesn't matter the option here, it is hard coded as TRUE inside LHCOpticsApproximator!
113 
114  bool tracked = approximator_->Transport_m_GeV(in_position, in_momentum, out_position, out_momentum, invert_beam_coord_system, m_Zout_ - m_Zin_);
115 
116  if (!tracked) return false;
117 
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];
121 
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 " << "====================";
126  return false;
127  }
128 
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]; // this need to be checked again, since it seems an invertion is occuring in the prop.
135  double pz = out_momentum[2];
136  double e = sqrt(px*px+py*py+pz*pz+ProtonMassSQ);
137  TLorentzVector p_out(px,py,pz,e);
138  double x1_ctpps = -out_position[0]*meter; // Totem parameterization uses meter, one need it in millimeter
139  double y1_ctpps = -out_position[1]*meter;
140 
141  unsigned int line = in_trk->barcode();
142 
143  if(m_verbosity) LogDebug("ProtonTransportEventProcessing") <<
144  "ProtonTransport:filterPPS: barcode = " << line << " x= "<< x1_ctpps <<" y= " << y1_ctpps;
145 
146  m_beamPart[line] = p_out;
147  m_xAtTrPoint[line] = x1_ctpps;
148  m_yAtTrPoint[line] = y1_ctpps;
149  return true;
150 }
#define LogDebug(id)
void ApplyBeamCorrection(HepMC::GenParticle *p)
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
static const double urad
double fCrossingAngle_45
LHCOpticsApproximator * m_aprox_ip_150_l
std::map< unsigned int, double > m_xAtTrPoint
double fCrossingAngle_56
T sqrt(T t)
Definition: SSEVec.h:18
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
double m_model_ip_150_r_zmin
Class finds the parametrisation of MADX proton transport and transports the protons according to it 5...
double m_beampipe_aperture_radius
LHCOpticsApproximator * m_aprox_ip_150_r
static const double ProtonMassSQ
double m_model_ip_150_r_zmax

Member Data Documentation

LHCOpticsApproximator* TotemTransport::m_aprox_ip_150_l = 0
private

Definition at line 42 of file TotemTransport.h.

Referenced by TotemTransport(), and transportProton().

LHCOpticsApproximator* TotemTransport::m_aprox_ip_150_r = 0
private

Definition at line 41 of file TotemTransport.h.

Referenced by TotemTransport(), and transportProton().

double TotemTransport::m_beampipe_aperture_radius
private

Definition at line 59 of file TotemTransport.h.

Referenced by transportProton().

double TotemTransport::m_fEtacut
private

Definition at line 62 of file TotemTransport.h.

double TotemTransport::m_fMomentumMin
private

Definition at line 63 of file TotemTransport.h.

std::string TotemTransport::m_model_ip_150_l_name
private

Definition at line 46 of file TotemTransport.h.

Referenced by TotemTransport().

double TotemTransport::m_model_ip_150_l_zmax
private

Definition at line 50 of file TotemTransport.h.

Referenced by TotemTransport(), and transportProton().

double TotemTransport::m_model_ip_150_l_zmin
private

Definition at line 49 of file TotemTransport.h.

Referenced by transportProton().

std::string TotemTransport::m_model_ip_150_r_name
private

Definition at line 45 of file TotemTransport.h.

Referenced by TotemTransport().

double TotemTransport::m_model_ip_150_r_zmax
private

Definition at line 48 of file TotemTransport.h.

Referenced by TotemTransport(), and transportProton().

double TotemTransport::m_model_ip_150_r_zmin
private

Definition at line 47 of file TotemTransport.h.

Referenced by transportProton().

std::string TotemTransport::m_model_root_file_l
private

Definition at line 44 of file TotemTransport.h.

Referenced by TotemTransport().

std::string TotemTransport::m_model_root_file_r
private

Definition at line 43 of file TotemTransport.h.

Referenced by TotemTransport().

edm::FileInPath TotemTransport::m_opticsFileBeam1_
private

Definition at line 55 of file TotemTransport.h.

edm::FileInPath TotemTransport::m_opticsFileBeam2_
private

Definition at line 55 of file TotemTransport.h.

edm::ParameterSet TotemTransport::m_parameters
private

Definition at line 39 of file TotemTransport.h.

Referenced by TotemTransport().

edm::ESHandle< ParticleDataTable > TotemTransport::m_pdt
private

Definition at line 57 of file TotemTransport.h.

edm::EDGetTokenT<edm::HepMCProduct> TotemTransport::m_protonsToken_
private

Definition at line 52 of file TotemTransport.h.

bool TotemTransport::m_verbosity
private

Definition at line 40 of file TotemTransport.h.

Referenced by transportProton().

double TotemTransport::m_Zin_
private

Definition at line 60 of file TotemTransport.h.

Referenced by transportProton().

double TotemTransport::m_Zout_
private

Definition at line 61 of file TotemTransport.h.

Referenced by transportProton().