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.;
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)
111 _ionization_points.resize(NumberOfSegmentation);
115 if (NumberOfSegmentation <= 1) {
119 float eLossVector[NumberOfSegmentation];
121 fluctuateEloss(particleMass, hit->
pabs(), eLoss, direction.
mag(), NumberOfSegmentation, eLossVector, engine);
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;
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
const ParticleDataTable * theParticleDataTable
float tof() const
deprecated name for timeOfFlight()
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
float TimeResponse(const PSimHit *hit, const StripGeomDetUnit &det)
SiLinearChargeDivider(const edm::ParameterSet &conf)
float driftXPos(const Local3DPoint &pos, const LocalVector &drift, double thickness)
void fluctuateEloss(double const particleMass, float momentum, float eloss, float length, int NumberOfSegmentation, float elossVector[], CLHEP::HepRandomEngine *)
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
const Plane & surface() const
The nominal surface of the GeomDet.
virtual float localPitch(const LocalPoint &) const =0
Local3DPoint exitPoint() const
Exit point in the local Det frame.
const bool fluctuateCharge
Local3DPoint localPosition() const
~SiLinearChargeDivider() override
Abs< T >::type abs(const T &t)
float pabs() const
fast and more accurate access to momentumAtEntry().mag()
HepPDT::ParticleData ParticleData
std::unique_ptr< SiG4UniversalFluctuation > fluctuate
T getParameter(std::string const &) const
void readPulseShape(const std::string &pulseShapeFileName)
float energyLoss() const
The energy deposit in the PSimHit, in ???.
const int chargedivisionsPerStrip
std::string fullPath() const
std::vector< EnergyDepositUnit > ionization_type
Local3DPoint entryPoint() const
Entry point in the local Det frame.
SiChargeDivider::ionization_type divide(const PSimHit *, const LocalVector &, double, const StripGeomDetUnit &det, CLHEP::HepRandomEngine *) override
std::vector< double > pulseValues