26 #include "larevt/CalibrationDBI/Interface/ChannelStatusProvider.h" 27 #include "larevt/CalibrationDBI/Interface/ChannelStatusService.h" 77 fIndWidth = pset.get<
int>(
"IndWidth", 20);
83 fAreaNorms = pset.get<std::vector<double>>(
"AreaNorms");
85 fSkipInd = pset.get<
bool>(
"SkipInd",
false);
116 std::vector<float> holder;
117 std::vector<short> rawadc;
125 std::vector<float> startTimes;
126 std::vector<float> maxTimes;
127 std::vector<float> endTimes;
128 std::vector<float> peakHeight;
129 std::vector<float> hitrms;
130 std::vector<double> charge;
132 uint32_t channel = 0;
133 double threshold = 0;
138 std::stringstream numConv;
140 hcol.
reserve(digitVecHandle->size());
141 for (
size_t rdIter = 0; rdIter < digitVecHandle->size(); ++rdIter) {
162 lariov::ChannelStatusProvider
const& channelStatus =
165 lariov::ChannelStatusProvider::ChannelSet_t
const BadChannels = channelStatus.BadChannels();
180 bool channelSwitch =
false;
182 for (
auto it = BadChannels.begin(); it != BadChannels.end(); it++) {
183 if (channel == *it) {
184 channelSwitch =
true;
189 if (channelSwitch ==
false) {
203 float negthr = -1.0 * threshold;
204 unsigned int bin = 1;
208 while (bin < (fDataSize - 1)) {
209 float thisadc = holder[
bin];
210 float nextadc = holder[bin + 1];
211 if (thisadc < negthr &&
215 unsigned int place =
bin;
216 while (thisadc <= 0 && bin > 0) {
219 thisadc = holder[
bin];
221 float hittime = bin + thisadc / (thisadc - holder[bin + 1]);
222 maxTimes.push_back(hittime);
230 while (thisadc < threshold && bin > stop) {
233 thisadc = holder[
bin];
235 if (bin >= 2) bin -= 2;
236 while (thisadc > threshold && bin > stop) {
239 thisadc = holder[
bin];
241 startTimes.push_back(bin + 1);
244 thisadc = holder[
bin];
247 totSig = fabs(thisadc);
248 while (thisadc < negthr && bin < fDataSize) {
249 totSig += fabs(thisadc);
250 thisadc = holder[
bin];
251 if (thisadc < minadc) minadc = thisadc;
254 endTimes.push_back(bin - 1);
255 peakHeight.push_back(-1.0 * minadc);
256 charge.push_back(totSig);
257 hitrms.push_back(5.0);
262 while (thisadc < 0 && bin < fDataSize) {
265 if (bin == fDataSize)
break;
266 thisadc = holder[
bin];
280 float madc = threshold;
284 unsigned int bin = 0;
286 while (bin < fDataSize) {
287 float thisadc = holder[
bin];
291 if (thisadc > madc) {
294 if (thisadc > threshold && bin < fDataSize) {
295 while (thisadc > threshold && bin < fDataSize) {
296 if (thisadc > madc) {
301 if (bin == fDataSize)
break;
302 thisadc = holder[
bin];
312 maxTimes.push_back(ibin);
313 peakHeight.push_back(madc);
314 startTimes.push_back(start);
315 endTimes.push_back(end);
324 for (
int i = start - moreTail; i <= end + moreTail; i++) {
325 if (i < (
int)(holder.size()) && i >= 0) {
326 float temp = ibin - i;
327 myrms += temp * temp * holder[i];
333 charge.push_back(totSig);
336 hitrms.push_back(sqrt(myrms));
373 double amplitude(0), position(0);
374 double start(0),
end(0);
375 double amplitudeErr(0), positionErr(0);
376 double goodnessOfFit(0), chargeErr(0);
379 numHits = maxTimes.size();
380 for (
int i = 0; i < numHits; ++i) {
381 amplitude = peakHeight[i];
382 position = maxTimes[i];
383 start = startTimes[i];
392 std::vector<geo::WireID> wids = geom->
ChannelToWire(channel);
397 <<
"Hit start " << start <<
" is >= hit end " <<
end;
412 std::accumulate(holder.begin() + (int)start,
413 holder.begin() + (int)end,
float GetPedestal() const
const ADCvector_t & ADCs() const
Reference to the compressed ADC count vector.
void produce(art::Event &evt) override
ULong64_t Samples() const
Number of samples in the uncompressed ADC data.
std::vector< WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
std::string fHitLabelName
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
EDProducer(fhicl::ParameterSet const &pset)
ChannelID_t Channel() const
DAQ channel this raw data was read from.
std::vector< double > fAreaNorms
Definition of basic raw digits.
static void declare_products(art::ProducesCollector &collector, std::string instance_name="", bool doWireAssns=true, bool doRawDigitAssns=true)
Declares the hit products we are going to fill.
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Class managing the creation of a new recob::Hit object.
Helper functions to create a hit.
A class handling a collection of hits and its associations.
#define DEFINE_ART_MODULE(klass)
Signal from induction planes.
void reserve(size_t new_size)
Prepares the collection to host at least new_size hits.
enum geo::_plane_sigtype SigType_t
Enumerate the possible plane projections.
Collect all the RawData header files together.
RawHitFinder(fhicl::ParameterSet const &pset)
void emplace_back(recob::Hit &&hit, art::Ptr< recob::Wire > const &wire=art::Ptr< recob::Wire >(), art::Ptr< raw::RawDigit > const &digits=art::Ptr< raw::RawDigit >())
Adds the specified hit to the data collection.
Definition of data types for geometry description.
void put_into(art::Event &)
Moves the data into an event.
Detector simulation of raw signals on wires.
ProducesCollector & producesCollector() noexcept
raw::Compress_t Compression() const
Compression algorithm used to store the ADC counts.
SigType_t SignalType(PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
std::string fCalDataModuleLabel
art::InputTag fDigitModuleLabel
void Uncompress(const std::vector< short > &adc, std::vector< short > &uncompressed, raw::Compress_t compress)
Uncompresses a raw data buffer.
art framework interface to geometry description
Signal from collection planes.