15 #include "nuevdb/EventDisplayBase/EventHolder.h"
17 #include "art/Utilities/ToolMacros.h"
18 #include "art/Framework/Principal/Handle.h"
19 #include "art/Framework/Services/Registry/ServiceHandle.h"
20 #include "messagefacility/MessageLogger/MessageLogger.h"
28 explicit DrawRawHist(
const fhicl::ParameterSet& pset);
32 void configure(
const fhicl::ParameterSet& pset)
override;
34 void Draw(
const std::string&,
float,
float)
override;
71 art::ServiceHandle<evd::RawDrawingOptions const> rawOpt;
74 const art::Event*
event = evdb::EventHolder::Instance()->GetEvent();
80 fMinimum = std::numeric_limits<float>::max();
81 fMaximum = std::numeric_limits<float>::lowest();
84 for (
const auto& rawDataLabel : rawOpt->fRawDataLabels) {
85 art::Handle<std::vector<raw::RawDigit>> rawDigitVecHandle;
86 event->getByLabel(rawDataLabel, rawDigitVecHandle);
88 if (!rawDigitVecHandle.isValid())
continue;
90 for (
size_t rawDigitIdx = 0; rawDigitIdx < rawDigitVecHandle->size(); rawDigitIdx++) {
91 art::Ptr<raw::RawDigit> rawDigit(rawDigitVecHandle, rawDigitIdx);
93 if (rawDigit->Channel() != channel)
continue;
97 art::ServiceHandle<lariov::DetPedestalService const>()->GetPedestalProvider();
102 if (rawOpt->fPedestalOption == 0) { pedestal = pedestalRetrievalAlg.
PedMean(channel); }
103 else if (rawOpt->fPedestalOption == 1) {
104 pedestal = rawDigit->GetPedestal();
106 else if (rawOpt->fPedestalOption == 2) {
110 mf::LogWarning(
"DrawRawHist")
111 <<
" PedestalOption is not understood: " << rawOpt->fPedestalOption
112 <<
". Pedestals not subtracted.";
115 std::vector<short> uncompressed(rawDigit->Samples());
116 raw::Uncompress(rawDigit->ADCs(), uncompressed, rawDigit->Compression());
120 for (
size_t idx = 0; idx < uncompressed.size(); idx++) {
121 float signalVal = float(uncompressed[idx]) - pedestal;
123 histPtr->Fill(
float(idx) + 0.5, signalVal);
126 short minimumVal = *std::min_element(uncompressed.begin(), uncompressed.end());
127 short maximumVal = *std::max_element(uncompressed.begin(), uncompressed.end());
129 fMinimum = float(minimumVal) - pedestal;
130 fMaximum = float(maximumVal) - pedestal;
132 histPtr->SetLineColor(kBlack);
148 histPtr->SetMaximum(maxHiVal);
149 histPtr->SetMinimum(maxLowVal);
151 histPtr->Draw(options.c_str());
160 art::ServiceHandle<evd::ColorDrawingOptions const> cst;
161 art::ServiceHandle<geo::Geometry const> geo;
169 int numBins = numTicks;
172 "fRAWQHisto",
";t [ticks];q [ADC]", numBins, startTick, startTick + numTicks);
176 histPtr->SetMaximum(cst->fRawQHigh[(
size_t)sigType]);
177 histPtr->SetMinimum(cst->fRawQLow[(
size_t)sigType]);
179 histPtr->SetLineColor(kBlack);
180 histPtr->SetLineWidth(1);
182 histPtr->GetXaxis()->SetLabelSize(0.10);
183 histPtr->GetXaxis()->SetLabelOffset(0.01);
184 histPtr->GetXaxis()->SetTitleSize(0.10);
185 histPtr->GetXaxis()->SetTitleOffset(0.60);
187 histPtr->GetYaxis()->SetLabelSize(0.10);
188 histPtr->GetYaxis()->SetLabelOffset(0.002);
189 histPtr->GetYaxis()->SetTitleSize(0.10);
190 histPtr->GetYaxis()->SetTitleOffset(0.16);
Definition of basic raw digits.
The color scales used by the event display.
enum geo::_plane_sigtype SigType_t
Collect all the RawData header files together.
virtual float PedMean(raw::ChannelID_t ch) const =0
Retrieve pedestal information.
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
unsigned int ChannelID_t
Type representing the ID of a readout channel.
void Uncompress(const std::vector< short > &adc, std::vector< short > &uncompressed, raw::Compress_t compress)
Uncompresses a raw data buffer.
art framework interface to geometry description