LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
evdb_tool::DrawWireHist Class Reference
Inheritance diagram for evdb_tool::DrawWireHist:
evdb_tool::IWaveformDrawer

Public Member Functions

 DrawWireHist (const fhicl::ParameterSet &pset)
 
 ~DrawWireHist ()
 
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
 

Private Member Functions

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

Private Attributes

float fMaximum
 
float fMinimum
 
std::vector< int > fColorMap
 
std::unordered_map< std::string, std::unique_ptr< TH1F > > fRecoHistMap
 

Detailed Description

Definition at line 24 of file DrawWireHist_tool.cc.

Constructor & Destructor Documentation

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

Definition at line 49 of file DrawWireHist_tool.cc.

References configure().

50  {
51  configure(pset);
52  }
void configure(const fhicl::ParameterSet &pset) override
evdb_tool::DrawWireHist::~DrawWireHist ( )

Definition at line 54 of file DrawWireHist_tool.cc.

54 {}

Member Function Documentation

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

Definition at line 140 of file DrawWireHist_tool.cc.

References DEFINE_ART_CLASS_TOOL, fRecoHistMap, evd::ColorDrawingOptions::fRecoQHigh, evd::ColorDrawingOptions::fRecoQLow, evd::RecoDrawingOptions::fWireLabels, and geo::GeometryCore::SignalType().

Referenced by Fill(), and getMinimum().

141  {
146 
147  // Get rid of the previous histograms
148  fRecoHistMap.clear();
149 
150  // Now add a histogram for each of the wire labels
151  for (auto& tag : recoOpt->fWireLabels) {
152  // figure out the signal type for this plane, assume that
153  // plane n in each TPC/cryostat has the same type
154  geo::SigType_t sigType = geo->SignalType(channel);
155  std::string tagString(tag.encode());
156  int numBins = numTicks;
157 
158  fRecoHistMap[tagString] = std::make_unique<TH1F>(
159  "fCALTQHisto", ";t [ticks];q [ADC]", numBins, startTick, startTick + numTicks);
160 
161  TH1F* histPtr = fRecoHistMap.at(tagString).get();
162 
163  histPtr->SetMaximum(cst->fRecoQHigh[(size_t)sigType]);
164  histPtr->SetMinimum(cst->fRecoQLow[(size_t)sigType]);
165 
166  histPtr->SetLineColor(kBlue);
167  histPtr->SetLineWidth(1);
168 
169  histPtr->GetXaxis()->SetLabelSize(0.10); // was 0.15
170  histPtr->GetXaxis()->SetLabelOffset(0.01); // was 0.00
171  histPtr->GetXaxis()->SetTitleSize(0.10); // was 0.15
172  histPtr->GetXaxis()->SetTitleOffset(0.60); // was 0.80
173 
174  histPtr->GetYaxis()->SetLabelSize(0.10); // was 0.15
175  histPtr->GetYaxis()->SetLabelOffset(0.002); // was 0.00
176  histPtr->GetYaxis()->SetTitleSize(0.10); // was 0.15
177  histPtr->GetYaxis()->SetTitleOffset(0.16); // was 0.80
178  }
179  }
std::unordered_map< std::string, std::unique_ptr< TH1F > > fRecoHistMap
std::vector< double > fRecoQHigh
high edge of ADC values for drawing raw digits
std::vector< double > fRecoQLow
low edge of ADC values for drawing raw digits
std::vector< art::InputTag > fWireLabels
module labels that produced wires
enum geo::_plane_sigtype SigType_t
Enumerate the possible plane projections.
SigType_t SignalType(PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
Namespace collecting geometry-related classes utilities.
void evdb_tool::DrawWireHist::configure ( const fhicl::ParameterSet pset)
overridevirtual

Implements evdb_tool::IWaveformDrawer.

Definition at line 56 of file DrawWireHist_tool.cc.

References fColorMap, and fRecoHistMap.

Referenced by DrawWireHist().

57  {
58  fColorMap.push_back(kBlue);
59  fColorMap.push_back(kMagenta);
60  fColorMap.push_back(kBlack);
61  fColorMap.push_back(kRed);
62 
63  fRecoHistMap.clear();
64 
65  return;
66  }
std::unordered_map< std::string, std::unique_ptr< TH1F > > fRecoHistMap
std::vector< int > fColorMap
void evdb_tool::DrawWireHist::Draw ( const std::string &  options,
float  maxLowVal,
float  maxHiVal 
)
overridevirtual

Implements evdb_tool::IWaveformDrawer.

Definition at line 124 of file DrawWireHist_tool.cc.

References fRecoHistMap.

125  {
126  for (const auto& histMap : fRecoHistMap) {
127  TH1F* histPtr = histMap.second.get();
128 
129  // Set the limits
130  histPtr->SetMaximum(maxHiVal);
131  histPtr->SetMinimum(maxLowVal);
132 
133  histPtr->Draw(options.c_str());
134  }
135 
136  return;
137  }
std::unordered_map< std::string, std::unique_ptr< TH1F > > fRecoHistMap
void evdb_tool::DrawWireHist::Fill ( evdb::View2D view2D,
raw::ChannelID_t channel,
float  lowBin,
float  numTicks 
)
overridevirtual

Implements evdb_tool::IWaveformDrawer.

Definition at line 68 of file DrawWireHist_tool.cc.

References BookHistogram(), recob::Wire::Channel(), art::InputTag::encode(), fColorMap, evd::RawDrawingOptions::fDrawRawDataOrCalibWires, fMaximum, fMinimum, fRecoHistMap, evd::RecoDrawingOptions::fWireLabels, evdb::EventHolder::GetEvent(), evdb::EventHolder::Instance(), and recob::Wire::Signal().

72  {
75 
76  // Check if we're supposed to draw raw hits at all
77  if (rawOpt->fDrawRawDataOrCalibWires == 0) return;
78 
79  //grab the singleton with the event
81  if (!event) return;
82 
83  // Handle histograms
84  BookHistogram(channel, lowBin, numTicks);
85 
86  fMinimum = std::numeric_limits<float>::max();
87  fMaximum = std::numeric_limits<float>::lowest();
88 
89  int nWireLabels = 0;
90  for (size_t imod = 0; imod < recoOpt->fWireLabels.size(); ++imod) {
91  // Step one is to recover the hits for this label that match the input channel
92  art::InputTag const which = recoOpt->fWireLabels[imod];
93 
95  if (!event->getByLabel(which, wireVecHandle)) continue;
96  ++nWireLabels;
97 
98  for (size_t wireIdx = 0; wireIdx < wireVecHandle->size(); wireIdx++) {
99  art::Ptr<recob::Wire> wire(wireVecHandle, wireIdx);
100 
101  if (wire->Channel() != channel) continue;
102 
103  const std::vector<float>& signalVec = wire->Signal();
104 
105  TH1F* histPtr = fRecoHistMap.at(which.encode()).get();
106 
107  for (size_t idx = 0; idx < signalVec.size(); idx++) {
108  histPtr->Fill(float(idx) + 0.5, signalVec[idx]);
109 
110  fMinimum = std::min(fMinimum, signalVec[idx]);
111  fMaximum = std::max(fMaximum, signalVec[idx]);
112  }
113 
114  histPtr->SetLineColor(fColorMap.at((nWireLabels - 1) % recoOpt->fWireLabels.size()));
115 
116  // There is only one channel displayed so if here we are done
117  break;
118  }
119  } //end loop over HitFinding modules
120 
121  return;
122  }
std::unordered_map< std::string, std::unique_ptr< TH1F > > fRecoHistMap
const art::Event * GetEvent() const
Definition: EventHolder.cxx:45
int fDrawRawDataOrCalibWires
0 for raw
void BookHistogram(raw::ChannelID_t &, float, float)
std::string encode() const
Definition: InputTag.cc:97
std::vector< art::InputTag > fWireLabels
module labels that produced wires
static EventHolder * Instance()
Definition: EventHolder.cxx:15
std::vector< int > fColorMap
Definition: fwd.h:26
Event finding and building.
float evdb_tool::DrawWireHist::getMaximum ( ) const
inlineoverridevirtual

Implements evdb_tool::IWaveformDrawer.

Definition at line 34 of file DrawWireHist_tool.cc.

References fMaximum.

34 { return fMaximum; };
float evdb_tool::DrawWireHist::getMinimum ( ) const
inlineoverridevirtual

Implements evdb_tool::IWaveformDrawer.

Definition at line 35 of file DrawWireHist_tool.cc.

References BookHistogram(), and fMinimum.

35 { return fMinimum; };

Member Data Documentation

std::vector<int> evdb_tool::DrawWireHist::fColorMap
private

Definition at line 43 of file DrawWireHist_tool.cc.

Referenced by configure(), and Fill().

float evdb_tool::DrawWireHist::fMaximum
private

Definition at line 40 of file DrawWireHist_tool.cc.

Referenced by Fill(), and getMaximum().

float evdb_tool::DrawWireHist::fMinimum
private

Definition at line 41 of file DrawWireHist_tool.cc.

Referenced by Fill(), and getMinimum().

std::unordered_map<std::string, std::unique_ptr<TH1F> > evdb_tool::DrawWireHist::fRecoHistMap
private

Definition at line 44 of file DrawWireHist_tool.cc.

Referenced by BookHistogram(), configure(), Draw(), and Fill().


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