25 std::cout <<
"ChargeDividerFP420.h: constructor" << std::endl;
26 std::cout <<
"peakMode = " << peakMode <<
"fluctuateCharge= "<< fluctuateCharge <<
"chargedivisionsPerHit = " << chargedivisionsPerHit <<
"deltaCut= "<< deltaCut << std::endl;
38 chargedivisionsPerHit=10;
61 zStationBegPos[0] = -40. + z420;
62 zStationBegPos[1] = zStationBegPos[0]+zD2;
63 zStationBegPos[2] = zStationBegPos[0]+zD3;
64 zStationBegPos[3] = zStationBegPos[0]+2*zD3;
93 std::cout <<
" CDividerFP420::ChargeDividerFP420:divide: direction= " << direction << std::endl;
94 std::cout <<
" CDividerFP420::ChargeDividerFP420:divide: direction.mag = " << direction.
mag() << std::endl;
96 std::cout <<
" pitchcur= " << pitchcur << std::endl;
97 std::cout <<
" peakMode = " << peakMode <<
" decoMode = " << decoMode <<
" fluctuateCharge= "<< fluctuateCharge <<
" chargedivisionsPerHit = " << chargedivisionsPerHit <<
" deltaCut= "<< deltaCut << std::endl;
100 int NumberOfSegmentation =
105 (int)(1+chargedivisionsPerHit*direction.
mag()/pitchcur);
109 std::cout <<
"NumberOfSegmentation= " << NumberOfSegmentation << std::endl;
116 std::cout <<
"CDividerFP420::ChargeDividerFP420:divide: eLoss= " << eLoss << std::endl;
122 float decSignal = TimeResponse(hit);
124 std::cout <<
"CDividerFP420::ChargeDividerFP420:divide: decSignal= " << decSignal << std::endl;
129 _ionization_points.resize(NumberOfSegmentation);
134 float* eLossVector =
new float[NumberOfSegmentation];
138 std::cout <<
"CDividerFP420::ChargeDividerFP420:divide: resize done; then, fluctuateCharge ? = " << fluctuateCharge << std::endl;
140 if( fluctuateCharge ) {
144 float momentum = hit.
pabs();
145 float length = direction.
mag();
148 std::cout <<
"pid= " << pid <<
"momentum= " << momentum <<
"eLoss= " << eLoss <<
"length= " << length << std::endl;
150 fluctuateEloss(pid, momentum, eLoss, length, NumberOfSegmentation, eLossVector);
153 for (
int i = 0;
i != NumberOfSegmentation; ++
i) {
154 if( fluctuateCharge ) {
155 energy=eLossVector[
i]*decSignal/eLoss;
158 _ionization_points[
i] = edu;
160 energy=decSignal/float(NumberOfSegmentation);
163 _ionization_points[
i] = edu;
168 std::cout <<
"CDividerFP420::ChargeDividerFP420:divide: !!! RESULT !!!" << std::endl;
169 std::cout <<
" _ionization_points size = " << _ionization_points.size() << std::endl;
170 for(
unsigned int i = 0;
i < _ionization_points.size(); ++
i ) {
171 std::cout <<
" eLossVector[i] i = " <<
i << eLossVector[
i] << std::endl;
175 delete[] eLossVector;
176 return _ionization_points;
180 float eloss,
float length,
181 int NumberOfSegs,
float elossVector[]) {
184 std::cout <<
"fluctuateEloss: eloss= " << eloss <<
"length= " << length <<
"NumberOfSegs= " << NumberOfSegs << std::endl;
188 double particleMass = 938.271;
193 if(pid==11) particleMass = 0.511;
194 else if(pid==13) particleMass = 105.658;
195 else if(pid==211) particleMass = 139.570;
198 float segmentLength = length/NumberOfSegs;
203 double segmentEloss = (1000.*eloss)/NumberOfSegs;
205 std::cout <<
"segmentLength= " << segmentLength <<
"segmentEloss= " << segmentEloss << std::endl;
208 for (
int i=0;
i<NumberOfSegs;++
i) {
213 double deltaCutoff = deltaCut;
214 de = fluctuate.SampleFluctuations(
double(particleMomentum*1000.),
215 particleMass, deltaCutoff,
216 double(segmentLength),
217 segmentEloss )/1000.;
223 std::cout <<
"sum= " << sum << std::endl;
227 float ratio = eloss/sum;
228 for (
int ii=0;
ii<NumberOfSegs;++
ii) elossVector[
ii]= ratio*elossVector[
ii];
230 float averageEloss = eloss/NumberOfSegs;
231 for (
int ii=0;
ii<NumberOfSegs;++
ii) elossVector[
ii]= averageEloss;
240 std::cout <<
"ChargeDividerFP420:TimeResponse: call of PeakShape" << std::endl;
242 return this->PeakShape( hit );
243 }
else if (decoMode) {
246 std::cout <<
"ChargeDividerFP420:TimeResponse: call of DeconvolutionShape" << std::endl;
248 return this->DeconvolutionShape( hit );
252 std::cout <<
"ChargeDividerFP420:TimeResponse: no any Shape" << std::endl;
269 float zEntry = 1000.;
274 int det,
zside, sector, zmodule;
280 float RRR =
sqrt(xEntry*xEntry + yEntry*yEntry + zEntry*zEntry);
281 float costheta = zEntry / RRR ;
287 float dist = (zStationBegPos[sector-1] - 420000.) / costheta;
292 std::cout <<
"sector=" << sector << std::endl;
293 std::cout <<
"zmodule=" << zmodule << std::endl;
294 std::cout <<
"zStationBegPos[sector-1]=" << zStationBegPos[sector-1] << std::endl;
296 std::cout <<
"costheta=" << costheta << std::endl;
297 std::cout <<
"unitID=" << unitID << std::endl;
300 std::cout <<
"dist found =" << dist << std::endl;
305 float SigmaShape = 52.17;
307 float tofNorm = (hit.
tof() - t0)/SigmaShape;
309 float readTimeNorm = -tofNorm;
313 std::cout <<
"ChargeDividerFP420:PeakShape::dist=" << dist << std::endl;
316 std::cout <<
"tofNorm=" << tofNorm << std::endl;
317 std::cout <<
"1 + readTimeNorm=" << 1 + readTimeNorm << std::endl;
319 std::cout <<
"(1 + readTimeNorm)*exp(-readTimeNorm)=" << (1 + readTimeNorm)*
exp(-readTimeNorm) << std::endl;
322 if (1 + readTimeNorm > 0) {
324 return hit.
energyLoss()*(1 + readTimeNorm)*
exp(-readTimeNorm);
340 float zEntry = 1000.;
345 int det,
zside, sector, zmodule;
351 float RRR =
sqrt(xEntry*xEntry + yEntry*yEntry + zEntry*zEntry);
352 float costheta = zEntry / RRR ;
358 float dist = (zStationBegPos[sector-1] - 420000.) / costheta;
363 std::cout <<
"sector=" << sector << std::endl;
364 std::cout <<
"zmodule=" << zmodule << std::endl;
365 std::cout <<
"zStationBegPos[sector-1]=" << zStationBegPos[sector-1] << std::endl;
367 std::cout <<
"costheta=" << costheta << std::endl;
368 std::cout <<
"unitID=" << unitID << std::endl;
371 std::cout <<
"dist found =" << dist << std::endl;
375 float SigmaShape = 12.;
379 float tofNorm = (hit.
tof() - t0)/SigmaShape;
381 float readTimeNorm = -tofNorm;
386 std::cout <<
"ChargeDividerFP420:DeconvolutionShape::dist=" << dist << std::endl;
389 std::cout <<
"tofNorm=" << tofNorm << std::endl;
391 std::cout <<
"exp(-0.5*readTimeNorm*readTimeNorm)=" <<
exp(-0.5*readTimeNorm*readTimeNorm) << std::endl;
float tof() const
deprecated name for timeOfFlight()
ChargeDividerFP420(double pit, double az420, double azD2, double azD3, int)
static void unpackFP420Index(const unsigned int &idx, int &det, int &zside, int &station, int &superplane)
std::vector< EnergySegmentFP420 > ionization_type
Local3DPoint exitPoint() const
Exit point in the local Det frame.
float DeconvolutionShape(const PSimHit &)
CDividerFP420::ionization_type divide(const PSimHit &, const double &)
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[])
virtual ~ChargeDividerFP420()
float TimeResponse(const PSimHit &)
float PeakShape(const PSimHit &)
float energyLoss() const
The energy deposit in the PSimHit, in ???.
Local3DPoint entryPoint() const
Entry point in the local Det frame.
unsigned int detUnitId() const