11 #include "art/Framework/Services/Registry/ServiceHandle.h"
12 #include "art/Framework/Services/Registry/ServiceDefinitionMacros.h"
13 #include "messagefacility/MessageLogger/MessageLogger.h"
14 #include "cetlib_except/exception.h"
16 #include "art_root_io/TFileService.h"
26 #include "art/Utilities/make_tool.h"
32 #include "tbb/spin_mutex.h"
44 art::ActivityRegistry& )
54 mf::LogInfo(
"fSignalShapingICARUSService") <<
" reconfiguring setup " ;
60 const fhicl::ParameterSet& responseTools = pset.get<fhicl::ParameterSet>(
"ResponseTools");
62 for(
const std::string& responseTool : responseTools.get_pset_names())
64 const fhicl::ParameterSet& responseToolParamSet = responseTools.get<fhicl::ParameterSet>(responseTool);
65 size_t planeIdx = responseToolParamSet.get<
size_t>(
"Plane");
67 fPlaneToResponseMap[planeIdx].push_back(art::make_tool<icarus_tool::IResponse>(responseToolParamSet));
102 art::ServiceHandle<geo::Geometry> geom;
105 size_t planeIdx = geom->ChannelToWire(channel)[0].Plane;
124 art::ServiceHandle<geo::Geometry> geo;
126 auto const samplingRate =
sampling_rate(art::ServiceHandle<detinfo::DetectorClocksService const>()->DataForJob());
130 double weight = 1. / integral;
132 for(
size_t planeIdx = 0; planeIdx < geo->Nplanes(); planeIdx++)
140 art::ServiceHandle<art::TFileService>
tfs;
146 art::TFileDirectory
dir = tfs->mkdir(
"SignalShaping");
149 for(
const auto& response:
fPlaneToResponseMap) response.second.front().get()->outputHistograms(samplingRate, dir);
160 size_t fftsize,
size_t channel)
162 art::ServiceHandle<geo::Geometry> geo;
168 double weight = 1. / integral;
170 for(
size_t planeIdx = 0; planeIdx < geo->Nplanes(); planeIdx++)
179 static const double fcToElectrons(6241.50975);
181 art::ServiceHandle<geo::Geometry> geom;
182 size_t planeIdx = geom->ChannelToWire(channel)[0].Plane;
184 double gain =
fPlaneToResponseMap.at(planeIdx).front()->getElectronicsResponse()->getFCperADCMicroS() * fcToElectrons;
192 double shaping_time =
fPlaneToResponseMap.at(planeIdx).front()->getElectronicsResponse()->getASICShapingTime();
199 art::ServiceHandle<geo::Geometry> geom;
200 size_t planeIdx = geom->ChannelToWire(channel)[0].Plane;
202 double gain =
fPlaneToResponseMap.at(planeIdx).front()->getElectronicsResponse()->getFCperADCMicroS();
203 double shaping_time =
fPlaneToResponseMap.at(planeIdx).front()->getElectronicsResponse()->getASICShapingTime();
208 }
else if (
std::abs(shaping_time - 1.3)<1
e-6){
210 }
else if (
std::abs(shaping_time - 2.0)<1
e-6){
219 rawNoise = tempNoise.at(temp);
221 rawNoise *= gain/4.7;
227 art::ServiceHandle<geo::Geometry> geom;
228 size_t planeIdx = geom->ChannelToWire(channel)[0].Plane;
230 double shaping_time =
fPlaneToResponseMap.at(planeIdx).front()->getElectronicsResponse()->getASICShapingTime();
235 }
else if (
std::abs(shaping_time - 1.3)<1
e-6){
237 }
else if (
std::abs(shaping_time - 2.0)<1.
e-6){
243 double deconNoise = tempNoise.at(temp);
254 art::ServiceHandle<geo::Geometry> geom;
256 size_t planeIdx = geom->ChannelToWire(channel)[0].Plane;
262 namespace icarusutil {
264 DEFINE_ART_SERVICE(SignalShapingICARUSService)
double GetASICGain(unsigned int const channel) const
Utilities related to art service access.
double GetRawNoise(unsigned int const channel) const
SignalShapingICARUSService(const fhicl::ParameterSet &pset, art::ActivityRegistry ®)
tbb::spin_mutex signalShapingSpinMutex
double GetShapingTime(unsigned int const planeIdx) const
This is the interface class for a tool to handle the field response It is assumed that the field resp...
DoubleVec2 fNoiseFactVec
RMS noise in ADCs for lowest gain setting.
size_t fPlaneForNormalization
Normalize responses to this plane.
std::vector< DoubleVec > DoubleVec2
size_t fInitialFFTSize
Size we initially initalize the responses.
double GetDeconNoise(unsigned int const channel) const
This is the interface class for a tool to handle a filter for the overall response.
void reconfigure(const fhicl::ParameterSet &pset)
bool fInit
Initialization flag.
PlaneToResponseMap fPlaneToResponseMap
Encapsulate the construction of a single detector plane.
double fDeconNorm
Final normalization to apply.
const icarus_tool::IResponse & GetResponse(size_t channel) const
art::ServiceHandle< art::TFileService > tfs
This is the interface class for a tool to handle the field response It is assumed that the field resp...
This is the interface class for a tool to handle the electronics response.
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
int ResponseTOffset(unsigned int const channel) const
void SetDecon(double samplingRate, size_t fftsize, size_t channel)
art framework interface to geometry description
Encapsulate the construction of a single detector plane.