122 double response_plane = 10.0 * units::cm;
123 double response_time_offset = response_plane /
m_drift_speed;
124 int response_nticks = (int)(response_time_offset /
m_tick);
134 for(
auto face : anode->faces()){
135 auto boundbox = face->sensitive();
136 if(!boundbox.inside(depo->pos()))
continue;
140 for (
auto plane : face->planes()) {
142 int iplane = plane->planeid().index();
143 if (iplane<0)
continue;
144 const Pimpos* pimpos = plane->pimpos();
145 auto& wires = plane->wires();
147 const double center_time = depo->time();
148 const double center_pitch = pimpos->distance(depo->pos());
150 double sigma_L = depo->extent_long();
154 double add_sigma_L = 1.428249 * time_slice_width / nrebin / (m_tick/units::us);
155 sigma_L = sqrt( pow(depo->extent_long(),2) + pow(add_sigma_L,2) );
157 Gen::GausDesc time_desc(center_time, sigma_L /
m_drift_speed);
160 double nmin_sigma = time_desc.distance(tbins.min());
161 double nmax_sigma = time_desc.distance(tbins.max());
164 if (nmin_sigma > eff_nsigma || nmax_sigma < -eff_nsigma) {
170 auto wbins = pimpos->region_binning();
172 double sigma_T = depo->extent_tran();
174 double add_sigma_T = wbins.binsize();
175 if (iplane==0) add_sigma_T *= (0.402993*0.3);
176 else if (iplane==1) add_sigma_T *= (0.402993*0.5);
177 else if (iplane==2) add_sigma_T *= (0.188060*0.2);
178 sigma_T = sqrt( pow(depo->extent_tran(),2) + pow(add_sigma_T,2) );
180 Gen::GausDesc pitch_desc(center_pitch, sigma_T);
183 double nmin_sigma = pitch_desc.distance(wbins.min());
184 double nmax_sigma = pitch_desc.distance(wbins.max());
186 double eff_nsigma = depo->extent_tran()>0?
m_nsigma:0;
187 if (nmin_sigma > eff_nsigma || nmax_sigma < -eff_nsigma) {
192 auto gd = std::make_shared<Gen::GaussianDiffusion>(depo, time_desc, pitch_desc);
193 gd->set_sampling(tbins, wbins,
m_nsigma, 0, 1);
197 double energy = 100.0;
199 id = depo->prior()->id();
207 const auto patch = gd->patch();
208 const int poffset_bin = gd->poffset_bin();
209 const int toffset_bin = gd->toffset_bin();
210 const int np = patch.rows();
211 const int nt = patch.cols();
214 int max_imp = wbins.nbins();
216 for (
int pbin = 0; pbin != np; pbin++){
217 int abs_pbin = pbin + poffset_bin;
218 if (abs_pbin < min_imp || abs_pbin >= max_imp)
continue;
220 auto iwire = wires[abs_pbin];
221 int channel = iwire->channel();
226 auto channelData =
m_mapSC.find(channel);
229 : channelData->second;
231 for (
int tbin = 0; tbin!= nt; tbin++){
232 int abs_tbin = tbin + toffset_bin;
233 double charge = patch(pbin, tbin);
234 double tdc = tbins.center(abs_tbin);
250 WireCell::IDepo::pointer orig = depo_chain(depo).back();
251 xyz[0] = orig->pos().x()/units::cm;
252 xyz[1] = orig->pos().y()/units::cm;
253 xyz[2] = orig->pos().z()/units::cm;
256 charge =
abs(charge);
Energy deposited on a readout channel by simulated tracks.
for($it=0;$it< $RaceTrack_number;$it++)
std::vector< WireCell::IAnodePlane::pointer > m_anodes
std::map< unsigned int, sim::SimChannel > m_mapSC
void AddIonizationElectrons(TrackID_t trackID, TDC_t tdc, double numberElectrons, double const *xyz, double energy, TrackID_t origTrackID=util::kBogusI)
Add ionization electrons and energy to this channel.