All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
icarusutil::SignalShapingICARUSService Class Reference

#include <SignalShapingICARUSService_service.h>

Public Member Functions

 SignalShapingICARUSService (const fhicl::ParameterSet &pset, art::ActivityRegistry &reg)
 
void reconfigure (const fhicl::ParameterSet &pset)
 
DoubleVec2 GetNoiseFactVec ()
 
double GetASICGain (unsigned int const channel) const
 
double GetShapingTime (unsigned int const planeIdx) const
 
double GetRawNoise (unsigned int const channel) const
 
double GetDeconNoise (unsigned int const channel) const
 
const icarus_tool::IResponseGetResponse (size_t channel) const
 
int ResponseTOffset (unsigned int const channel) const
 
void SetDecon (double samplingRate, size_t fftsize, size_t channel)
 
double GetDeconNorm ()
 

Private Types

using IResponsePtr = std::unique_ptr< icarus_tool::IResponse >
 
using ResponseVec = std::vector< IResponsePtr >
 
using PlaneToResponseMap = std::map< size_t, ResponseVec >
 

Private Member Functions

void init () const
 
void init ()
 

Private Attributes

bool fInit
 Initialization flag. More...
 
size_t fPlaneForNormalization
 Normalize responses to this plane. More...
 
double fDeconNorm
 Final normalization to apply. More...
 
DoubleVec2 fNoiseFactVec
 RMS noise in ADCs for lowest gain setting. More...
 
size_t fInitialFFTSize
 Size we initially initalize the responses. More...
 
bool fPrintResponses
 
bool fStoreHistograms
 
PlaneToResponseMap fPlaneToResponseMap
 

Detailed Description

Definition at line 96 of file SignalShapingICARUSService_service.h.

Member Typedef Documentation

Definition at line 127 of file SignalShapingICARUSService_service.h.

Definition at line 129 of file SignalShapingICARUSService_service.h.

Definition at line 128 of file SignalShapingICARUSService_service.h.

Constructor & Destructor Documentation

icarusutil::SignalShapingICARUSService::SignalShapingICARUSService ( const fhicl::ParameterSet &  pset,
art::ActivityRegistry &  reg 
)

Definition at line 43 of file SignalShapingICARUSService_service.cc.

45 : fInit(false)
46 {
47  reconfigure(pset);
48 }
void reconfigure(const fhicl::ParameterSet &pset)

Member Function Documentation

double icarusutil::SignalShapingICARUSService::GetASICGain ( unsigned int const  channel) const

Definition at line 177 of file SignalShapingICARUSService_service.cc.

178 {
179  static const double fcToElectrons(6241.50975);
180 
181  art::ServiceHandle<geo::Geometry> geom;
182  size_t planeIdx = geom->ChannelToWire(channel)[0].Plane;
183 
184  double gain = fPlaneToResponseMap.at(planeIdx).front()->getElectronicsResponse()->getFCperADCMicroS() * fcToElectrons;
185 
186  return gain;
187 }
double icarusutil::SignalShapingICARUSService::GetDeconNoise ( unsigned int const  channel) const

Definition at line 225 of file SignalShapingICARUSService_service.cc.

226 {
227  art::ServiceHandle<geo::Geometry> geom;
228  size_t planeIdx = geom->ChannelToWire(channel)[0].Plane;
229 
230  double shaping_time = fPlaneToResponseMap.at(planeIdx).front()->getElectronicsResponse()->getASICShapingTime();
231  int temp;
232 
233  if (std::abs(shaping_time - 0.6)<1e-6){
234  temp = 0;
235  }else if (std::abs(shaping_time - 1.3)<1e-6){
236  temp = 1;
237  }else if (std::abs(shaping_time - 2.0)<1.e-6){
238  temp = 2;
239  }else{
240  temp = 3;
241  }
242  auto tempNoise = fNoiseFactVec.at(planeIdx);
243  double deconNoise = tempNoise.at(temp);
244 
245  //deconNoise = deconNoise /4096.*2000./4.7 *6.241*1000/fDeconNorm; <== I don't know where these numbers come from...
246 
247  return deconNoise;
248 }
DoubleVec2 fNoiseFactVec
RMS noise in ADCs for lowest gain setting.
T abs(T value)
do i e
double icarusutil::SignalShapingICARUSService::GetDeconNorm ( )
inline

Definition at line 121 of file SignalShapingICARUSService_service.h.

121 {return fDeconNorm;};
DoubleVec2 icarusutil::SignalShapingICARUSService::GetNoiseFactVec ( )
inline

Definition at line 108 of file SignalShapingICARUSService_service.h.

108 { return fNoiseFactVec; }
DoubleVec2 fNoiseFactVec
RMS noise in ADCs for lowest gain setting.
double icarusutil::SignalShapingICARUSService::GetRawNoise ( unsigned int const  channel) const

Definition at line 197 of file SignalShapingICARUSService_service.cc.

198 {
199  art::ServiceHandle<geo::Geometry> geom;
200  size_t planeIdx = geom->ChannelToWire(channel)[0].Plane;
201 
202  double gain = fPlaneToResponseMap.at(planeIdx).front()->getElectronicsResponse()->getFCperADCMicroS();
203  double shaping_time = fPlaneToResponseMap.at(planeIdx).front()->getElectronicsResponse()->getASICShapingTime();
204  int temp;
205 
206  if (std::abs(shaping_time - 0.6)<1e-6){
207  temp = 0;
208  }else if (std::abs(shaping_time - 1.3)<1e-6){
209  temp = 1;
210  }else if (std::abs(shaping_time - 2.0)<1e-6){
211  temp = 2;
212  }else{
213  temp = 3;
214  }
215 
216  double rawNoise;
217 
218  auto tempNoise = fNoiseFactVec.at(planeIdx);
219  rawNoise = tempNoise.at(temp);
220 
221  rawNoise *= gain/4.7;
222  return rawNoise;
223 }
DoubleVec2 fNoiseFactVec
RMS noise in ADCs for lowest gain setting.
T abs(T value)
do i e
const icarus_tool::IResponse & icarusutil::SignalShapingICARUSService::GetResponse ( size_t  channel) const

Definition at line 98 of file SignalShapingICARUSService_service.cc.

99 {
100  if (!fInit) init();
101 
102  art::ServiceHandle<geo::Geometry> geom;
103 
104  //use channel number to set some useful numbers
105  size_t planeIdx = geom->ChannelToWire(channel)[0].Plane;
106 
107  return *fPlaneToResponseMap.at(planeIdx).front();
108 }
double icarusutil::SignalShapingICARUSService::GetShapingTime ( unsigned int const  planeIdx) const

Definition at line 190 of file SignalShapingICARUSService_service.cc.

191 {
192  double shaping_time = fPlaneToResponseMap.at(planeIdx).front()->getElectronicsResponse()->getASICShapingTime();
193 
194  return shaping_time;
195 }
void icarusutil::SignalShapingICARUSService::init ( ) const
inlineprivate

Definition at line 132 of file SignalShapingICARUSService_service.h.

132 {const_cast<SignalShapingICARUSService*>(this)->init();}
SignalShapingICARUSService(const fhicl::ParameterSet &pset, art::ActivityRegistry &reg)
void icarusutil::SignalShapingICARUSService::init ( )
private

Definition at line 115 of file SignalShapingICARUSService_service.cc.

116 {
117  // First get a lock to make sure we are clear to run
118  tbb::spin_mutex::scoped_lock lock(signalShapingSpinMutex);
119 
120  if(!fInit)
121  {
122  // Do ICARUS-specific configuration of SignalShaping by providing
123  // ICARUS response and filter functions.
124  art::ServiceHandle<geo::Geometry> geo;
125 
126  auto const samplingRate = sampling_rate(art::ServiceHandle<detinfo::DetectorClocksService const>()->DataForJob());
127 
128  // Get the normalization from the field response for the collection plane
129  double integral = fPlaneToResponseMap.at(fPlaneForNormalization).front().get()->getFieldResponse()->getIntegral();
130  double weight = 1. / integral;
131 
132  for(size_t planeIdx = 0; planeIdx < geo->Nplanes(); planeIdx++)
133  {
134  fPlaneToResponseMap[planeIdx].front().get()->setResponse(samplingRate, weight);
135  }
136 
137  // Check to see if we want histogram output
138  if (fStoreHistograms)
139  {
140  art::ServiceHandle<art::TFileService> tfs;
141 
142  // Make sure we are at the top level
143  tfs->file().cd();
144 
145  // Make a directory for these histograms
146  art::TFileDirectory dir = tfs->mkdir("SignalShaping");
147 
148  // Loop through response tools first
149  for(const auto& response: fPlaneToResponseMap) response.second.front().get()->outputHistograms(samplingRate, dir);
150 
151  }
152 
153  fInit = true;
154  }
155 
156  return;
157 }
tbb::spin_mutex signalShapingSpinMutex
size_t fPlaneForNormalization
Normalize responses to this plane.
tuple dir
Definition: dropbox.py:28
art::ServiceHandle< art::TFileService > tfs
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
void icarusutil::SignalShapingICARUSService::reconfigure ( const fhicl::ParameterSet &  pset)

Definition at line 52 of file SignalShapingICARUSService_service.cc.

53 {
54  mf::LogInfo("fSignalShapingICARUSService") << " reconfiguring setup " ;
55 
56  // If called again, then we need to clear out the existing tools...
57  fPlaneToResponseMap.clear();
58 
59  // Implement the tools for handling the responses
60  const fhicl::ParameterSet& responseTools = pset.get<fhicl::ParameterSet>("ResponseTools");
61 
62  for(const std::string& responseTool : responseTools.get_pset_names())
63  {
64  const fhicl::ParameterSet& responseToolParamSet = responseTools.get<fhicl::ParameterSet>(responseTool);
65  size_t planeIdx = responseToolParamSet.get<size_t>("Plane");
66 
67  fPlaneToResponseMap[planeIdx].push_back(art::make_tool<icarus_tool::IResponse>(responseToolParamSet));
68  }
69 
70  fPlaneForNormalization = pset.get<size_t>( "PlaneForNormalization");
71  fPrintResponses = pset.get<bool>( "PrintResponses" );
72  fDeconNorm = pset.get<double>( "DeconNorm" );
73  fInitialFFTSize = pset.get<size_t>( "InitialFFTSize" );
74  fNoiseFactVec = pset.get<DoubleVec2>("NoiseFactVec" );
75  fStoreHistograms = pset.get<bool>( "StoreHistograms" );
76 
77  fInit = false;
78 
79  return;
80 }
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.
int icarusutil::SignalShapingICARUSService::ResponseTOffset ( unsigned int const  channel) const

Definition at line 250 of file SignalShapingICARUSService_service.cc.

251 {
252  if (!fInit) init();
253 
254  art::ServiceHandle<geo::Geometry> geom;
255 
256  size_t planeIdx = geom->ChannelToWire(channel)[0].Plane;
257 
258  return fPlaneToResponseMap.at(planeIdx).front()->getTOffset();
259 }
void icarusutil::SignalShapingICARUSService::SetDecon ( double  samplingRate,
size_t  fftsize,
size_t  channel 
)

Definition at line 159 of file SignalShapingICARUSService_service.cc.

161 {
162  art::ServiceHandle<geo::Geometry> geo;
163 
164  if (!fInit) init();
165 
166  // Assume we need to reset the kernels
167  double integral = fPlaneToResponseMap.at(fPlaneForNormalization).front().get()->getFieldResponse()->getIntegral();
168  double weight = 1. / integral;
169 
170  for(size_t planeIdx = 0; planeIdx < geo->Nplanes(); planeIdx++)
171  {
172  fPlaneToResponseMap.at(planeIdx).front()->setResponse(samplingRate, weight);
173  }
174 }
size_t fPlaneForNormalization
Normalize responses to this plane.

Member Data Documentation

double icarusutil::SignalShapingICARUSService::fDeconNorm
private

Final normalization to apply.

Definition at line 140 of file SignalShapingICARUSService_service.h.

bool icarusutil::SignalShapingICARUSService::fInit
private

Initialization flag.

Definition at line 136 of file SignalShapingICARUSService_service.h.

size_t icarusutil::SignalShapingICARUSService::fInitialFFTSize
private

Size we initially initalize the responses.

Definition at line 142 of file SignalShapingICARUSService_service.h.

DoubleVec2 icarusutil::SignalShapingICARUSService::fNoiseFactVec
private

RMS noise in ADCs for lowest gain setting.

Definition at line 141 of file SignalShapingICARUSService_service.h.

size_t icarusutil::SignalShapingICARUSService::fPlaneForNormalization
private

Normalize responses to this plane.

Definition at line 139 of file SignalShapingICARUSService_service.h.

PlaneToResponseMap icarusutil::SignalShapingICARUSService::fPlaneToResponseMap
private

Definition at line 147 of file SignalShapingICARUSService_service.h.

bool icarusutil::SignalShapingICARUSService::fPrintResponses
private

Definition at line 143 of file SignalShapingICARUSService_service.h.

bool icarusutil::SignalShapingICARUSService::fStoreHistograms
private

Definition at line 144 of file SignalShapingICARUSService_service.h.


The documentation for this class was generated from the following files: