Skip to content

Commit b0b6e3d

Browse files
committed
Merge branch 'release/v10_00_10'
2 parents ffd1b1e + 8ec6721 commit b0b6e3d

14 files changed

Lines changed: 416 additions & 15 deletions

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
1515

1616
find_package(cetmodules 3.20.00 REQUIRED)
17-
project(sbnobj VERSION 10.00.09 LANGUAGES CXX)
17+
project(sbnobj VERSION 10.00.10 LANGUAGES CXX)
1818

1919
message(STATUS
2020
"\n-- ============================================================================="
@@ -34,9 +34,13 @@ cet_set_compiler_flags(DIAGS CAUTIOUS
3434
cet_report_compiler_flags(REPORT_THRESHOLD VERBOSE)
3535

3636
# these are minimum required versions, not the actual product versions
37+
find_package(art REQUIRED EXPORT)
38+
find_package(canvas REQUIRED EXPORT)
3739
find_package( messagefacility REQUIRED )
3840
find_package( canvas REQUIRED )
41+
find_package( larcore REQUIRED )
3942
find_package( larcoreobj REQUIRED )
43+
find_package( lardata REQUIRED )
4044
find_package( lardataobj REQUIRED )
4145
find_package( larcorealg REQUIRED )
4246
find_package( lardataalg REQUIRED )

sbnobj/Common/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ add_subdirectory(SBNEventWeight)
77
add_subdirectory(POTAccounting)
88
add_subdirectory(EventGen)
99
add_subdirectory(Trigger)
10+
add_subdirectory(Utilities)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
cet_make_library(
2+
SOURCE
3+
ChannelROICreator.cxx
4+
LIBRARIES
5+
cetlib_except::cetlib_except
6+
messagefacility::MF_MessageLogger
7+
sbnobj::ICARUS_TPC
8+
larcore::Geometry_Geometry_service
9+
larcorealg::Geometry
10+
lardata::ArtDataHelper
11+
lardataobj::AnalysisBase
12+
art::Framework_Core
13+
art::Framework_Principal
14+
art::Framework_Services_Registry
15+
art::Persistency_Common
16+
art::Persistency_Provenance
17+
art::Utilities
18+
)
19+
20+
install_headers()
21+
install_source()
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/** ****************************************************************************
2+
* @file ChannelROICreator.cxx
3+
* @brief Helper functions to create a wire - implementation file
4+
* @date April 20, 2025
5+
* @author usher@slac.stanford.edu
6+
* @see ChannelROI.h ChannelROICreator.h
7+
*
8+
* ****************************************************************************/
9+
10+
// declaration header
11+
#include "sbnobj/Common/Utilities/ChannelROICreator.h"
12+
13+
// LArSoft libraries
14+
#include "lardataobj/RawData/RawDigit.h"
15+
16+
/// Reconstruction base classes
17+
namespace recob {
18+
19+
//----------------------------------------------------------------------
20+
ChannelROICreator::ChannelROICreator
21+
(const RegionsOfInterest_t& sigROIlist, const raw::RawDigit& rawdigit):
22+
channelROI(
23+
sigROIlist,
24+
rawdigit.Channel()
25+
)
26+
{
27+
// resize fSignalROI again:
28+
// just in case the user hasn't cared to set sigROIlist size right
29+
channelROI.fSignalROI.resize(rawdigit.Samples());
30+
} // Wire::Wire(RegionsOfInterest_t&)
31+
32+
//----------------------------------------------------------------------
33+
ChannelROICreator::ChannelROICreator
34+
(RegionsOfInterest_t&& sigROIlist, const raw::RawDigit& rawdigit):
35+
channelROI(
36+
std::move(sigROIlist),
37+
rawdigit.Channel()
38+
)
39+
{
40+
// resize fSignalROI again:
41+
// just in case the user hasn't cared to set sigROIlist size right
42+
channelROI.fSignalROI.resize(rawdigit.Samples());
43+
} // Wire::Wire(RegionsOfInterest_t&)
44+
45+
//----------------------------------------------------------------------
46+
ChannelROICreator::ChannelROICreator(
47+
RegionsOfInterest_t const& sigROIlist,
48+
raw::ChannelID_t channel,
49+
short int adcScaleFactor
50+
):
51+
channelROI(sigROIlist, channel, adcScaleFactor)
52+
{}
53+
54+
//----------------------------------------------------------------------
55+
ChannelROICreator::ChannelROICreator(
56+
RegionsOfInterest_t&& sigROIlist,
57+
raw::ChannelID_t channel,
58+
short int adcScaleFactor
59+
):
60+
channelROI(std::move(sigROIlist), channel, adcScaleFactor)
61+
{}
62+
63+
} // namespace recob
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
/** ****************************************************************************
2+
* @file ChannelROICreator.h
3+
* @brief Helper functions to create a wire
4+
* @date April 20,2025
5+
* @author usher@slac.stanford.edu
6+
* @see ChannelROI.h ChannelROICreator.cxx
7+
*
8+
* ****************************************************************************/
9+
10+
#ifndef ChannelROICreator_H
11+
#define ChannelROICreator_H
12+
13+
// C/C++ standard library
14+
#include <utility> // std::move()
15+
16+
// LArSoft libraries
17+
#include "larcoreobj/SimpleTypesAndConstants/RawTypes.h" // raw::ChannelID_t
18+
#include "sbnobj/ICARUS/TPC/ChannelROI.h"
19+
20+
namespace raw { class RawDigit; }
21+
22+
/// Reconstruction base classes
23+
namespace recob {
24+
25+
/**
26+
* @brief Class managing the creation of a new recob::Wire object
27+
*
28+
* As Gianluca Petrillo points out, the same considerations described in
29+
* `recob::WireCreator` apply here as well
30+
*/
31+
class ChannelROICreator {
32+
public:
33+
/// Alias for the type of regions of interest
34+
using RegionsOfInterest_t = ChannelROI::RegionsOfInterest_t;
35+
36+
// destructor, copy and move constructor and assignment as default
37+
38+
/**
39+
* @brief Constructor: uses specified signal in regions of interest
40+
* @param sigROIlist signal organized in regions of interest
41+
* @param rawdigit the raw digit this channel is associated to
42+
*
43+
* The information used from the raw digit are the channel ID and the
44+
* length in samples (TDC ticks) of the original readout window.
45+
*/
46+
ChannelROICreator
47+
(const RegionsOfInterest_t& sigROIlist, const raw::RawDigit& rawdigit);
48+
49+
50+
/**
51+
* @brief Constructor: uses specified signal in regions of interest
52+
* @param sigROIlist signal organized in regions of interest
53+
* @param rawdigit the raw digit this channel is associated to
54+
*
55+
* The information used from the raw digit are the channel ID and the
56+
* length in samples (TDC ticks) of the original readout window.
57+
*
58+
* Signal information is moved from sigROIlist, that becomes empty.
59+
*/
60+
ChannelROICreator
61+
(RegionsOfInterest_t&& sigROIlist, const raw::RawDigit& rawdigit);
62+
63+
64+
/**
65+
* @brief Constructor: uses specified signal in regions of interest
66+
* @param sigROIlist signal organized in regions of interest
67+
* @param channel the ID of the channel
68+
* @param adcScaleFactor the scaling used to preserve resolution
69+
*
70+
* The information used from the raw digit are the channel ID and the
71+
* length in samples (TDC ticks) of the original readout window.
72+
*/
73+
ChannelROICreator(
74+
RegionsOfInterest_t const& sigROIlist,
75+
raw::ChannelID_t channel,
76+
short int adcScaleFactor = recob::ChannelROI::defADCScaleFactor
77+
);
78+
79+
80+
/**
81+
* @brief Constructor: uses specified signal in regions of interest
82+
* @param sigROIlist signal organized in regions of interest
83+
* @param channel the ID of the channel
84+
* @param adcScaleFactor the scaling used to preserve resolution
85+
*
86+
* The information used from the raw digit are the channel ID and the
87+
* length in samples (TDC ticks) of the original readout window.
88+
*
89+
* Signal information is moved from sigROIlist, that becomes empty.
90+
*/
91+
ChannelROICreator(
92+
RegionsOfInterest_t&& sigROIlist,
93+
raw::ChannelID_t channel,
94+
short int adcScaleFactor = recob::ChannelROI::defADCScaleFactor
95+
);
96+
97+
/**
98+
* @brief Prepares the constructed wire to be moved away
99+
* @return a right-value reference to the constructed wire
100+
*
101+
* Despite the name, no move happens in this function.
102+
* Move takes place in the caller code as proper; for example:
103+
*
104+
* // be wire a ChannelROICreator instance:
105+
* std::vector<recob::Wire> Wires;
106+
* wire.move(); // nothing happens
107+
* Wires.push_back(wire.move()); // here the copy happens
108+
* recob::Wire single_wire(wire.move()); // wrong! wire is empty now
109+
*
110+
*/
111+
ChannelROI&& move() { return std::move(channelROI); }
112+
113+
114+
/**
115+
* @brief Returns the constructed wire
116+
* @return a constant reference to the constructed wire
117+
*
118+
* Despite the name, no copy happens in this function.
119+
* Copy takes place in the caller code as proper; for example:
120+
*
121+
* // be wire a ChannelROICreator instance:
122+
* std::vector<recob::Wire> Wires;
123+
* wire.copy(); // nothing happens
124+
* Wires.push_back(wire.copy()); // here a copy happens
125+
* recob::Wire single_wire(wire.copy()); // wire is copied again
126+
*
127+
*/
128+
const ChannelROI& copy() const { return channelROI; }
129+
130+
protected:
131+
132+
ChannelROI channelROI; ///< local instance of the wire being constructed
133+
134+
}; // class ChannelROICreator
135+
136+
} // namespace recob
137+
138+
#endif // ChannelROICreator_H

sbnobj/ICARUS/TPC/ChannelROI.cxx

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,36 @@
1010

1111
// C/C++ standard libraries
1212
#include <utility> // std::move()
13+
#include <functional> // std::bind()
1314

1415
namespace recob{
1516

1617
//----------------------------------------------------------------------
1718
ChannelROI::ChannelROI()
1819
: fChannel(raw::InvalidChannelID)
20+
, fADCScaleFactor(defADCScaleFactor)
1921
, fSignalROI()
2022
{}
2123

2224
//----------------------------------------------------------------------
2325
ChannelROI::ChannelROI(
2426
RegionsOfInterest_t const& sigROIlist,
25-
raw::ChannelID_t channel
27+
raw::ChannelID_t channel,
28+
short int adcScaleFactor
2629
)
2730
: fChannel(channel)
31+
, fADCScaleFactor(adcScaleFactor)
2832
, fSignalROI(sigROIlist)
2933
{}
3034

3135
//----------------------------------------------------------------------
3236
ChannelROI::ChannelROI(
3337
RegionsOfInterest_t&& sigROIlist,
34-
raw::ChannelID_t channel
38+
raw::ChannelID_t channel,
39+
short int adcScaleFactor
3540
)
3641
: fChannel(channel)
42+
, fADCScaleFactor(adcScaleFactor)
3743
, fSignalROI(std::move(sigROIlist))
3844
{}
3945

@@ -43,6 +49,28 @@ namespace recob{
4349
return { fSignalROI.begin(), fSignalROI.end() };
4450
} // ChannelROI::Signal()
4551

52+
ChannelROI::RegionsOfInterest_f ChannelROI::SignalROIF() const
53+
{
54+
RegionsOfInterest_f ROIVec;
55+
56+
/// Note that when we are storing we scale the ADC values by a factor
57+
/// in order to maintain resolution
58+
//const float ADCScaleFactor = 10.;
59+
60+
// Loop through the ROIs for this channel
61+
for(const auto& range : fSignalROI.get_ranges())
62+
{
63+
size_t startTick = range.begin_index();
64+
65+
std::vector<float> dataVec(range.data().begin(),range.data().end());
66+
67+
for(auto& data : dataVec) data /= fADCScaleFactor;
68+
69+
ROIVec.add_range(startTick, std::move(dataVec));
70+
}
71+
72+
return ROIVec;
73+
}
4674

4775
}
4876
////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)