CMS 3D CMS Logo

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

#include <ProtonTransport.h>

Inheritance diagram for ProtonTransport:
HectorTransport TotemTransport

Public Member Functions

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

Protected Types

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

Protected Attributes

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 15 of file ProtonTransport.h.

Member Enumeration Documentation

enum ProtonTransport::TransportMode
strongprotected
Enumerator
HECTOR 
TOTEM 

Definition at line 27 of file ProtonTransport.h.

27 { HECTOR, TOTEM };

Constructor & Destructor Documentation

ProtonTransport::ProtonTransport ( )

Definition at line 6 of file ProtonTransport.cc.

6 {};
ProtonTransport::~ProtonTransport ( )
virtual

Definition at line 7 of file ProtonTransport.cc.

7 {};

Member Function Documentation

void ProtonTransport::addPartToHepMC ( HepMC::GenEvent evt)

Definition at line 14 of file ProtonTransport.cc.

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

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

14  {
15  NEvent++;
16  m_CorrespondenceMap.clear();
17 
18  int direction = 0;
19  HepMC::GenParticle* gpart;
20 
21  unsigned int line;
22 
23  for (auto const& it : m_beamPart) {
24  line = (it).first;
25  gpart = evt->barcode_to_particle(line);
26 
27  direction = (gpart->momentum().pz() > 0) ? 1 : -1;
28 
29  double ddd =
30  (direction > 0)
32  : fabs(
33  fPPSRegionStart_56); // Totem uses negative Z for sector 56 while Hector uses always positive distance
34 
35  double time = (ddd * meter - gpart->production_vertex()->position().z() * mm); // mm
36 
37  //
38  // ATTENTION: at this point, the vertex at PPS is already in mm
39  //
40  if (ddd == 0.)
41  continue;
42  if (m_verbosity) {
43  LogDebug("ProtonTransportEventProcessing")
44  << "ProtonTransport:: x= " << (*(m_xAtTrPoint.find(line))).second << "\n"
45  << "ProtonTransport:: y= " << (*(m_yAtTrPoint.find(line))).second << "\n"
46  << "ProtonTransport:: z= " << ddd * direction * m_to_mm << "\n"
47  << "ProtonTransport:: t= " << time;
48  }
49  TLorentzVector const& p_out = (it).second;
50 
51  HepMC::GenVertex* vert = new HepMC::GenVertex(HepMC::FourVector((*(m_xAtTrPoint.find(line))).second,
52  (*(m_yAtTrPoint.find(line))).second,
53  ddd * direction * m_to_mm,
54  time + time * 0.001));
55 
56  gpart->set_status(2);
57  vert->add_particle_in(gpart);
58  vert->add_particle_out(new HepMC::GenParticle(
59  HepMC::FourVector(p_out.Px(), p_out.Py(), p_out.Pz(), p_out.E()), gpart->pdg_id(), 1, gpart->flow()));
60  evt->add_vertex(vert);
61 
62  int ingoing = (*vert->particles_in_const_begin())->barcode();
63  int outgoing = (*vert->particles_out_const_begin())->barcode();
64 
65  LHCTransportLink theLink(ingoing, outgoing);
66  if (m_verbosity)
67  LogDebug("ProtonTransportEventProcessing") << "ProtonTransport:addPartToHepMC: LHCTransportLink " << theLink;
68  m_CorrespondenceMap.push_back(theLink);
69  }
70 }
#define LogDebug(id)
double fPPSRegionStart_45
std::map< unsigned int, TLorentzVector > m_beamPart
std::map< unsigned int, double > m_yAtTrPoint
std::vector< LHCTransportLink > m_CorrespondenceMap
std::map< unsigned int, double > m_xAtTrPoint
U second(std::pair< T, U > const &p)
double fPPSRegionStart_56
static const double m_to_mm
void ProtonTransport::ApplyBeamCorrection ( HepMC::GenParticle *  p)

Definition at line 71 of file ProtonTransport.cc.

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

71  {
72  TLorentzVector p_out;
73  p_out.SetPx(p->momentum().px());
74  p_out.SetPy(p->momentum().py());
75  p_out.SetPz(p->momentum().pz());
76  p_out.SetE(p->momentum().e());
77  ApplyBeamCorrection(p_out);
78  p->set_momentum(HepMC::FourVector(p_out.Px(), p_out.Py(), p_out.Pz(), p_out.E()));
79 }
void ApplyBeamCorrection(HepMC::GenParticle *p)
void ProtonTransport::ApplyBeamCorrection ( TLorentzVector &  p)

Definition at line 80 of file ProtonTransport.cc.

References funct::cos(), MillePedeFileConverter_cfg::e, HCALHighEnergyHPDFilter_cfi::energy, engine, fCrossingAngle_45, fCrossingAngle_56, m_sig_E, m_sigmaSTX, m_sigmaSTY, MODE, AlCaHLTBitMon_ParallelJobs::p, Pi, funct::pow(), ProtonMassSQ, funct::sin(), mathSSE::sqrt(), theta(), TOTEM, and urad.

80  {
81  double theta = p_out.Theta();
82  double thetax = atan(p_out.Px() / fabs(p_out.Pz()));
83  double thetay = atan(p_out.Py() / fabs(p_out.Pz()));
84  double energy = p_out.E();
85  double urad = 1e-6;
86 
87  int direction = (p_out.Pz() > 0) ? 1 : -1;
88 
89  if (p_out.Pz() < 0)
90  theta = TMath::Pi() - theta;
91 
93  thetax += (p_out.Pz() > 0) ? fCrossingAngle_45 * urad : fCrossingAngle_56 * urad;
94 
95  double dtheta_x = (double)CLHEP::RandGauss::shoot(engine, 0., m_sigmaSTX);
96  double dtheta_y = (double)CLHEP::RandGauss::shoot(engine, 0., m_sigmaSTY);
97  double denergy = (double)CLHEP::RandGauss::shoot(engine, 0., m_sig_E);
98 
99  double s_theta = sqrt(pow(thetax + dtheta_x * urad, 2) + pow(thetay + dtheta_y * urad, 2));
100  double s_phi = atan2(thetay + dtheta_y * urad, thetax + dtheta_x * urad);
101  energy += denergy;
102  double p = sqrt(pow(energy, 2) - ProtonMassSQ);
103 
104  p_out.SetPx((double)p * sin(s_theta) * cos(s_phi));
105  p_out.SetPy((double)p * sin(s_theta) * sin(s_phi));
106  p_out.SetPz((double)p * (cos(s_theta)) * direction);
107  p_out.SetE(energy);
108 }
const double Pi
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
TransportMode MODE
Geom::Theta< T > theta() const
static const double urad
double fCrossingAngle_45
double fCrossingAngle_56
T sqrt(T t)
Definition: SSEVec.h:19
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
static const double ProtonMassSQ
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
CLHEP::HepRandomEngine * engine
void ProtonTransport::clear ( void  )

Definition at line 8 of file ProtonTransport.cc.

References m_beamPart, m_xAtTrPoint, and m_yAtTrPoint.

Referenced by PPSSimTrackProducer::produce(), HectorTransport::~HectorTransport(), and TotemTransport::~TotemTransport().

8  {
9  m_beamPart.clear();
10  m_xAtTrPoint.clear();
11  m_yAtTrPoint.clear();
12 };
std::map< unsigned int, TLorentzVector > m_beamPart
std::map< unsigned int, double > m_yAtTrPoint
std::map< unsigned int, double > m_xAtTrPoint
std::vector<LHCTransportLink>& ProtonTransport::getCorrespondenceMap ( )
inline

Definition at line 19 of file ProtonTransport.h.

References hitfit::clear(), ev, GenParticle::GenParticle, AlCaHLTBitMon_ParallelJobs::p, and LaserDQM_cfg::process.

Referenced by PPSSimTrackProducer::produce().

19 { return m_CorrespondenceMap; }
std::vector< LHCTransportLink > m_CorrespondenceMap
virtual void ProtonTransport::process ( const HepMC::GenEvent ev,
const edm::EventSetup es,
CLHEP::HepRandomEngine *  engine 
)
pure virtual

Implemented in HectorTransport, and TotemTransport.

Referenced by PPSSimTrackProducer::produce().

Member Data Documentation

bool ProtonTransport::bApplyZShift
protected
CLHEP::HepRandomEngine* ProtonTransport::engine
protected
double ProtonTransport::fBeamEnergy
protected
double ProtonTransport::fBeamMomentum
protected
double ProtonTransport::fBeamXatIP
protected
double ProtonTransport::fBeamYatIP
protected
double ProtonTransport::fCrossingAngle_45
protected
double ProtonTransport::fCrossingAngle_56
protected
double ProtonTransport::fPPSRegionStart_45
protected
double ProtonTransport::fPPSRegionStart_56
protected
double ProtonTransport::fVtxMeanX
protected
double ProtonTransport::fVtxMeanY
protected
double ProtonTransport::fVtxMeanZ
protected
std::map<unsigned int, TLorentzVector> ProtonTransport::m_beamPart
protected
std::vector<LHCTransportLink> ProtonTransport::m_CorrespondenceMap
protected

Definition at line 39 of file ProtonTransport.h.

Referenced by addPartToHepMC().

double ProtonTransport::m_sig_E
protected
double ProtonTransport::m_sigmaSTX
protected
double ProtonTransport::m_sigmaSTY
protected
double ProtonTransport::m_sigmaSX
protected

Definition at line 44 of file ProtonTransport.h.

Referenced by HectorTransport::HectorTransport().

double ProtonTransport::m_sigmaSY
protected

Definition at line 45 of file ProtonTransport.h.

Referenced by HectorTransport::HectorTransport().

bool ProtonTransport::m_verbosity
protected
std::map<unsigned int, double> ProtonTransport::m_xAtTrPoint
protected
std::map<unsigned int, double> ProtonTransport::m_yAtTrPoint
protected
TransportMode ProtonTransport::MODE
protected
int ProtonTransport::NEvent
protected

Definition at line 29 of file ProtonTransport.h.

Referenced by addPartToHepMC().