CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Types | Protected 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
 
void setBeamEnergy (double e)
 
virtual ~BaseProtonTransport ()
 

Protected Types

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

Protected Attributes

bool bApplyZShift
 
std::string beam1Filename_
 
std::string beam2Filename_
 
double beamEnergy_
 
double beamMomentum_
 
CLHEP::HepRandomEngine * engine_
 
double etaCut_
 
double fBeamXatIP
 
double fBeamYatIP
 
double fCrossingAngleX_45
 
double fCrossingAngleX_56
 
double fCrossingAngleY_45
 
double fCrossingAngleY_56
 
double fPPSRegionStart_45
 
double fPPSRegionStart_56
 
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
 
std::map< unsigned int, double > m_xAtTrPoint
 
std::map< unsigned int, double > m_yAtTrPoint
 
TransportMode MODE
 
double momentumCut_
 
int NEvent
 
bool verbosity_
 

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 41 of file BaseProtonTransport.h.

41 { HECTOR, TOTEM, OPTICALFUNCTIONS };

Constructor & Destructor Documentation

◆ BaseProtonTransport()

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

Definition at line 8 of file BaseProtonTransport.cc.

9  : verbosity_(iConfig.getParameter<bool>("Verbosity")),
10  bApplyZShift(iConfig.getParameter<bool>("ApplyZShift")),
11  fPPSRegionStart_45(iConfig.getParameter<double>("PPSRegionStart_45")),
12  fPPSRegionStart_56(iConfig.getParameter<double>("PPSRegionStart_56")),
13  etaCut_(iConfig.getParameter<double>("EtaCut")),
14  momentumCut_(iConfig.getParameter<double>("MomentumCut")) {
16 }

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

◆ ~BaseProtonTransport()

virtual BaseProtonTransport::~BaseProtonTransport ( )
inlinevirtual

Definition at line 20 of file BaseProtonTransport.h.

20 { this->clear(); };

References clear().

Member Function Documentation

◆ addPartToHepMC()

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

Definition at line 55 of file BaseProtonTransport.cc.

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

References dqmdumpme::first, fPPSRegionStart_45, fPPSRegionStart_56, GenParticle::GenParticle, mps_splice::line, LogDebug, m_beamPart, m_CorrespondenceMap, m_to_mm, m_xAtTrPoint, m_yAtTrPoint, NEvent, edm::second(), ntuplemaker::time, and verbosity_.

Referenced by ProtonTransport::addPartToHepMC().

◆ ApplyBeamCorrection() [1/2]

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

Definition at line 17 of file BaseProtonTransport.cc.

17  {
18  TLorentzVector p_out;
19  p_out.SetPx(p->momentum().px());
20  p_out.SetPy(p->momentum().py());
21  p_out.SetPz(p->momentum().pz());
22  p_out.SetE(p->momentum().e());
23  ApplyBeamCorrection(p_out);
24  p->set_momentum(HepMC::FourVector(p_out.Px(), p_out.Py(), p_out.Pz(), p_out.E()));
25 }

References AlCaHLTBitMon_ParallelJobs::p.

Referenced by TotemTransport::transportProton().

◆ ApplyBeamCorrection() [2/2]

void BaseProtonTransport::ApplyBeamCorrection ( TLorentzVector &  p)

Definition at line 26 of file BaseProtonTransport.cc.

26  {
27  double theta = p_out.Theta();
28  double thetax = atan(p_out.Px() / fabs(p_out.Pz()));
29  double thetay = atan(p_out.Py() / fabs(p_out.Pz()));
30  double energy = p_out.E();
31  double urad = 1e-6;
32 
33  int direction = (p_out.Pz() > 0) ? 1 : -1;
34 
35  if (p_out.Pz() < 0)
36  theta = TMath::Pi() - theta;
37 
39  thetax += (p_out.Pz() > 0) ? fCrossingAngleX_45 * urad : fCrossingAngleX_56 * urad;
40 
41  double dtheta_x = (double)CLHEP::RandGauss::shoot(engine_, 0., m_sigmaSTX);
42  double dtheta_y = (double)CLHEP::RandGauss::shoot(engine_, 0., m_sigmaSTY);
43  double denergy = (double)CLHEP::RandGauss::shoot(engine_, 0., m_sig_E);
44 
45  double s_theta = sqrt(pow(thetax + dtheta_x * urad, 2) + pow(thetay + dtheta_y * urad, 2));
46  double s_phi = atan2(thetay + dtheta_y * urad, thetax + dtheta_x * urad);
47  energy += denergy;
48  double p = sqrt(pow(energy, 2) - ProtonMassSQ);
49 
50  p_out.SetPx((double)p * sin(s_theta) * cos(s_phi));
51  p_out.SetPy((double)p * sin(s_theta) * sin(s_phi));
52  p_out.SetPz((double)p * (cos(s_theta)) * direction);
53  p_out.SetE(energy);
54 }

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, Pi, funct::pow(), ProtonMassSQ, funct::sin(), mathSSE::sqrt(), theta(), TOTEM, and urad.

◆ beamEnergy()

double BaseProtonTransport::beamEnergy ( )
inline

Definition at line 37 of file BaseProtonTransport.h.

37 { return beamEnergy_; };

References beamEnergy_.

◆ beamMomentum()

double BaseProtonTransport::beamMomentum ( )
inline

Definition at line 38 of file BaseProtonTransport.h.

38 { return beamMomentum_; };

References beamMomentum_.

Referenced by OpticalFunctionsTransport::transportProton().

◆ clear()

void BaseProtonTransport::clear ( void  )

◆ getCorrespondenceMap()

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

Definition at line 22 of file BaseProtonTransport.h.

22 { return m_CorrespondenceMap; }

References m_CorrespondenceMap.

Referenced by ProtonTransport::getCorrespondenceMap().

◆ process()

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

◆ setBeamEnergy()

void BaseProtonTransport::setBeamEnergy ( double  e)
inline

Member Data Documentation

◆ bApplyZShift

bool BaseProtonTransport::bApplyZShift
protected

Definition at line 52 of file BaseProtonTransport.h.

◆ beam1Filename_

std::string BaseProtonTransport::beam1Filename_
protected

◆ beam2Filename_

std::string BaseProtonTransport::beam2Filename_
protected

◆ beamEnergy_

double BaseProtonTransport::beamEnergy_
protected

◆ beamMomentum_

double BaseProtonTransport::beamMomentum_
protected

◆ engine_

CLHEP::HepRandomEngine* BaseProtonTransport::engine_
protected

◆ etaCut_

double BaseProtonTransport::etaCut_
protected

◆ fBeamXatIP

double BaseProtonTransport::fBeamXatIP
protected

◆ fBeamYatIP

double BaseProtonTransport::fBeamYatIP
protected

◆ fCrossingAngleX_45

double BaseProtonTransport::fCrossingAngleX_45
protected

◆ fCrossingAngleX_56

double BaseProtonTransport::fCrossingAngleX_56
protected

◆ fCrossingAngleY_45

double BaseProtonTransport::fCrossingAngleY_45
protected

◆ fCrossingAngleY_56

double BaseProtonTransport::fCrossingAngleY_56
protected

◆ 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 46 of file BaseProtonTransport.h.

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

◆ m_sig_E

double BaseProtonTransport::m_sig_E
protected

◆ m_sigmaSTX

double BaseProtonTransport::m_sigmaSTX
protected

◆ m_sigmaSTY

double BaseProtonTransport::m_sigmaSTY
protected

◆ m_sigmaSX

double BaseProtonTransport::m_sigmaSX
protected

◆ m_sigmaSY

double BaseProtonTransport::m_sigmaSY
protected

◆ 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

◆ NEvent

int BaseProtonTransport::NEvent
protected

Definition at line 44 of file BaseProtonTransport.h.

Referenced by addPartToHepMC().

◆ verbosity_

bool BaseProtonTransport::verbosity_
protected
BaseProtonTransport::beamMomentum_
double beamMomentum_
Definition: BaseProtonTransport.h:64
BaseProtonTransport::m_sigmaSTY
double m_sigmaSTY
Definition: BaseProtonTransport.h:70
BaseProtonTransport::clear
void clear()
Definition: BaseProtonTransport.cc:109
BaseProtonTransport::MODE
TransportMode MODE
Definition: BaseProtonTransport.h:42
BaseProtonTransport::ApplyBeamCorrection
void ApplyBeamCorrection(HepMC::GenParticle *p)
Definition: BaseProtonTransport.cc:17
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
BaseProtonTransport::verbosity_
bool verbosity_
Definition: BaseProtonTransport.h:51
BaseProtonTransport::fPPSRegionStart_45
double fPPSRegionStart_45
Definition: BaseProtonTransport.h:57
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
BaseProtonTransport::momentumCut_
double momentumCut_
Definition: BaseProtonTransport.h:67
BaseProtonTransport::m_sig_E
double m_sig_E
Definition: BaseProtonTransport.h:73
dqmdumpme.first
first
Definition: dqmdumpme.py:55
BaseProtonTransport::fPPSRegionStart_56
double fPPSRegionStart_56
Definition: BaseProtonTransport.h:58
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
m_to_mm
static const double m_to_mm
Definition: PPSUnitConversion.h:20
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
BaseProtonTransport::NEvent
int NEvent
Definition: BaseProtonTransport.h:44
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
BaseProtonTransport::fCrossingAngleX_45
double fCrossingAngleX_45
Definition: BaseProtonTransport.h:59
ProtonMassSQ
static const double ProtonMassSQ
Definition: PPSUnitConversion.h:6
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
BaseProtonTransport::etaCut_
double etaCut_
Definition: BaseProtonTransport.h:66
BaseProtonTransport::bApplyZShift
bool bApplyZShift
Definition: BaseProtonTransport.h:52
BaseProtonTransport::m_beamPart
std::map< unsigned int, TLorentzVector > m_beamPart
Definition: BaseProtonTransport.h:47
urad
static const double urad
Definition: PPSUnitConversion.h:10
BaseProtonTransport::engine_
CLHEP::HepRandomEngine * engine_
Definition: BaseProtonTransport.h:45
BaseProtonTransport::TransportMode::TOTEM
GenParticle.GenParticle
GenParticle
Definition: GenParticle.py:18
BaseProtonTransport::m_yAtTrPoint
std::map< unsigned int, double > m_yAtTrPoint
Definition: BaseProtonTransport.h:49
BaseProtonTransport::m_sigmaSTX
double m_sigmaSTX
Definition: BaseProtonTransport.h:69
BaseProtonTransport::beamEnergy_
double beamEnergy_
Definition: BaseProtonTransport.h:65
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
BaseProtonTransport::m_xAtTrPoint
std::map< unsigned int, double > m_xAtTrPoint
Definition: BaseProtonTransport.h:48
BaseProtonTransport::fCrossingAngleX_56
double fCrossingAngleX_56
Definition: BaseProtonTransport.h:60
Pi
const double Pi
Definition: CosmicMuonParameters.h:18
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
ntuplemaker.time
time
Definition: ntuplemaker.py:310
mps_splice.line
line
Definition: mps_splice.py:76
BaseProtonTransport::m_CorrespondenceMap
std::vector< LHCTransportLink > m_CorrespondenceMap
Definition: BaseProtonTransport.h:46
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37