All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 26 of file DrawRawHist_tool.cc.

Constructor & Destructor Documentation

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

Definition at line 58 of file DrawRawHist_tool.cc.

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

Definition at line 60 of file DrawRawHist_tool.cc.

60 {}

Member Function Documentation

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

Definition at line 158 of file DrawRawHist_tool.cc.

159  {
160  art::ServiceHandle<evd::ColorDrawingOptions const> cst;
161  art::ServiceHandle<geo::Geometry const> geo;
162 
163  // Get rid of the previous histograms
164  if (fRawDigitHist.get()) fRawDigitHist.reset();
165 
166  // figure out the signal type for this plane, assume that
167  // plane n in each TPC/cryostat has the same type
168  geo::SigType_t sigType = geo->SignalType(channel);
169  int numBins = numTicks;
170 
171  fRawDigitHist = std::make_unique<TH1F>(
172  "fRAWQHisto", ";t [ticks];q [ADC]", numBins, startTick, startTick + numTicks);
173 
174  TH1F* histPtr = fRawDigitHist.get();
175 
176  histPtr->SetMaximum(cst->fRawQHigh[(size_t)sigType]);
177  histPtr->SetMinimum(cst->fRawQLow[(size_t)sigType]);
178 
179  histPtr->SetLineColor(kBlack);
180  histPtr->SetLineWidth(1);
181 
182  histPtr->GetXaxis()->SetLabelSize(0.10); // was 0.15
183  histPtr->GetXaxis()->SetLabelOffset(0.01); // was 0.00
184  histPtr->GetXaxis()->SetTitleSize(0.10); // was 0.15
185  histPtr->GetXaxis()->SetTitleOffset(0.60); // was 0.80
186 
187  histPtr->GetYaxis()->SetLabelSize(0.10); // was 0.15
188  histPtr->GetYaxis()->SetLabelOffset(0.002); // was 0.00
189  histPtr->GetYaxis()->SetTitleSize(0.10); // was 0.15
190  histPtr->GetYaxis()->SetTitleOffset(0.16); // was 0.80
191  }
enum geo::_plane_sigtype SigType_t
std::unique_ptr< TH1F > fRawDigitHist
void evdb_tool::DrawRawHist::configure ( const fhicl::ParameterSet &  pset)
overridevirtual

Implements evdb_tool::IWaveformDrawer.

Definition at line 63 of file DrawRawHist_tool.cc.

64  {
65  return;
66  }
void evdb_tool::DrawRawHist::Draw ( const std::string &  options,
float  maxLowVal,
float  maxHiVal 
)
overridevirtual

Implements evdb_tool::IWaveformDrawer.

Definition at line 143 of file DrawRawHist_tool.cc.

144  {
145  TH1F* histPtr = fRawDigitHist.get();
146 
147  // Do we have valid limits to set?
148  histPtr->SetMaximum(maxHiVal);
149  histPtr->SetMinimum(maxLowVal);
150 
151  histPtr->Draw(options.c_str());
152 
153  return;
154  }
then echo echo For and will not be changed by echo further linking echo echo B echo The symbol is in the uninitialized data multiple common symbols may appear with the echo same name If the symbol is defined the common echo symbols are treated as undefined references For more echo details on common see the discussion of warn common echo in *Note Linker options
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 69 of file DrawRawHist_tool.cc.

70  {
71  art::ServiceHandle<evd::RawDrawingOptions const> rawOpt;
72 
73  //grab the singleton with the event
74  const art::Event* event = evdb::EventHolder::Instance()->GetEvent();
75  if (!event) return;
76 
77  // Handle histograms
78  BookHistogram(channel, lowBin, numTicks);
79 
80  fMinimum = std::numeric_limits<float>::max();
81  fMaximum = std::numeric_limits<float>::lowest();
82 
83  // Loop over the possible producers of RawDigits
84  for (const auto& rawDataLabel : rawOpt->fRawDataLabels) {
85  art::Handle<std::vector<raw::RawDigit>> rawDigitVecHandle;
86  event->getByLabel(rawDataLabel, rawDigitVecHandle);
87 
88  if (!rawDigitVecHandle.isValid()) continue;
89 
90  for (size_t rawDigitIdx = 0; rawDigitIdx < rawDigitVecHandle->size(); rawDigitIdx++) {
91  art::Ptr<raw::RawDigit> rawDigit(rawDigitVecHandle, rawDigitIdx);
92 
93  if (rawDigit->Channel() != channel) continue;
94 
95  // We will need the pedestal service...
96  const lariov::DetPedestalProvider& pedestalRetrievalAlg =
97  art::ServiceHandle<lariov::DetPedestalService const>()->GetPedestalProvider();
98 
99  // recover the pedestal
100  float pedestal = 0;
101 
102  if (rawOpt->fPedestalOption == 0) { pedestal = pedestalRetrievalAlg.PedMean(channel); }
103  else if (rawOpt->fPedestalOption == 1) {
104  pedestal = rawDigit->GetPedestal();
105  }
106  else if (rawOpt->fPedestalOption == 2) {
107  pedestal = 0;
108  }
109  else {
110  mf::LogWarning("DrawRawHist")
111  << " PedestalOption is not understood: " << rawOpt->fPedestalOption
112  << ". Pedestals not subtracted.";
113  }
114 
115  std::vector<short> uncompressed(rawDigit->Samples());
116  raw::Uncompress(rawDigit->ADCs(), uncompressed, rawDigit->Compression());
117 
118  TH1F* histPtr = fRawDigitHist.get();
119 
120  for (size_t idx = 0; idx < uncompressed.size(); idx++) {
121  float signalVal = float(uncompressed[idx]) - pedestal;
122 
123  histPtr->Fill(float(idx) + 0.5, signalVal);
124  }
125 
126  short minimumVal = *std::min_element(uncompressed.begin(), uncompressed.end());
127  short maximumVal = *std::max_element(uncompressed.begin(), uncompressed.end());
128 
129  fMinimum = float(minimumVal) - pedestal;
130  fMaximum = float(maximumVal) - pedestal;
131 
132  histPtr->SetLineColor(kBlack);
133 
134  // There is only one channel displayed so if here we are done
135  break;
136  }
137  }
138 
139  return;
140  }
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
std::unique_ptr< TH1F > fRawDigitHist
void BookHistogram(raw::ChannelID_t &, float, float)
float evdb_tool::DrawRawHist::getMaximum ( ) const
inlineoverridevirtual

Implements evdb_tool::IWaveformDrawer.

Definition at line 37 of file DrawRawHist_tool.cc.

38  {
39  return fMaximum;
40  };
float evdb_tool::DrawRawHist::getMinimum ( ) const
inlineoverridevirtual

Implements evdb_tool::IWaveformDrawer.

Definition at line 42 of file DrawRawHist_tool.cc.

43  {
44  return fMinimum;
45  };

Member Data Documentation

float evdb_tool::DrawRawHist::fMaximum
private

Definition at line 50 of file DrawRawHist_tool.cc.

float evdb_tool::DrawRawHist::fMinimum
private

Definition at line 51 of file DrawRawHist_tool.cc.

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

Definition at line 53 of file DrawRawHist_tool.cc.


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