Public Member Functions | Private Member Functions | Private Attributes | List of all members
evdb_tool::DrawRawHist Class Reference
Inheritance diagram for evdb_tool::DrawRawHist:
evdb_tool::IWaveformDrawer

Public Member Functions

 DrawRawHist (const fhicl::ParameterSet &pset)
 
 ~DrawRawHist ()
 
void configure (const fhicl::ParameterSet &pset) override
 
void Fill (evdb::View2D &, raw::ChannelID_t &, float, float) override
 
void Draw (const std::string &, float, float) override
 
float getMaximum () const override
 
float getMinimum () const override
 
- Public Member Functions inherited from evdb_tool::IWaveformDrawer
virtual ~IWaveformDrawer () noexcept=default
 

Private Member Functions

void BookHistogram (raw::ChannelID_t &, float, float)
 

Private Attributes

float fMaximum
 
float fMinimum
 
std::unique_ptr< TH1F > fRawDigitHist
 

Detailed Description

Definition at line 23 of file DrawRawHist_tool.cc.

Constructor & Destructor Documentation

evdb_tool::DrawRawHist::DrawRawHist ( const fhicl::ParameterSet pset)
explicit

Definition at line 55 of file DrawRawHist_tool.cc.

55 { configure(pset); }
void configure(const fhicl::ParameterSet &pset) override
evdb_tool::DrawRawHist::~DrawRawHist ( )

Definition at line 57 of file DrawRawHist_tool.cc.

57 {}

Member Function Documentation

void evdb_tool::DrawRawHist::BookHistogram ( raw::ChannelID_t channel,
float  startTick,
float  numTicks 
)
private

Definition at line 155 of file DrawRawHist_tool.cc.

156  {
159 
160  // Get rid of the previous histograms
161  if (fRawDigitHist.get()) fRawDigitHist.reset();
162 
163  // figure out the signal type for this plane, assume that
164  // plane n in each TPC/cryostat has the same type
165  geo::SigType_t sigType = geo->SignalType(channel);
166  int numBins = numTicks;
167 
168  fRawDigitHist = std::make_unique<TH1F>(
169  "fRAWQHisto", ";t [ticks];q [ADC]", numBins, startTick, startTick + numTicks);
170 
171  TH1F* histPtr = fRawDigitHist.get();
172 
173  histPtr->SetMaximum(cst->fRawQHigh[(size_t)sigType]);
174  histPtr->SetMinimum(cst->fRawQLow[(size_t)sigType]);
175 
176  histPtr->SetLineColor(kBlack);
177  histPtr->SetLineWidth(1);
178 
179  histPtr->GetXaxis()->SetLabelSize(0.10); // was 0.15
180  histPtr->GetXaxis()->SetLabelOffset(0.01); // was 0.00
181  histPtr->GetXaxis()->SetTitleSize(0.10); // was 0.15
182  histPtr->GetXaxis()->SetTitleOffset(0.60); // was 0.80
183 
184  histPtr->GetYaxis()->SetLabelSize(0.10); // was 0.15
185  histPtr->GetYaxis()->SetLabelOffset(0.002); // was 0.00
186  histPtr->GetYaxis()->SetTitleSize(0.10); // was 0.15
187  histPtr->GetYaxis()->SetTitleOffset(0.16); // was 0.80
188  }
std::vector< double > fRawQLow
low edge of ADC values for drawing raw digits
uint8_t channel
Definition: CRTFragment.hh:201
SigType_t SignalType(geo::PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
enum geo::_plane_sigtype SigType_t
std::vector< double > fRawQHigh
high edge of ADC values for drawing raw digits
LArSoft geometry interface.
Definition: ChannelGeo.h:16
std::unique_ptr< TH1F > fRawDigitHist
void evdb_tool::DrawRawHist::configure ( const fhicl::ParameterSet pset)
overridevirtual

Implements evdb_tool::IWaveformDrawer.

Definition at line 60 of file DrawRawHist_tool.cc.

61  {
62  return;
63  }
void evdb_tool::DrawRawHist::Draw ( const std::string options,
float  maxLowVal,
float  maxHiVal 
)
overridevirtual

Implements evdb_tool::IWaveformDrawer.

Definition at line 140 of file DrawRawHist_tool.cc.

141  {
142  TH1F* histPtr = fRawDigitHist.get();
143 
144  // Do we have valid limits to set?
145  histPtr->SetMaximum(maxHiVal);
146  histPtr->SetMinimum(maxLowVal);
147 
148  histPtr->Draw(options.c_str());
149 
150  return;
151  }
std::unique_ptr< TH1F > fRawDigitHist
void evdb_tool::DrawRawHist::Fill ( evdb::View2D &  view2D,
raw::ChannelID_t channel,
float  lowBin,
float  numTicks 
)
overridevirtual

Implements evdb_tool::IWaveformDrawer.

Definition at line 66 of file DrawRawHist_tool.cc.

67  {
69 
70  //grab the singleton with the event
71  const art::Event* event = evdb::EventHolder::Instance()->GetEvent();
72  if (!event) return;
73 
74  // Handle histograms
75  BookHistogram(channel, lowBin, numTicks);
76 
78  fMaximum = std::numeric_limits<float>::lowest();
79 
80  // Loop over the possible producers of RawDigits
81  for (const auto& rawDataLabel : rawOpt->fRawDataLabels) {
82  art::Handle<std::vector<raw::RawDigit>> rawDigitVecHandle;
83  event->getByLabel(rawDataLabel, rawDigitVecHandle);
84 
85  if (!rawDigitVecHandle.isValid()) continue;
86 
87  for (size_t rawDigitIdx = 0; rawDigitIdx < rawDigitVecHandle->size(); rawDigitIdx++) {
88  art::Ptr<raw::RawDigit> rawDigit(rawDigitVecHandle, rawDigitIdx);
89 
90  if (rawDigit->Channel() != channel) continue;
91 
92  // We will need the pedestal service...
93  const lariov::DetPedestalProvider& pedestalRetrievalAlg =
95 
96  // recover the pedestal
97  float pedestal = 0;
98 
99  if (rawOpt->fPedestalOption == 0) { pedestal = pedestalRetrievalAlg.PedMean(channel); }
100  else if (rawOpt->fPedestalOption == 1) {
101  pedestal = rawDigit->GetPedestal();
102  }
103  else if (rawOpt->fPedestalOption == 2) {
104  pedestal = 0;
105  }
106  else {
107  mf::LogWarning("DrawRawHist")
108  << " PedestalOption is not understood: " << rawOpt->fPedestalOption
109  << ". Pedestals not subtracted.";
110  }
111 
112  std::vector<short> uncompressed(rawDigit->Samples());
113  raw::Uncompress(rawDigit->ADCs(), uncompressed, rawDigit->Compression());
114 
115  TH1F* histPtr = fRawDigitHist.get();
116 
117  for (size_t idx = 0; idx < uncompressed.size(); idx++) {
118  float signalVal = float(uncompressed[idx]) - pedestal;
119 
120  histPtr->Fill(float(idx) + 0.5, signalVal);
121  }
122 
123  short minimumVal = *std::min_element(uncompressed.begin(), uncompressed.end());
124  short maximumVal = *std::max_element(uncompressed.begin(), uncompressed.end());
125 
126  fMinimum = float(minimumVal) - pedestal;
127  fMaximum = float(maximumVal) - pedestal;
128 
129  histPtr->SetLineColor(kBlack);
130 
131  // There is only one channel displayed so if here we are done
132  break;
133  }
134  }
135 
136  return;
137  }
uint8_t channel
Definition: CRTFragment.hh:201
bool isValid() const noexcept
Definition: Handle.h:191
static int max(int a, int b)
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
std::vector< art::InputTag > fRawDataLabels
module label that made the raw digits, default is daq
virtual float PedMean(raw::ChannelID_t ch) const =0
Retrieve pedestal information.
void Uncompress(const std::vector< short > &adc, std::vector< short > &uncompressed, raw::Compress_t compress)
Uncompresses a raw data buffer.
Definition: raw.cxx:776
int fPedestalOption
0: use DetPedestalService; 1: Use pedestal in raw::RawDigt; 2: no ped subtraction ...
std::unique_ptr< TH1F > fRawDigitHist
void BookHistogram(raw::ChannelID_t &, float, float)
Event finding and building.
float evdb_tool::DrawRawHist::getMaximum ( ) const
inlineoverridevirtual

Implements evdb_tool::IWaveformDrawer.

Definition at line 34 of file DrawRawHist_tool.cc.

35  {
36  return fMaximum;
37  };
float evdb_tool::DrawRawHist::getMinimum ( ) const
inlineoverridevirtual

Implements evdb_tool::IWaveformDrawer.

Definition at line 39 of file DrawRawHist_tool.cc.

40  {
41  return fMinimum;
42  };

Member Data Documentation

float evdb_tool::DrawRawHist::fMaximum
private

Definition at line 47 of file DrawRawHist_tool.cc.

float evdb_tool::DrawRawHist::fMinimum
private

Definition at line 48 of file DrawRawHist_tool.cc.

std::unique_ptr<TH1F> evdb_tool::DrawRawHist::fRawDigitHist
private

Definition at line 50 of file DrawRawHist_tool.cc.


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