CMS 3D CMS Logo

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

#include <HectorTransport.h>

Inheritance diagram for HectorTransport:
ProtonTransport

Public Member Functions

 HectorTransport ()
 
 HectorTransport (const edm::ParameterSet &ps, bool verbosity)
 
void process (const HepMC::GenEvent *, const edm::EventSetup &, CLHEP::HepRandomEngine *) override
 
 ~HectorTransport () 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

void genProtonsLoop (const HepMC::GenEvent *, const edm::EventSetup &)
 Clears BeamParticle, prepares PPSHector for a next Aperture check or/and a next event. More...
 
double getBeamEnergy ()
 
double getBeamMomentum ()
 
void setBeamEnergy (double e)
 
bool setBeamLine ()
 
bool transportProton (const HepMC::GenParticle *)
 propagate the particles through a beamline to PPS More...
 

Private Attributes

double m_b_ctpps_b
 
std::string m_beam1filename
 
std::string m_beam2filename
 
std::unique_ptr< H_BeamLine > m_beamline45
 
std::unique_ptr< H_BeamLine > m_beamline56
 
double m_f_ctpps_f
 
double m_fEtacut
 
double m_fMomentumMin
 
double m_lengthctpps
 
edm::ESHandle< ParticleDataTablem_pdt
 

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 35 of file HectorTransport.h.

Constructor & Destructor Documentation

HectorTransport::HectorTransport ( )

Definition at line 9 of file HectorTransport.cc.

9 {};
HectorTransport::HectorTransport ( const edm::ParameterSet ps,
bool  verbosity 
)

Definition at line 11 of file HectorTransport.cc.

References ProtonTransport::bApplyZShift, ProtonTransport::fBeamEnergy, ProtonTransport::fBeamMomentum, ProtonTransport::fBeamXatIP, ProtonTransport::fBeamYatIP, ProtonTransport::fCrossingAngle_45, ProtonTransport::fCrossingAngle_56, dqmMemoryStats::float, ProtonTransport::fPPSRegionStart_45, ProtonTransport::fPPSRegionStart_56, ProtonTransport::fVtxMeanX, ProtonTransport::fVtxMeanY, ProtonTransport::fVtxMeanZ, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), ProtonTransport::HECTOR, m_b_ctpps_b, m_beam1filename, m_beam2filename, m_f_ctpps_f, m_fEtacut, m_fMomentumMin, m_lengthctpps, ProtonTransport::m_sig_E, ProtonTransport::m_sigmaSTX, ProtonTransport::m_sigmaSTY, ProtonTransport::m_sigmaSX, ProtonTransport::m_sigmaSY, ProtonTransport::m_verbosity, ProtonTransport::MODE, PPSTools::ProtonMassSQ, setBeamLine(), mathSSE::sqrt(), and HIPAlignmentAlgorithm_cfi::verbosity.

11  {
12  // Create LHC beam line
13  MODE = TransportMode::HECTOR; // defines the MODE for the transport
15  edm::ParameterSet hector_par = param.getParameter<edm::ParameterSet>("PPSHector");
16 
17  m_f_ctpps_f = (float)hector_par.getParameter<double>("PPSf");
18  m_b_ctpps_b = (float)hector_par.getParameter<double>("PPSb");
19  fCrossingAngle_56 = hector_par.getParameter<double>("CrossingAngleBeam1");
20  fCrossingAngle_45 = hector_par.getParameter<double>("CrossingAngleBeam2");
21  fBeamEnergy = hector_par.getParameter<double>("BeamEnergy"); // beam energy in GeV
22  m_fEtacut = hector_par.getParameter<double>("EtaCutForHector");
23  m_fMomentumMin = hector_par.getParameter<double>("MomentumMin");
24  fBeamMomentum = sqrt(fBeamEnergy * fBeamEnergy - PPSTools::ProtonMassSQ);
25 
26  // User definitons
27  m_lengthctpps = hector_par.getParameter<double>("BeamLineLengthPPS");
28 
29  m_beam1filename = hector_par.getParameter<string>("Beam1");
30  m_beam2filename = hector_par.getParameter<string>("Beam2");
31  fVtxMeanX = param.getParameter<double>("VtxMeanX");
32  fVtxMeanY = param.getParameter<double>("VtxMeanY");
33  fVtxMeanZ = param.getParameter<double>("VtxMeanZ");
34  m_sigmaSTX = hector_par.getParameter<double>("sigmaSTX");
35  m_sigmaSTY = hector_par.getParameter<double>("sigmaSTY");
36  m_sigmaSX = hector_par.getParameter<double>("sigmaSX");
37  m_sigmaSY = hector_par.getParameter<double>("sigmaSY");
38  m_sig_E = hector_par.getParameter<double>("sigmaEnergy");
39  fBeamXatIP = hector_par.getUntrackedParameter<double>("BeamXatIP", fVtxMeanX);
40  fBeamYatIP = hector_par.getUntrackedParameter<double>("BeamYatIP", fVtxMeanY);
41  bApplyZShift = hector_par.getParameter<bool>("ApplyZShift");
42  //PPS
43  edm::LogInfo("ProtonTransport") << "=============================================================================\n"
44  << " Bulding LHC Proton transporter based on HECTOR model\n"
45  << "=============================================================================\n";
46  setBeamLine();
49 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
double fPPSRegionStart_45
TransportMode MODE
std::string m_beam2filename
double fCrossingAngle_45
double fCrossingAngle_56
T sqrt(T t)
Definition: SSEVec.h:19
double fPPSRegionStart_56
const double ProtonMassSQ
Definition: PPSUtilities.h:31
std::string m_beam1filename
HectorTransport::~HectorTransport ( )
override

Definition at line 50 of file HectorTransport.cc.

References ProtonTransport::clear().

50 { this->clear(); }

Member Function Documentation

void HectorTransport::genProtonsLoop ( const HepMC::GenEvent evt,
const edm::EventSetup iSetup 
)
private

Clears BeamParticle, prepares PPSHector for a next Aperture check or/and a next event.

Adds the stable protons from the event ev to a beamline

Definition at line 162 of file HectorTransport.cc.

References GenParticle::GenParticle, mps_splice::line, ProtonTransport::m_beamPart, m_fEtacut, m_fMomentumMin, and transportProton().

Referenced by process().

162  {
163  /*
164  Loop over genVertex looking for transportable protons
165 */
166  unsigned int line;
167 
168  for (HepMC::GenEvent::particle_const_iterator eventParticle = evt->particles_begin();
169  eventParticle != evt->particles_end();
170  ++eventParticle) {
171  if (!((*eventParticle)->status() == 1 && (*eventParticle)->pdg_id() == 2212))
172  continue;
173  if (!(fabs((*eventParticle)->momentum().eta()) > m_fEtacut &&
174  fabs((*eventParticle)->momentum().pz()) > m_fMomentumMin))
175  continue;
176  line = (*eventParticle)->barcode();
177 
178  if (m_beamPart.find(line) != m_beamPart.end())
179  continue;
180 
181  HepMC::GenParticle* gpart = (*eventParticle);
182 
183  transportProton(gpart);
184  }
185 }
std::map< unsigned int, TLorentzVector > m_beamPart
bool transportProton(const HepMC::GenParticle *)
propagate the particles through a beamline to PPS
double HectorTransport::getBeamEnergy ( )
inlineprivate

Definition at line 56 of file HectorTransport.h.

56 { return fBeamEnergy; }
double HectorTransport::getBeamMomentum ( )
inlineprivate

Definition at line 58 of file HectorTransport.h.

58 { return fBeamMomentum; }
void HectorTransport::process ( const HepMC::GenEvent ev,
const edm::EventSetup iSetup,
CLHEP::HepRandomEngine *  _engine 
)
overridevirtual

Implements ProtonTransport.

Definition at line 51 of file HectorTransport.cc.

References ProtonTransport::addPartToHepMC(), ProtonTransport::engine, genProtonsLoop(), edm::EventSetup::getData(), and m_pdt.

53  {
54  engine = _engine;
55  iSetup.getData(m_pdt);
56  genProtonsLoop(ev, iSetup);
57  addPartToHepMC(const_cast<HepMC::GenEvent*>(ev));
58 }
void genProtonsLoop(const HepMC::GenEvent *, const edm::EventSetup &)
Clears BeamParticle, prepares PPSHector for a next Aperture check or/and a next event.
bool getData(T &iHolder) const
Definition: EventSetup.h:113
edm::ESHandle< ParticleDataTable > m_pdt
void addPartToHepMC(HepMC::GenEvent *)
CLHEP::HepRandomEngine * engine
void HectorTransport::setBeamEnergy ( double  e)
inlineprivate

Definition at line 51 of file HectorTransport.h.

References MillePedeFileConverter_cfg::e, ProtonMassSQ, and mathSSE::sqrt().

51  {
52  fBeamEnergy = e;
54  }
T sqrt(T t)
Definition: SSEVec.h:19
static const double ProtonMassSQ
bool HectorTransport::setBeamLine ( )
private

Definition at line 186 of file HectorTransport.cc.

References LogDebug, m_b_ctpps_b, m_beam1filename, m_beam2filename, m_beamline45, m_beamline56, m_f_ctpps_f, m_lengthctpps, and ProtonTransport::m_verbosity.

Referenced by HectorTransport().

186  {
187  m_beamline45 = nullptr;
188  m_beamline56 = nullptr;
189  edm::FileInPath b1(m_beam1filename.c_str());
190  edm::FileInPath b2(m_beam2filename.c_str());
191  if (m_verbosity) {
192  edm::LogInfo("HectorTransportSetup") << "===================================================================\n"
193  << " * * * * * * * * * * * * * * * * * * * * * * * * * * * * \n"
194  << " * * \n"
195  << " * --<--<-- A fast simulator --<--<-- * \n"
196  << " * | --<--<-- of particle --<--<-- * \n"
197  << " * ----HECTOR----< * \n"
198  << " * | -->-->-- transport through-->-->-- * \n"
199  << " * -->-->-- generic beamlines -->-->-- * \n"
200  << " * * \n"
201  << " * JINST 2:P09005 (2007) * \n"
202  << " * X Rouby, J de Favereau, K Piotrzkowski (CP3) * \n"
203  << " * http://www.fynu.ucl.ac.be/hector.html * \n"
204  << " * * \n"
205  << " * Center for Cosmology, Particle Physics and Phenomenology * \n"
206  << " * Universite catholique de Louvain * \n"
207  << " * Louvain-la-Neuve, Belgium * \n"
208  << " * * \n"
209  << " * * * * * * * * * * * * * * * * * * * * * * * * * * * * \n"
210  << " HectorTransport configuration: \n"
211  << " lengthctpps = " << m_lengthctpps << "\n"
212  << " m_f_ctpps_f = " << m_f_ctpps_f << "\n"
213  << " m_b_ctpps_b = " << m_b_ctpps_b << "\n"
214  << "===================================================================\n";
215  }
216 
217  // construct beam line for PPS (forward 1 backward 2):
218  if (m_lengthctpps > 0.) {
219  m_beamline45 = std::unique_ptr<H_BeamLine>(new H_BeamLine(-1, m_lengthctpps + 0.1)); // (direction, length)
220  m_beamline45->fill(b2.fullPath(), 1, "IP5");
221  m_beamline56 = std::unique_ptr<H_BeamLine>(new H_BeamLine(1, m_lengthctpps + 0.1)); //
222  m_beamline56->fill(b1.fullPath(), 1, "IP5");
223  } else {
224  if (m_verbosity)
225  LogDebug("HectorTransportSetup") << "HectorTransport: WARNING: lengthctpps= " << m_lengthctpps;
226  return false;
227  }
228  if (m_verbosity) {
229  edm::LogInfo("HectorTransportSetup") << "====================================================================\n"
230  << " Forward beam line elements \n";
231  m_beamline45->showElements();
232  edm::LogInfo("HectorTransportSetup") << "====================================================================\n"
233  << " Backward beam line elements \n";
234  m_beamline56->showElements();
235  }
236 
237  return true;
238 }
#define LogDebug(id)
std::string m_beam2filename
std::string m_beam1filename
std::unique_ptr< H_BeamLine > m_beamline56
std::unique_ptr< H_BeamLine > m_beamline45
bool HectorTransport::transportProton ( const HepMC::GenParticle *  gpart)
private

propagate the particles through a beamline to PPS

Definition at line 59 of file HectorTransport.cc.

References ProtonTransport::ApplyBeamCorrection(), ProtonTransport::bApplyZShift, ALCARECOTkAlJpsiMuMu_cff::charge, cm_to_m, cm_to_um, MillePedeFileConverter_cfg::e, ProtonTransport::fBeamEnergy, ProtonTransport::fBeamMomentum, ProtonTransport::fBeamXatIP, ProtonTransport::fBeamYatIP, ProtonTransport::fCrossingAngle_45, ProtonTransport::fCrossingAngle_56, ProtonTransport::fVtxMeanX, ProtonTransport::fVtxMeanY, PPSTools::HectorParticle2LorentzVector(), mps_splice::line, LogDebug, PPSTools::LorentzBoost(), m_b_ctpps_b, m_beamline45, m_beamline56, ProtonTransport::m_beamPart, m_f_ctpps_f, ProtonTransport::m_verbosity, ProtonTransport::m_xAtTrPoint, ProtonTransport::m_yAtTrPoint, EgHLTOffHistBins_cfi::mass, mm_to_cm, funct::pow(), multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, mathSSE::sqrt(), funct::tan(), um_to_mm, and urad.

Referenced by genProtonsLoop().

59  {
60  edm::LogInfo("ProtonTransport") << "Starting proton transport using HECTOR method\n";
61 
62  double px, py, pz, e;
63  unsigned int line = (gpart)->barcode();
64 
65  double mass = gpart->generatedMass();
66  double charge = 1.;
67 
68  px = gpart->momentum().px();
69  py = gpart->momentum().py();
70  pz = gpart->momentum().pz();
71  e = gpart->momentum().e();
72 
73  e = sqrt(pow(mass, 2) + pow(px, 2) + pow(py, 2) + pow(pz, 2));
74 
75  int direction = (pz > 0) ? 1 : -1;
76 
77  // Apply Beam and Crossing Angle Corrections
78  TLorentzVector p_out(px, py, pz, e);
80  "LAB",
81  {fCrossingAngle_56, //Beam1
82  fCrossingAngle_45, //Beam2
84  fBeamEnergy});
85 
86  ApplyBeamCorrection(p_out);
87 
88  // from mm to cm
89  double XforPosition = gpart->production_vertex()->position().x() / cm; //cm
90  double YforPosition = gpart->production_vertex()->position().y() / cm; //cm
91  double ZforPosition = gpart->production_vertex()->position().z() / cm; //cm
92 
93  H_BeamParticle h_p(mass, charge);
94  h_p.set4Momentum(-direction * p_out.Px(), p_out.Py(), fabs(p_out.Pz()), p_out.E());
95  // shift the beam position to the given beam position at IP (in cm)
96  XforPosition = (XforPosition - fVtxMeanX) + fBeamXatIP * mm_to_cm;
97  YforPosition = (YforPosition - fVtxMeanY) + fBeamYatIP * mm_to_cm;
98  //ZforPosition stays the same, move the closed orbit only in the X,Y plane
99  //
100  // shift the starting position of the track to Z=0 if configured so (all the variables below are still in cm)
101  if (bApplyZShift) {
102  double fCrossingAngle = (p_out.Pz() > 0) ? fCrossingAngle_45 : -fCrossingAngle_56;
103  XforPosition = XforPosition +
104  (tan((long double)fCrossingAngle * urad) - ((long double)p_out.Px()) / ((long double)p_out.Pz())) *
105  ZforPosition;
106  YforPosition = YforPosition - ((long double)p_out.Py()) / ((long double)p_out.Pz()) * ZforPosition;
107  ZforPosition = 0.;
108  }
109 
110  //
111  // set position, but do not invert the coordinate for the angles (TX,TY) because it is done by set4Momentum
112  h_p.setPosition(-direction * XforPosition * cm_to_um,
113  YforPosition * cm_to_um,
114  h_p.getTX(),
115  h_p.getTY(),
116  -direction * ZforPosition * cm_to_m);
117  bool is_stop;
118  float x1_ctpps;
119  float y1_ctpps;
120 
121  H_BeamLine* _beamline = nullptr;
122  double _targetZ = 0;
123  switch (direction) {
124  case -1:
125  _beamline = &*m_beamline56; // negative side propagation
126  _targetZ = m_b_ctpps_b;
127  break;
128  case 1:
129  _beamline = &*m_beamline45;
130  _targetZ = m_f_ctpps_f;
131  break;
132  }
133  // insert protection for NULL beamlines here
134  h_p.computePath(&*_beamline);
135  is_stop = h_p.stopped(&*_beamline);
136  if (m_verbosity)
137  LogDebug("HectorTransportEventProcessing")
138  << "HectorTransport:filterPPS: barcode = " << line << " is_stop= " << is_stop;
139  if (is_stop) {
140  return false;
141  }
142  //
143  //propagating
144  //
145  h_p.propagate(_targetZ);
146 
147  p_out = PPSTools::HectorParticle2LorentzVector(h_p, direction);
148 
149  p_out.SetPx(direction * p_out.Px());
150  x1_ctpps = direction * h_p.getX() * um_to_mm;
151  y1_ctpps = h_p.getY() * um_to_mm;
152 
153  if (m_verbosity)
154  LogDebug("HectorTransportEventProcessing")
155  << "HectorTransport:filterPPS: barcode = " << line << " x= " << x1_ctpps << " y= " << y1_ctpps;
156 
157  m_beamPart[line] = p_out;
158  m_xAtTrPoint[line] = x1_ctpps;
159  m_yAtTrPoint[line] = y1_ctpps;
160  return true;
161 }
#define LogDebug(id)
void LorentzBoost(H_BeamParticle &h_p, int dir, const std::string &frame, FullBeamInfo const &bi)
TLorentzVector HectorParticle2LorentzVector(H_BeamParticle hp, int)
Definition: PPSUtilities.cc:6
void ApplyBeamCorrection(HepMC::GenParticle *p)
std::map< unsigned int, TLorentzVector > m_beamPart
std::map< unsigned int, double > m_yAtTrPoint
static const double urad
static const double cm_to_um
double fCrossingAngle_45
std::map< unsigned int, double > m_xAtTrPoint
double fCrossingAngle_56
T sqrt(T t)
Definition: SSEVec.h:19
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
static const double um_to_mm
static const double mm_to_cm
static const double cm_to_m
std::unique_ptr< H_BeamLine > m_beamline56
std::unique_ptr< H_BeamLine > m_beamline45
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30

Member Data Documentation

double HectorTransport::m_b_ctpps_b
private

Definition at line 74 of file HectorTransport.h.

Referenced by HectorTransport(), setBeamLine(), and transportProton().

std::string HectorTransport::m_beam1filename
private

Definition at line 80 of file HectorTransport.h.

Referenced by HectorTransport(), and setBeamLine().

std::string HectorTransport::m_beam2filename
private

Definition at line 81 of file HectorTransport.h.

Referenced by HectorTransport(), and setBeamLine().

std::unique_ptr<H_BeamLine> HectorTransport::m_beamline45
private

Definition at line 77 of file HectorTransport.h.

Referenced by setBeamLine(), and transportProton().

std::unique_ptr<H_BeamLine> HectorTransport::m_beamline56
private

Definition at line 78 of file HectorTransport.h.

Referenced by setBeamLine(), and transportProton().

double HectorTransport::m_f_ctpps_f
private

Definition at line 73 of file HectorTransport.h.

Referenced by HectorTransport(), setBeamLine(), and transportProton().

double HectorTransport::m_fEtacut
private

Definition at line 69 of file HectorTransport.h.

Referenced by genProtonsLoop(), and HectorTransport().

double HectorTransport::m_fMomentumMin
private

Definition at line 70 of file HectorTransport.h.

Referenced by genProtonsLoop(), and HectorTransport().

double HectorTransport::m_lengthctpps
private

Definition at line 72 of file HectorTransport.h.

Referenced by HectorTransport(), and setBeamLine().

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

Definition at line 67 of file HectorTransport.h.

Referenced by process().