11 #include "art/Framework/Core/EDAnalyzer.h"
12 #include "art/Framework/Core/ModuleMacros.h"
13 #include "art/Framework/Principal/Event.h"
14 #include "art/Framework/Principal/Handle.h"
15 #include "art/Framework/Services/Registry/ServiceHandle.h"
16 #include "art_root_io/TFileService.h"
17 #include "canvas/Persistency/Common/Ptr.h"
18 #include "canvas/Persistency/Common/PtrVector.h"
19 #include "messagefacility/MessageLogger/MessageLogger.h"
20 #include "fhiclcpp/ParameterSet.h"
40 explicit SimWireAna(fhicl::ParameterSet
const& pset);
68 , fDetSimModuleLabel{pset.get< std::string >(
"DetSimModuleLabel")}
75 art::ServiceHandle<art::TFileService const>
tfs;
77 fDiffs = tfs->make<TH1F>(
"One timestamp diffs",
";#Delta ADC;", 40, -19.5, 20.5);
78 fCompressErr = tfs->make<TH1F>(
"compressErr",
";Raw-Compressed;", 1000, -495.5, 500.5);
79 fCompressFactor = tfs->make<TH1F>(
"compressFactor",
";Compression;", 500, 0., 1.);
81 fCompressErr2D = tfs->make<TH2F>(
"compressErr2D",
";Raw;Raw-Compressed", 100, -50., 50., 1000, -495.5, 500.5);
82 fRawVsCompress = tfs->make<TH2F>(
"rawVsCompress",
";Raw;Compressed", 100, -50., 50., 100, -50., 50.);
94 art::Handle< std::vector<raw::RawDigit> > rdHandle;
97 art::PtrVector<raw::RawDigit> rdvec;
98 for(
unsigned int i = 0; i < rdHandle->size(); ++i){
99 art::Ptr<raw::RawDigit>
r(rdHandle,i);
104 for(
unsigned int rd = 0; rd < rdvec.size(); ++rd){
106 std::vector<short> adc;
107 std::vector<short> uncompressed(rdvec[rd]->Samples());
108 for(
unsigned int t = 1; t < rdvec[rd]->Samples(); ++t){
109 fDiffs->Fill(rdvec[rd]->ADC(t) - rdvec[rd]->ADC(t-1));
110 adc.push_back(rdvec[rd]->ADC(t-1));
114 adc.push_back(rdvec[rd]->ADC(rdvec[rd]->Samples()-1));
122 if(uncompressed.size() != rdvec[rd]->Samples()){
123 cet::exception(
"WrongSizeUncompress")
124 <<
"uncompression does not produce same size vector as original: "
125 <<
"original = " << rdvec[rd]->Samples() <<
" uncompress = "
126 << uncompressed.size() <<
"\n";
129 for(
unsigned int t = 0; t < uncompressed.size(); ++t){
131 if(uncompressed[t]-rdvec[rd]->ADC(t) > 1)
132 mf::LogWarning(
"SimWireAna") <<
"problem with event "
133 <<
" time " << t <<
" ADC " << rdvec[rd]->ADC(t)
134 <<
" uncompress " << uncompressed[t]
135 <<
" channel " << rdvec[rd]->Channel();
138 fCompressErr2D->Fill(rdvec[rd]->ADC(t), uncompressed[t]-rdvec[rd]->ADC(t));
151 DEFINE_ART_MODULE(SimWireAna)
Definition of basic raw digits.
TH1F * fDiffs
histogram of Raw tdc to tdc differences
Collect all the RawData header files together.
std::string fDetSimModuleLabel
name of module that produced the digits
void analyze(const art::Event &evt)
read/write access to event
TH1F * fCompressFactor
compression factor
TH2F * fRawVsCompress
histogram of original tdc value vs compressesed value
SimWireAna(fhicl::ParameterSet const &pset)
void Compress(std::vector< short > &adc, raw::Compress_t compress)
Compresses a raw data buffer.
Base class for creation of raw signals on wires.
art::ServiceHandle< art::TFileService > tfs
void Uncompress(const std::vector< short > &adc, std::vector< short > &uncompressed, raw::Compress_t compress)
Uncompresses a raw data buffer.
TH2F * fCompressErr2D
histogram of original tdc value vs compressesed value