CMS 3D CMS Logo

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

#include <RPLinearChargeDivider.h>

Public Member Functions

simromanpot::energy_path_distribution divide (const PSimHit &hit)
 
 RPLinearChargeDivider (const edm::ParameterSet &params, CLHEP::HepRandomEngine &eng, RPDetId det_id)
 
 ~RPLinearChargeDivider ()
 

Private Member Functions

void FluctuateEloss (int pid, double particleMomentum, double eloss, double length, int NumberOfSegs, simromanpot::energy_path_distribution &elossVector)
 

Private Attributes

int chargedivisionsPerStrip_
 
int chargedivisionsPerThickness_
 
double deltaCut_
 
RPDetId det_id_
 
std::unique_ptr< SiG4UniversalFluctuationfluctuate_
 
bool fluctuateCharge_
 
const edm::ParameterSetparams_
 
double pitch_
 
CLHEP::HepRandomEngine & rndEngine_
 
simromanpot::energy_path_distribution the_energy_path_distribution_
 
double thickness_
 
int verbosity_
 

Detailed Description

Definition at line 13 of file RPLinearChargeDivider.h.

Constructor & Destructor Documentation

◆ RPLinearChargeDivider()

RPLinearChargeDivider::RPLinearChargeDivider ( const edm::ParameterSet params,
CLHEP::HepRandomEngine &  eng,
RPDetId  det_id 
)

Definition at line 7 of file RPLinearChargeDivider.cc.

10  : params_(params), rndEngine_(eng), det_id_(det_id) {
11  verbosity_ = params.getParameter<int>("RPVerbosity");
12 
13  fluctuate_ = std::make_unique<SiG4UniversalFluctuation>();
14 
15  // To Run APV in peak instead of deconvolution mode, which degrades the time resolution.
16  //use: SimpleConfigurable<bool> SiLinearChargeDivider::peakMode(false,"SiStripDigitizer:APVpeakmode");
17 
18  // To Enable interstrip Landau fluctuations within a cluster.
19  //use: SimpleConfigurable<bool> SiLinearChargeDivider::fluctuateCharge(true,"SiStripDigitizer:LandauFluctuations");
20  fluctuateCharge_ = params.getParameter<bool>("RPLandauFluctuations");
21 
22  // Number of segments per strip into which charge is divided during
23  // simulation. If large, precision of simulation improves.
24  //to do so: SimpleConfigurable<int> SiLinearChargeDivider::chargeDivisionsPerStrip(10,"SiStripDigitizer:chargeDivisionsPerStrip");
25  chargedivisionsPerStrip_ = params.getParameter<int>("RPChargeDivisionsPerStrip");
26  chargedivisionsPerThickness_ = params.getParameter<int>("RPChargeDivisionsPerThickness");
27 
28  // delta cutoff in MeV, has to be same as in OSCAR (0.120425 MeV corresponding // to 100um range for electrons)
29  // SimpleConfigurable<double> SiLinearChargeDivider::deltaCut(0.120425,
30  deltaCut_ = params.getParameter<double>("RPDeltaProductionCut");
31 
32  RPTopology rp_det_topol;
33  pitch_ = rp_det_topol.DetPitch();
34  thickness_ = rp_det_topol.DetThickness();
35 }

References chargedivisionsPerStrip_, chargedivisionsPerThickness_, deltaCut_, fluctuate_, fluctuateCharge_, CalibrationSummaryClient_cfi::params, pitch_, thickness_, and verbosity_.

◆ ~RPLinearChargeDivider()

RPLinearChargeDivider::~RPLinearChargeDivider ( )

Definition at line 37 of file RPLinearChargeDivider.cc.

37 {}

Member Function Documentation

◆ divide()

simromanpot::energy_path_distribution RPLinearChargeDivider::divide ( const PSimHit hit)

Definition at line 39 of file RPLinearChargeDivider.cc.

39  {
40  LocalVector direction = hit.exitPoint() - hit.entryPoint();
41  if (direction.z() > 10 || direction.x() > 200 || direction.y() > 200) {
44  }
45 
46  int NumberOfSegmentation_y = (int)(1 + chargedivisionsPerStrip_ * fabs(direction.y()) / pitch_);
47  int NumberOfSegmentation_z = (int)(1 + chargedivisionsPerThickness_ * fabs(direction.z()) / thickness_);
48  int NumberOfSegmentation = std::max(NumberOfSegmentation_y, NumberOfSegmentation_z);
49 
50  double eLoss = hit.energyLoss(); // Eloss in GeV
51 
52  the_energy_path_distribution_.resize(NumberOfSegmentation);
53 
54  if (fluctuateCharge_) {
55  int pid = hit.particleType();
56  double momentum = hit.pabs();
57  double length = direction.mag(); // Track length in Silicon
58  FluctuateEloss(pid, momentum, eLoss, length, NumberOfSegmentation, the_energy_path_distribution_);
59  for (int i = 0; i < NumberOfSegmentation; i++) {
60  the_energy_path_distribution_[i].setPosition(hit.entryPoint() +
61  double((i + 0.5) / NumberOfSegmentation) * direction);
62  }
63  } else {
64  for (int i = 0; i < NumberOfSegmentation; i++) {
65  the_energy_path_distribution_[i].setPosition(hit.entryPoint() +
66  double((i + 0.5) / NumberOfSegmentation) * direction);
67  the_energy_path_distribution_[i].setEnergy(eLoss / (double)NumberOfSegmentation);
68  }
69  }
70 
71  if (verbosity_) {
72  edm::LogInfo("RPLinearChargeDivider") << det_id_ << " charge along the track:\n";
73  double sum = 0;
74  for (unsigned int i = 0; i < the_energy_path_distribution_.size(); i++) {
75  edm::LogInfo("RPLinearChargeDivider")
76  << the_energy_path_distribution_[i].Position().x() << " " << the_energy_path_distribution_[i].Position().y()
77  << " " << the_energy_path_distribution_[i].Position().z() << " " << the_energy_path_distribution_[i].Energy()
78  << "\n";
79  sum += the_energy_path_distribution_[i].Energy();
80  }
81  edm::LogInfo("RPLinearChargeDivider") << "energy dep. sum=" << sum << "\n";
82  }
83 
85 }

References chargedivisionsPerStrip_, chargedivisionsPerThickness_, det_id_, simKBmtfDigis_cfi::eLoss, fluctuateCharge_, FluctuateEloss(), mps_fire::i, createfilelist::int, PV3DBase< T, PVType, FrameType >::mag(), SiStripPI::max, pitch_, the_energy_path_distribution_, thickness_, verbosity_, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

◆ FluctuateEloss()

void RPLinearChargeDivider::FluctuateEloss ( int  pid,
double  particleMomentum,
double  eloss,
double  length,
int  NumberOfSegs,
simromanpot::energy_path_distribution elossVector 
)
private

Definition at line 87 of file RPLinearChargeDivider.cc.

92  {
93  double particleMass = 139.6; // Mass in MeV, Assume pion
94  pid = std::abs(pid);
95  if (pid != 211) { // Mass in MeV
96  if (pid == 11)
97  particleMass = 0.511;
98  else if (pid == 13)
99  particleMass = 105.7;
100  else if (pid == 321)
101  particleMass = 493.7;
102  else if (pid == 2212)
103  particleMass = 938.3;
104  }
105 
106  double segmentLength = length / NumberOfSegs;
107 
108  // Generate charge fluctuations.
109  double de = 0.;
110  double sum = 0.;
111  double segmentEloss = (eloss * 1000) / NumberOfSegs; //eloss in MeV
112  for (int i = 0; i < NumberOfSegs; i++) {
113  // The G4 routine needs momentum in MeV, mass in Mev, delta-cut in MeV,
114  // track segment length in mm, segment eloss in MeV
115  // Returns fluctuated eloss in MeV
116  double deltaCutoff = deltaCut_;
117  de = fluctuate_->SampleFluctuations(
118  particleMomentum * 1000, particleMass, deltaCutoff, segmentLength, segmentEloss, &(rndEngine_)) /
119  1000; //convert to GeV
120  elossVector[i].setEnergy(de);
121  sum += de;
122  }
123 
124  if (sum > 0.) { // If fluctuations give eloss>0.
125  // Rescale to the same total eloss
126  double ratio = eloss / sum;
127  for (int ii = 0; ii < NumberOfSegs; ii++)
128  elossVector[ii].setEnergy(ratio * elossVector[ii].Energy());
129  } else { // If fluctuations gives 0 eloss
130  double averageEloss = eloss / NumberOfSegs;
131  for (int ii = 0; ii < NumberOfSegs; ii++)
132  elossVector[ii].setEnergy(averageEloss);
133  }
134  return;
135 }

References funct::abs(), deltaCut_, EcalCondDBWriter_cfi::Energy, fluctuate_, mps_fire::i, cuy::ii, particleFlowDisplacedVertex_cfi::ratio, and rndEngine_.

Referenced by divide().

Member Data Documentation

◆ chargedivisionsPerStrip_

int RPLinearChargeDivider::chargedivisionsPerStrip_
private

Definition at line 25 of file RPLinearChargeDivider.h.

Referenced by divide(), and RPLinearChargeDivider().

◆ chargedivisionsPerThickness_

int RPLinearChargeDivider::chargedivisionsPerThickness_
private

Definition at line 26 of file RPLinearChargeDivider.h.

Referenced by divide(), and RPLinearChargeDivider().

◆ deltaCut_

double RPLinearChargeDivider::deltaCut_
private

Definition at line 27 of file RPLinearChargeDivider.h.

Referenced by FluctuateEloss(), and RPLinearChargeDivider().

◆ det_id_

RPDetId RPLinearChargeDivider::det_id_
private

Definition at line 22 of file RPLinearChargeDivider.h.

Referenced by divide().

◆ fluctuate_

std::unique_ptr<SiG4UniversalFluctuation> RPLinearChargeDivider::fluctuate_
private

Definition at line 31 of file RPLinearChargeDivider.h.

Referenced by FluctuateEloss(), and RPLinearChargeDivider().

◆ fluctuateCharge_

bool RPLinearChargeDivider::fluctuateCharge_
private

Definition at line 24 of file RPLinearChargeDivider.h.

Referenced by divide(), and RPLinearChargeDivider().

◆ params_

const edm::ParameterSet& RPLinearChargeDivider::params_
private

Definition at line 20 of file RPLinearChargeDivider.h.

◆ pitch_

double RPLinearChargeDivider::pitch_
private

Definition at line 28 of file RPLinearChargeDivider.h.

Referenced by divide(), and RPLinearChargeDivider().

◆ rndEngine_

CLHEP::HepRandomEngine& RPLinearChargeDivider::rndEngine_
private

Definition at line 21 of file RPLinearChargeDivider.h.

Referenced by FluctuateEloss().

◆ the_energy_path_distribution_

simromanpot::energy_path_distribution RPLinearChargeDivider::the_energy_path_distribution_
private

Definition at line 30 of file RPLinearChargeDivider.h.

Referenced by divide().

◆ thickness_

double RPLinearChargeDivider::thickness_
private

Definition at line 29 of file RPLinearChargeDivider.h.

Referenced by divide(), and RPLinearChargeDivider().

◆ verbosity_

int RPLinearChargeDivider::verbosity_
private

Definition at line 32 of file RPLinearChargeDivider.h.

Referenced by divide(), and RPLinearChargeDivider().

Vector3DBase< float, LocalTag >
mps_fire.i
i
Definition: mps_fire.py:355
EcalCondDBWriter_cfi.Energy
Energy
Definition: EcalCondDBWriter_cfi.py:152
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
RPLinearChargeDivider::pitch_
double pitch_
Definition: RPLinearChargeDivider.h:28
edm::LogInfo
Definition: MessageLogger.h:254
RPLinearChargeDivider::fluctuate_
std::unique_ptr< SiG4UniversalFluctuation > fluctuate_
Definition: RPLinearChargeDivider.h:31
RPLinearChargeDivider::FluctuateEloss
void FluctuateEloss(int pid, double particleMomentum, double eloss, double length, int NumberOfSegs, simromanpot::energy_path_distribution &elossVector)
Definition: RPLinearChargeDivider.cc:87
simKBmtfDigis_cfi.eLoss
eLoss
Definition: simKBmtfDigis_cfi.py:9
RPLinearChargeDivider::the_energy_path_distribution_
simromanpot::energy_path_distribution the_energy_path_distribution_
Definition: RPLinearChargeDivider.h:30
RPLinearChargeDivider::chargedivisionsPerThickness_
int chargedivisionsPerThickness_
Definition: RPLinearChargeDivider.h:26
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
RPLinearChargeDivider::thickness_
double thickness_
Definition: RPLinearChargeDivider.h:29
particleFlowDisplacedVertex_cfi.ratio
ratio
Definition: particleFlowDisplacedVertex_cfi.py:93
RPLinearChargeDivider::rndEngine_
CLHEP::HepRandomEngine & rndEngine_
Definition: RPLinearChargeDivider.h:21
RPTopology
Geometrical and topological information on RP silicon detector. Uses coordinate a frame with origin i...
Definition: RPTopology.h:18
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
createfilelist.int
int
Definition: createfilelist.py:10
RPLinearChargeDivider::det_id_
RPDetId det_id_
Definition: RPLinearChargeDivider.h:22
RPLinearChargeDivider::fluctuateCharge_
bool fluctuateCharge_
Definition: RPLinearChargeDivider.h:24
PV3DBase::mag
T mag() const
Definition: PV3DBase.h:64
RPLinearChargeDivider::params_
const edm::ParameterSet & params_
Definition: RPLinearChargeDivider.h:20
RPLinearChargeDivider::chargedivisionsPerStrip_
int chargedivisionsPerStrip_
Definition: RPLinearChargeDivider.h:25
RPLinearChargeDivider::deltaCut_
double deltaCut_
Definition: RPLinearChargeDivider.h:27
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
cuy.ii
ii
Definition: cuy.py:590
RPLinearChargeDivider::verbosity_
int verbosity_
Definition: RPLinearChargeDivider.h:32
hit
Definition: SiStripHitEffFromCalibTree.cc:88