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

Member Enumeration Documentation

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 ( const edm::ParameterSet iConfig)

Definition at line 8 of file BaseProtonTransport.cc.

References beamEnergy_, and setBeamEnergy().

9  : verbosity_(iConfig.getParameter<bool>("Verbosity")),
10  bApplyZShift(iConfig.getParameter<bool>("ApplyZShift")),
11  useBeamPositionFromLHCInfo_(iConfig.getParameter<bool>("useBeamPositionFromLHCInfo")),
12  produceHitsRelativeToBeam_(iConfig.getParameter<bool>("produceHitsRelativeToBeam")),
13  fPPSRegionStart_45(iConfig.getParameter<double>("PPSRegionStart_45")),
14  fPPSRegionStart_56(iConfig.getParameter<double>("PPSRegionStart_56")),
15  beamEnergy_(iConfig.getParameter<double>("BeamEnergy")),
16  etaCut_(iConfig.getParameter<double>("EtaCut")),
17  momentumCut_(iConfig.getParameter<double>("MomentumCut")) {
19 }
void setBeamEnergy(double e)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
virtual BaseProtonTransport::~BaseProtonTransport ( )
inlinevirtual

Definition at line 20 of file BaseProtonTransport.h.

References clear().

20 { this->clear(); };

Member Function Documentation

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

Definition at line 58 of file BaseProtonTransport.cc.

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

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

Definition at line 20 of file BaseProtonTransport.cc.

Referenced by TotemTransport::transportProton().

20  {
21  TLorentzVector p_out;
22  p_out.SetPx(p->momentum().px());
23  p_out.SetPy(p->momentum().py());
24  p_out.SetPz(p->momentum().pz());
25  p_out.SetE(p->momentum().e());
26  ApplyBeamCorrection(p_out);
27  p->set_momentum(HepMC::FourVector(p_out.Px(), p_out.Py(), p_out.Pz(), p_out.E()));
28 }
void ApplyBeamCorrection(HepMC::GenParticle *p)
void BaseProtonTransport::ApplyBeamCorrection ( TLorentzVector &  p)

Definition at line 29 of file BaseProtonTransport.cc.

References funct::cos(), alignCSCRings::e, relval_parameters_module::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.

29  {
30  double theta = p_out.Theta();
31  double thetax = atan(p_out.Px() / fabs(p_out.Pz()));
32  double thetay = atan(p_out.Py() / fabs(p_out.Pz()));
33  double energy = p_out.E();
34  double urad = 1e-6;
35 
36  int direction = (p_out.Pz() > 0) ? 1 : -1;
37 
38  if (p_out.Pz() < 0)
39  theta = TMath::Pi() - theta;
40 
42  thetax += (p_out.Pz() > 0) ? fCrossingAngleX_45 * urad : fCrossingAngleX_56 * urad;
43 
44  double dtheta_x = (double)CLHEP::RandGauss::shoot(engine_, 0., m_sigmaSTX);
45  double dtheta_y = (double)CLHEP::RandGauss::shoot(engine_, 0., m_sigmaSTY);
46  double denergy = (double)CLHEP::RandGauss::shoot(engine_, 0., m_sig_E);
47 
48  double s_theta = sqrt(pow(thetax + dtheta_x * urad, 2) + pow(thetay + dtheta_y * urad, 2));
49  double s_phi = atan2(thetay + dtheta_y * urad, thetax + dtheta_x * urad);
50  energy += denergy;
51  double p = sqrt(pow(energy, 2) - ProtonMassSQ);
52 
53  p_out.SetPx((double)p * sin(s_theta) * cos(s_phi));
54  p_out.SetPy((double)p * sin(s_theta) * sin(s_phi));
55  p_out.SetPz((double)p * (cos(s_theta)) * direction);
56  p_out.SetE(energy);
57 }
const double Pi
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
static const double urad
T sqrt(T t)
Definition: SSEVec.h:19
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
CLHEP::HepRandomEngine * engine_
static const double ProtonMassSQ
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
double BaseProtonTransport::beamEnergy ( )
inline

Definition at line 37 of file BaseProtonTransport.h.

References beamEnergy_.

37 { return beamEnergy_; };
double BaseProtonTransport::beamMomentum ( )
inline

Definition at line 38 of file BaseProtonTransport.h.

References beamMomentum_.

Referenced by OpticalFunctionsTransport::transportProton().

38 { return beamMomentum_; };
void BaseProtonTransport::clear ( void  )

Definition at line 112 of file BaseProtonTransport.cc.

References m_beamPart, m_CorrespondenceMap, m_xAtTrPoint, and m_yAtTrPoint.

Referenced by OpticalFunctionsTransport::process(), TotemTransport::process(), HectorTransport::process(), and ~BaseProtonTransport().

112  {
113  m_beamPart.clear();
114  m_xAtTrPoint.clear();
115  m_yAtTrPoint.clear();
116  m_CorrespondenceMap.clear();
117 }
std::map< unsigned int, double > m_xAtTrPoint
std::map< unsigned int, TLorentzVector > m_beamPart
std::map< unsigned int, double > m_yAtTrPoint
std::vector< LHCTransportLink > m_CorrespondenceMap
std::vector<LHCTransportLink>& BaseProtonTransport::getCorrespondenceMap ( )
inline

Definition at line 22 of file BaseProtonTransport.h.

References m_CorrespondenceMap.

22 { return m_CorrespondenceMap; }
std::vector< LHCTransportLink > m_CorrespondenceMap
virtual void BaseProtonTransport::process ( const HepMC::GenEvent ev,
const edm::EventSetup es,
CLHEP::HepRandomEngine *  engine 
)
pure virtual
void BaseProtonTransport::setBeamEnergy ( double  e)
inline

Definition at line 32 of file BaseProtonTransport.h.

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

Referenced by BaseProtonTransport().

32  {
33  beamEnergy_ = e;
35  }
T sqrt(T t)
Definition: SSEVec.h:19
static const double ProtonMassSQ

Member Data Documentation

bool BaseProtonTransport::bApplyZShift
protected

Definition at line 52 of file BaseProtonTransport.h.

std::string BaseProtonTransport::beam1Filename_
protected
std::string BaseProtonTransport::beam2Filename_
protected
double BaseProtonTransport::beamEnergy_
protected
double BaseProtonTransport::beamMomentum_
protected
CLHEP::HepRandomEngine* BaseProtonTransport::engine_
protected
double BaseProtonTransport::etaCut_
protected
double BaseProtonTransport::fCrossingAngleX_45
protected
double BaseProtonTransport::fCrossingAngleX_56
protected
double BaseProtonTransport::fCrossingAngleY_45
protected
double BaseProtonTransport::fCrossingAngleY_56
protected
double BaseProtonTransport::fPPSRegionStart_45
protected
double BaseProtonTransport::fPPSRegionStart_56
protected
std::map<unsigned int, TLorentzVector> BaseProtonTransport::m_beamPart
protected
std::vector<LHCTransportLink> BaseProtonTransport::m_CorrespondenceMap
protected

Definition at line 46 of file BaseProtonTransport.h.

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

double BaseProtonTransport::m_sig_E
protected
double BaseProtonTransport::m_sigmaSTX
protected
double BaseProtonTransport::m_sigmaSTY
protected
double BaseProtonTransport::m_sigmaSX
protected
double BaseProtonTransport::m_sigmaSY
protected
std::map<unsigned int, double> BaseProtonTransport::m_xAtTrPoint
protected
std::map<unsigned int, double> BaseProtonTransport::m_yAtTrPoint
protected
TransportMode BaseProtonTransport::MODE
protected
double BaseProtonTransport::momentumCut_
protected
int BaseProtonTransport::NEvent
protected

Definition at line 44 of file BaseProtonTransport.h.

Referenced by addPartToHepMC().

bool BaseProtonTransport::produceHitsRelativeToBeam_
protected

Definition at line 54 of file BaseProtonTransport.h.

Referenced by HectorTransport::transportProton().

bool BaseProtonTransport::useBeamPositionFromLHCInfo_
protected
bool BaseProtonTransport::verbosity_
protected