All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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:

Public Member Functions

 SimWireAna (fhicl::ParameterSet const &pset)
 
void analyze (const art::Event &evt)
 read/write access to event More...
 
void beginJob ()
 

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...
 

Detailed Description

Base class for creation of raw signals on wires.

Definition at line 36 of file SimWireAna_module.cc.

Constructor & Destructor Documentation

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

Definition at line 66 of file SimWireAna_module.cc.

67  : EDAnalyzer(pset)
68  , fDetSimModuleLabel{pset.get< std::string >("DetSimModuleLabel")}
69  {}
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 89 of file SimWireAna_module.cc.

90  {
91 
92  // loop over the raw digits and get the adc vector for each, then compress it and uncompress it
93 
94  art::Handle< std::vector<raw::RawDigit> > rdHandle;
95  evt.getByLabel(fDetSimModuleLabel,rdHandle);
96 
97  art::PtrVector<raw::RawDigit> rdvec;
98  for(unsigned int i = 0; i < rdHandle->size(); ++i){
99  art::Ptr<raw::RawDigit> r(rdHandle,i);
100  rdvec.push_back(r);
101  }
102 
103  /// loop over all the raw digits
104  for(unsigned int rd = 0; rd < rdvec.size(); ++rd){
105 
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));
111  }
112 
113  //get the last one for the adc vector
114  adc.push_back(rdvec[rd]->ADC(rdvec[rd]->Samples()-1));
115 
117 
118  fCompressFactor->Fill((1.*adc.size())/(1.*rdvec[rd]->Samples()));
119 
120  raw::Uncompress(adc, uncompressed, raw::kHuffman);
121 
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";
127  }
128 
129  for(unsigned int t = 0; t < uncompressed.size(); ++t){
130  //std::cout << t << " " << rdFE->ADC(t) << " " << uncompressed[t] << std::endl;
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();
136 
137  fCompressErr->Fill(uncompressed[t]-rdvec[rd]->ADC(t));
138  fCompressErr2D->Fill(rdvec[rd]->ADC(t), uncompressed[t]-rdvec[rd]->ADC(t));
139  fRawVsCompress->Fill(rdvec[rd]->ADC(t), uncompressed[t]);
140  }
141  }//end loop over digits
142 
143  return;
144  }//end analyze method
Huffman Encoding.
Definition: RawTypes.h:10
TH1F * fDiffs
histogram of Raw tdc to tdc differences
std::string fDetSimModuleLabel
name of module that produced the digits
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
TCEvent evt
Definition: DataStructs.cxx:8
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
esac echo uname r
void detsim::SimWireAna::beginJob ( )

Definition at line 72 of file SimWireAna_module.cc.

73  {
74  // get access to the TFile service
75  art::ServiceHandle<art::TFileService const> tfs;
76 
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.);
80 
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.);
83 
84  return;
85 
86  }
TH1F * fDiffs
histogram of Raw tdc to tdc differences
TH1F * fCompressFactor
compression factor
TH2F * fRawVsCompress
histogram of original tdc value vs compressesed value
art::ServiceHandle< art::TFileService > tfs
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 51 of file SimWireAna_module.cc.

TH2F* detsim::SimWireAna::fCompressErr2D
private

histogram of original tdc value vs compressesed value

Definition at line 56 of file SimWireAna_module.cc.

TH1F* detsim::SimWireAna::fCompressFactor
private

compression factor

Definition at line 53 of file SimWireAna_module.cc.

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

name of module that produced the digits

Definition at line 48 of file SimWireAna_module.cc.

TH1F* detsim::SimWireAna::fDiffs
private

histogram of Raw tdc to tdc differences

Definition at line 49 of file SimWireAna_module.cc.

TH2F* detsim::SimWireAna::fRawVsCompress
private

histogram of original tdc value vs compressesed value

Definition at line 55 of file SimWireAna_module.cc.


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