Public Member Functions | Private Attributes | List of all members
gar::evd::CalorPad Class Reference

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

#include <CalorPad.h>

Inheritance diagram for gar::evd::CalorPad:
gar::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 gar::evd::DrawingPad
 DrawingPad (const char *nm, const char *ti, double x1, double y1, double y2, double x2)
 
 ~DrawingPad ()
 
TPad * Pad ()
 
HeaderDrawerHeaderDraw ()
 
GeometryDrawerGeometryDraw ()
 
SimulationDrawerSimulationDraw ()
 
RawDataDrawerRawDataDraw ()
 
RecoBaseDrawerRecoBaseDraw ()
 
AnalysisBaseDrawerAnalysisBaseDraw ()
 
HitSelector * HitSelectorGet ()
 

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 Attributes inherited from gar::evd::DrawingPad
TPad * fPad
 The ROOT graphics pad. More...
 
HeaderDrawerfHeaderDraw
 Drawer for event header info. More...
 
GeometryDrawerfGeometryDraw
 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

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

Definition at line 53 of file CalorPad.cxx.

57 : DrawingPad(name, title, x1, y1, x2, y2)
58 , fcurvetype(curvetype)
59 {
60 
61  // Set up pad.
62  this->Pad()->cd();
63  this->Pad()->SetBit(kCannotPick);
64  this->Pad()->SetBit(TPad::kCannotMove);
65  this->Pad()->SetFillColor(kWhite);
66  this->Pad()->SetLeftMargin(0.10);
67  this->Pad()->SetRightMargin (0.025);
68  this->Pad()->SetTopMargin (0.025);
69  this->Pad()->SetBottomMargin (0.10);
70  this->Pad()->Draw();
71 
72  dedx_range_pro = 0;
73  dedx_range_ka = 0;
74  dedx_range_pi = 0;
75  dedx_range_mu = 0;
76  ke_range_pro = 0;
77  ke_range_ka = 0;
78  ke_range_pi = 0;
79  ke_range_mu = 0;
80 
81  fView = new evdb::View2D();
82 
83 }
static QCString name
Definition: declinfo.cpp:673
TGraph * dedx_range_mu
muon template
Definition: CalorPad.h:40
DrawingPad(const char *nm, const char *ti, double x1, double y1, double y2, double x2)
Definition: DrawingPad.cxx:38
TGraph * dedx_range_pro
proton template
Definition: CalorPad.h:37
TGraph * dedx_range_ka
kaon template
Definition: CalorPad.h:38
TGraph * ke_range_pro
proton template
Definition: CalorPad.h:42
TGraph * ke_range_pi
pion template
Definition: CalorPad.h:44
TGraph * ke_range_ka
kaon template
Definition: CalorPad.h:43
TGraph * dedx_range_pi
pion template
Definition: CalorPad.h:39
TGraph * ke_range_mu
muon template
Definition: CalorPad.h:45
evdb::View2D * fView
Collection of graphics objects to render; text labels.
Definition: CalorPad.h:48
gar::evd::CalorPad::~CalorPad ( )

Definition at line 87 of file CalorPad.cxx.

88 {
90  if(dedx_range_ka) {delete dedx_range_ka; dedx_range_ka = 0;}
91  if(dedx_range_pi) {delete dedx_range_pi; dedx_range_pi = 0;}
92  if(dedx_range_mu) {delete dedx_range_mu; dedx_range_mu = 0;}
93  if(ke_range_pro) {delete ke_range_pro; ke_range_pro = 0;}
94  if(ke_range_ka) {delete ke_range_ka; ke_range_ka = 0;}
95  if(ke_range_pi) {delete ke_range_pi; ke_range_pi = 0;}
96  if(ke_range_mu) {delete ke_range_mu; ke_range_mu = 0;}
97  if (fView) { delete fView; fView = 0; }
98 }
TGraph * dedx_range_mu
muon template
Definition: CalorPad.h:40
TGraph * dedx_range_pro
proton template
Definition: CalorPad.h:37
TGraph * dedx_range_ka
kaon template
Definition: CalorPad.h:38
TGraph * ke_range_pro
proton template
Definition: CalorPad.h:42
TGraph * ke_range_pi
pion template
Definition: CalorPad.h:44
TGraph * ke_range_ka
kaon template
Definition: CalorPad.h:43
TGraph * dedx_range_pi
pion template
Definition: CalorPad.h:39
TGraph * ke_range_mu
muon template
Definition: CalorPad.h:45
evdb::View2D * fView
Collection of graphics objects to render; text labels.
Definition: CalorPad.h:48

Member Function Documentation

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

Definition at line 103 of file CalorPad.cxx.

104 {
105 
106  this->Pad()->cd();
107 
108  //Remove all previous objects from Pad's primitive list
109  this->Pad()->Clear();
110 
111  //Remove all previous TPolyMarkers, TLatexs, etc... from list of such objects
112  fView->Clear();
113 
114  //Draw coordinate axis and also GEANT based dE/dx vs. Range, or KE vs. Range, curves.
115  DrawRefCurves();
116 
117  // grab the event from the singleton
118  const art::Event *evt = evdb::EventHolder::Instance()->GetEvent();
120 
121  // Insert graphic objects into fView collection.
122  if(evt){
123  try{
124  if(fcurvetype == 1) AnalysisBaseDraw()->DrawDeDx (*evt, fView);
125  else if(fcurvetype == 0) AnalysisBaseDraw()->DrawKineticEnergy(*evt, fView);
126  }
127  catch (cet::exception &e){
128  if(fcurvetype==1) writeErrMsg("Draw->DrawDeDx",e);
129  else if (fcurvetype==0) writeErrMsg("Draw->DrawKineticEnergy",e);
130  else if (fcurvetype==2) writeErrMsg("Draw->CalorShower",e);
131  }
132  }
133 // try{
134 // AnalysisBaseDraw()->CalorShower(*evt, fView);
135 // }
136 // catch (cet::exception e){
137 // writeErrMsg("Draw->CalorShower",e);
138 // }
139 
140  // Draw objects on pad.
141  fView->Draw();
142  fPad->Modified();
143  fPad->Update();
144 
145 }
TPad * fPad
The ROOT graphics pad.
Definition: DrawingPad.h:42
const double e
void DrawDeDx(const art::Event &evt, evdb::View2D *view)
void DrawKineticEnergy(const art::Event &evt, evdb::View2D *view)
AnalysisBaseDrawer * AnalysisBaseDraw()
Definition: DrawingPad.cxx:127
TCEvent evt
Definition: DataStructs.cxx:7
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
evdb::View2D * fView
Collection of graphics objects to render; text labels.
Definition: CalorPad.h:48
void gar::evd::CalorPad::DrawRefCurves ( )

Definition at line 150 of file CalorPad.cxx.

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

Member Data Documentation

TGraph* gar::evd::CalorPad::dedx_range_ka
private

kaon template

Definition at line 38 of file CalorPad.h.

TGraph* gar::evd::CalorPad::dedx_range_mu
private

muon template

Definition at line 40 of file CalorPad.h.

TGraph* gar::evd::CalorPad::dedx_range_pi
private

pion template

Definition at line 39 of file CalorPad.h.

TGraph* gar::evd::CalorPad::dedx_range_pro
private

proton template

Definition at line 37 of file CalorPad.h.

int gar::evd::CalorPad::fcurvetype
private

Definition at line 46 of file CalorPad.h.

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

Definition at line 36 of file CalorPad.h.

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

Collection of graphics objects to render; text labels.

Definition at line 48 of file CalorPad.h.

TGraph* gar::evd::CalorPad::ke_range_ka
private

kaon template

Definition at line 43 of file CalorPad.h.

TGraph* gar::evd::CalorPad::ke_range_mu
private

muon template

Definition at line 45 of file CalorPad.h.

TGraph* gar::evd::CalorPad::ke_range_pi
private

pion template

Definition at line 44 of file CalorPad.h.

TGraph* gar::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: