All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
evd::TQPad Class Reference

#include <TQPad.h>

Inheritance diagram for evd::TQPad:
evd::DrawingPad

Public Member Functions

 TQPad (const char *nm, const char *ti, double x1, double y1, double x2, double y2, const char *opt, unsigned int plane, unsigned int wire)
 
 ~TQPad ()
 
void Draw ()
 
void SetPlaneWire (unsigned int plane=0, unsigned int wire=0)
 
- Public Member Functions inherited from evd::DrawingPad
 DrawingPad (const char *nm, const char *ti, double x1, double y1, double y2, double x2)
 
 ~DrawingPad ()
 
TPad * Pad ()
 
HeaderDrawerHeaderDraw ()
 
evd_tool::IExperimentDrawerGeometryDraw ()
 
SimulationDrawerSimulationDraw ()
 
RawDataDrawerRawDataDraw ()
 
RecoBaseDrawerRecoBaseDraw ()
 
AnalysisBaseDrawerAnalysisBaseDraw ()
 
HitSelectorHitSelectorGet ()
 

Private Types

using IWFHitDrawerPtr = std::unique_ptr< evdb_tool::IWFHitDrawer >
 
using IWaveformDrawerPtr = std::unique_ptr< evdb_tool::IWaveformDrawer >
 

Private Member Functions

void BookHistogram ()
 

Private Attributes

unsigned int fWire
 
unsigned int fPlane
 Which plane in the detector. More...
 
int fTQ
 0 = plot shows charge only, 1 = plot shows charge vs time for a wire More...
 
TH1F * fFrameHist
 A dummy histogram to define the axes. More...
 
evdb::View2D * fView
 Superimpose scale on 1D histo. More...
 
IWFHitDrawerPtr fHitDrawerTool
 An instance of the tool to draw hits. More...
 
IWaveformDrawerPtr fRawDigitDrawerTool
 An instance of the tool to draw hits. More...
 
IWaveformDrawerPtr fWireDrawerTool
 An instance of the tool to draw hits. More...
 

Additional Inherited Members

- Protected Types inherited from evd::DrawingPad
using IExperimentDrawerPtr = std::unique_ptr< evd_tool::IExperimentDrawer >
 
- Protected Attributes inherited from evd::DrawingPad
TPad * fPad
 The ROOT graphics pad. More...
 
HeaderDrawerfHeaderDraw
 Drawer for event header info. More...
 
IExperimentDrawerPtr fGeometryDraw
 Drawer for detector geometry. More...
 
SimulationDrawerfSimulationDraw
 Drawer for simulation objects. More...
 
RawDataDrawerfRawDataDraw
 Drawer for raw data. More...
 
RecoBaseDrawerfRecoBaseDraw
 Drawer for recobase objects. More...
 
AnalysisBaseDrawerfAnalysisBaseDraw
 Drawer for analysisbase objects. More...
 

Detailed Description

Definition at line 24 of file TQPad.h.

Member Typedef Documentation

Definition at line 47 of file TQPad.h.

using evd::TQPad::IWFHitDrawerPtr = std::unique_ptr<evdb_tool::IWFHitDrawer>
private

Definition at line 46 of file TQPad.h.

Constructor & Destructor Documentation

evd::TQPad::TQPad ( const char *  nm,
const char *  ti,
double  x1,
double  y1,
double  x2,
double  y2,
const char *  opt,
unsigned int  plane,
unsigned int  wire 
)

Definition at line 37 of file TQPad.cxx.

46  : DrawingPad(nm, ti, x1, y1, x2, y2), fWire(wire), fPlane(plane), fFrameHist(0)
47  {
48  art::ServiceHandle<geo::Geometry const> geo;
49  unsigned int planes = geo->Nplanes();
50 
51  this->Pad()->cd();
52 
53  this->Pad()->SetLeftMargin(0.050);
54  this->Pad()->SetRightMargin(0.050);
55 
56  this->Pad()->SetTopMargin(0.005);
57  this->Pad()->SetBottomMargin(0.110);
58 
59  // there has to be a better way of doing this that does
60  // not have a case for each number of planes in a detector
61  if (planes == 2 && fPlane > 0) {
62  this->Pad()->SetTopMargin(0.110);
63  this->Pad()->SetBottomMargin(0.010);
64  }
65  else if (planes > 2) {
66  if (fPlane == 1) {
67  this->Pad()->SetTopMargin(0.005);
68  this->Pad()->SetBottomMargin(0.010);
69  }
70  else if (fPlane == 2) {
71  this->Pad()->SetTopMargin(0.110);
72  this->Pad()->SetBottomMargin(0.010);
73  }
74  }
75 
76  std::string opts(opt);
77  if (opts == "TQ") {
78  fTQ = kTQ;
79  // BB adjust the vertical spacing
80  this->Pad()->SetTopMargin(0);
81  this->Pad()->SetBottomMargin(0.2);
82  }
83  if (opts == "Q") { fTQ = kQ; }
84 
85  this->BookHistogram();
86  fView = new evdb::View2D();
87 
88  art::ServiceHandle<evd::RawDrawingOptions const> rawOptions;
89  art::ServiceHandle<evd::RecoDrawingOptions const> recoOptions;
90 
91  fHitDrawerTool = art::make_tool<evdb_tool::IWFHitDrawer>(recoOptions->fHitDrawerParams);
93  art::make_tool<evdb_tool::IWaveformDrawer>(rawOptions->fRawDigitDrawerParams);
94  fWireDrawerTool = art::make_tool<evdb_tool::IWaveformDrawer>(recoOptions->fWireDrawerParams);
95  }
IWFHitDrawerPtr fHitDrawerTool
An instance of the tool to draw hits.
Definition: TQPad.h:54
unsigned int fPlane
Which plane in the detector.
Definition: TQPad.h:50
TH1F * fFrameHist
A dummy histogram to define the axes.
Definition: TQPad.h:52
void BookHistogram()
Definition: TQPad.cxx:245
IWaveformDrawerPtr fWireDrawerTool
An instance of the tool to draw hits.
Definition: TQPad.h:56
unsigned int fWire
Definition: TQPad.h:49
evdb::View2D * fView
Superimpose scale on 1D histo.
Definition: TQPad.h:53
TPad * Pad()
Definition: DrawingPad.h:37
static const int kQ
Definition: TQPad.cxx:32
static const int kTQ
Definition: TQPad.cxx:33
BEGIN_PROLOG Z planes
IWaveformDrawerPtr fRawDigitDrawerTool
An instance of the tool to draw hits.
Definition: TQPad.h:55
int fTQ
0 = plot shows charge only, 1 = plot shows charge vs time for a wire
Definition: TQPad.h:51
DrawingPad(const char *nm, const char *ti, double x1, double y1, double y2, double x2)
Definition: DrawingPad.cxx:36
evd::TQPad::~TQPad ( )

Definition at line 99 of file TQPad.cxx.

100  {
101  if (fView) {
102  delete fView;
103  fView = 0;
104  }
105  if (fFrameHist) {
106  delete fFrameHist;
107  fFrameHist = 0;
108  }
109  }
TH1F * fFrameHist
A dummy histogram to define the axes.
Definition: TQPad.h:52
evdb::View2D * fView
Superimpose scale on 1D histo.
Definition: TQPad.h:53

Member Function Documentation

void evd::TQPad::BookHistogram ( )
private
Todo:
decide if ndivraw and ndivreco are useful

Definition at line 245 of file TQPad.cxx.

246  {
247  if (fFrameHist) {
248  delete fFrameHist;
249  fFrameHist = 0;
250  }
251 
252  art::ServiceHandle<evd::ColorDrawingOptions const> cst;
253  art::ServiceHandle<evd::RawDrawingOptions const> drawopt;
254 
255  // figure out the signal type for this plane, assume that
256  // plane n in each TPC/cryostat has the same type
257  geo::PlaneID planeid(drawopt->CurrentTPC(), fPlane);
258  art::ServiceHandle<geo::Geometry const> geo;
259  geo::SigType_t sigType = geo->SignalType(planeid);
260 
261  /// \todo decide if ndivraw and ndivreco are useful
262  double qxloraw = cst->fRawQLow[(size_t)sigType];
263  double qxhiraw = cst->fRawQHigh[(size_t)sigType];
264  double tqxlo = 1. * this->RawDataDraw()->StartTick();
265  double tqxhi = 1. * this->RawDataDraw()->TotalClockTicks();
266 
267  switch (fTQ) {
268  case kQ:
269  fFrameHist = new TH1F("fFrameHist", ";t [ticks];[ADC]", 2, 0., 1.);
270  fFrameHist->SetMaximum(qxhiraw);
271  fFrameHist->SetMinimum(qxloraw);
272  break; // kQ
273  case kTQ:
274  fFrameHist = new TH1F("fFrameHist", ";t [ticks];q [ADC]", (int)tqxhi, tqxlo, tqxhi + tqxlo);
275  break;
276  default: throw cet::exception("TQPad") << __func__ << ": unexpected quantity #" << fTQ << "\n";
277  } //end if fTQ == kTQ
278 
279  // Set the label, title size and offsets
280  // Note this is the base histogram so this control these for both the raw and wire histograms
281  fFrameHist->GetXaxis()->SetLabelSize(0.10);
282  fFrameHist->GetXaxis()->SetLabelOffset(0.00);
283  fFrameHist->GetXaxis()->SetTitleSize(0.10);
284  fFrameHist->GetXaxis()->SetTitleOffset(0.80);
285 
286  fFrameHist->GetYaxis()->SetLabelSize(0.10);
287  fFrameHist->GetYaxis()->SetLabelOffset(0.01);
288  fFrameHist->GetYaxis()->SetTitleSize(0.10);
289  fFrameHist->GetYaxis()->SetTitleOffset(0.80);
290  }
unsigned int fPlane
Which plane in the detector.
Definition: TQPad.h:50
TH1F * fFrameHist
A dummy histogram to define the axes.
Definition: TQPad.h:52
The data type to uniquely identify a Plane.
Definition: geo_types.h:472
RawDataDrawer * RawDataDraw()
Definition: DrawingPad.cxx:106
enum geo::_plane_sigtype SigType_t
double TotalClockTicks() const
Definition: RawDataDrawer.h:85
static const int kQ
Definition: TQPad.cxx:32
static const int kTQ
Definition: TQPad.cxx:33
int fTQ
0 = plot shows charge only, 1 = plot shows charge vs time for a wire
Definition: TQPad.h:51
double StartTick() const
Definition: RawDataDrawer.h:80
void evd::TQPad::Draw ( )

Definition at line 113 of file TQPad.cxx.

114  {
115  art::ServiceHandle<evd::RawDrawingOptions const> drawopt;
116 
117  //grab the singleton with the event
118  const art::Event* evt = evdb::EventHolder::Instance()->GetEvent();
119  if (!evt) return;
120 
121  art::ServiceHandle<geo::Geometry const> geoSvc;
122 
123  fPad->Clear();
124  fPad->cd();
125 
126  // Note this handles drawing waveforms for both SP and DP where the difference is handled by the tools
127  if (fTQ == kTQ) {
128  // Recover a channel number from current information
129  raw::ChannelID_t channel =
130  geoSvc->PlaneWireToChannel(fPlane, fWire, drawopt->fTPC, drawopt->fCryostat);
131 
132  // Call the tools to fill the histograms for RawDigits and Wire data
133  fRawDigitDrawerTool->Fill(
134  *fView, channel, this->RawDataDraw()->StartTick(), this->RawDataDraw()->TotalClockTicks());
135  fWireDrawerTool->Fill(
136  *fView, channel, this->RawDataDraw()->StartTick(), this->RawDataDraw()->TotalClockTicks());
137 
138  // Vertical limits set for the enclosing histogram, then draw it with axes only
139  float maxLowVal = std::min(fRawDigitDrawerTool->getMinimum(), fWireDrawerTool->getMinimum());
140  float maxHiVal = std::max(fRawDigitDrawerTool->getMaximum(), fWireDrawerTool->getMaximum());
141 
142  if (drawopt->fDrawRawDataOrCalibWires == kCALIB) {
143  maxLowVal = fWireDrawerTool->getMinimum();
144  maxHiVal = fWireDrawerTool->getMaximum();
145  }
146 
147  if (maxLowVal < std::numeric_limits<float>::max())
148  maxLowVal -= 5.;
149  else
150  maxLowVal = -10.;
151  if (maxHiVal > std::numeric_limits<float>::lowest())
152  maxHiVal += 5.;
153  else
154  maxHiVal = 10.;
155 
156  fFrameHist->SetMaximum(maxHiVal);
157  fFrameHist->SetMinimum(maxLowVal);
158  fFrameHist->Draw("AXIS");
159 
160  // draw with histogram style, only (square) lines, no errors
161  static const std::string defaultDrawOptions = "HIST same";
162 
163  // Draw the desired histograms
164  // If its not just the raw hists then we output the wire histograms
165  if (drawopt->fDrawRawDataOrCalibWires != kRAW) {
166  fWireDrawerTool->Draw(defaultDrawOptions.c_str(), maxLowVal, maxHiVal);
167 
168  fHitDrawerTool->Draw(*fView, channel);
169  }
170 
171  // Likewise, if it is not just the calib hists then we output the raw histogram
172  if (drawopt->fDrawRawDataOrCalibWires != kCALIB)
173  fRawDigitDrawerTool->Draw(defaultDrawOptions.c_str(), maxLowVal, maxHiVal);
174 
175  // This is a remnant from a time long past...
176  fFrameHist->SetTitleOffset(0.2, "Y");
177  } // end if fTQ == kTQ
178 
179  // I am not sure what the block below is trying to do... I don't see where the hists are actually filled.
180  // ** remove this for now until someone can explain what it is **
181  // else if(fTQ == kQ && fTQ == -1)
182  // {
183  // // figure out the signal type for this plane, assume that
184  // // plane n in each TPC/cryostat has the same type
185  // geo::PlaneID planeid(drawopt->CurrentTPC(), fPlane);
186  // geo::SigType_t sigType = geoSvc->SignalType(planeid);
187  //
188  // art::ServiceHandle<evd::ColorDrawingOptions const> cst;
189  //
190  // TH1F *hist;
191  //
192  // int ndiv = 0;
193  // if(drawopt->fDrawRawDataOrCalibWires != kCALIB){
194  // hist = fRawHisto;
195  // hist->SetMinimum(cst->fRawQLow [(size_t)sigType]);
196  // hist->SetMaximum(cst->fRawQHigh[(size_t)sigType]);
197  // ndiv = cst->fRawDiv[(size_t)sigType];
198  // }
199  // if(drawopt->fDrawRawDataOrCalibWires == kCALIB){
200  // hist = fRecoHisto;
201  // hist->SetMinimum(cst->fRecoQLow [(size_t)sigType]);
202  // hist->SetMaximum(cst->fRecoQHigh[(size_t)sigType]);
203  // ndiv = cst->fRecoDiv[(size_t)sigType];
204  // }
205  //
206  // hist->SetLabelSize(0, "X");
207  // hist->SetLabelSize(0, "Y");
208  // hist->SetTickLength(0, "X");
209  // hist->SetTickLength(0, "Y");
210  // hist->Draw("pY+");
211  //
212  // //
213  // // Use this to fill the histogram with colors from the color scale
214  // //
215  // double x1, x2, y1, y2;
216  // x1 = 0.;
217  // x2 = 1.;
218  //
219  // for(int i = 0; i < ndiv; ++i){
220  // y1 = hist->GetMinimum() + i*(hist->GetMaximum()-hist->GetMinimum())/(1.*ndiv);
221  // y2 = hist->GetMinimum() + (i + 1)*(hist->GetMaximum()-hist->GetMinimum())/(1.*ndiv);
222  //
223  // int c = 1;
224  // if (drawopt->fDrawRawDataOrCalibWires==kRAW) {
225  // c = cst->RawQ(sigType).GetColor(0.5*(y1+y2));
226  // }
227  // if (drawopt->fDrawRawDataOrCalibWires!=kRAW) {
228  // c= cst->CalQ(sigType).GetColor(0.5*(y1+y2));
229  // }
230  //
231  // TBox& b = fView->AddBox(x1,y1,x2,y2);
232  // b.SetFillStyle(1001);
233  // b.SetFillColor(c);
234  // b.Draw();
235  // } // end loop over Q histogram bins
236  //
237  // hist->Draw("same");
238  // } // end if fTQ == kQ
239 
240  return;
241  }
IWFHitDrawerPtr fHitDrawerTool
An instance of the tool to draw hits.
Definition: TQPad.h:54
unsigned int fPlane
Which plane in the detector.
Definition: TQPad.h:50
TH1F * fFrameHist
A dummy histogram to define the axes.
Definition: TQPad.h:52
IWaveformDrawerPtr fWireDrawerTool
An instance of the tool to draw hits.
Definition: TQPad.h:56
static const int kRAW
Definition: TQPad.cxx:29
BEGIN_PROLOG StartTick
static const int kCALIB
Definition: TQPad.cxx:30
unsigned int fWire
Definition: TQPad.h:49
evdb::View2D * fView
Superimpose scale on 1D histo.
Definition: TQPad.h:53
RawDataDrawer * RawDataDraw()
Definition: DrawingPad.cxx:106
static const int kTQ
Definition: TQPad.cxx:33
IWaveformDrawerPtr fRawDigitDrawerTool
An instance of the tool to draw hits.
Definition: TQPad.h:55
int fTQ
0 = plot shows charge only, 1 = plot shows charge vs time for a wire
Definition: TQPad.h:51
TPad * fPad
The ROOT graphics pad.
Definition: DrawingPad.h:52
TCEvent evt
Definition: DataStructs.cxx:8
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
void evd::TQPad::SetPlaneWire ( unsigned int  plane = 0,
unsigned int  wire = 0 
)
inline

Definition at line 41 of file TQPad.h.

41 { fPlane = plane; fWire = wire; }
unsigned int fPlane
Which plane in the detector.
Definition: TQPad.h:50
unsigned int fWire
Definition: TQPad.h:49

Member Data Documentation

TH1F* evd::TQPad::fFrameHist
private

A dummy histogram to define the axes.

Definition at line 52 of file TQPad.h.

IWFHitDrawerPtr evd::TQPad::fHitDrawerTool
private

An instance of the tool to draw hits.

Definition at line 54 of file TQPad.h.

unsigned int evd::TQPad::fPlane
private

Which plane in the detector.

Definition at line 50 of file TQPad.h.

IWaveformDrawerPtr evd::TQPad::fRawDigitDrawerTool
private

An instance of the tool to draw hits.

Definition at line 55 of file TQPad.h.

int evd::TQPad::fTQ
private

0 = plot shows charge only, 1 = plot shows charge vs time for a wire

Definition at line 51 of file TQPad.h.

evdb::View2D* evd::TQPad::fView
private

Superimpose scale on 1D histo.

Definition at line 53 of file TQPad.h.

unsigned int evd::TQPad::fWire
private

Definition at line 49 of file TQPad.h.

IWaveformDrawerPtr evd::TQPad::fWireDrawerTool
private

An instance of the tool to draw hits.

Definition at line 56 of file TQPad.h.


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