DPhaseSimChannelExtractService_service.cc
Go to the documentation of this file.
1 // DPhaseSimChannelExtractService.cxx
2 
3 #include <iostream>
10 
11 using std::cout;
12 using std::endl;
13 using std::string;
14 
15 //**********************************************************************
16 
19 : m_ntick(m_pfft->FFTSize())
20 {
21  const string myname = "DPhaseSimChannelExtractService::ctor: ";
22  if( !(m_ntick > 0 && !(m_ntick & (m_ntick-1))) )
23  {
24  throw cet::exception("DPhaseSimChannelExtractService")
25  << "FFT size is not a power of 2. ";
26  }
27 
28  /*
29  m_CrpGainToolName = pset.get<string>("CrpGainToolName");
30  DuneToolManager* ptm = DuneToolManager::instance("");
31  if ( ptm == nullptr )
32  {
33  throw cet::exception("DPhaseSimChannelExtractService")
34  << "Unable to retrieve tool manaager.";
35  }
36 
37  m_CrpGainTool = ptm->getPrivate<CrpGainSimTool>(m_CrpGainToolName);
38 
39  if( !m_CrpGainTool )
40  {
41  throw cet::exception("DPhaseSimChannelExtractService")
42  << "Unable to retrieve "<<m_CrpGainToolName<<".";
43  }
44  */
45  //fDPGainPerView = pset.get<float> ("DPGainPerView");
46  //mf::LogInfo("DPhaseSimChannelExtractService")<<" Gain per view "<<fDPGainPerView;
47 }
48 
49 //**********************************************************************
50 
53  const sim::SimChannel* psc, AdcSignalVector& sigs) const {
54 
55  if ( psc == nullptr ) return 0;
56 
57  // get the channel number
58  unsigned int chan = psc->Channel();
59 
60  // clear and resize temporary ADC buffer
61  sigs.clear();
62  sigs.resize(m_ntick, 0.0);
63 
64  for ( size_t itck=0; itck<sigs.size(); ++itck ){
65  sigs[itck] = m_crpgain->viewCharge( psc, itck );
66  }
67 
68  // perform convolution
69  m_psss->Convolute(clockData, chan, sigs);
70 
71  return 0;
72 }
73 
74 //**********************************************************************
75 
76 std::ostream& DPhaseSimChannelExtractService::print(std::ostream& out, std::string prefix) const {
77  out << prefix << "DPhaseSimChannelExtractService";
78  return out;
79 }
80 
81 //**********************************************************************
82 
84 
85 //**********************************************************************
Energy deposited on a readout channel by simulated tracks.
Definition: SimChannel.h:140
art::ServiceHandle< util::CrpGainService > m_crpgain
std::string string
Definition: nybbler.cc:12
int extract(detinfo::DetectorClocksData const &clockData, const sim::SimChannel *psc, AdcSignalVector &sig) const
DPhaseSimChannelExtractService(fhicl::ParameterSet const &pset, art::ActivityRegistry &)
art framework interface to geometry description
void Convolute(unsigned int channel, std::vector< T > &func) const
art::ServiceHandle< util::SignalShapingServiceDUNEDPhase > m_psss
double viewCharge(const sim::SimChannel *psc, unsigned itck) const
raw::ChannelID_t Channel() const
Returns the readout channel this object describes.
Definition: SimChannel.h:329
Contains all timing reference information for the detector.
std::vector< AdcSignal > AdcSignalVector
Definition: AdcTypes.h:22
std::ostream & print(std::ostream &out=std::cout, std::string prefix="") const
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
QTextStream & endl(QTextStream &s)
#define DEFINE_ART_SERVICE_INTERFACE_IMPL(svc, iface)