11 peakMode(conf.getParameter<
bool>(
"APVpeakmode")),
13 fluctuateCharge(conf.getParameter<
bool>(
"LandauFluctuations")),
16 chargedivisionsPerStrip(conf.getParameter<
int>(
"chargeDivisionsPerStrip")),
18 deltaCut(conf.getParameter<double>(
"DeltaProductionCut")),
22 cosmicShift(conf.getUntrackedParameter<double>(
"CosmicDelayShift")),
23 theParticleDataTable(nullptr),
37 std::ifstream shapeFile(pulseShapeFileName.c_str());
38 if (!shapeFile.good()) {
39 throw cms::Exception(
"FileError") <<
"Problem opening APV Shape file: " << pulseShapeFileName;
44 while (std::getline(shapeFile,
line)) {
45 if ((!
line.empty()) && (
line.substr(1) !=
"#")) {
46 std::istringstream lStr{
line};
47 if (
line.substr(0, resoPrefix.size()) == resoPrefix) {
48 lStr.seekg(resoPrefix.size());
52 while (lStr >>
value) {
59 throw cms::Exception(
"WrongAPVPulseShape") <<
"Problem reading from APV pulse shape file " << pulseShapeFileName
60 <<
": " << (
pulseValues.empty() ?
"no values" :
"no resolution");
65 <<
"The max value of the APV pulse shape stored in the text file used in "
66 "SimGeneral/MixingModule/python/SiStripSimParameters_cfi.py is not equal to 1. Need to be fixed.";
73 double moduleThickness,
75 CLHEP::HepRandomEngine* engine) {
87 double const particleMass = particle ? particle->mass() * 1000 : 139.57;
88 double const particleCharge = particle ? particle->charge() : 1.;
91 LogDebug(
"SiLinearChargeDivider") <<
"Cannot find particle of type " <<
hit->particleType()
92 <<
" in the PDT we assign to this particle the mass and charge of the Pion";
95 int NumberOfSegmentation =
97 (fabs(particleMass) < 1.e-6 || particleCharge == 0)
102 fabs(
driftXPos(
hit->exitPoint(), driftdir, moduleThickness) -
103 driftXPos(
hit->entryPoint(), driftdir, moduleThickness)) /
111 _ionization_points.resize(NumberOfSegmentation);
115 if (NumberOfSegmentation <= 1) {
119 float eLossVector[NumberOfSegmentation];
123 for (
int i = 0;
i != NumberOfSegmentation;
i++) {
125 _ionization_points[
i] =
127 hit->entryPoint() +
float((
i + 0.5) / NumberOfSegmentation) * direction);
131 for (
int i = 0;
i != NumberOfSegmentation;
i++) {
133 _ionization_points[
i] =
135 hit->entryPoint() +
float((
i + 0.5) / NumberOfSegmentation) * direction);
139 return _ionization_points;
143 float particleMomentum,
148 CLHEP::HepRandomEngine* engine) {
152 double mom = particleMomentum * 1000.;
153 double seglen = length / NumberOfSegs * 10.;
154 double segeloss = (1000. * eloss) / NumberOfSegs;
155 for (
int i = 0;
i < NumberOfSegs;
i++) {
161 sum += (elossVector[
i] =
162 fluctuate->SampleFluctuations(mom, particleMass, deltaCutoff, seglen, segeloss, engine) / 1000.);
167 float ratio = eloss / sum;
168 for (
int ii = 0;
ii < NumberOfSegs;
ii++)
169 elossVector[
ii] =
ratio * elossVector[
ii];
171 float averageEloss = eloss / NumberOfSegs;
172 for (
int ii = 0;
ii < NumberOfSegs;
ii++)
173 elossVector[
ii] = averageEloss;