169 std::vector<geo::WireID> wireids = geo->
ChannelToWire(channel);
171 std::map<geo::WireID, std::map<unsigned int, double>> wireIDSignals;
175 for (
auto const& mapitr : idemap) {
176 unsigned short tdc = mapitr.first;
179 if (tdc < spill * fReadOutWindowSize || tdc > (spill + 1) *
fReadOutWindowSize)
continue;
187 for (
auto const& ideitr : mapitr.second) {
189 const float edep = ideitr.numElectrons;
191 std::array<double, 3>
pos;
199 <<
"TPC for position ( " << pos[0] <<
" ; " << pos[1] <<
" ; " << pos[2] <<
" )" 200 <<
" in no TPC; move on to the next sim::IDE";
203 const unsigned int tpc = tpcID.
TPC;
204 const unsigned int cstat = tpcID.
Cryostat;
206 for (
auto const& wid : wireids) {
207 if (wid.TPC == tpc && wid.Cryostat == cstat) {
211 if (wid.Wire == geo->
NearestWire(pos.data(), wid.Plane, wid.TPC, wid.Cryostat))
212 wireIDSignals[wid][tdc] += edep;
219 for (
auto const& widitr : wireIDSignals) {
222 unsigned short prev = widitr.second.begin()->first;
223 unsigned short startTime = prev;
224 double totCharge = 0.;
225 double maxCharge = -1.;
226 double peakTime = 0.;
227 int multiplicity = 1;
231 for (
auto tdcitr : widitr.second) {
232 unsigned short tdc = tdcitr.first;
242 hits.emplace_back(channel,
249 std::sqrt(maxCharge),
252 std::sqrt(totCharge),
262 MF_LOG_DEBUG(
"HitCheater") <<
"new hit is " << hits.back();
281 time.
add(tdc - startTime, adc);
282 if (adc > maxCharge) {
293 hits.emplace_back(channel,
300 std::sqrt(maxCharge),
303 std::sqrt(totCharge),
313 MF_LOG_DEBUG(
"HitCheater") <<
"last hit is " << hits.back();
int fNumberTimeSamples
Number of total time samples (N*readoutwindowsize)
int fNewHitTDCGap
gap allowed in tdcs without charge before making a new hit
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
bool isValid
Whether this ID points to a valid element.
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
CryostatID_t Cryostat
Index of cryostat.
SigType_t SignalType(geo::PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
Weight_t RMS() const
Returns the root mean square.
double fMinCharge
Minimum charge required to make a hit.
int TDCtick_t
Type representing a TDC tick.
geo::TPCID FindTPCAtPosition(double const worldLoc[3]) const
Returns the ID of the TPC at specified location.
enum geo::_plane_sigtype SigType_t
geo::WireID::WireID_t NearestWire(geo::Point_t const &point, geo::PlaneID const &planeid) const
Returns the index of wire closest to position in the specified TPC.
The data type to uniquely identify a TPC.
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
raw::ChannelID_t Channel() const
Returns the readout channel this object describes.
int fReadOutWindowSize
Number of samples in a readout window; NOT total samples.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
TDCIDEs_t const & TDCIDEMap() const
Returns all the deposited energy information as stored.
unsigned int ChannelID_t
Type representing the ID of a readout channel.
double fElectronsToADC
Conversion factor of electrons to ADC counts.
TPCID_t TPC
Index of the TPC within its cryostat.
void clear()
Clears all the statistics.
LArSoft geometry interface.
Collects statistics on a single quantity (weighted)
void add(Data_t value, Weight_t weight=Weight_t(1.0))
Adds one entry with specified value and weight.