CMS 3D CMS Logo

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

#include <MuonBremsstrahlungSimulator.h>

Inheritance diagram for MuonBremsstrahlungSimulator:
MaterialEffectsSimulator

Public Member Functions

const XYZTLorentzVectordeltaP_BremMuon () const
 
const XYZTLorentzVectordeltaP_BremPhoton () const
 
 MuonBremsstrahlungSimulator (double A, double Z, double density, double radLen, double photonEnergyCut, double photonFractECut)
 Constructor. More...
 
 ~MuonBremsstrahlungSimulator () override
 Default destructor. More...
 
- Public Member Functions inherited from MaterialEffectsSimulator
RHEP_const_iter beginDaughters () const
 Returns const iterator to the beginning of the daughters list. More...
 
int closestDaughterId ()
 The id of the closest charged daughter (filled for nuclear interactions only) More...
 
double eMass () const
 Electron mass in GeV/c2. More...
 
RHEP_const_iter endDaughters () const
 Returns const iterator to the end of the daughters list. More...
 
double excitE () const
 Mean excitation energy (in GeV) More...
 
 MaterialEffectsSimulator (double A=28.0855, double Z=14.0000, double density=2.329, double radLen=9.360)
 
unsigned nDaughters () const
 Returns the number of daughters. More...
 
XYZVector orthogonal (const XYZVector &) const
 A vector orthogonal to another one (because it's not in XYZTLorentzVector) More...
 
double radLenIncm () const
 One radiation length in cm. More...
 
double rho () const
 Density in g/cm3. More...
 
virtual void save ()
 Used by NuclearInteractionSimulator to save last sampled event. More...
 
void setNormalVector (const GlobalVector &normal)
 Sets the vector normal to the surface traversed. More...
 
double theA () const
 A. More...
 
double theZ () const
 Z. More...
 
void updateState (ParticlePropagator &myTrack, double radlen, RandomEngineAndDistribution const *)
 Compute the material effect (calls the sub class) More...
 
virtual ~MaterialEffectsSimulator ()
 

Private Member Functions

XYZTLorentzVector brem (ParticlePropagator &p, RandomEngineAndDistribution const *) const
 Compute Brem photon energy and angles, if any. More...
 
void compute (ParticlePropagator &Particle, RandomEngineAndDistribution const *) override
 Generate Bremsstrahlung photons. More...
 
double gbteth (const double ener, const double partm, const double efrac, RandomEngineAndDistribution const *) const
 A universal angular distribution - still from GEANT. More...
 
unsigned int poisson (double ymu)
 Generate numbers according to a Poisson distribution of mean ymu. More...
 

Private Attributes

XYZTLorentzVector brem_photon
 
double bremProba
 
double d
 
XYZTLorentzVector deltaPMuon
 
TF1 * f1
 
int npar
 
double photonEnergy
 The minimum photon energy to be radiated, in GeV. More...
 
double photonFractE
 The minimum photon fractional energy (wrt that of the electron) More...
 
double rand
 
double xmax
 
double xmin
 The fractional photon energy cut (determined from the above two) More...
 

Additional Inherited Members

- Public Types inherited from MaterialEffectsSimulator
typedef std::vector< RawParticle >::const_iterator RHEP_const_iter
 
- Protected Attributes inherited from MaterialEffectsSimulator
std::vector< RawParticle_theUpdatedState
 
double A
 
double density
 
double radLen
 
double radLengths
 
int theClosestChargedDaughterId
 
GlobalVector theNormalVector
 
double Z
 

Detailed Description

Definition at line 29 of file MuonBremsstrahlungSimulator.h.

Constructor & Destructor Documentation

◆ MuonBremsstrahlungSimulator()

MuonBremsstrahlungSimulator::MuonBremsstrahlungSimulator ( double  A,
double  Z,
double  density,
double  radLen,
double  photonEnergyCut,
double  photonFractECut 
)

Constructor.

Definition at line 20 of file MuonBremsstrahlungSimulator.cc.

23  // Set the minimal photon energy for a Brem from mu+/-
25  photonFractE = photonFractECut;
26  d = 0.; //distance
27  LogDebug("MuonBremsstrahlungSimulator") << "Starting the MuonBremsstrahlungSimulator" << std::endl;
28 }

References d, LogDebug, photonEnergy, fastSimProducer_cff::photonEnergyCut, and photonFractE.

◆ ~MuonBremsstrahlungSimulator()

MuonBremsstrahlungSimulator::~MuonBremsstrahlungSimulator ( )
inlineoverride

Default destructor.

Definition at line 36 of file MuonBremsstrahlungSimulator.h.

36 {}

Member Function Documentation

◆ brem()

XYZTLorentzVector MuonBremsstrahlungSimulator::brem ( ParticlePropagator p,
RandomEngineAndDistribution const *  random 
) const
private

Compute Brem photon energy and angles, if any.

Definition at line 116 of file MuonBremsstrahlungSimulator.cc.

117  {
118  // This is a simple version of a Muon Brem using Petrukhin model .
119  //Ref: http://pdg.lbl.gov/2008/AtomicNuclearProperties/adndt.pdf
120  double mumass = 0.105658367; //mu mass (GeV/c^2)
121 
122  // RANDOM_NUMBER_ERROR
123  // Random number should be generated by the engines from the
124  // RandomNumberGeneratorService. This appears to use the global
125  // engine in ROOT. This is not thread safe unless the module using
126  // it is a one module and declares a shared resource and all
127  // other modules using it also declare the same shared resource.
128  // This also breaks replay.
129  // It might be that this is never used because of the std::cout
130  // statement 2 lines below. I've never seen or heard complaints
131  // about that vebosity ....
132  double xp = f1->GetRandom();
133  LogDebug("MuonBremsstrahlungSimulator") << "MuonBremsstrahlungSimulator: xp->" << xp << std::endl;
134  std::cout << "MuonBremsstrahlungSimulator: xp->" << xp << std::endl;
135 
136  // Have photon energy. Now generate angles with respect to the z axis
137  // defined by the incoming particle's momentum.
138 
139  // Isotropic in phi
140  const double phi = random->flatShoot() * 2 * M_PI;
141  // theta from universal distribution
142  const double theta = gbteth(pp.particle().e(), mumass, xp, random) * mumass / pp.particle().e();
143 
144  // Make momentum components
145  double stheta = std::sin(theta);
146  double ctheta = std::cos(theta);
147  double sphi = std::sin(phi);
148  double cphi = std::cos(phi);
149 
150  return xp * pp.particle().e() * XYZTLorentzVector(stheta * cphi, stheta * sphi, ctheta, 1.);
151 }

References funct::cos(), gather_cfg::cout, f1, RandomEngineAndDistribution::flatShoot(), gbteth(), LogDebug, M_PI, phi, createTree::pp, funct::sin(), and theta().

Referenced by compute().

◆ compute()

void MuonBremsstrahlungSimulator::compute ( ParticlePropagator Particle,
RandomEngineAndDistribution const *  random 
)
overrideprivatevirtual

Generate Bremsstrahlung photons.

Implements MaterialEffectsSimulator.

Definition at line 31 of file MuonBremsstrahlungSimulator.cc.

31  {
32  double NA = 6.022e+23; //Avogadro's number
33 
34  if (radLengths > 4.) {
35  Particle.particle().setMomentum(0., 0., 0., 0.);
36  deltaPMuon.SetXYZT(0., 0., 0., 0.);
37  brem_photon.SetXYZT(0., 0., 0., 0.);
38  }
39 
40  // Hard brem probability with a photon Energy above photonEnergy.
41 
42  double EMuon = Particle.particle().e(); //Muon Energy
43  if (EMuon < photonEnergy)
44  return;
45  xmin = std::max(photonEnergy / EMuon, photonFractE); //fraction of muon's energy transferred to the photon
46 
47  // xmax = photonEnergy/Particle.particle().e();
48  if (xmin >= 1. || xmin <= 0.)
49  return;
50 
51  xmax = 1.;
52  npar = 3; //Number of parameters
53 
54  // create TF1 using a free C function
55  f1 = new TF1("f1", PetrukhinFunc, xmin, xmax, npar);
56  //Setting parameters
57  f1->SetParameters(EMuon, A, Z);
59  //d = distance for several materials
60  //X0 = radLen
61  //d = radLengths * X0(for tracker,yoke,ECAL and HCAL)
62  d = radLengths * radLen;
63  //Integration
64  bremProba = density * d * (NA / A) * (f1->Integral(0., 1.));
65 
66  // Number of photons to be radiated.
67  unsigned int nPhotons = random->poissonShoot(bremProba);
68  _theUpdatedState.reserve(nPhotons);
69 
70  if (!nPhotons)
71  return;
72 
73  //Rotate to the lab frame
74  double chi = Particle.particle().theta();
75  double psi = Particle.particle().phi();
77  RawParticle::RotationY rotY(chi);
78 
79  // Energy of these photons
80  for (unsigned int i = 0; i < nPhotons; ++i) {
81  // Check that there is enough energy left.
82  if (Particle.particle().e() < photonEnergy)
83  break;
84  LogDebug("MuonBremsstrahlungSimulator") << "MuonBremsstrahlungSimulator parameters:" << std::endl;
85  LogDebug("MuonBremsstrahlungSimulator") << "xmin-> " << xmin << std::endl;
86  LogDebug("MuonBremsstrahlungSimulator") << "Atomic Weight-> " << A << std::endl;
87  LogDebug("MuonBremsstrahlungSimulator") << "Density-> " << density << std::endl;
88  LogDebug("MuonBremsstrahlungSimulator") << "Distance-> " << d << std::endl;
89  LogDebug("MuonBremsstrahlungSimulator") << "bremProba->" << bremProba << std::endl;
90  LogDebug("MuonBremsstrahlungSimulator") << "nPhotons->" << nPhotons << std::endl;
91  LogDebug("MuonBremsstrahlungSimulator") << " Muon_Energy-> " << EMuon << std::endl;
92  LogDebug("MuonBremsstrahlungSimulator") << "X0-> " << radLen << std::endl;
93  LogDebug("MuonBremsstrahlungSimulator") << " radLengths-> " << radLengths << std::endl;
94 
95  // Add a photon
96  RawParticle thePhoton = makeParticle(Particle.particleDataTable(), 22, brem(Particle, random));
97  if (thePhoton.E() > 0.) {
98  thePhoton.rotate(rotY);
99  thePhoton.rotate(rotZ);
100 
101  _theUpdatedState.push_back(thePhoton);
102 
103  // Update the original mu +/-
104  deltaPMuon = Particle.particle().momentum() -= thePhoton.momentum();
105  // Information of brem photon
106  brem_photon.SetXYZT(thePhoton.Px(), thePhoton.Py(), thePhoton.Pz(), thePhoton.E());
107 
108  LogDebug("MuonBremsstrahlungSimulator") << " Muon Bremsstrahlung: photon_energy-> " << thePhoton.E() << std::endl;
109  LogDebug("MuonBremsstrahlungSimulator") << "photon_px->" << thePhoton.Px() << std::endl;
110  LogDebug("MuonBremsstrahlungSimulator") << "photon_py->" << thePhoton.Py() << std::endl;
111  LogDebug("MuonBremsstrahlungSimulator") << "photon_pz->" << thePhoton.Pz() << std::endl;
112  }
113  }
114 }

References MaterialEffectsSimulator::_theUpdatedState, MaterialEffectsSimulator::A, brem(), brem_photon, bremProba, d, deltaPMuon, MaterialEffectsSimulator::density, RawParticle::E(), f1, mps_fire::i, LogDebug, makeParticle(), SiStripPI::max, RawParticle::momentum(), fastsim::Constants::NA, npar, PetrukhinFunc(), photonEnergy, photonFractE, RandomEngineAndDistribution::poissonShoot(), RawParticle::Px(), RawParticle::Py(), RawParticle::Pz(), MaterialEffectsSimulator::radLen, MaterialEffectsSimulator::radLengths, RawParticle::rotate(), xmax, xmin, and MaterialEffectsSimulator::Z.

◆ deltaP_BremMuon()

const XYZTLorentzVector& MuonBremsstrahlungSimulator::deltaP_BremMuon ( ) const
inline

Definition at line 39 of file MuonBremsstrahlungSimulator.h.

39 { return deltaPMuon; }

References deltaPMuon.

◆ deltaP_BremPhoton()

const XYZTLorentzVector& MuonBremsstrahlungSimulator::deltaP_BremPhoton ( ) const
inline

Definition at line 42 of file MuonBremsstrahlungSimulator.h.

42 { return brem_photon; }

References brem_photon.

◆ gbteth()

double MuonBremsstrahlungSimulator::gbteth ( const double  ener,
const double  partm,
const double  efrac,
RandomEngineAndDistribution const *  random 
) const
private

A universal angular distribution - still from GEANT.

Definition at line 153 of file MuonBremsstrahlungSimulator.cc.

156  {
157  const double alfa = 0.625;
158 
159  const double d = 0.13 * (0.8 + 1.3 / theZ()) * (100.0 + (1.0 / ener)) * (1.0 + efrac);
160  const double w1 = 9.0 / (9.0 + d);
161  const double umax = ener * M_PI / partm;
162  double u;
163 
164  do {
165  double beta = (random->flatShoot() <= w1) ? alfa : 3.0 * alfa;
166  u = -std::log(random->flatShoot() * random->flatShoot()) / beta;
167  } while (u >= umax);
168 
169  return u;
170 }

References HLT_FULL_cff::beta, d, RandomEngineAndDistribution::flatShoot(), dqm-mbProfile::log, M_PI, and MaterialEffectsSimulator::theZ().

Referenced by brem().

◆ poisson()

unsigned int MuonBremsstrahlungSimulator::poisson ( double  ymu)
private

Generate numbers according to a Poisson distribution of mean ymu.

Member Data Documentation

◆ brem_photon

XYZTLorentzVector MuonBremsstrahlungSimulator::brem_photon
private

Definition at line 74 of file MuonBremsstrahlungSimulator.h.

Referenced by compute(), and deltaP_BremPhoton().

◆ bremProba

double MuonBremsstrahlungSimulator::bremProba
private

Definition at line 51 of file MuonBremsstrahlungSimulator.h.

Referenced by compute().

◆ d

double MuonBremsstrahlungSimulator::d
private

Definition at line 57 of file MuonBremsstrahlungSimulator.h.

Referenced by compute(), gbteth(), and MuonBremsstrahlungSimulator().

◆ deltaPMuon

XYZTLorentzVector MuonBremsstrahlungSimulator::deltaPMuon
private

Definition at line 72 of file MuonBremsstrahlungSimulator.h.

Referenced by compute(), and deltaP_BremMuon().

◆ f1

TF1* MuonBremsstrahlungSimulator::f1
private

Definition at line 45 of file MuonBremsstrahlungSimulator.h.

Referenced by brem(), and compute().

◆ npar

int MuonBremsstrahlungSimulator::npar
private

Definition at line 47 of file MuonBremsstrahlungSimulator.h.

Referenced by compute().

◆ photonEnergy

double MuonBremsstrahlungSimulator::photonEnergy
private

The minimum photon energy to be radiated, in GeV.

Definition at line 50 of file MuonBremsstrahlungSimulator.h.

Referenced by compute(), MuonBremsstrahlungSimulator(), and Jet.Jet::photonEnergyFraction().

◆ photonFractE

double MuonBremsstrahlungSimulator::photonFractE
private

The minimum photon fractional energy (wrt that of the electron)

Definition at line 53 of file MuonBremsstrahlungSimulator.h.

Referenced by compute(), and MuonBremsstrahlungSimulator().

◆ rand

double MuonBremsstrahlungSimulator::rand
private

Definition at line 56 of file MuonBremsstrahlungSimulator.h.

◆ xmax

double MuonBremsstrahlungSimulator::xmax
private

Definition at line 56 of file MuonBremsstrahlungSimulator.h.

Referenced by svgfig.XAxis::__repr__(), and compute().

◆ xmin

double MuonBremsstrahlungSimulator::xmin
private

The fractional photon energy cut (determined from the above two)

Definition at line 56 of file MuonBremsstrahlungSimulator.h.

Referenced by svgfig.XAxis::__repr__(), svgfig.Axes::__repr__(), svgfig.HGrid::__repr__(), svgfig.Grid::__repr__(), compute(), and svgfig.Axes::SVG().

RawParticle
Definition: RawParticle.h:37
mps_fire.i
i
Definition: mps_fire.py:428
RawParticle::E
double E() const
energy of the momentum
Definition: RawParticle.h:306
RawParticle::momentum
const XYZTLorentzVector & momentum() const
the momentum fourvector
Definition: RawParticle.h:321
makeParticle
RawParticle makeParticle(HepPDT::ParticleDataTable const *, int id, const math::XYZTLorentzVector &p)
Definition: makeParticle.cc:28
HLT_FULL_cff.beta
beta
Definition: HLT_FULL_cff.py:8686
MaterialEffectsSimulator::_theUpdatedState
std::vector< RawParticle > _theUpdatedState
Definition: MaterialEffectsSimulator.h:82
gather_cfg.cout
cout
Definition: gather_cfg.py:144
MuonBremsstrahlungSimulator::deltaPMuon
XYZTLorentzVector deltaPMuon
Definition: MuonBremsstrahlungSimulator.h:72
XYZTLorentzVector
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:25
MaterialEffectsSimulator::theZ
double theZ() const
Z.
Definition: MaterialEffectsSimulator.h:40
RawParticle::RotationZ
ROOT::Math::RotationZ RotationZ
Definition: RawParticle.h:48
PetrukhinFunc
double PetrukhinFunc(double *x, double *p)
Definition: PetrukhinModel.cc:22
MuonBremsstrahlungSimulator::f1
TF1 * f1
Definition: MuonBremsstrahlungSimulator.h:45
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
MuonBremsstrahlungSimulator::xmin
double xmin
The fractional photon energy cut (determined from the above two)
Definition: MuonBremsstrahlungSimulator.h:56
MuonBremsstrahlungSimulator::brem_photon
XYZTLorentzVector brem_photon
Definition: MuonBremsstrahlungSimulator.h:74
MuonBremsstrahlungSimulator::d
double d
Definition: MuonBremsstrahlungSimulator.h:57
RawParticle::RotationY
ROOT::Math::RotationY RotationY
Definition: RawParticle.h:47
MuonBremsstrahlungSimulator::npar
int npar
Definition: MuonBremsstrahlungSimulator.h:47
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
MuonBremsstrahlungSimulator::xmax
double xmax
Definition: MuonBremsstrahlungSimulator.h:56
MaterialEffectsSimulator::Z
double Z
Definition: MaterialEffectsSimulator.h:88
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
MaterialEffectsSimulator::MaterialEffectsSimulator
MaterialEffectsSimulator(double A=28.0855, double Z=14.0000, double density=2.329, double radLen=9.360)
Definition: MaterialEffectsSimulator.cc:9
fastSimProducer_cff.photonEnergyCut
photonEnergyCut
Definition: fastSimProducer_cff.py:22
MuonBremsstrahlungSimulator::photonFractE
double photonFractE
The minimum photon fractional energy (wrt that of the electron)
Definition: MuonBremsstrahlungSimulator.h:53
MaterialEffectsSimulator::radLengths
double radLengths
Definition: MaterialEffectsSimulator.h:84
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
MuonBremsstrahlungSimulator::brem
XYZTLorentzVector brem(ParticlePropagator &p, RandomEngineAndDistribution const *) const
Compute Brem photon energy and angles, if any.
Definition: MuonBremsstrahlungSimulator.cc:116
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
MaterialEffectsSimulator::density
double density
Definition: MaterialEffectsSimulator.h:89
A
RawParticle::Py
double Py() const
y of the momentum
Definition: RawParticle.h:300
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
RawParticle::rotate
void rotate(double rphi, const XYZVector &raxis)
Definition: RawParticle.cc:41
MuonBremsstrahlungSimulator::bremProba
double bremProba
Definition: MuonBremsstrahlungSimulator.h:51
DDAxes::phi
MuonBremsstrahlungSimulator::gbteth
double gbteth(const double ener, const double partm, const double efrac, RandomEngineAndDistribution const *) const
A universal angular distribution - still from GEANT.
Definition: MuonBremsstrahlungSimulator.cc:153
psi
std::map< std::string, int, std::less< std::string > > psi
Definition: CountProcessesAction.h:15
MaterialEffectsSimulator::radLen
double radLen
Definition: MaterialEffectsSimulator.h:90
Particle
Definition: Particle.py:1
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
createTree.pp
pp
Definition: createTree.py:17
RawParticle::Px
double Px() const
x of the momentum
Definition: RawParticle.h:297
MuonBremsstrahlungSimulator::photonEnergy
double photonEnergy
The minimum photon energy to be radiated, in GeV.
Definition: MuonBremsstrahlungSimulator.h:50
RawParticle::Pz
double Pz() const
z of the momentum
Definition: RawParticle.h:303
MaterialEffectsSimulator::A
double A
Definition: MaterialEffectsSimulator.h:87
fastsim::Constants::NA
static constexpr double NA
Avogadro's number.
Definition: Constants.h:16