Public Member Functions | Private Attributes | List of all members
detsim::SimWireAna Class Reference

Base class for creation of raw signals on wires. More...

Inheritance diagram for detsim::SimWireAna:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Public Member Functions

 SimWireAna (fhicl::ParameterSet const &pset)
 
void analyze (const art::Event &evt)
 read/write access to event More...
 
void beginJob ()
 
- 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 fDetSimModuleLabel
 name of module that produced the digits More...
 
TH1F * fDiffs
 histogram of Raw tdc to tdc differences More...
 
TH1F * fCompressErr
 
TH1F * fCompressFactor
 compression factor More...
 
TH2F * fRawVsCompress
 histogram of original tdc value vs compressesed value More...
 
TH2F * fCompressErr2D
 histogram of original tdc value vs compressesed value More...
 

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

Base class for creation of raw signals on wires.

Definition at line 33 of file SimWireAna_module.cc.

Constructor & Destructor Documentation

detsim::SimWireAna::SimWireAna ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 63 of file SimWireAna_module.cc.

64  : EDAnalyzer(pset)
65  , fDetSimModuleLabel{pset.get< std::string >("DetSimModuleLabel")}
66  {}
std::string string
Definition: nybbler.cc:12
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
std::string fDetSimModuleLabel
name of module that produced the digits

Member Function Documentation

void detsim::SimWireAna::analyze ( const art::Event evt)

read/write access to event

loop over all the raw digits

Definition at line 86 of file SimWireAna_module.cc.

87  {
88 
89  // loop over the raw digits and get the adc vector for each, then compress it and uncompress it
90 
92  evt.getByLabel(fDetSimModuleLabel,rdHandle);
93 
95  for(unsigned int i = 0; i < rdHandle->size(); ++i){
96  art::Ptr<raw::RawDigit> r(rdHandle,i);
97  rdvec.push_back(r);
98  }
99 
100  /// loop over all the raw digits
101  for(unsigned int rd = 0; rd < rdvec.size(); ++rd){
102 
103  std::vector<short> adc;
104  std::vector<short> uncompressed(rdvec[rd]->Samples());
105  for(unsigned int t = 1; t < rdvec[rd]->Samples(); ++t){
106  fDiffs->Fill(rdvec[rd]->ADC(t) - rdvec[rd]->ADC(t-1));
107  adc.push_back(rdvec[rd]->ADC(t-1));
108  }
109 
110  //get the last one for the adc vector
111  adc.push_back(rdvec[rd]->ADC(rdvec[rd]->Samples()-1));
112 
114 
115  fCompressFactor->Fill((1.*adc.size())/(1.*rdvec[rd]->Samples()));
116 
117  raw::Uncompress(adc, uncompressed, raw::kHuffman);
118 
119  if(uncompressed.size() != rdvec[rd]->Samples()){
120  cet::exception("WrongSizeUncompress")
121  << "uncompression does not produce same size vector as original: "
122  << "original = " << rdvec[rd]->Samples() << " uncompress = "
123  << uncompressed.size() << "\n";
124  }
125 
126  for(unsigned int t = 0; t < uncompressed.size(); ++t){
127  //std::cout << t << " " << rdFE->ADC(t) << " " << uncompressed[t] << std::endl;
128  if(uncompressed[t]-rdvec[rd]->ADC(t) > 1)
129  mf::LogWarning("SimWireAna") << "problem with event "
130  << " time " << t << " ADC " << rdvec[rd]->ADC(t)
131  << " uncompress " << uncompressed[t]
132  << " channel " << rdvec[rd]->Channel();
133 
134  fCompressErr->Fill(uncompressed[t]-rdvec[rd]->ADC(t));
135  fCompressErr2D->Fill(rdvec[rd]->ADC(t), uncompressed[t]-rdvec[rd]->ADC(t));
136  fRawVsCompress->Fill(rdvec[rd]->ADC(t), uncompressed[t]);
137  }
138  }//end loop over digits
139 
140  return;
141  }//end analyze method
Huffman Encoding.
Definition: RawTypes.h:10
int16_t adc
Definition: CRTFragment.hh:202
TH1F * fDiffs
histogram of Raw tdc to tdc differences
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:633
void push_back(Ptr< U > const &p)
Definition: PtrVector.h:435
std::string fDetSimModuleLabel
name of module that produced the digits
size_type size() const
Definition: PtrVector.h:302
TH1F * fCompressFactor
compression factor
TH2F * fRawVsCompress
histogram of original tdc value vs compressesed value
void Compress(std::vector< short > &adc, raw::Compress_t compress)
Compresses a raw data buffer.
Definition: raw.cxx:19
void Uncompress(const std::vector< short > &adc, std::vector< short > &uncompressed, raw::Compress_t compress)
Uncompresses a raw data buffer.
Definition: raw.cxx:776
TH2F * fCompressErr2D
histogram of original tdc value vs compressesed value
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void detsim::SimWireAna::beginJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 69 of file SimWireAna_module.cc.

70  {
71  // get access to the TFile service
73 
74  fDiffs = tfs->make<TH1F>("One timestamp diffs", ";#Delta ADC;", 40, -19.5, 20.5);
75  fCompressErr = tfs->make<TH1F>("compressErr", ";Raw-Compressed;", 1000, -495.5, 500.5);
76  fCompressFactor = tfs->make<TH1F>("compressFactor", ";Compression;", 500, 0., 1.);
77 
78  fCompressErr2D = tfs->make<TH2F>("compressErr2D", ";Raw;Raw-Compressed", 100, -50., 50., 1000, -495.5, 500.5);
79  fRawVsCompress = tfs->make<TH2F>("rawVsCompress", ";Raw;Compressed", 100, -50., 50., 100, -50., 50.);
80 
81  return;
82 
83  }
TH1F * fDiffs
histogram of Raw tdc to tdc differences
TH1F * fCompressFactor
compression factor
TH2F * fRawVsCompress
histogram of original tdc value vs compressesed value
TH2F * fCompressErr2D
histogram of original tdc value vs compressesed value

Member Data Documentation

TH1F* detsim::SimWireAna::fCompressErr
private

histogram of difference between original tdc value and compressesed value

Definition at line 48 of file SimWireAna_module.cc.

TH2F* detsim::SimWireAna::fCompressErr2D
private

histogram of original tdc value vs compressesed value

Definition at line 53 of file SimWireAna_module.cc.

TH1F* detsim::SimWireAna::fCompressFactor
private

compression factor

Definition at line 50 of file SimWireAna_module.cc.

std::string detsim::SimWireAna::fDetSimModuleLabel
private

name of module that produced the digits

Definition at line 45 of file SimWireAna_module.cc.

TH1F* detsim::SimWireAna::fDiffs
private

histogram of Raw tdc to tdc differences

Definition at line 46 of file SimWireAna_module.cc.

TH2F* detsim::SimWireAna::fRawVsCompress
private

histogram of original tdc value vs compressesed value

Definition at line 52 of file SimWireAna_module.cc.


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