CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Attributes
BaseProtonTransport Class Referenceabstract

#include <BaseProtonTransport.h>

Inheritance diagram for BaseProtonTransport:
HectorTransport OpticalFunctionsTransport TotemTransport

Public Member Functions

void addPartToHepMC (const HepMC::GenEvent *, HepMC::GenEvent *)
 
void ApplyBeamCorrection (HepMC::GenParticle *p)
 
void ApplyBeamCorrection (TLorentzVector &p)
 
 BaseProtonTransport (const edm::ParameterSet &iConfig)
 
double beamEnergy ()
 
double beamMomentum ()
 
void clear ()
 
std::vector< LHCTransportLink > & getCorrespondenceMap ()
 
virtual void process (const HepMC::GenEvent *ev, const edm::EventSetup &es, CLHEP::HepRandomEngine *engine)=0
 
virtual ~BaseProtonTransport ()
 

Protected Types

enum  TransportMode { TransportMode::HECTOR, TransportMode::TOTEM, TransportMode::OPTICALFUNCTIONS }
 

Protected Member Functions

void setBeamFileNames (const std::string &nam1, const std::string &nam2)
 
void setBeamParameters (double stx, double sty, double sx, double sy, double se)
 
void setCrossingAngles (double cx45, double cx56, double cy45, double cy56)
 

Protected Attributes

bool bApplyZShift_
 
std::string beam1Filename_ {""}
 
std::string beam2Filename_ {""}
 
CLHEP::HepRandomEngine * engine_ {nullptr}
 
double etaCut_
 
double fCrossingAngleX_45_ {0.0}
 
double fCrossingAngleX_56_ {0.0}
 
double fCrossingAngleY_45_ {0.0}
 
double fCrossingAngleY_56_ {0.0}
 
double fPPSRegionStart_45_
 
double fPPSRegionStart_56_
 
std::map< unsigned int, TLorentzVector > m_beamPart
 
std::vector< LHCTransportLinkm_CorrespondenceMap
 
std::map< unsigned int, double > m_xAtTrPoint
 
std::map< unsigned int, double > m_yAtTrPoint
 
TransportMode MODE
 
double momentumCut_
 
bool produceHitsRelativeToBeam_
 
bool useBeamPositionFromLHCInfo_
 
bool verbosity_
 

Private Attributes

double beamEnergy_
 
double beamMomentum_
 
double m_sig_E {0.0}
 
double m_sigmaSTX {0.0}
 
double m_sigmaSTY {0.0}
 
double m_sigmaSX {0.0}
 
double m_sigmaSY {0.0}
 

Detailed Description

Definition at line 17 of file BaseProtonTransport.h.

Member Enumeration Documentation

◆ TransportMode

enum BaseProtonTransport::TransportMode
strongprotected
Enumerator
HECTOR 
TOTEM 
OPTICALFUNCTIONS 

Definition at line 56 of file BaseProtonTransport.h.

56 { HECTOR, TOTEM, OPTICALFUNCTIONS };

Constructor & Destructor Documentation

◆ BaseProtonTransport()

BaseProtonTransport::BaseProtonTransport ( const edm::ParameterSet iConfig)

Definition at line 7 of file BaseProtonTransport.cc.

References beamEnergy_, beamMomentum_, ProtonMassSQ, and mathSSE::sqrt().

8  : verbosity_(iConfig.getParameter<bool>("Verbosity")),
9  bApplyZShift_(iConfig.getParameter<bool>("ApplyZShift")),
10  useBeamPositionFromLHCInfo_(iConfig.getParameter<bool>("useBeamPositionFromLHCInfo")),
11  produceHitsRelativeToBeam_(iConfig.getParameter<bool>("produceHitsRelativeToBeam")),
12  fPPSRegionStart_45_(iConfig.getParameter<double>("PPSRegionStart_45")),
13  fPPSRegionStart_56_(iConfig.getParameter<double>("PPSRegionStart_56")),
14  etaCut_(iConfig.getParameter<double>("EtaCut")),
15  momentumCut_(iConfig.getParameter<double>("MomentumCut")),
16  beamEnergy_(iConfig.getParameter<double>("BeamEnergy")) {
18 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
T sqrt(T t)
Definition: SSEVec.h:19
static const double ProtonMassSQ

◆ ~BaseProtonTransport()

BaseProtonTransport::~BaseProtonTransport ( )
virtual

Definition at line 20 of file BaseProtonTransport.cc.

References clear().

Member Function Documentation

◆ addPartToHepMC()

void BaseProtonTransport::addPartToHepMC ( const HepMC::GenEvent in_evt,
HepMC::GenEvent evt 
)

Definition at line 59 of file BaseProtonTransport.cc.

References first, fPPSRegionStart_45_, fPPSRegionStart_56_, GenParticle::GenParticle, mps_splice::line, LogDebug, m_beamPart, m_CorrespondenceMap, m_to_mm, m_xAtTrPoint, m_yAtTrPoint, edm::second(), protons_cff::time, and verbosity_.

59  {
60  m_CorrespondenceMap.clear();
61 
62  int direction = 0;
63  HepMC::GenParticle* gpart;
64 
65  unsigned int line;
66 
67  for (auto const& it : m_beamPart) {
68  line = (it).first;
69  gpart = in_evt->barcode_to_particle(line);
70 
71  direction = (gpart->momentum().pz() > 0) ? 1 : -1;
72 
73  // Totem uses negative Z for sector 56 while Hector uses always positive distance
74  double ddd = (direction > 0) ? fPPSRegionStart_45_ : fabs(fPPSRegionStart_56_);
75 
76  double time = (ddd * meter - gpart->production_vertex()->position().z() * mm); // mm
77 
78  //
79  // ATTENTION: at this point, the vertex at PPS is already in mm
80  //
81  if (ddd == 0.)
82  continue;
83 
84  if (verbosity_) {
85  LogDebug("BaseProtonTransportEventProcessing")
86  << "BaseProtonTransport:: x= " << (*(m_xAtTrPoint.find(line))).second << "\n"
87  << "BaseProtonTransport:: y= " << (*(m_yAtTrPoint.find(line))).second << "\n"
88  << "BaseProtonTransport:: z= " << ddd * direction * m_to_mm << "\n"
89  << "BaseProtonTransport:: t= " << time;
90  }
91  TLorentzVector const& p_out = (it).second;
92 
93  HepMC::GenVertex* vert = new HepMC::GenVertex(HepMC::FourVector((*(m_xAtTrPoint.find(line))).second,
94  (*(m_yAtTrPoint.find(line))).second,
95  ddd * direction * m_to_mm,
96  time + time * 0.001));
97 
98  vert->add_particle_out(new HepMC::GenParticle(
99  HepMC::FourVector(p_out.Px(), p_out.Py(), p_out.Pz(), p_out.E()), gpart->pdg_id(), 1, gpart->flow()));
100  evt->add_vertex(vert);
101 
102  int ingoing = 0; //do not attach the incoming proton to this vertex to avoid duplicating data
103  int outgoing = (*vert->particles_out_const_begin())->barcode();
104 
105  LHCTransportLink theLink(ingoing, outgoing);
106  if (verbosity_)
107  LogDebug("BaseProtonTransportEventProcessing")
108  << "BaseProtonTransport:addPartToHepMC: LHCTransportLink " << theLink;
109  m_CorrespondenceMap.push_back(theLink);
110  }
111 }
U second(std::pair< T, U > const &p)
std::map< unsigned int, double > m_xAtTrPoint
static const double m_to_mm
std::map< unsigned int, TLorentzVector > m_beamPart
std::map< unsigned int, double > m_yAtTrPoint
std::vector< LHCTransportLink > m_CorrespondenceMap
#define LogDebug(id)

◆ ApplyBeamCorrection() [1/2]

void BaseProtonTransport::ApplyBeamCorrection ( HepMC::GenParticle *  p)

Definition at line 22 of file BaseProtonTransport.cc.

References AlCaHLTBitMon_ParallelJobs::p.

Referenced by TotemTransport::transportProton().

22  {
23  TLorentzVector p_out;
24  p_out.SetPx(p->momentum().px());
25  p_out.SetPy(p->momentum().py());
26  p_out.SetPz(p->momentum().pz());
27  p_out.SetE(p->momentum().e());
28  ApplyBeamCorrection(p_out);
29  p->set_momentum(HepMC::FourVector(p_out.Px(), p_out.Py(), p_out.Pz(), p_out.E()));
30 }
void ApplyBeamCorrection(HepMC::GenParticle *p)

◆ ApplyBeamCorrection() [2/2]

void BaseProtonTransport::ApplyBeamCorrection ( TLorentzVector &  p)

Definition at line 32 of file BaseProtonTransport.cc.

References funct::cos(), MillePedeFileConverter_cfg::e, HCALHighEnergyHPDFilter_cfi::energy, engine_, fCrossingAngleX_45_, fCrossingAngleX_56_, m_sig_E, m_sigmaSTX, m_sigmaSTY, MODE, AlCaHLTBitMon_ParallelJobs::p, funct::pow(), ProtonMassSQ, funct::sin(), mathSSE::sqrt(), TOTEM, and urad.

32  {
33  double thetax = atan(p_out.Px() / fabs(p_out.Pz()));
34  double thetay = atan(p_out.Py() / fabs(p_out.Pz()));
35  double energy = p_out.E();
36  double urad = 1e-6;
37 
38  int direction = (p_out.Pz() > 0) ? 1 : -1;
39 
41  thetax += (p_out.Pz() > 0) ? fCrossingAngleX_45_ * urad : fCrossingAngleX_56_ * urad;
42 
43  double dtheta_x = (m_sigmaSTX <= 0.0) ? 0.0 : CLHEP::RandGauss::shoot(engine_, 0., m_sigmaSTX);
44  double dtheta_y = (m_sigmaSTY <= 0.0) ? 0.0 : CLHEP::RandGauss::shoot(engine_, 0., m_sigmaSTY);
45  double denergy = (m_sig_E <= 0.0) ? 0.0 : CLHEP::RandGauss::shoot(engine_, 0., m_sig_E);
46 
47  double s_theta = std::sqrt(pow(thetax + dtheta_x * urad, 2) + std::pow(thetay + dtheta_y * urad, 2));
48  double s_phi = std::atan2(thetay + dtheta_y * urad, thetax + dtheta_x * urad);
49  energy += denergy;
50  double p = std::sqrt(std::pow(energy, 2) - ProtonMassSQ);
51  double sint = std::sin(s_theta);
52 
53  p_out.SetPx(p * sint * std::cos(s_phi));
54  p_out.SetPy(p * sint * std::sin(s_phi));
55  p_out.SetPz(p * std::cos(s_theta) * direction);
56  p_out.SetE(energy);
57 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
static const double urad
T sqrt(T t)
Definition: SSEVec.h:19
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
CLHEP::HepRandomEngine * engine_
static const double ProtonMassSQ
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ beamEnergy()

double BaseProtonTransport::beamEnergy ( )
inline

Definition at line 32 of file BaseProtonTransport.h.

References beamEnergy_.

Referenced by HectorTransport::transportProton().

32 { return beamEnergy_; };

◆ beamMomentum()

double BaseProtonTransport::beamMomentum ( )
inline

◆ clear()

void BaseProtonTransport::clear ( void  )

Definition at line 112 of file BaseProtonTransport.cc.

References m_beamPart, m_CorrespondenceMap, m_xAtTrPoint, and m_yAtTrPoint.

Referenced by OpticalFunctionsTransport::process(), TotemTransport::process(), HectorTransport::process(), and ~BaseProtonTransport().

112  {
113  m_beamPart.clear();
114  m_xAtTrPoint.clear();
115  m_yAtTrPoint.clear();
116  m_CorrespondenceMap.clear();
117 }
std::map< unsigned int, double > m_xAtTrPoint
std::map< unsigned int, TLorentzVector > m_beamPart
std::map< unsigned int, double > m_yAtTrPoint
std::vector< LHCTransportLink > m_CorrespondenceMap

◆ getCorrespondenceMap()

std::vector<LHCTransportLink>& BaseProtonTransport::getCorrespondenceMap ( )
inline

Definition at line 22 of file BaseProtonTransport.h.

References m_CorrespondenceMap.

22 { return m_CorrespondenceMap; }
std::vector< LHCTransportLink > m_CorrespondenceMap

◆ process()

virtual void BaseProtonTransport::process ( const HepMC::GenEvent ev,
const edm::EventSetup es,
CLHEP::HepRandomEngine *  engine 
)
pure virtual

◆ setBeamFileNames()

void BaseProtonTransport::setBeamFileNames ( const std::string &  nam1,
const std::string &  nam2 
)
inlineprotected

Definition at line 36 of file BaseProtonTransport.h.

References beam1Filename_, and beam2Filename_.

Referenced by HectorTransport::HectorTransport(), and TotemTransport::TotemTransport().

36  {
37  beam1Filename_ = nam1;
38  beam2Filename_ = nam2;
39  };

◆ setBeamParameters()

void BaseProtonTransport::setBeamParameters ( double  stx,
double  sty,
double  sx,
double  sy,
double  se 
)
inlineprotected

◆ setCrossingAngles()

void BaseProtonTransport::setCrossingAngles ( double  cx45,
double  cx56,
double  cy45,
double  cy56 
)
inlineprotected

Member Data Documentation

◆ bApplyZShift_

bool BaseProtonTransport::bApplyZShift_
protected

Definition at line 66 of file BaseProtonTransport.h.

◆ beam1Filename_

std::string BaseProtonTransport::beam1Filename_ {""}
protected

◆ beam2Filename_

std::string BaseProtonTransport::beam2Filename_ {""}
protected

◆ beamEnergy_

double BaseProtonTransport::beamEnergy_
private

Definition at line 85 of file BaseProtonTransport.h.

Referenced by BaseProtonTransport(), and beamEnergy().

◆ beamMomentum_

double BaseProtonTransport::beamMomentum_
private

Definition at line 84 of file BaseProtonTransport.h.

Referenced by BaseProtonTransport(), and beamMomentum().

◆ engine_

CLHEP::HepRandomEngine* BaseProtonTransport::engine_ {nullptr}
protected

◆ etaCut_

double BaseProtonTransport::etaCut_
protected

◆ fCrossingAngleX_45_

double BaseProtonTransport::fCrossingAngleX_45_ {0.0}
protected

◆ fCrossingAngleX_56_

double BaseProtonTransport::fCrossingAngleX_56_ {0.0}
protected

◆ fCrossingAngleY_45_

double BaseProtonTransport::fCrossingAngleY_45_ {0.0}
protected

Definition at line 77 of file BaseProtonTransport.h.

Referenced by setCrossingAngles(), and HectorTransport::transportProton().

◆ fCrossingAngleY_56_

double BaseProtonTransport::fCrossingAngleY_56_ {0.0}
protected

Definition at line 78 of file BaseProtonTransport.h.

Referenced by setCrossingAngles(), and HectorTransport::transportProton().

◆ fPPSRegionStart_45_

double BaseProtonTransport::fPPSRegionStart_45_
protected

◆ fPPSRegionStart_56_

double BaseProtonTransport::fPPSRegionStart_56_
protected

◆ m_beamPart

std::map<unsigned int, TLorentzVector> BaseProtonTransport::m_beamPart
protected

◆ m_CorrespondenceMap

std::vector<LHCTransportLink> BaseProtonTransport::m_CorrespondenceMap
protected

Definition at line 60 of file BaseProtonTransport.h.

Referenced by addPartToHepMC(), clear(), and getCorrespondenceMap().

◆ m_sig_E

double BaseProtonTransport::m_sig_E {0.0}
private

Definition at line 91 of file BaseProtonTransport.h.

Referenced by ApplyBeamCorrection(), and setBeamParameters().

◆ m_sigmaSTX

double BaseProtonTransport::m_sigmaSTX {0.0}
private

Definition at line 87 of file BaseProtonTransport.h.

Referenced by ApplyBeamCorrection(), and setBeamParameters().

◆ m_sigmaSTY

double BaseProtonTransport::m_sigmaSTY {0.0}
private

Definition at line 88 of file BaseProtonTransport.h.

Referenced by ApplyBeamCorrection(), and setBeamParameters().

◆ m_sigmaSX

double BaseProtonTransport::m_sigmaSX {0.0}
private

Definition at line 89 of file BaseProtonTransport.h.

Referenced by setBeamParameters().

◆ m_sigmaSY

double BaseProtonTransport::m_sigmaSY {0.0}
private

Definition at line 90 of file BaseProtonTransport.h.

Referenced by setBeamParameters().

◆ m_xAtTrPoint

std::map<unsigned int, double> BaseProtonTransport::m_xAtTrPoint
protected

◆ m_yAtTrPoint

std::map<unsigned int, double> BaseProtonTransport::m_yAtTrPoint
protected

◆ MODE

TransportMode BaseProtonTransport::MODE
protected

◆ momentumCut_

double BaseProtonTransport::momentumCut_
protected

◆ produceHitsRelativeToBeam_

bool BaseProtonTransport::produceHitsRelativeToBeam_
protected

◆ useBeamPositionFromLHCInfo_

bool BaseProtonTransport::useBeamPositionFromLHCInfo_
protected

◆ verbosity_

bool BaseProtonTransport::verbosity_
protected