Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions sbndcode/Utilities/SignalShapingServiceSBND.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
#include "art/Framework/Services/Registry/ActivityRegistry.h"
#include "art/Framework/Services/Registry/ServiceMacros.h"
#include "lardata/Utilities/SignalShaping.h"
#include "larcore/Geometry/Geometry.h"
#include "larcorealg/Geometry/TPCGeo.h"
#include "larcorealg/Geometry/PlaneGeo.h"
namespace detinfo { class DetectorClocksData; }

#include "TF1.h"
Expand Down Expand Up @@ -92,6 +95,7 @@ namespace util {
void init() const{const_cast<SignalShapingServiceSBND*>(this)->init();}
void init();


// Calculate response functions.
// Copied from SimWireSBND.

Expand All @@ -102,6 +106,9 @@ namespace util {


void SetFilters();

// Calculate view corresponding to channel
geo::View_t GetView(unsigned int chan) const;

// Attributes.

Expand Down
47 changes: 28 additions & 19 deletions sbndcode/Utilities/SignalShapingServiceSBND_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,11 @@ util::SignalShapingServiceSBND::SignalShaping(unsigned int channel) const
if(!fInit)
init();

// Figure out plane type.

art::ServiceHandle<geo::Geometry> geom;
//geo::SigType_t sigtype = geom->SignalType(channel);
// art::ServiceHandle<geo::Geometry> geom;

// Figure out plane type.
// we need to distiguish the U and V planes
geo::View_t view = geom->View(channel);
geo::View_t view = GetView(channel);

// Return appropriate shaper.
//geo::SigType_t sigtype = geom->SignalType(channel);
Expand All @@ -250,11 +248,8 @@ util::SignalShapingServiceSBND::SignalShaping(unsigned int channel) const
//---Give Gain Settings to SimWire ---//
double util::SignalShapingServiceSBND::GetASICGain(unsigned int const channel) const
{
art::ServiceHandle<geo::Geometry> geom;
//geo::SigType_t sigtype = geom->SignalType(channel);

// we need to distiguish the U and V planes
geo::View_t view = geom->View(channel);
geo::View_t view = GetView(channel);

double gain = 0.0;
if(view == geo::kU)
Expand All @@ -272,11 +267,8 @@ double util::SignalShapingServiceSBND::GetASICGain(unsigned int const channel) c
// //---Give Shaping time Settings to SimWire ---//
// double util::SignalShapingServiceSBND::GetShapingTime(unsigned int const channel) const
// {
// art::ServiceHandle<geo::Geometry> geom;
// //geo::SigType_t sigtype = geom->SignalType(channel);

// // we need to distiguish the U and V planes
// geo::View_t view = geom->View(channel);
// geo::View_t view = GetView(channel);

// double shaping_time = 0;
// if(view == geo::kU)
Expand All @@ -294,11 +286,11 @@ double util::SignalShapingServiceSBND::GetASICGain(unsigned int const channel) c
double util::SignalShapingServiceSBND::GetRawNoise(unsigned int const channel) const
{
unsigned int plane;
art::ServiceHandle<geo::Geometry> geom;
// art::ServiceHandle<geo::Geometry> geom;
//geo::SigType_t sigtype = geom->SignalType(channel);

// we need to distiguish the U and V planes
geo::View_t view = geom->View(channel);
geo::View_t view = GetView(channel);

if(view == geo::kU)
plane = 0;
Expand Down Expand Up @@ -334,11 +326,11 @@ double util::SignalShapingServiceSBND::GetRawNoise(unsigned int const channel) c
double util::SignalShapingServiceSBND::GetDeconNoise(unsigned int const channel) const
{
unsigned int plane;
art::ServiceHandle<geo::Geometry> geom;
// art::ServiceHandle<geo::Geometry> geom;
//geo::SigType_t sigtype = geom->SignalType(channel);

// we need to distiguish the U and V planes
geo::View_t view = geom->View(channel);
geo::View_t view = GetView(channel);

if(view == geo::kU)
plane = 0;
Expand Down Expand Up @@ -878,8 +870,8 @@ void util::SignalShapingServiceSBND::SetResponseSampling()
int util::SignalShapingServiceSBND::FieldResponseTOffset(detinfo::DetectorClocksData const& clockData,
unsigned int const channel) const
{
art::ServiceHandle<geo::Geometry> geom;
geo::View_t view = geom->View(channel);
//art::ServiceHandle<geo::Geometry> geom;
geo::View_t view = GetView(channel);

double time_offset = 0;
if(view == geo::kU)
Expand All @@ -897,6 +889,23 @@ int util::SignalShapingServiceSBND::FieldResponseTOffset(detinfo::DetectorClocks
return tpc_clock.Ticks(time_offset/1.e3);
}

geo::View_t util::SignalShapingServiceSBND::GetView(unsigned int chan) const {
art::ServiceHandle<geo::Geometry> geom;
geo::View_t view = geom->View(chan);

// TEMPORARY BUG FIX (7/23/2021, v09_26_00): With geometry v2, LArSoft is mixing
// up the view assignments for the U and V planes in TPC0, but not TPC1, resulting
// in the wrong signal shapes being used. To work around this, we explicitly assign
// the view based on the plane number for the two induction planes. -wforeman
std::vector<geo::WireID> wires = geom->ChannelToWire(chan);
if( wires.size() ) {
if ( wires[0].Plane == 0 ) view = geo::kU;
else if ( wires[0].Plane == 1 ) view = geo::kV;
}

return view;
}


namespace util {

Expand Down