25 const string myname =
"StandardAdcWireBuildingService::ctor: ";
35 const string myname =
"StandardAdcWireBuildingService:build: ";
36 if (
m_LogLevel >= 2 ) cout << myname <<
"Building recob::Wire for channel " 38 if ( data.
wire !=
nullptr ) {
39 cout << myname <<
"WARNING: Wire already exists for channel " << data.
channel()
40 <<
". No action taken." <<
endl;
43 if ( data.
digit ==
nullptr ) {
44 cout << myname <<
"WARNING: No digit is specified for channel " << data.
channel()
45 <<
". No action taken." <<
endl;
49 cout << myname <<
"WARNING: Input data channel differs from digit: " << data.
channel()
53 if ( data.
samples.size() == 0 ) {
54 cout << myname <<
"WARNING: Channel " << data.
channel() <<
" has no samples." <<
endl;
58 cout << myname <<
" Channel " << data.
channel() <<
" has " << data.
rois.size() <<
" ROI" 59 << (data.
rois.size()==1 ?
"" :
"s") <<
"." <<
endl;
64 unsigned int lastROI = 0;
68 for (
unsigned int isig=roi.first; isig<=roi.second; ++isig ) {
78 for(
unsigned int isig = 0; isig < data.
samples.size(); ++isig) {
80 for(
const auto& roi : data.
rois) {
81 if(isig >= roi.first && isig <= roi.second) {
87 if(data.
samples[isig] == 0)
continue;
97 double arg = sum2 - cnt * ped * ped;
98 if(arg > 0) rms = sqrt(arg / (cnt - 1));
109 bool dataOwnsWire = (pwires ==
nullptr) || (data.
rois.size() == 0);
110 if ( ! dataOwnsWire ) {
111 if ( pwires->size() == pwires->capacity() ) {
112 cout << myname <<
"ERROR: Wire vector capacity " << pwires->capacity()
113 <<
" is too small. Wire is not recorded." <<
endl;
117 pwires->push_back(wc.
move());
118 data.
wire = &pwires->back();
120 cout << myname <<
" Channel " << data.
channel() <<
" ROIs stored in container." <<
endl;
123 if ( dataOwnsWire ) {
135 out << prefix <<
"StandardAdcWireBuildingService:" <<
endl;
double rms(sqlite3 *db, std::string const &table_name, std::string const &column_name)
Helper functions to create a wire.
std::ostream & print(std::ostream &out=std::cout, std::string prefix="") const
ChannelID_t Channel() const
DAQ channel this raw data was read from.
std::pair< AdcIndex, AdcIndex > AdcRoi
const datarange_t & add_range(size_type offset, ITER first, ITER last)
Adds a sequence of elements as a range with specified offset.
Wire && move()
Prepares the constructed wire to be moved away.
Class managing the creation of a new recob::Wire object.
const raw::RawDigit * digit
std::vector< recob::Wire > WireVector
Q_EXPORT QTSManip setw(int w)
std::optional< T > get_if_present(std::string const &key) const
std::vector< AdcSignal > AdcSignalVector
void push_back(value_type value)
StandardAdcWireBuildingService(fhicl::ParameterSet const &pset, art::ActivityRegistry &)
int build(AdcChannelData &data, WireVector *pwires) const
QTextStream & endl(QTextStream &s)
#define DEFINE_ART_SERVICE_INTERFACE_IMPL(svc, iface)