CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
HectorTransport Class Reference

#include <HectorTransport.h>

Inheritance diagram for HectorTransport:
BaseProtonTransport

Public Member Functions

 HectorTransport (const edm::ParameterSet &ps, edm::ConsumesCollector iC)
 
void process (const HepMC::GenEvent *ev, const edm::EventSetup &es, CLHEP::HepRandomEngine *engine) override
 
 ~HectorTransport () override
 
- Public Member Functions inherited from BaseProtonTransport
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 ()
 
void setBeamEnergy (double e)
 
virtual ~BaseProtonTransport ()
 

Private Member Functions

bool setBeamLine ()
 
bool transportProton (const HepMC::GenParticle *)
 propagate the particles through a beamline to PPS More...
 

Private Attributes

const CTPPSBeamParametersbeamParameters_
 
edm::ESGetToken
< CTPPSBeamParameters,
CTPPSBeamParametersRcd
beamParametersToken_
 
const BeamSpotObjectsbeamspot_
 
edm::ESGetToken
< BeamSpotObjects,
BeamSpotObjectsRcd
beamspotToken_
 
std::unique_ptr< H_BeamLine > m_beamline45
 
std::unique_ptr< H_BeamLine > m_beamline56
 
double m_fEtacut
 
double m_fMomentumMin
 
bool m_verbosity
 

Static Private Attributes

static constexpr double fPPSBeamLineLength_ = 250.
 

Additional Inherited Members

- Protected Types inherited from BaseProtonTransport
enum  TransportMode { TransportMode::HECTOR, TransportMode::TOTEM, TransportMode::OPTICALFUNCTIONS }
 
- Protected Attributes inherited from BaseProtonTransport
bool bApplyZShift
 
std::string beam1Filename_
 
std::string beam2Filename_
 
double beamEnergy_
 
double beamMomentum_
 
CLHEP::HepRandomEngine * engine_
 
double etaCut_
 
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 produceHitsRelativeToBeam_
 
bool useBeamPositionFromLHCInfo_
 
bool verbosity_
 

Detailed Description

Definition at line 39 of file HectorTransport.h.

Constructor & Destructor Documentation

HectorTransport::HectorTransport ( const edm::ParameterSet ps,
edm::ConsumesCollector  iC 
)

Definition at line 14 of file HectorTransport.cc.

References BaseProtonTransport::beam1Filename_, BaseProtonTransport::beam2Filename_, BaseProtonTransport::fCrossingAngleX_45, BaseProtonTransport::fCrossingAngleX_56, BaseProtonTransport::fCrossingAngleY_45, BaseProtonTransport::fCrossingAngleY_56, edm::ParameterSet::getParameter(), BaseProtonTransport::HECTOR, BaseProtonTransport::m_sig_E, BaseProtonTransport::m_sigmaSTX, BaseProtonTransport::m_sigmaSTY, BaseProtonTransport::m_sigmaSX, BaseProtonTransport::m_sigmaSY, BaseProtonTransport::MODE, setBeamLine(), and AlCaHLTBitMon_QueryRunRegistry::string.

16  m_beamline45(nullptr),
17  m_beamline56(nullptr),
20  // Create LHC beam line
21 
22  MODE = TransportMode::HECTOR; // defines the MODE for the transport
23  beam1Filename_ = iConfig.getParameter<std::string>("Beam1Filename");
24  beam2Filename_ = iConfig.getParameter<std::string>("Beam2Filename");
25  fCrossingAngleX_45 = iConfig.getParameter<double>("halfCrossingAngleXSector45");
26  fCrossingAngleX_56 = iConfig.getParameter<double>("halfCrossingAngleXSector56");
27  fCrossingAngleY_45 = iConfig.getParameter<double>("halfCrossingAngleYSector45");
28  fCrossingAngleY_56 = iConfig.getParameter<double>("halfCrossingAngleYSector56");
29  m_sigmaSTX = iConfig.getParameter<double>("BeamDivergenceX");
30  m_sigmaSTY = iConfig.getParameter<double>("BeamDivergenceY");
31  m_sigmaSX = iConfig.getParameter<double>("BeamSigmaX");
32  m_sigmaSY = iConfig.getParameter<double>("BeamSigmaY");
33  m_sig_E = iConfig.getParameter<double>("BeamEnergyDispersion");
34 
35  //PPS
36  edm::LogInfo("ProtonTransport") << "=============================================================================\n"
37  << " Bulding LHC Proton transporter based on HECTOR model\n"
38  << "=============================================================================\n";
39  setBeamLine();
40 }
BaseProtonTransport(const edm::ParameterSet &iConfig)
edm::ESGetToken< CTPPSBeamParameters, CTPPSBeamParametersRcd > beamParametersToken_
Log< level::Info, false > LogInfo
std::unique_ptr< H_BeamLine > m_beamline56
std::unique_ptr< H_BeamLine > m_beamline45
edm::ESGetToken< BeamSpotObjects, BeamSpotObjectsRcd > beamspotToken_
HectorTransport::~HectorTransport ( )
override

Definition at line 12 of file HectorTransport.cc.

12 {};

Member Function Documentation

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

Implements BaseProtonTransport.

Definition at line 45 of file HectorTransport.cc.

References beamParameters_, beamParametersToken_, beamspot_, beamspotToken_, BaseProtonTransport::clear(), BaseProtonTransport::engine_, BaseProtonTransport::etaCut_, GenParticle::GenParticle, edm::EventSetup::getData(), geometryCSVtoXML::line, BaseProtonTransport::m_beamPart, BaseProtonTransport::momentumCut_, and transportProton().

47  {
48  this->clear();
49 
50  engine_ = _engine; // the engine needs to be updated for each event
51 
52  beamspot_ = &iSetup.getData(beamspotToken_);
53  beamParameters_ = &iSetup.getData(beamParametersToken_);
54 
55  for (HepMC::GenEvent::particle_const_iterator eventParticle = evt->particles_begin();
56  eventParticle != evt->particles_end();
57  ++eventParticle) {
58  if (!((*eventParticle)->status() == 1 && (*eventParticle)->pdg_id() == 2212))
59  continue;
60 
61  if (!(fabs((*eventParticle)->momentum().eta()) > etaCut_ && fabs((*eventParticle)->momentum().pz()) > momentumCut_))
62  continue; // discard protons outside kinematic acceptance
63 
64  unsigned int line = (*eventParticle)->barcode();
65  HepMC::GenParticle* gpart = (*eventParticle);
66 
67  if (gpart->pdg_id() != 2212)
68  continue; // only transport stable protons
69  if (gpart->status() != 1)
70  continue;
71  if (m_beamPart.find(line) != m_beamPart.end())
72  continue; // assures this protons has not been already propagated
73 
74  transportProton(gpart);
75  }
76 }
bool transportProton(const HepMC::GenParticle *)
propagate the particles through a beamline to PPS
edm::ESGetToken< CTPPSBeamParameters, CTPPSBeamParametersRcd > beamParametersToken_
const CTPPSBeamParameters * beamParameters_
const BeamSpotObjects * beamspot_
CLHEP::HepRandomEngine * engine_
std::map< unsigned int, TLorentzVector > m_beamPart
edm::ESGetToken< BeamSpotObjects, BeamSpotObjectsRcd > beamspotToken_
bool HectorTransport::setBeamLine ( )
private

Definition at line 193 of file HectorTransport.cc.

References b1, b2, BaseProtonTransport::beam1Filename_, BaseProtonTransport::beam2Filename_, fPPSBeamLineLength_, BaseProtonTransport::fPPSRegionStart_45, BaseProtonTransport::fPPSRegionStart_56, LogDebug, m_beamline45, m_beamline56, and BaseProtonTransport::verbosity_.

Referenced by HectorTransport().

193  {
196 
197  // construct beam line for PPS (forward 1 backward 2):
198  if (fPPSBeamLineLength_ > 0.) {
199  m_beamline45 = std::make_unique<H_BeamLine>(-1, fPPSBeamLineLength_ + 0.1);
200  m_beamline45->fill(b2.fullPath(), 1, "IP5");
201  m_beamline56 = std::make_unique<H_BeamLine>(1, fPPSBeamLineLength_ + 0.1);
202  m_beamline56->fill(b1.fullPath(), 1, "IP5");
203  } else {
204  if (verbosity_)
205  LogDebug("HectorTransportSetup") << "HectorTransport: WARNING: lengthctpps= " << fPPSBeamLineLength_;
206  return false;
207  }
208  if (verbosity_) {
209  edm::LogInfo("HectorTransportSetup") << "===================================================================\n"
210  << " * * * * * * * * * * * * * * * * * * * * * * * * * * * * \n"
211  << " * * \n"
212  << " * --<--<-- A fast simulator --<--<-- * \n"
213  << " * | --<--<-- of particle --<--<-- * \n"
214  << " * ----HECTOR----< * \n"
215  << " * | -->-->-- transport through-->-->-- * \n"
216  << " * -->-->-- generic beamlines -->-->-- * \n"
217  << " * * \n"
218  << " * JINST 2:P09005 (2007) * \n"
219  << " * X Rouby, J de Favereau, K Piotrzkowski (CP3) * \n"
220  << " * http://www.fynu.ucl.ac.be/hector.html * \n"
221  << " * * \n"
222  << " * Center for Cosmology, Particle Physics and Phenomenology * \n"
223  << " * Universite catholique de Louvain * \n"
224  << " * Louvain-la-Neuve, Belgium * \n"
225  << " * * \n"
226  << " * * * * * * * * * * * * * * * * * * * * * * * * * * * * \n"
227  << " HectorTransport configuration: \n"
228  << " Beam line length = " << fPPSBeamLineLength_ << "\n"
229  << " PPS Region Start 44 = " << fPPSRegionStart_45 << "\n"
230  << " PPS Region Start 56 = " << fPPSRegionStart_56 << "\n"
231  << "===================================================================\n";
232  }
233  if (verbosity_) {
234  edm::LogInfo("HectorTransportSetup") << "====================================================================\n"
235  << " Forward beam line elements \n";
236  m_beamline45->showElements();
237  edm::LogInfo("HectorTransportSetup") << "====================================================================\n"
238  << " Backward beam line elements \n";
239  m_beamline56->showElements();
240  }
241  return true;
242 }
Log< level::Info, false > LogInfo
static constexpr double fPPSBeamLineLength_
std::unique_ptr< H_BeamLine > m_beamline56
std::unique_ptr< H_BeamLine > m_beamline45
static constexpr float b2
static constexpr float b1
#define LogDebug(id)
bool HectorTransport::transportProton ( const HepMC::GenParticle *  gpart)
private

propagate the particles through a beamline to PPS

Definition at line 77 of file HectorTransport.cc.

References BaseProtonTransport::beamEnergy_, BaseProtonTransport::beamMomentum_, beamParameters_, beamspot_, RecoTauCleanerPlugins::charge, cm_to_mm, funct::cos(), alignCSCRings::e, BaseProtonTransport::fCrossingAngleX_45, BaseProtonTransport::fCrossingAngleX_56, BaseProtonTransport::fCrossingAngleY_45, BaseProtonTransport::fCrossingAngleY_56, BaseProtonTransport::fPPSRegionStart_45, BaseProtonTransport::fPPSRegionStart_56, CTPPSBeamParameters::getVtxOffsetX45(), CTPPSBeamParameters::getVtxOffsetY45(), CTPPSBeamParameters::getVtxOffsetZ45(), BeamSpotObjects::GetX(), BeamSpotObjects::GetY(), BeamSpotObjects::GetZ(), geometryCSVtoXML::line, LogDebug, m_beamline45, m_beamline56, BaseProtonTransport::m_beamPart, BaseProtonTransport::m_xAtTrPoint, BaseProtonTransport::m_yAtTrPoint, ResonanceBuilder::mass, mm_to_um, funct::pow(), BaseProtonTransport::produceHitsRelativeToBeam_, ProtonMassSQ, mathSSE::sqrt(), funct::tan(), theta(), um_to_mm, urad, BaseProtonTransport::useBeamPositionFromLHCInfo_, and BaseProtonTransport::verbosity_.

Referenced by process().

77  {
78  edm::LogInfo("ProtonTransport") << "Starting proton transport using HECTOR method\n";
79 
80  double px, py, pz, e;
81  unsigned int line = (gpart)->barcode();
82 
83  double mass = gpart->generatedMass();
84  double charge = 1.;
85 
86  // remove the CMS vertex shift
87  double vtxXoffset_;
88  double vtxYoffset_;
89  double vtxZoffset_;
91  vtxXoffset_ = beamParameters_->getVtxOffsetX45() * cm_to_mm;
92  vtxYoffset_ = beamParameters_->getVtxOffsetY45() * cm_to_mm;
93  vtxZoffset_ = beamParameters_->getVtxOffsetZ45() * cm_to_mm;
94  } else {
95  vtxXoffset_ = beamspot_->GetX() * cm_to_mm;
96  vtxYoffset_ = beamspot_->GetY() * cm_to_mm;
97  vtxZoffset_ = beamspot_->GetZ() * cm_to_mm;
98  }
99  vtxZoffset_ *= 1; // to avoid compilation error, should be used in the future
100  // Momentum in LHC ref. frame
101  px = -gpart->momentum().px();
102  py = gpart->momentum().py();
103  pz = -gpart->momentum().pz();
104  e = gpart->momentum().e();
105 
106  int direction = (pz > 0) ? 1 : -1; // in relation to LHC ref frame
107 
108  double XforPosition = -gpart->production_vertex()->position().x(); //mm in the ref. frame of LHC
109  double YforPosition = gpart->production_vertex()->position().y(); //mm
110  double ZforPosition = -gpart->production_vertex()->position().z(); //mm
111  double fCrossingAngleX = (pz < 0) ? fCrossingAngleX_45 : fCrossingAngleX_56;
112  double fCrossingAngleY = (pz < 0) ? fCrossingAngleY_45 : fCrossingAngleY_56;
113  //
114  H_BeamParticle h_p(mass, charge);
115  h_p.set4Momentum(px, py, pz, e);
116  //
117  // shift the starting position of the track to Z=0 if configured so (all the variables below are still in cm)
118  XforPosition = XforPosition - ZforPosition * (px / pz + fCrossingAngleX * urad); // theta ~=tan(theta)
119  YforPosition = YforPosition - ZforPosition * (py / pz + fCrossingAngleY * urad);
120  XforPosition -= (-vtxXoffset_); // X was already in the LHC ref. frame
121  YforPosition -= vtxYoffset_;
122  ZforPosition = 0.;
123 
124  // set position, but do not invert the coordinate for the angles (TX,TY) because it is done by set4Momentum
125  h_p.setPosition(XforPosition * mm_to_um, YforPosition * mm_to_um, h_p.getTX(), h_p.getTY(), 0.);
126 
127  bool is_stop;
128  float x1_ctpps;
129  float y1_ctpps;
130 
131  H_BeamLine* _beamline = nullptr;
132  double _targetZ = 0;
133  switch (direction) {
134  case 1:
135  _beamline = &*m_beamline56; // negative side propagation
136  _targetZ = fPPSRegionStart_56;
137  break;
138  case -1:
139  _beamline = &*m_beamline45;
140  _targetZ = fPPSRegionStart_45;
141  break;
142  }
143  // insert protection for NULL beamlines here
144  h_p.computePath(&*_beamline);
145  is_stop = h_p.stopped(&*_beamline);
146  if (verbosity_)
147  LogDebug("HectorTransportEventProcessing")
148  << "HectorTransport:filterPPS: barcode = " << line << " is_stop= " << is_stop;
149  if (is_stop) {
150  return false;
151  }
152  //
153  //propagating
154  //
155  h_p.propagate(_targetZ);
156  x1_ctpps = h_p.getX();
157  y1_ctpps = h_p.getY();
158 
159  double thx = h_p.getTX();
160  double thy = h_p.getTY();
161 
163  H_BeamParticle p_beam(mass, charge);
164  p_beam.set4Momentum(0., 0., beamMomentum_, beamEnergy_);
165  p_beam.setPosition(0., 0., fCrossingAngleX * urad, fCrossingAngleY * urad, 0.);
166  p_beam.computePath(&*_beamline);
167  thx -= p_beam.getTX();
168  thy -= p_beam.getTY();
169  x1_ctpps -= p_beam.getX();
170  y1_ctpps -= p_beam.getY();
171  edm::LogInfo("HectorTransportEventProcessing")
172  << "Shifting the hit relative to beam : X = " << p_beam.getX() << "(mm) Y = " << p_beam.getY() << "(mm)";
173  }
174 
175  double partP = sqrt(pow(h_p.getE(), 2) - ProtonMassSQ);
176  double theta = sqrt(thx * thx + thy * thy) * urad;
177 
178  // copy the kinematic changing to CMS ref. frame, only the negative Pz needs to be changed
179  TLorentzVector p_out(-tan(thx * urad) * partP * cos(theta),
180  tan(thy * urad) * partP * cos(theta),
181  -direction * partP * cos(theta),
182  h_p.getE());
183 
184  m_beamPart[line] = p_out;
185  m_xAtTrPoint[line] = -x1_ctpps * um_to_mm; // move to CMS ref. frame
186  m_yAtTrPoint[line] = y1_ctpps * um_to_mm;
187  if (verbosity_)
188  LogDebug("HectorTransportEventProcessing")
189  << "HectorTransport:filterPPS: barcode = " << line << " x= " << x1_ctpps << " y= " << y1_ctpps;
190 
191  return true;
192 }
double GetY() const
get Y beam position
Geom::Theta< T > theta() const
static const double urad
double getVtxOffsetX45() const
const CTPPSBeamParameters * beamParameters_
T sqrt(T t)
Definition: SSEVec.h:19
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
double GetZ() const
get Z beam position
const BeamSpotObjects * beamspot_
static const double um_to_mm
Log< level::Info, false > LogInfo
double GetX() const
get X beam position
std::map< unsigned int, double > m_xAtTrPoint
double getVtxOffsetZ45() const
static const double mm_to_um
std::map< unsigned int, TLorentzVector > m_beamPart
double getVtxOffsetY45() const
std::unique_ptr< H_BeamLine > m_beamline56
std::unique_ptr< H_BeamLine > m_beamline45
static const double ProtonMassSQ
std::map< unsigned int, double > m_yAtTrPoint
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
static const double cm_to_mm
#define LogDebug(id)

Member Data Documentation

const CTPPSBeamParameters* HectorTransport::beamParameters_
private

Definition at line 69 of file HectorTransport.h.

Referenced by process(), and transportProton().

edm::ESGetToken<CTPPSBeamParameters, CTPPSBeamParametersRcd> HectorTransport::beamParametersToken_
private

Definition at line 66 of file HectorTransport.h.

Referenced by process().

const BeamSpotObjects* HectorTransport::beamspot_
private

Definition at line 70 of file HectorTransport.h.

Referenced by process(), and transportProton().

edm::ESGetToken<BeamSpotObjects, BeamSpotObjectsRcd> HectorTransport::beamspotToken_
private

Definition at line 67 of file HectorTransport.h.

Referenced by process().

constexpr double HectorTransport::fPPSBeamLineLength_ = 250.
staticprivate

Definition at line 49 of file HectorTransport.h.

Referenced by setBeamLine().

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

Definition at line 63 of file HectorTransport.h.

Referenced by setBeamLine(), and transportProton().

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

Definition at line 64 of file HectorTransport.h.

Referenced by setBeamLine(), and transportProton().

double HectorTransport::m_fEtacut
private

Definition at line 59 of file HectorTransport.h.

double HectorTransport::m_fMomentumMin
private

Definition at line 60 of file HectorTransport.h.

bool HectorTransport::m_verbosity
private

Definition at line 47 of file HectorTransport.h.