25 std::cout <<
"ChargeDividerFP420.h: constructor" << std::endl;
26 std::cout <<
"peakMode = " << peakMode <<
"fluctuateCharge= " << fluctuateCharge
27 <<
"chargedivisionsPerHit = " << chargedivisionsPerHit <<
"deltaCut= " << deltaCut << std::endl;
36 fluctuateCharge =
true;
40 chargedivisionsPerHit = 10;
62 zStationBegPos[0] = -40. +
z420;
63 zStationBegPos[1] = zStationBegPos[0] +
zD2;
64 zStationBegPos[2] = zStationBegPos[0] +
zD3;
65 zStationBegPos[3] = zStationBegPos[0] + 2 *
zD3;
90 std::cout <<
" CDividerFP420::ChargeDividerFP420:divide: direction= " << direction << std::endl;
91 std::cout <<
" CDividerFP420::ChargeDividerFP420:divide: direction.mag = " << direction.
mag() << std::endl;
93 <<
" EntryLocalP = " << hit.
entryPoint() << std::endl;
94 std::cout <<
" pitchcur= " << pitchcur << std::endl;
95 std::cout <<
" peakMode = " << peakMode <<
" decoMode = " << decoMode
96 <<
" fluctuateCharge= " << fluctuateCharge <<
" chargedivisionsPerHit = " << chargedivisionsPerHit
97 <<
" deltaCut= " << deltaCut << std::endl;
100 int NumberOfSegmentation =
107 (
int)(1 + chargedivisionsPerHit * direction.
mag() / pitchcur);
110 std::cout <<
"NumberOfSegmentation= " << NumberOfSegmentation << std::endl;
117 std::cout <<
"CDividerFP420::ChargeDividerFP420:divide: eLoss= " << eLoss << std::endl;
124 float decSignal = TimeResponse(hit);
126 std::cout <<
"CDividerFP420::ChargeDividerFP420:divide: decSignal= " << decSignal << std::endl;
131 _ionization_points.resize(NumberOfSegmentation);
136 float *eLossVector =
new float[NumberOfSegmentation];
139 std::cout <<
"CDividerFP420::ChargeDividerFP420:divide: resize done; " 140 "then, fluctuateCharge ? = " 141 << fluctuateCharge << std::endl;
143 if (fluctuateCharge) {
147 float momentum = hit.
pabs();
148 float length = direction.
mag();
151 std::cout <<
"pid= " << pid <<
"momentum= " << momentum <<
"eLoss= " << eLoss <<
"length= " << length
154 fluctuateEloss(pid, momentum, eLoss, length, NumberOfSegmentation, eLossVector);
157 for (
int i = 0;
i != NumberOfSegmentation; ++
i) {
158 if (fluctuateCharge) {
159 energy = eLossVector[
i] * decSignal / eLoss;
166 _ionization_points[
i] = edu;
168 energy = decSignal /
float(NumberOfSegmentation);
176 _ionization_points[
i] = edu;
181 std::cout <<
"CDividerFP420::ChargeDividerFP420:divide: !!! RESULT !!!" << std::endl;
182 std::cout <<
" _ionization_points size = " << _ionization_points.size() << std::endl;
183 for (
unsigned int i = 0;
i < _ionization_points.size(); ++
i) {
184 std::cout <<
" eLossVector[i] i = " <<
i << eLossVector[
i] << std::endl;
188 delete[] eLossVector;
189 return _ionization_points;
193 int pid,
float particleMomentum,
float eloss,
float length,
int NumberOfSegs,
float elossVector[]) {
195 std::cout <<
"fluctuateEloss: eloss= " << eloss <<
"length= " << length <<
"NumberOfSegs= " << NumberOfSegs
200 double particleMass = 938.271;
207 particleMass = 0.511;
209 particleMass = 105.658;
211 particleMass = 139.570;
214 float segmentLength = length / NumberOfSegs;
219 double segmentEloss = (1000. * eloss) / NumberOfSegs;
221 std::cout <<
"segmentLength= " << segmentLength <<
"segmentEloss= " << segmentEloss << std::endl;
224 for (
int i = 0;
i < NumberOfSegs; ++
i) {
230 double deltaCutoff = deltaCut;
231 de = fluctuate.SampleFluctuations(
double(particleMomentum * 1000.),
234 double(segmentLength),
242 std::cout <<
"sum= " << sum << std::endl;
246 float ratio = eloss / sum;
247 for (
int ii = 0;
ii < NumberOfSegs; ++
ii)
248 elossVector[
ii] = ratio * elossVector[
ii];
250 float averageEloss = eloss / NumberOfSegs;
251 for (
int ii = 0;
ii < NumberOfSegs; ++
ii)
252 elossVector[
ii] = averageEloss;
260 std::cout <<
"ChargeDividerFP420:TimeResponse: call of PeakShape" << std::endl;
262 return this->PeakShape(hit);
263 }
else if (decoMode) {
265 std::cout <<
"ChargeDividerFP420:TimeResponse: call of DeconvolutionShape" << std::endl;
267 return this->DeconvolutionShape(hit);
270 std::cout <<
"ChargeDividerFP420:TimeResponse: no any Shape" << std::endl;
286 float zEntry = 1000.;
291 int det,
zside, sector, zmodule;
298 float RRR =
sqrt(xEntry * xEntry + yEntry * yEntry + zEntry * zEntry);
299 float costheta = zEntry / RRR;
305 float dist = (zStationBegPos[sector - 1] - 420000.) / costheta;
310 std::cout <<
"sector=" << sector << std::endl;
311 std::cout <<
"zmodule=" << zmodule << std::endl;
312 std::cout <<
"zStationBegPos[sector-1]=" << zStationBegPos[sector - 1] << std::endl;
314 std::cout <<
"costheta=" << costheta << std::endl;
315 std::cout <<
"unitID=" << unitID << std::endl;
318 std::cout <<
"dist found =" << dist << std::endl;
322 float t0 = dist / 30.;
323 float SigmaShape = 52.17;
325 float tofNorm = (hit.
tof() -
t0) / SigmaShape;
327 float readTimeNorm = -tofNorm;
331 std::cout <<
"ChargeDividerFP420:PeakShape::dist=" << dist << std::endl;
334 std::cout <<
"tofNorm=" << tofNorm << std::endl;
335 std::cout <<
"1 + readTimeNorm=" << 1 + readTimeNorm << std::endl;
337 std::cout <<
"(1 + readTimeNorm)*exp(-readTimeNorm)=" << (1 + readTimeNorm) *
exp(-readTimeNorm) << std::endl;
340 if (1 + readTimeNorm > 0) {
342 return hit.
energyLoss() * (1 + readTimeNorm) *
exp(-readTimeNorm);
358 float zEntry = 1000.;
363 int det,
zside, sector, zmodule;
370 float RRR =
sqrt(xEntry * xEntry + yEntry * yEntry + zEntry * zEntry);
371 float costheta = zEntry / RRR;
377 float dist = (zStationBegPos[sector - 1] - 420000.) / costheta;
382 std::cout <<
"sector=" << sector << std::endl;
383 std::cout <<
"zmodule=" << zmodule << std::endl;
384 std::cout <<
"zStationBegPos[sector-1]=" << zStationBegPos[sector - 1] << std::endl;
386 std::cout <<
"costheta=" << costheta << std::endl;
387 std::cout <<
"unitID=" << unitID << std::endl;
390 std::cout <<
"dist found =" << dist << std::endl;
393 float t0 = dist / 30.;
394 float SigmaShape = 12.;
398 float tofNorm = (hit.
tof() -
t0) / SigmaShape;
400 float readTimeNorm = -tofNorm;
405 std::cout <<
"ChargeDividerFP420:DeconvolutionShape::dist=" << dist << std::endl;
408 std::cout <<
"tofNorm=" << tofNorm << std::endl;
410 std::cout <<
"exp(-0.5*readTimeNorm*readTimeNorm)=" <<
exp(-0.5 * readTimeNorm * readTimeNorm) << std::endl;
413 return hit.
energyLoss() *
exp(-0.5 * readTimeNorm * readTimeNorm);
float tof() const
deprecated name for timeOfFlight()
ChargeDividerFP420(double pit, double az420, double azD2, double azD3, int)
std::vector< EnergySegmentFP420 > ionization_type
static void unpackFP420Index(const unsigned int &idx, int &det, int &zside, int &station, int &superplane)
Local3DPoint exitPoint() const
Exit point in the local Det frame.
float DeconvolutionShape(const PSimHit &)
Abs< T >::type abs(const T &t)
float pabs() const
fast and more accurate access to momentumAtEntry().mag()
void fluctuateEloss(int particleId, float momentum, float eloss, float length, int NumberOfSegmentation, float elossVector[])
float TimeResponse(const PSimHit &)
float PeakShape(const PSimHit &)
float energyLoss() const
The energy deposit in the PSimHit, in ???.
CDividerFP420::ionization_type divide(const PSimHit &, const double &) override
Local3DPoint entryPoint() const
Entry point in the local Det frame.
unsigned int detUnitId() const
~ChargeDividerFP420() override