LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
evd::CalorPad Class Reference

A drawing pad showing calorimetric particle ID information. More...

#include "CalorPad.h"

Inheritance diagram for evd::CalorPad:
evd::DrawingPad

Public Member Functions

 CalorPad (const char *name, const char *title, double x1, double y1, double x2, double y2, int curvetype)
 
 ~CalorPad ()
 
void Draw (const char *opt=0)
 
void DrawRefCurves ()
 
TPad * Pad ()
 
HeaderDrawerHeaderDraw ()
 
evd_tool::IExperimentDrawerGeometryDraw ()
 
SimulationDrawerSimulationDraw ()
 
RawDataDrawerRawDataDraw ()
 
RecoBaseDrawerRecoBaseDraw ()
 
AnalysisBaseDrawerAnalysisBaseDraw ()
 
HitSelectorHitSelectorGet ()
 

Protected Types

using IExperimentDrawerPtr = std::unique_ptr< evd_tool::IExperimentDrawer >
 

Protected Attributes

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...
 

Private Attributes

std::string fROOTfile
 
TGraph * dedx_range_pro
 proton template More...
 
TGraph * dedx_range_ka
 kaon template More...
 
TGraph * dedx_range_pi
 pion template More...
 
TGraph * dedx_range_mu
 muon template More...
 
TGraph * ke_range_pro
 proton template More...
 
TGraph * ke_range_ka
 kaon template More...
 
TGraph * ke_range_pi
 pion template More...
 
TGraph * ke_range_mu
 muon template More...
 
int fcurvetype
 
evdb::View2DfView
 Collection of graphics objects to render; text labels. More...
 

Detailed Description

A drawing pad showing calorimetric particle ID information.

Definition at line 23 of file CalorPad.h.

Member Typedef Documentation

using evd::DrawingPad::IExperimentDrawerPtr = std::unique_ptr<evd_tool::IExperimentDrawer>
protectedinherited

Definition at line 43 of file DrawingPad.h.

Constructor & Destructor Documentation

evd::CalorPad::CalorPad ( const char *  name,
const char *  title,
double  x1,
double  y1,
double  x2,
double  y2,
int  curvetype 
)

Definition at line 40 of file CalorPad.cxx.

References dedx_range_ka, dedx_range_mu, dedx_range_pi, dedx_range_pro, fView, ke_range_ka, ke_range_mu, ke_range_pi, ke_range_pro, and evd::DrawingPad::Pad().

47  : DrawingPad(name, title, x1, y1, x2, y2), fcurvetype(curvetype)
48 {
49 
50  // Set up pad.
51  this->Pad()->cd();
52  this->Pad()->SetBit(kCannotPick);
53  this->Pad()->SetBit(TPad::kCannotMove);
54  this->Pad()->SetFillColor(kWhite);
55  this->Pad()->SetLeftMargin(0.10);
56  this->Pad()->SetRightMargin(0.025);
57  this->Pad()->SetTopMargin(0.025);
58  this->Pad()->SetBottomMargin(0.10);
59  this->Pad()->Draw();
60 
61  dedx_range_pro = 0;
62  dedx_range_ka = 0;
63  dedx_range_pi = 0;
64  dedx_range_mu = 0;
65  ke_range_pro = 0;
66  ke_range_ka = 0;
67  ke_range_pi = 0;
68  ke_range_mu = 0;
69 
70  fView = new evdb::View2D();
71 }
int fcurvetype
Definition: CalorPad.h:50
Float_t y1[n_points_granero]
Definition: compare.C:5
TGraph * ke_range_pi
pion template
Definition: CalorPad.h:48
Float_t x1[n_points_granero]
Definition: compare.C:5
evdb::View2D * fView
Collection of graphics objects to render; text labels.
Definition: CalorPad.h:52
TGraph * dedx_range_pi
pion template
Definition: CalorPad.h:43
Float_t y2[n_points_geant4]
Definition: compare.C:26
TPad * Pad()
Definition: DrawingPad.h:31
TGraph * ke_range_ka
kaon template
Definition: CalorPad.h:47
TGraph * ke_range_pro
proton template
Definition: CalorPad.h:46
TGraph * dedx_range_ka
kaon template
Definition: CalorPad.h:42
Float_t x2[n_points_geant4]
Definition: compare.C:26
TGraph * ke_range_mu
muon template
Definition: CalorPad.h:49
TGraph * dedx_range_mu
muon template
Definition: CalorPad.h:44
TGraph * dedx_range_pro
proton template
Definition: CalorPad.h:41
DrawingPad(const char *nm, const char *ti, double x1, double y1, double y2, double x2)
Definition: DrawingPad.cxx:36
evd::CalorPad::~CalorPad ( )

Definition at line 75 of file CalorPad.cxx.

References dedx_range_ka, dedx_range_mu, dedx_range_pi, dedx_range_pro, fView, ke_range_ka, ke_range_mu, ke_range_pi, and ke_range_pro.

76 {
77  if (dedx_range_pro) {
78  delete dedx_range_pro;
79  dedx_range_pro = 0;
80  }
81  if (dedx_range_ka) {
82  delete dedx_range_ka;
83  dedx_range_ka = 0;
84  }
85  if (dedx_range_pi) {
86  delete dedx_range_pi;
87  dedx_range_pi = 0;
88  }
89  if (dedx_range_mu) {
90  delete dedx_range_mu;
91  dedx_range_mu = 0;
92  }
93  if (ke_range_pro) {
94  delete ke_range_pro;
95  ke_range_pro = 0;
96  }
97  if (ke_range_ka) {
98  delete ke_range_ka;
99  ke_range_ka = 0;
100  }
101  if (ke_range_pi) {
102  delete ke_range_pi;
103  ke_range_pi = 0;
104  }
105  if (ke_range_mu) {
106  delete ke_range_mu;
107  ke_range_mu = 0;
108  }
109  if (fView) {
110  delete fView;
111  fView = 0;
112  }
113 }
TGraph * ke_range_pi
pion template
Definition: CalorPad.h:48
evdb::View2D * fView
Collection of graphics objects to render; text labels.
Definition: CalorPad.h:52
TGraph * dedx_range_pi
pion template
Definition: CalorPad.h:43
TGraph * ke_range_ka
kaon template
Definition: CalorPad.h:47
TGraph * ke_range_pro
proton template
Definition: CalorPad.h:46
TGraph * dedx_range_ka
kaon template
Definition: CalorPad.h:42
TGraph * ke_range_mu
muon template
Definition: CalorPad.h:49
TGraph * dedx_range_mu
muon template
Definition: CalorPad.h:44
TGraph * dedx_range_pro
proton template
Definition: CalorPad.h:41

Member Function Documentation

AnalysisBaseDrawer * evd::DrawingPad::AnalysisBaseDraw ( )
inherited

Provide access to the drawer for AnalysisBase classes

Definition at line 143 of file DrawingPad.cxx.

References evd::DrawingPad::fAnalysisBaseDraw.

Referenced by Draw().

144  {
145  if (fAnalysisBaseDraw == 0) fAnalysisBaseDraw = new AnalysisBaseDrawer();
146  return fAnalysisBaseDraw;
147  }
AnalysisBaseDrawer * fAnalysisBaseDraw
Drawer for analysisbase objects.
Definition: DrawingPad.h:51
void evd::CalorPad::Draw ( const char *  opt = 0)

Definition at line 118 of file CalorPad.cxx.

References evd::DrawingPad::AnalysisBaseDraw(), evd::AnalysisBaseDrawer::CalorShower(), evdb::View2D::Clear(), evdb::View2D::Draw(), evd::AnalysisBaseDrawer::DrawDeDx(), evd::AnalysisBaseDrawer::DrawKineticEnergy(), DrawRefCurves(), e, tca::evt, fcurvetype, evd::DrawingPad::fPad, fView, evdb::EventHolder::GetEvent(), evdb::EventHolder::Instance(), and evd::DrawingPad::Pad().

Referenced by evd::CalorView::Draw().

119 {
120 
121  this->Pad()->cd();
122 
123  //Remove all previous objects from Pad's primitive list
124  this->Pad()->Clear();
125 
126  //Remove all previous TPolyMarkers, TLatexs, etc... from list of such objects
127  fView->Clear();
128 
129  //Draw coordinate axis and also GEANT based dE/dx vs. Range, or KE vs. Range, curves.
130  DrawRefCurves();
131 
132  // grab the event from the singleton
134 
135  // Insert graphic objects into fView collection.
136  if (evt) {
137  try {
138  if (fcurvetype == 1)
139  AnalysisBaseDraw()->DrawDeDx(*evt, fView);
140  else if (fcurvetype == 0)
142  else if (fcurvetype == 2)
144  }
145  catch (cet::exception const& e) {
146  if (fcurvetype == 1)
147  writeErrMsg("Draw->DrawDeDx", e);
148  else if (fcurvetype == 0)
149  writeErrMsg("Draw->DrawKineticEnergy", e);
150  else if (fcurvetype == 2)
151  writeErrMsg("Draw->CalorShower", e);
152  }
153  }
154 
155  // Draw objects on pad.
156  fView->Draw();
157  fPad->Modified();
158  fPad->Update();
159 }
AnalysisBaseDrawer * AnalysisBaseDraw()
Definition: DrawingPad.cxx:143
void DrawDeDx(const art::Event &evt, evdb::View2D *view)
void DrawRefCurves()
Definition: CalorPad.cxx:164
const art::Event * GetEvent() const
Definition: EventHolder.cxx:45
int fcurvetype
Definition: CalorPad.h:50
evdb::View2D * fView
Collection of graphics objects to render; text labels.
Definition: CalorPad.h:52
void Clear()
Definition: View2D.cxx:109
void Draw()
Definition: View2D.cxx:89
static EventHolder * Instance()
Definition: EventHolder.cxx:15
TPad * Pad()
Definition: DrawingPad.h:31
TPad * fPad
The ROOT graphics pad.
Definition: DrawingPad.h:45
TCEvent evt
Definition: DataStructs.cxx:8
void CalorShower(const art::Event &evt, evdb::View2D *view)
Float_t e
Definition: plot.C:35
void DrawKineticEnergy(const art::Event &evt, evdb::View2D *view)
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void evd::CalorPad::DrawRefCurves ( )

Definition at line 164 of file CalorPad.cxx.

References dedx_range_ka, dedx_range_mu, dedx_range_pi, dedx_range_pro, evd::AnalysisDrawingOptions::fCalorTemplateFileName, fcurvetype, file, fROOTfile, ke_range_ka, ke_range_mu, ke_range_pi, ke_range_pro, and evd::DrawingPad::Pad().

Referenced by Draw().

165 {
166 
167  if (dedx_range_pro) {
168  delete dedx_range_pro;
169  dedx_range_pro = 0;
170  }
171  if (dedx_range_ka) {
172  delete dedx_range_ka;
173  dedx_range_ka = 0;
174  }
175  if (dedx_range_pi) {
176  delete dedx_range_pi;
177  dedx_range_pi = 0;
178  }
179  if (dedx_range_mu) {
180  delete dedx_range_mu;
181  dedx_range_mu = 0;
182  }
183  if (ke_range_pro) {
184  delete ke_range_pro;
185  ke_range_pro = 0;
186  }
187  if (ke_range_ka) {
188  delete ke_range_ka;
189  ke_range_ka = 0;
190  }
191  if (ke_range_pi) {
192  delete ke_range_pi;
193  ke_range_pi = 0;
194  }
195  if (ke_range_mu) {
196  delete ke_range_mu;
197  ke_range_mu = 0;
198  }
199 
200  double ymax;
201  if (fcurvetype == 1)
202  ymax = 50.0;
203  else
204  ymax = 200.0;
205  TH1F* h = this->Pad()->DrawFrame(0.0, 0.0, 25.0, ymax);
206  h->GetXaxis()->SetLabelSize(0.04);
207  h->GetXaxis()->SetTitleSize(0.04);
208  h->GetXaxis()->CenterTitle();
209  h->GetYaxis()->SetLabelSize(0.04);
210  h->GetYaxis()->SetTitleSize(0.04);
211  h->GetYaxis()->CenterTitle();
212 
213  if (fcurvetype == 1) {
214  h->GetXaxis()->SetTitle("Residual Range (cm)");
215  h->GetYaxis()->SetTitle("dE/dx (MeV/cm)");
216  }
217  else {
218  h->GetXaxis()->SetTitle("Total Range (cm)");
219  h->GetYaxis()->SetTitle("T (MeV)");
220  }
221 
223 
224  cet::search_path sp("FW_SEARCH_PATH");
225  if (!sp.find_file(anaOpt->fCalorTemplateFileName + ".root", fROOTfile))
226  throw cet::exception("Chi2ParticleID")
227  << "cannot find the root template file: \n"
228  << anaOpt->fCalorTemplateFileName << "\n bail ungracefully.\n";
229 
230  TFile* file = TFile::Open(fROOTfile.c_str());
231  if (fcurvetype == 1) {
232  dedx_range_pro = (TGraph*)file->Get("dedx_range_pro");
233  dedx_range_ka = (TGraph*)file->Get("dedx_range_ka");
234  dedx_range_pi = (TGraph*)file->Get("dedx_range_pi");
235  dedx_range_mu = (TGraph*)file->Get("dedx_range_mu");
236 
237  dedx_range_pro->SetMarkerStyle(7);
238  dedx_range_ka->SetMarkerStyle(7);
239  dedx_range_pi->SetMarkerStyle(7);
240  dedx_range_mu->SetMarkerStyle(7);
241 
242  dedx_range_pro->SetMarkerColor(kBlack);
243  dedx_range_ka->SetMarkerColor(kGray + 2);
244  dedx_range_pi->SetMarkerColor(kGray + 1);
245  dedx_range_mu->SetMarkerColor(kGray);
246 
247  dedx_range_mu->Draw("P,same");
248  dedx_range_pi->Draw("P,same");
249  dedx_range_ka->Draw("P,same");
250  dedx_range_pro->Draw("P,same");
251  }
252  else {
253  ke_range_pro = (TGraph*)file->Get("kinen_range_pro");
254  ke_range_ka = (TGraph*)file->Get("kinen_range_ka");
255  ke_range_pi = (TGraph*)file->Get("kinen_range_pi");
256  ke_range_mu = (TGraph*)file->Get("kinen_range_mu");
257 
258  ke_range_pro->SetMarkerStyle(7);
259  ke_range_ka->SetMarkerStyle(7);
260  ke_range_pi->SetMarkerStyle(7);
261  ke_range_mu->SetMarkerStyle(7);
262 
263  ke_range_pro->SetMarkerColor(kBlack);
264  ke_range_ka->SetMarkerColor(kGray + 2);
265  ke_range_pi->SetMarkerColor(kGray + 1);
266  ke_range_mu->SetMarkerColor(kGray);
267 
268  ke_range_mu->Draw("P,same");
269  ke_range_pi->Draw("P,same");
270  ke_range_ka->Draw("P,same");
271  ke_range_pro->Draw("P,same");
272  }
273  file->Close();
274 }
int fcurvetype
Definition: CalorPad.h:50
TGraph * ke_range_pi
pion template
Definition: CalorPad.h:48
TGraph * dedx_range_pi
pion template
Definition: CalorPad.h:43
std::string fROOTfile
Definition: CalorPad.h:40
std::string fCalorTemplateFileName
files that have calorimetry template curves
TPad * Pad()
Definition: DrawingPad.h:31
TGraph * ke_range_ka
kaon template
Definition: CalorPad.h:47
TGraph * ke_range_pro
proton template
Definition: CalorPad.h:46
TFile * file
TGraph * dedx_range_ka
kaon template
Definition: CalorPad.h:42
TGraph * ke_range_mu
muon template
Definition: CalorPad.h:49
TGraph * dedx_range_mu
muon template
Definition: CalorPad.h:44
TGraph * dedx_range_pro
proton template
Definition: CalorPad.h:41
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
evd_tool::IExperimentDrawer * evd::DrawingPad::GeometryDraw ( )
inherited

Provide access to the drawer for the detector geometry

Definition at line 97 of file DrawingPad.cxx.

References evd::DrawingPad::fGeometryDraw, evd::EvdLayoutOptions::fParameterSet, and fhicl::ParameterSet::get().

Referenced by evd::Display3DPad::Draw().

98  {
99  if (fGeometryDraw == 0) {
101  const fhicl::ParameterSet& pset = layoutOptions->fParameterSet;
102 
103  fGeometryDraw = art::make_tool<evd_tool::IExperimentDrawer>(
104  pset.get<fhicl::ParameterSet>("Experiment3DDrawer"));
105  }
106  return fGeometryDraw.get();
107  }
IExperimentDrawerPtr fGeometryDraw
Drawer for detector geometry.
Definition: DrawingPad.h:47
T get(std::string const &key) const
Definition: ParameterSet.h:314
fhicl::ParameterSet const & fParameterSet
HeaderDrawer * evd::DrawingPad::HeaderDraw ( )
inherited

Provide access to the drawer for the detector geometry

Definition at line 88 of file DrawingPad.cxx.

References evd::DrawingPad::fHeaderDraw.

Referenced by evd::HeaderPad::Draw().

89  {
90  if (fHeaderDraw == 0) fHeaderDraw = new HeaderDrawer();
91  return fHeaderDraw;
92  }
HeaderDrawer * fHeaderDraw
Drawer for event header info.
Definition: DrawingPad.h:46
HitSelector * evd::DrawingPad::HitSelectorGet ( )
inherited

Provide access to the HitSelector

Definition at line 155 of file DrawingPad.cxx.

References evd::gTheHitSelector.

Referenced by evd::TWireProjPad::ClearHitList(), evd::TWireProjPad::Draw(), evd::TWireProjPad::SaveHitList(), evd::TWireProjPad::SaveSeedList(), and evd::TWireProjPad::SelectOneHit().

156  {
157  if (gTheHitSelector == 0) gTheHitSelector = new HitSelector();
158  return gTheHitSelector;
159  }
HitSelector * gTheHitSelector
Definition: DrawingPad.cxx:25
RawDataDrawer * evd::DrawingPad::RawDataDraw ( )
inherited

Provide access to the drawer for the RawData classes

Definition at line 121 of file DrawingPad.cxx.

References evd::DrawingPad::fRawDataDraw.

Referenced by evd::TQPad::BookHistogram(), evd::TQPad::Draw(), evd::TWireProjPad::Draw(), evd::TWireProjPad::ShowFull(), and evd::TWireProjPad::TWireProjPad().

122  {
123  if (fRawDataDraw == 0) fRawDataDraw = new RawDataDrawer();
124  return fRawDataDraw;
125  }
RawDataDrawer * fRawDataDraw
Drawer for raw data.
Definition: DrawingPad.h:49
RecoBaseDrawer * evd::DrawingPad::RecoBaseDraw ( )
inherited

Provide access to the drawer for RecoBase classes

Definition at line 132 of file DrawingPad.cxx.

References evd::DrawingPad::fRecoBaseDraw.

Referenced by evd::Display3DPad::Draw(), evd::TWireProjPad::Draw(), evd::Ortho3DPad::Draw(), and evd::TWireProjPad::ShowFull().

133  {
134  if (fRecoBaseDraw == 0) fRecoBaseDraw = new RecoBaseDrawer();
135  return fRecoBaseDraw;
136  }
RecoBaseDrawer * fRecoBaseDraw
Drawer for recobase objects.
Definition: DrawingPad.h:50
SimulationDrawer * evd::DrawingPad::SimulationDraw ( )
inherited

Provide access to the drawer for the Simulation classes

Definition at line 112 of file DrawingPad.cxx.

References evd::DrawingPad::fSimulationDraw.

Referenced by evd::MCBriefPad::Draw(), evd::TWireProjPad::Draw(), and evd::Ortho3DPad::Draw().

113  {
114  if (fSimulationDraw == 0) fSimulationDraw = new SimulationDrawer();
115  return fSimulationDraw;
116  }
SimulationDrawer * fSimulationDraw
Drawer for simulation objects.
Definition: DrawingPad.h:48

Member Data Documentation

TGraph* evd::CalorPad::dedx_range_ka
private

kaon template

Definition at line 42 of file CalorPad.h.

Referenced by CalorPad(), DrawRefCurves(), and ~CalorPad().

TGraph* evd::CalorPad::dedx_range_mu
private

muon template

Definition at line 44 of file CalorPad.h.

Referenced by CalorPad(), DrawRefCurves(), and ~CalorPad().

TGraph* evd::CalorPad::dedx_range_pi
private

pion template

Definition at line 43 of file CalorPad.h.

Referenced by CalorPad(), DrawRefCurves(), and ~CalorPad().

TGraph* evd::CalorPad::dedx_range_pro
private

proton template

Definition at line 41 of file CalorPad.h.

Referenced by CalorPad(), DrawRefCurves(), and ~CalorPad().

AnalysisBaseDrawer* evd::DrawingPad::fAnalysisBaseDraw
protectedinherited

Drawer for analysisbase objects.

Definition at line 51 of file DrawingPad.h.

Referenced by evd::DrawingPad::AnalysisBaseDraw(), and evd::DrawingPad::~DrawingPad().

int evd::CalorPad::fcurvetype
private

Definition at line 50 of file CalorPad.h.

Referenced by Draw(), and DrawRefCurves().

IExperimentDrawerPtr evd::DrawingPad::fGeometryDraw
protectedinherited

Drawer for detector geometry.

Definition at line 47 of file DrawingPad.h.

Referenced by evd::DrawingPad::GeometryDraw().

HeaderDrawer* evd::DrawingPad::fHeaderDraw
protectedinherited

Drawer for event header info.

Definition at line 46 of file DrawingPad.h.

Referenced by evd::DrawingPad::HeaderDraw(), and evd::DrawingPad::~DrawingPad().

RawDataDrawer* evd::DrawingPad::fRawDataDraw
protectedinherited

Drawer for raw data.

Definition at line 49 of file DrawingPad.h.

Referenced by evd::DrawingPad::RawDataDraw(), and evd::DrawingPad::~DrawingPad().

RecoBaseDrawer* evd::DrawingPad::fRecoBaseDraw
protectedinherited

Drawer for recobase objects.

Definition at line 50 of file DrawingPad.h.

Referenced by evd::DrawingPad::RecoBaseDraw(), and evd::DrawingPad::~DrawingPad().

std::string evd::CalorPad::fROOTfile
private

Definition at line 40 of file CalorPad.h.

Referenced by DrawRefCurves().

SimulationDrawer* evd::DrawingPad::fSimulationDraw
protectedinherited

Drawer for simulation objects.

Definition at line 48 of file DrawingPad.h.

Referenced by evd::DrawingPad::SimulationDraw(), and evd::DrawingPad::~DrawingPad().

evdb::View2D* evd::CalorPad::fView
private

Collection of graphics objects to render; text labels.

Definition at line 52 of file CalorPad.h.

Referenced by CalorPad(), Draw(), and ~CalorPad().

TGraph* evd::CalorPad::ke_range_ka
private

kaon template

Definition at line 47 of file CalorPad.h.

Referenced by CalorPad(), DrawRefCurves(), and ~CalorPad().

TGraph* evd::CalorPad::ke_range_mu
private

muon template

Definition at line 49 of file CalorPad.h.

Referenced by CalorPad(), DrawRefCurves(), and ~CalorPad().

TGraph* evd::CalorPad::ke_range_pi
private

pion template

Definition at line 48 of file CalorPad.h.

Referenced by CalorPad(), DrawRefCurves(), and ~CalorPad().

TGraph* evd::CalorPad::ke_range_pro
private

proton template

Definition at line 46 of file CalorPad.h.

Referenced by CalorPad(), DrawRefCurves(), and ~CalorPad().


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