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::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 24 of file DrawWireHist_tool.cc.

Constructor & Destructor Documentation

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

Definition at line 51 of file DrawWireHist_tool.cc.

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

Definition at line 56 of file DrawWireHist_tool.cc.

57 {
58 }

Member Function Documentation

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

Definition at line 149 of file DrawWireHist_tool.cc.

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

Implements evdb_tool::IWaveformDrawer.

Definition at line 60 of file DrawWireHist_tool.cc.

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

133 {
134  for(const auto& histMap : fRecoHistMap)
135  {
136  TH1F* histPtr = histMap.second.get();
137 
138  // Set the limits
139  histPtr->SetMaximum(maxHiVal);
140  histPtr->SetMinimum(maxLowVal);
141 
142  histPtr->Draw(options.c_str());
143  }
144 
145  return;
146 }
std::unordered_map< std::string, std::unique_ptr< TH1F > > fRecoHistMap
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
void evdb_tool::DrawWireHist::Fill ( evdb::View2D &  view2D,
raw::ChannelID_t channel,
float  lowBin,
float  numTicks 
)
overridevirtual

Implements evdb_tool::IWaveformDrawer.

Definition at line 73 of file DrawWireHist_tool.cc.

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

Implements evdb_tool::IWaveformDrawer.

Definition at line 35 of file DrawWireHist_tool.cc.

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

Implements evdb_tool::IWaveformDrawer.

Definition at line 36 of file DrawWireHist_tool.cc.

36 {return fMinimum;};

Member Data Documentation

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

Definition at line 45 of file DrawWireHist_tool.cc.

float evdb_tool::DrawWireHist::fMaximum
private

Definition at line 42 of file DrawWireHist_tool.cc.

float evdb_tool::DrawWireHist::fMinimum
private

Definition at line 43 of file DrawWireHist_tool.cc.

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

Definition at line 46 of file DrawWireHist_tool.cc.


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