10 #include "nuevdb/EventDisplayBase/EventHolder.h"
11 #include "nuevdb/EventDisplayBase/View2D.h"
18 #include "art/Framework/Principal/fwd.h"
19 #include "art/Framework/Services/Registry/ServiceHandle.h"
20 #include "cetlib/search_path.h"
21 #include "messagefacility/MessageLogger/MessageLogger.h"
34 void writeErrMsg(
const char* fcn,
35 cet::exception
const&
e)
37 mf::LogWarning(
"CalorPad") <<
"CalorPad::" << fcn
38 <<
" failed with message:\n"
49 , fcurvetype(curvetype)
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);
72 fView =
new evdb::View2D();
80 if(dedx_range_pro) {
delete dedx_range_pro; dedx_range_pro = 0;}
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; }
100 this->Pad()->Clear();
109 const art::Event *
evt = evdb::EventHolder::Instance()->GetEvent();
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);
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);
139 delete dedx_range_pro;
143 delete dedx_range_ka;
147 delete dedx_range_pi;
151 delete dedx_range_mu;
172 if(fcurvetype==1) ymax=50.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();
183 h->GetXaxis()->SetTitle(
"Residual Range (cm)");
184 h->GetYaxis()->SetTitle(
"dE/dx (MeV/cm)");
186 h->GetXaxis()->SetTitle(
"Total Range (cm)");
187 h->GetYaxis()->SetTitle(
"T (MeV)");
190 art::ServiceHandle<evd::AnalysisDrawingOptions const> anaOpt;
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";
198 TFile *
file = TFile::Open(fROOTfile.c_str());
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");
205 dedx_range_pro->SetMarkerStyle(7);
206 dedx_range_ka->SetMarkerStyle(7);
207 dedx_range_pi->SetMarkerStyle(7);
208 dedx_range_mu->SetMarkerStyle(7);
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);
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");
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");
225 ke_range_pro->SetMarkerStyle(7);
226 ke_range_ka->SetMarkerStyle(7);
227 ke_range_pi->SetMarkerStyle(7);
228 ke_range_mu->SetMarkerStyle(7);
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);
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");
Class to aid in the rendering of AnalysisBase objects.
void Draw(const char *opt=0)
TGraph * ke_range_pi
pion template
evdb::View2D * fView
Collection of graphics objects to render; text labels.
TGraph * dedx_range_pi
pion template
Drawing pad showing calorimetric particle ID information.
CalorPad(const char *name, const char *title, double x1, double y1, double x2, double y2, int curvetype)
Base class for event display drawing pads.
TGraph * ke_range_ka
kaon template
TGraph * ke_range_pro
proton template
TGraph * dedx_range_ka
kaon template
TGraph * ke_range_mu
muon template
TGraph * dedx_range_mu
muon template
TGraph * dedx_range_pro
proton template