Public Member Functions | Private Member Functions | Private Attributes | List of all members
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
 
- 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::vector< int > fColorMap
 
std::unordered_map< std::string, std::unique_ptr< TH1F > > fRecoHistMap
 

Detailed Description

Definition at line 21 of file DrawWireHist_tool.cc.

Constructor & Destructor Documentation

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

Definition at line 48 of file DrawWireHist_tool.cc.

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

Definition at line 53 of file DrawWireHist_tool.cc.

54 {
55 }

Member Function Documentation

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

Definition at line 146 of file DrawWireHist_tool.cc.

147 {
152 
153  // Get rid of the previous histograms
154  fRecoHistMap.clear();
155 
156  // Now add a histogram for each of the wire labels
157  for(auto& tag : recoOpt->fWireLabels)
158  {
159  // figure out the signal type for this plane, assume that
160  // plane n in each TPC/cryostat has the same type
161  geo::SigType_t sigType = geo->SignalType(channel);
162  std::string tagString(tag.encode());
163  int numBins = numTicks;
164 
165  fRecoHistMap[tagString] = std::make_unique<TH1F>("fCALTQHisto", ";t [ticks];q [ADC]",numBins,startTick,startTick+numTicks);
166 
167  TH1F* histPtr = fRecoHistMap.at(tagString).get();
168 
169  histPtr->SetMaximum(cst->fRecoQHigh[(size_t)sigType]);
170  histPtr->SetMinimum(cst->fRecoQLow[(size_t)sigType]);
171 
172  histPtr->SetLineColor(kBlue);
173  histPtr->SetLineWidth(1);
174 
175  histPtr->GetXaxis()->SetLabelSize (0.10); // was 0.15
176  histPtr->GetXaxis()->SetLabelOffset(0.01); // was 0.00
177  histPtr->GetXaxis()->SetTitleSize (0.10); // was 0.15
178  histPtr->GetXaxis()->SetTitleOffset(0.60); // was 0.80
179 
180  histPtr->GetYaxis()->SetLabelSize (0.10 ); // was 0.15
181  histPtr->GetYaxis()->SetLabelOffset(0.002); // was 0.00
182  histPtr->GetYaxis()->SetTitleSize (0.10 ); // was 0.15
183  histPtr->GetYaxis()->SetTitleOffset(0.16 ); // was 0.80
184  }
185 }
std::string string
Definition: nybbler.cc:12
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.
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
std::unordered_map< std::string, std::unique_ptr< TH1F > > fRecoHistMap
enum geo::_plane_sigtype SigType_t
LArSoft geometry interface.
Definition: ChannelGeo.h:16
void evdb_tool::DrawWireHist::configure ( const fhicl::ParameterSet pset)
overridevirtual

Implements evdb_tool::IWaveformDrawer.

Definition at line 57 of file DrawWireHist_tool.cc.

58 {
59  fColorMap.push_back(kBlue);
60  fColorMap.push_back(kMagenta);
61  fColorMap.push_back(kBlack);
62  fColorMap.push_back(kRed);
63 
64  fRecoHistMap.clear();
65 
66  return;
67 }
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 129 of file DrawWireHist_tool.cc.

130 {
131  for(const auto& histMap : fRecoHistMap)
132  {
133  TH1F* histPtr = histMap.second.get();
134 
135  // Set the limits
136  histPtr->SetMaximum(maxHiVal);
137  histPtr->SetMinimum(maxLowVal);
138 
139  histPtr->Draw(options.c_str());
140  }
141 
142  return;
143 }
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 70 of file DrawWireHist_tool.cc.

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

Implements evdb_tool::IWaveformDrawer.

Definition at line 32 of file DrawWireHist_tool.cc.

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

Implements evdb_tool::IWaveformDrawer.

Definition at line 33 of file DrawWireHist_tool.cc.

33 {return fMinimum;};

Member Data Documentation

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

Definition at line 42 of file DrawWireHist_tool.cc.

float evdb_tool::DrawWireHist::fMaximum
private

Definition at line 39 of file DrawWireHist_tool.cc.

float evdb_tool::DrawWireHist::fMinimum
private

Definition at line 40 of file DrawWireHist_tool.cc.

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

Definition at line 43 of file DrawWireHist_tool.cc.


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