70 {
71
72
73
74
77
78
81
82
83 const CscReadoutElement* descriptor =
m_muonMgr->getCscReadoutElement(HitId);
84 if (!descriptor) {
85 std::cout << "CSC_Digitizer::ERROR : Cannot get descriptor for GeoModel = " << std::endl;
86 return StatusCode::FAILURE;
87 }
88
89
91
93 double step = stepHit.mag();
94
95 if (step == 0) return StatusCode::SUCCESS;
96
97
98 int nInter = 0;
99 if (ipart == 1)
100 nInter = 1;
101 else {
105 0.000001;
106 nInter = energyLoss / elecEnergy;
107 } else {
108 double average_int = 30;
109 double pois = CLHEP::RandPoisson::shoot(rndmEngine, average_int);
110 nInter =
int(step * pois / 10.0 + 0.5);
112 std::cout <<
"[CSC_Digitizer::digitize_hit(NEW)] nInter info from random number pois:step:nInter " << pois <<
" " <<
step
113 << " " << nInter << std::endl;
114 }
115 }
116
117 if (nInter <= 0) return StatusCode::SUCCESS;
118
119 double wireCharge{0.};
120 int nElectrons{0};
121
122
123 for (
int i = 0;
i < nInter; ++
i) {
125 if (ipart == 1 || ipart == 999)
127 else
128 t = CLHEP::RandFlat::shoot(rndmEngine, 0.0, 1.0);
129
131
132
133 double preDriftTime =
getDriftTime(descriptor, pos_vec);
135
137 std::cout <<
"[CSC_Digitizer::digitize_hit(NEW)] totTime:driftTime:hitTime:bunchTime (ns) = " <<
driftTime <<
" "
139 std::cout << "[CSC_Digitizer::digitize_hit(NEW)] start hit coordinates (xc,yc,zc) / step hit and t / the hit are " << startHit
140 <<
" " << stepHit <<
" " <<
t <<
" " << pos_vec << std::endl;
141 }
142
143
144
145
146
147
149
150
151 double flat = CLHEP::RandFlat::shoot(rndmEngine, 0.0, 1.0);
156 break;
157 }
158 }
159
160
161
163 double gammaDist = CLHEP::RandGamma::shoot(rndmEngine, (1.0 +
m_Polia), 1.0);
164 wireCharge =
qWire(nElectrons, gammaDist);
165
167 std::cout <<
"[CSC_Digitizer::digitize_hit(NEW)] flat:p:maxEle:nEle:gammaDist:wireCharge " << flat <<
" " <<
p <<
" "
168 <<
s_maxElectron <<
" " << nElectrons <<
" " << gammaDist <<
" " << wireCharge << std::endl;
169 }
170
171
172 for (int measuresPhi = 0; measuresPhi <= 1; ++measuresPhi) {
175
177 std::cout << "[CSC_Digitizer::digitize_hit(NEW)] CSC_Digitizer::digitize_hit: Chamber Parameters"
178 <<
" measuresPhi= " << measuresPhi <<
" stripWidth= " << stripWidth <<
" maxStrip= " <<
maxStrip << std::endl;
179 }
180
181
182
183 if (measuresPhi == 0) {
184 double zz = pos_vec.z() +
maxStrip * stripWidth * 0.50;
185 int strip =
int(zz / stripWidth) + 1;
186
187 for (
int j =
strip - 4; j <=
strip + 4; ++j) {
188 double zpos = stripWidth * j - stripWidth * 0.50;
189 if (j > 0 && j <= maxStrip) {
190 double stripCharge = wireCharge *
qStripR((zpos - zz) / stripWidth, HitId) * 0.50;
191
192
194 std::cout << "[CSC_Digitizer::digitize_hit(NEW)] zpos = " << zpos << " zz = " << zz
195 << " diff = " << std::abs(zz - zpos) << " strip = " << j << " charge = " << stripCharge << std::endl;
196
197 IdentifierHash hashId =
getHashId(HitId, j, measuresPhi);
198 fillSampleMaps(hashId, driftTime, stripCharge, hashVec, data_SampleMap);
199 fillSampleMaps(hashId, driftTime, stripCharge, hashVec, data_SampleMapOddPhase, 1);
201 std::cout <<
"[CSC_Digitizer::digitize_hit(NEW)] DriftTimeVSstripCharge " <<
driftTime <<
" " << stripCharge
202 << std::endl;
203 }
204 }
205 } else {
208
209 yy = pos_vec.y() +
maxStrip * stripWidth * 0.5;
211 yy = -pos_vec.y() +
maxStrip * stripWidth * 0.5;
213
214
215 for (
int j =
strip - 1; j <=
strip + 1; ++j) {
216 if (j > 0 && j <= maxStrip) {
217 double ypos = stripWidth * (j - 0.5);
218 double stripCharge = wireCharge *
qStripPhi(ypos - yy, HitId) * 0.50;
220 std::cout <<
"[CSC_Digitizer::digitize_hit(NEW)] ypos = " << ypos <<
" yy = " <<
yy
221 << " diff = " << std::abs(yy - ypos) << " strip = " << j << " charge = " << stripCharge << std::endl;
222
223 IdentifierHash hashId =
getHashId(HitId, j, measuresPhi);
224 fillSampleMaps(hashId, driftTime, stripCharge, hashVec, data_SampleMap);
225 fillSampleMaps(hashId, driftTime, stripCharge, hashVec, data_SampleMapOddPhase, 1);
226 }
227 }
228 }
229 }
230 }
231
232 return StatusCode::SUCCESS;
233}
double energyDeposit() const
bool m_NInterFromEnergyLoss