Public Member Functions | Private Attributes | List of all members
WaveformPDSAndTruthDump Class Reference
Inheritance diagram for WaveformPDSAndTruthDump:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Public Member Functions

 WaveformPDSAndTruthDump (fhicl::ParameterSet const &p)
 
 WaveformPDSAndTruthDump (WaveformPDSAndTruthDump const &)=delete
 
 WaveformPDSAndTruthDump (WaveformPDSAndTruthDump &&)=delete
 
WaveformPDSAndTruthDumpoperator= (WaveformPDSAndTruthDump const &)=delete
 
WaveformPDSAndTruthDumpoperator= (WaveformPDSAndTruthDump &&)=delete
 
void analyze (art::Event const &e) override
 
- Public Member Functions inherited from art::EDAnalyzer
 EDAnalyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDAnalyzer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Analyzer
virtual ~Analyzer () noexcept
 
 Analyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 Analyzer (Table< Config > const &config)
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Observer
 ~Observer () noexcept
 
 Observer (Observer const &)=delete
 
 Observer (Observer &&)=delete
 
Observeroperator= (Observer const &)=delete
 
Observeroperator= (Observer &&)=delete
 
void registerProducts (ProductDescriptions &, ModuleDescription const &)
 
void fillDescriptions (ModuleDescription const &)
 
fhicl::ParameterSetID selectorConfig () const
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Attributes

std::string m_inputTagGEANT
 
std::string m_inputTagPDS
 
std::string m_outputFilename_pds
 
std::string m_outputFilename_true_pds
 
std::ofstream m_outputFile_pds
 
std::ofstream m_outputFile_true_pds
 

Additional Inherited Members

- Public Types inherited from art::EDAnalyzer
using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 
- Protected Member Functions inherited from art::Observer
std::string const & processName () const
 
bool wantAllEvents () const noexcept
 
bool wantEvent (ScheduleID id, Event const &e) const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) const
 
 Observer (fhicl::ParameterSet const &config)
 
 Observer (std::vector< std::string > const &select_paths, std::vector< std::string > const &reject_paths, fhicl::ParameterSet const &config)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Definition at line 29 of file WaveformPDSAndTruthDump_module.cc.

Constructor & Destructor Documentation

WaveformPDSAndTruthDump::WaveformPDSAndTruthDump ( fhicl::ParameterSet const &  p)
explicit

Definition at line 55 of file WaveformPDSAndTruthDump_module.cc.

56  : EDAnalyzer(p),
57  m_inputTagGEANT (p.get<std::string>("InputTagGEANT" , "largeant")),
58  m_inputTagPDS (p.get<std::string>("InputTagPDS" , "opdigi" )),
59  m_outputFilename_pds (p.get<std::string>("OutputFilePDS" ,"OutputFilePDS.txt" )),
60  m_outputFilename_true_pds(p.get<std::string>("OutputFileTruePDS","OutputFileTruePDS.txt")),
63 {
64 }
std::string string
Definition: nybbler.cc:12
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
p
Definition: test.py:223
WaveformPDSAndTruthDump::WaveformPDSAndTruthDump ( WaveformPDSAndTruthDump const &  )
delete
WaveformPDSAndTruthDump::WaveformPDSAndTruthDump ( WaveformPDSAndTruthDump &&  )
delete

Member Function Documentation

void WaveformPDSAndTruthDump::analyze ( art::Event const &  e)
overridevirtual

Implements art::EDAnalyzer.

Definition at line 66 of file WaveformPDSAndTruthDump_module.cc.

67 {
69  auto const& digits_handle_pds=e.getValidHandle<std::vector<raw::OpDetWaveform>>(m_inputTagPDS);
70  std::map<int, std::pair<int, int>> channel_timestamp;
71 
72  auto& digits_pds_in = *digits_handle_pds;
73  for (auto&& digit: digits_pds_in) {
74  m_outputFile_pds << e.event() << " "
75  << digit.ChannelNumber() << " ";
76 
77  auto f = channel_timestamp.find(digit.ChannelNumber());
78  if (f == channel_timestamp.end()) {
79  channel_timestamp[digit.ChannelNumber()] = std::make_pair(digit.TimeStamp(), digit.size());
80  } else {
81  int begin_old = f->second.first;
82  int begin_new = digit.TimeStamp();
83  begin_new = (begin_old > begin_new) ? begin_new : begin_old;
84  int end_old = f->second.first+f->second.second;
85  int end_new = digit.TimeStamp()+digit.size();
86  end_new = (end_old > end_new) ? end_old : end_new;
87  f->second.first = begin_new;
88  f->second.second = end_new - begin_new;
89  }
90  for(auto const& adc: digit) {
91  m_outputFile_pds << adc << " ";
92  }
93 
94  m_outputFile_pds << "\n";
95  }
96 
97  // PDS truth
98  auto const& truth_handle_pds=e.getValidHandle<std::vector<sim::OpDetBacktrackerRecord>>(m_inputTagGEANT);
99  auto& truth_pds_in =*truth_handle_pds;
100 
101  for (auto const& interesting: channel_timestamp) {
102  int channel = interesting.first;
103  int timestamp = interesting.second.first;
104  int nticks = interesting.second.second;
105  bool found = false;
106  for (auto&& truth: truth_pds_in) {
107  if (truth.OpDetNum() != channel) continue;
108  m_outputFile_true_pds << e.event() << " "
109  << truth.OpDetNum() << " ";
110  for(int ichge=timestamp; ichge<nticks+timestamp; ++ichge){
111  m_outputFile_true_pds << truth.Photons(ichge) << " ";
112  }
113  m_outputFile_true_pds << "\n";
114  found=true;
115  break;
116  }
117  if (!found) {
118  std::cout << "didn't find this channel " << channel
119  << " timestamp " << timestamp
120  << " ticks " << nticks <<" in truth\n";
121  }
122  }
123 }
int16_t adc
Definition: CRTFragment.hh:202
uint8_t channel
Definition: CRTFragment.hh:201
const double e
LArSoft geometry interface.
Definition: ChannelGeo.h:16
WaveformPDSAndTruthDump& WaveformPDSAndTruthDump::operator= ( WaveformPDSAndTruthDump const &  )
delete
WaveformPDSAndTruthDump& WaveformPDSAndTruthDump::operator= ( WaveformPDSAndTruthDump &&  )
delete

Member Data Documentation

std::string WaveformPDSAndTruthDump::m_inputTagGEANT
private

Definition at line 46 of file WaveformPDSAndTruthDump_module.cc.

std::string WaveformPDSAndTruthDump::m_inputTagPDS
private

Definition at line 47 of file WaveformPDSAndTruthDump_module.cc.

std::ofstream WaveformPDSAndTruthDump::m_outputFile_pds
private

Definition at line 50 of file WaveformPDSAndTruthDump_module.cc.

std::ofstream WaveformPDSAndTruthDump::m_outputFile_true_pds
private

Definition at line 51 of file WaveformPDSAndTruthDump_module.cc.

std::string WaveformPDSAndTruthDump::m_outputFilename_pds
private

Definition at line 48 of file WaveformPDSAndTruthDump_module.cc.

std::string WaveformPDSAndTruthDump::m_outputFilename_true_pds
private

Definition at line 49 of file WaveformPDSAndTruthDump_module.cc.


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