Public Member Functions | Private Attributes | List of all members
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 ()
 
- 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 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::View2D * fView
 Collection of graphics objects to render; text labels. 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

A drawing pad showing calorimetric particle ID information.

Definition at line 21 of file CalorPad.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 44 of file CalorPad.cxx.

48  : DrawingPad(name, title, x1, y1, x2, y2)
49  , fcurvetype(curvetype)
50 {
51 
52  // Set up pad.
53  this->Pad()->cd();
54  this->Pad()->SetBit(kCannotPick);
55  this->Pad()->SetBit(TPad::kCannotMove);
56  this->Pad()->SetFillColor(kWhite);
57  this->Pad()->SetLeftMargin(0.10);
58  this->Pad()->SetRightMargin (0.025);
59  this->Pad()->SetTopMargin (0.025);
60  this->Pad()->SetBottomMargin (0.10);
61  this->Pad()->Draw();
62 
63  dedx_range_pro = 0;
64  dedx_range_ka = 0;
65  dedx_range_pi = 0;
66  dedx_range_mu = 0;
67  ke_range_pro = 0;
68  ke_range_ka = 0;
69  ke_range_pi = 0;
70  ke_range_mu = 0;
71 
72  fView = new evdb::View2D();
73 
74 }
static QCString name
Definition: declinfo.cpp:673
int fcurvetype
Definition: CalorPad.h:46
TGraph * ke_range_pi
pion template
Definition: CalorPad.h:44
evdb::View2D * fView
Collection of graphics objects to render; text labels.
Definition: CalorPad.h:48
TGraph * dedx_range_pi
pion template
Definition: CalorPad.h:39
TPad * Pad()
Definition: DrawingPad.h:37
TGraph * ke_range_ka
kaon template
Definition: CalorPad.h:43
TGraph * ke_range_pro
proton template
Definition: CalorPad.h:42
TGraph * dedx_range_ka
kaon template
Definition: CalorPad.h:38
TGraph * ke_range_mu
muon template
Definition: CalorPad.h:45
TGraph * dedx_range_mu
muon template
Definition: CalorPad.h:40
TGraph * dedx_range_pro
proton template
Definition: CalorPad.h:37
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 78 of file CalorPad.cxx.

79 {
81  if(dedx_range_ka) {delete dedx_range_ka; dedx_range_ka = 0;}
82  if(dedx_range_pi) {delete dedx_range_pi; dedx_range_pi = 0;}
83  if(dedx_range_mu) {delete dedx_range_mu; dedx_range_mu = 0;}
84  if(ke_range_pro) {delete ke_range_pro; ke_range_pro = 0;}
85  if(ke_range_ka) {delete ke_range_ka; ke_range_ka = 0;}
86  if(ke_range_pi) {delete ke_range_pi; ke_range_pi = 0;}
87  if(ke_range_mu) {delete ke_range_mu; ke_range_mu = 0;}
88  if (fView) { delete fView; fView = 0; }
89 }
TGraph * ke_range_pi
pion template
Definition: CalorPad.h:44
evdb::View2D * fView
Collection of graphics objects to render; text labels.
Definition: CalorPad.h:48
TGraph * dedx_range_pi
pion template
Definition: CalorPad.h:39
TGraph * ke_range_ka
kaon template
Definition: CalorPad.h:43
TGraph * ke_range_pro
proton template
Definition: CalorPad.h:42
TGraph * dedx_range_ka
kaon template
Definition: CalorPad.h:38
TGraph * ke_range_mu
muon template
Definition: CalorPad.h:45
TGraph * dedx_range_mu
muon template
Definition: CalorPad.h:40
TGraph * dedx_range_pro
proton template
Definition: CalorPad.h:37

Member Function Documentation

void evd::CalorPad::Draw ( const char *  opt = 0)

Definition at line 94 of file CalorPad.cxx.

95 {
96 
97  this->Pad()->cd();
98 
99  //Remove all previous objects from Pad's primitive list
100  this->Pad()->Clear();
101 
102  //Remove all previous TPolyMarkers, TLatexs, etc... from list of such objects
103  fView->Clear();
104 
105  //Draw coordinate axis and also GEANT based dE/dx vs. Range, or KE vs. Range, curves.
106  DrawRefCurves();
107 
108  // grab the event from the singleton
109  const art::Event *evt = evdb::EventHolder::Instance()->GetEvent();
110 
111  // Insert graphic objects into fView collection.
112  if(evt){
113  try{
114  if(fcurvetype==1) AnalysisBaseDraw()->DrawDeDx(*evt, fView);
115  else if (fcurvetype==0) AnalysisBaseDraw()->DrawKineticEnergy(*evt, fView);
116  else if (fcurvetype==2) AnalysisBaseDraw()->CalorShower(*evt, fView);
117  }
118  catch (cet::exception const& e){
119  if(fcurvetype==1) writeErrMsg("Draw->DrawDeDx",e);
120  else if (fcurvetype==0) writeErrMsg("Draw->DrawKineticEnergy",e);
121  else if (fcurvetype==2) writeErrMsg("Draw->CalorShower",e);
122  }
123  }
124 
125  // Draw objects on pad.
126  fView->Draw();
127  fPad->Modified();
128  fPad->Update();
129 
130 }
AnalysisBaseDrawer * AnalysisBaseDraw()
Definition: DrawingPad.cxx:129
void DrawDeDx(const art::Event &evt, evdb::View2D *view)
void DrawRefCurves()
Definition: CalorPad.cxx:135
int fcurvetype
Definition: CalorPad.h:46
evdb::View2D * fView
Collection of graphics objects to render; text labels.
Definition: CalorPad.h:48
const double e
TPad * Pad()
Definition: DrawingPad.h:37
TPad * fPad
The ROOT graphics pad.
Definition: DrawingPad.h:52
TCEvent evt
Definition: DataStructs.cxx:7
void CalorShower(const art::Event &evt, evdb::View2D *view)
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 135 of file CalorPad.cxx.

136 {
137 
138  if(dedx_range_pro){
139  delete dedx_range_pro;
140  dedx_range_pro = 0;
141  }
142  if(dedx_range_ka){
143  delete dedx_range_ka;
144  dedx_range_ka = 0;
145  }
146  if(dedx_range_pi){
147  delete dedx_range_pi;
148  dedx_range_pi = 0;
149  }
150  if(dedx_range_mu){
151  delete dedx_range_mu;
152  dedx_range_mu = 0;
153  }
154  if(ke_range_pro){
155  delete ke_range_pro;
156  ke_range_pro = 0;
157  }
158  if(ke_range_ka){
159  delete ke_range_ka;
160  ke_range_ka = 0;
161  }
162  if(ke_range_pi){
163  delete ke_range_pi;
164  ke_range_pi = 0;
165  }
166  if(ke_range_mu){
167  delete ke_range_mu;
168  ke_range_mu = 0;
169  }
170 
171  double ymax;
172  if(fcurvetype==1) ymax=50.0;
173  else ymax = 200.0;
174  TH1F* h = this->Pad()->DrawFrame(0.0,0.0,25.0,ymax);
175  h->GetXaxis()->SetLabelSize(0.04);
176  h->GetXaxis()->SetTitleSize(0.04);
177  h->GetXaxis()->CenterTitle();
178  h->GetYaxis()->SetLabelSize(0.04);
179  h->GetYaxis()->SetTitleSize(0.04);
180  h->GetYaxis()->CenterTitle();
181 
182  if(fcurvetype==1){
183  h->GetXaxis()->SetTitle("Residual Range (cm)");
184  h->GetYaxis()->SetTitle("dE/dx (MeV/cm)");
185  }else{
186  h->GetXaxis()->SetTitle("Total Range (cm)");
187  h->GetYaxis()->SetTitle("T (MeV)");
188  }
189 
191 
192  cet::search_path sp("FW_SEARCH_PATH");
193  if( !sp.find_file(anaOpt->fCalorTemplateFileName + ".root", fROOTfile) )
194  throw cet::exception("Chi2ParticleID") << "cannot find the root template file: \n"
195  << anaOpt->fCalorTemplateFileName
196  << "\n bail ungracefully.\n";
197 
198  TFile *file = TFile::Open(fROOTfile.c_str());
199  if(fcurvetype==1){
200  dedx_range_pro = (TGraph*)file->Get("dedx_range_pro");
201  dedx_range_ka = (TGraph*)file->Get("dedx_range_ka");
202  dedx_range_pi = (TGraph*)file->Get("dedx_range_pi");
203  dedx_range_mu = (TGraph*)file->Get("dedx_range_mu");
204 
205  dedx_range_pro->SetMarkerStyle(7);
206  dedx_range_ka->SetMarkerStyle(7);
207  dedx_range_pi->SetMarkerStyle(7);
208  dedx_range_mu->SetMarkerStyle(7);
209 
210  dedx_range_pro->SetMarkerColor(kBlack);
211  dedx_range_ka->SetMarkerColor(kGray+2);
212  dedx_range_pi->SetMarkerColor(kGray+1);
213  dedx_range_mu->SetMarkerColor(kGray);
214 
215  dedx_range_mu->Draw("P,same");
216  dedx_range_pi->Draw("P,same");
217  dedx_range_ka->Draw("P,same");
218  dedx_range_pro->Draw("P,same");
219  }else{
220  ke_range_pro = (TGraph*)file->Get("kinen_range_pro");
221  ke_range_ka = (TGraph*)file->Get("kinen_range_ka");
222  ke_range_pi = (TGraph*)file->Get("kinen_range_pi");
223  ke_range_mu = (TGraph*)file->Get("kinen_range_mu");
224 
225  ke_range_pro->SetMarkerStyle(7);
226  ke_range_ka->SetMarkerStyle(7);
227  ke_range_pi->SetMarkerStyle(7);
228  ke_range_mu->SetMarkerStyle(7);
229 
230  ke_range_pro->SetMarkerColor(kBlack);
231  ke_range_ka->SetMarkerColor(kGray+2);
232  ke_range_pi->SetMarkerColor(kGray+1);
233  ke_range_mu->SetMarkerColor(kGray);
234 
235  ke_range_mu->Draw("P,same");
236  ke_range_pi->Draw("P,same");
237  ke_range_ka->Draw("P,same");
238  ke_range_pro->Draw("P,same");
239  }
240  file->Close();
241 
242 
243 
244 }
int fcurvetype
Definition: CalorPad.h:46
TGraph * ke_range_pi
pion template
Definition: CalorPad.h:44
TGraph * dedx_range_pi
pion template
Definition: CalorPad.h:39
std::string fROOTfile
Definition: CalorPad.h:36
std::string fCalorTemplateFileName
files that have calorimetry template curves
TPad * Pad()
Definition: DrawingPad.h:37
TGraph * ke_range_ka
kaon template
Definition: CalorPad.h:43
TGraph * ke_range_pro
proton template
Definition: CalorPad.h:42
TGraph * dedx_range_ka
kaon template
Definition: CalorPad.h:38
TGraph * ke_range_mu
muon template
Definition: CalorPad.h:45
TGraph * dedx_range_mu
muon template
Definition: CalorPad.h:40
TGraph * dedx_range_pro
proton template
Definition: CalorPad.h:37
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33

Member Data Documentation

TGraph* evd::CalorPad::dedx_range_ka
private

kaon template

Definition at line 38 of file CalorPad.h.

TGraph* evd::CalorPad::dedx_range_mu
private

muon template

Definition at line 40 of file CalorPad.h.

TGraph* evd::CalorPad::dedx_range_pi
private

pion template

Definition at line 39 of file CalorPad.h.

TGraph* evd::CalorPad::dedx_range_pro
private

proton template

Definition at line 37 of file CalorPad.h.

int evd::CalorPad::fcurvetype
private

Definition at line 46 of file CalorPad.h.

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

Definition at line 36 of file CalorPad.h.

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

Collection of graphics objects to render; text labels.

Definition at line 48 of file CalorPad.h.

TGraph* evd::CalorPad::ke_range_ka
private

kaon template

Definition at line 43 of file CalorPad.h.

TGraph* evd::CalorPad::ke_range_mu
private

muon template

Definition at line 45 of file CalorPad.h.

TGraph* evd::CalorPad::ke_range_pi
private

pion template

Definition at line 44 of file CalorPad.h.

TGraph* evd::CalorPad::ke_range_pro
private

proton template

Definition at line 42 of file CalorPad.h.


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