3 #include "TLorentzVector.h" 5 #include "H_BeamLine.h" 6 #include "H_BeamParticle.h" 13 m_beamline45(nullptr),
14 m_beamline56(nullptr),
21 double cax45 = iConfig.
getParameter<
double>(
"halfCrossingAngleXSector45");
22 double cax56 = iConfig.
getParameter<
double>(
"halfCrossingAngleXSector56");
23 double cay45 = iConfig.
getParameter<
double>(
"halfCrossingAngleYSector45");
24 double cay56 = iConfig.
getParameter<
double>(
"halfCrossingAngleYSector56");
26 double stx = iConfig.
getParameter<
double>(
"BeamDivergenceX");
27 double sty = iConfig.
getParameter<
double>(
"BeamDivergenceY");
30 double se = iConfig.
getParameter<
double>(
"BeamEnergyDispersion");
34 <<
"=============================================================================\n" 35 <<
" Bulding LHC Proton transporter based on HECTOR model\n" 36 <<
"=============================================================================\n";
46 CLHEP::HepRandomEngine* engine) {
53 for (HepMC::GenEvent::particle_const_iterator eventParticle = evt->particles_begin();
54 eventParticle != evt->particles_end();
56 if (!((*eventParticle)->status() == 1 && (*eventParticle)->pdg_id() == 2212))
59 if (!(fabs((*eventParticle)->momentum().eta()) >
etaCut_ && fabs((*eventParticle)->momentum().pz()) >
momentumCut_))
62 unsigned int line = (*eventParticle)->barcode();
65 if (gpart->pdg_id() != 2212)
67 if (gpart->status() != 1)
76 edm::LogVerbatim(
"ProtonTransport") <<
"Starting proton transport using HECTOR method\n";
79 unsigned int line = (gpart)->barcode();
81 double mass = gpart->generatedMass();
96 px = -gpart->momentum().px();
97 py = gpart->momentum().py();
98 pz = -gpart->momentum().pz();
99 e = gpart->momentum().e();
101 int direction = (pz > 0) ? 1 : -1;
103 double XforPosition = -gpart->production_vertex()->position().x();
104 double YforPosition = gpart->production_vertex()->position().y();
105 double ZforPosition = -gpart->production_vertex()->position().z();
110 h_p.set4Momentum(
px,
py, pz,
e);
113 XforPosition = XforPosition - ZforPosition * (
px / pz + fCrossingAngleX *
urad);
114 YforPosition = YforPosition - ZforPosition * (
py / pz + fCrossingAngleY *
urad);
115 XforPosition -= (-vtxXoffset);
116 YforPosition -= vtxYoffset;
119 h_p.setPosition(XforPosition *
mm_to_um, YforPosition *
mm_to_um, h_p.getTX(), h_p.getTY(), 0.);
125 H_BeamLine* beamline =
nullptr;
138 h_p.computePath(&*beamline);
139 is_stop = h_p.stopped(&*beamline);
141 LogDebug(
"HectorTransportEventProcessing")
142 <<
"HectorTransport:filterPPS: barcode = " <<
line <<
" is_stop= " << is_stop;
149 h_p.propagate(targetZ);
150 x1_ctpps = h_p.getX();
151 y1_ctpps = h_p.getY();
153 double thx = h_p.getTX();
154 double thy = h_p.getTY();
159 p_beam.setPosition(0., 0., fCrossingAngleX *
urad, fCrossingAngleY *
urad, 0.);
160 p_beam.computePath(&*beamline);
161 thx -= p_beam.getTX();
162 thy -= p_beam.getTY();
163 x1_ctpps -= p_beam.getX();
164 y1_ctpps -= p_beam.getY();
166 <<
"Shifting the hit relative to beam : X = " << p_beam.getX() <<
"(mm) Y = " << p_beam.getY() <<
"(mm)";
182 LogDebug(
"HectorTransportEventProcessing")
183 <<
"HectorTransport:filterPPS: barcode = " <<
line <<
" x= " << x1_ctpps <<
" y= " << y1_ctpps;
203 edm::LogInfo(
"HectorTransportSetup") <<
"===================================================================\n" 204 <<
" * * * * * * * * * * * * * * * * * * * * * * * * * * * * \n" 206 <<
" * --<--<-- A fast simulator --<--<-- * \n" 207 <<
" * | --<--<-- of particle --<--<-- * \n" 208 <<
" * ----HECTOR----< * \n" 209 <<
" * | -->-->-- transport through-->-->-- * \n" 210 <<
" * -->-->-- generic beamlines -->-->-- * \n" 212 <<
" * JINST 2:P09005 (2007) * \n" 213 <<
" * X Rouby, J de Favereau, K Piotrzkowski (CP3) * \n" 214 <<
" * http://www.fynu.ucl.ac.be/hector.html * \n" 216 <<
" * Center for Cosmology, Particle Physics and Phenomenology * \n" 217 <<
" * Universite catholique de Louvain * \n" 218 <<
" * Louvain-la-Neuve, Belgium * \n" 220 <<
" * * * * * * * * * * * * * * * * * * * * * * * * * * * * \n" 221 <<
" HectorTransport configuration: \n" 225 <<
"===================================================================\n";
226 edm::LogVerbatim(
"HectorTransportSetup") <<
"===================================================================\n" 227 <<
" Forward beam line elements \n";
229 edm::LogVerbatim(
"HectorTransportSetup") <<
"===================================================================\n" 230 <<
" Backward beam line elements \n";
Log< level::Info, true > LogVerbatim
T getParameter(std::string const &) const
std::string beam1Filename_
double fCrossingAngleY_45_
~HectorTransport() override
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
std::string beam2Filename_
bool produceHitsRelativeToBeam_
bool useBeamPositionFromLHCInfo_
double fCrossingAngleX_56_
double getVtxOffsetX45() const
bool transportProton(const HepMC::GenParticle *)
propagate the particles through a beamline to PPS
void setBeamParameters(double stx, double sty, double sx, double sy, double se)
double fCrossingAngleX_45_
const SimBeamSpotObjects * beamspot_
double fPPSRegionStart_56_
edm::ESGetToken< CTPPSBeamParameters, CTPPSBeamParametersRcd > beamParametersToken_
const CTPPSBeamParameters * beamParameters_
Cos< T >::type cos(const T &t)
Tan< T >::type tan(const T &t)
double getVtxOffsetY45() const
CLHEP::HepRandomEngine * engine_
void setCrossingAngles(double cx45, double cx56, double cy45, double cy56)
void setBeamFileNames(const std::string &nam1, const std::string &nam2)
static const double um_to_mm
HectorTransport(const edm::ParameterSet &ps, edm::ConsumesCollector iC)
Log< level::Info, false > LogInfo
edm::ESGetToken< SimBeamSpotObjects, SimBeamSpotObjectsRcd > beamspotToken_
void process(const HepMC::GenEvent *ev, const edm::EventSetup &es, CLHEP::HepRandomEngine *engine) override
std::map< unsigned int, double > m_xAtTrPoint
static const double mm_to_um
std::map< unsigned int, TLorentzVector > m_beamPart
static constexpr double fPPSBeamLineLength_
double fPPSRegionStart_45_
std::unique_ptr< H_BeamLine > m_beamline56
double x() const
get X, Y, Z position
std::unique_ptr< H_BeamLine > m_beamline45
static const double ProtonMassSQ
std::map< unsigned int, double > m_yAtTrPoint
double fCrossingAngleY_56_
Geom::Theta< T > theta() const
Power< A, B >::type pow(const A &a, const B &b)
static constexpr float b1
static const double cm_to_mm