19 #include "TGraphErrors.h" 27 std::vector<std::string>&
tokens,
33 while (std::string::npos != pos || std::string::npos != lastPos) {
34 tokens.push_back(str.substr(lastPos, pos-lastPos));
35 lastPos = str.find_first_not_of(delimiters, pos);
36 pos = str.find_first_of(delimiters, lastPos);
49 art::Handle< std::vector<TGraphErrors> >& tgrapherrors)
53 { if (V.failedToGet()==false) {\ 54 for (i=0; i<V->size(); ++i) {\ 55 if (n==(*V)[i].GetName()) return (TObject*)&(*V)[i];\ 100 if (str.find(
" ")!=std::string::npos) {
101 str.erase(remove_if(str.begin(), str.end(), isspace));
105 std::vector<std::string>
plots;
107 for (j=0; j<plots.size(); ++
j) {
111 std::vector<std::string>
fields;
116 if (fields.size()>0) plot.
fModule = fields[0];
117 if (fields.size()>1) plot.
fObject = fields[1];
118 if (fields.size()>2) {
121 pad.
fPlot.push_back(plot);
138 std::vector<PlotPad> pads;
142 unsigned int nx=1, ny=1;
143 while (nx*ny < pads.size()) {
152 unsigned int i,
j, k;
153 for (i=0; i<pads.size(); ++
i) {
157 gPad->SetBottomMargin(.1);
158 gPad->SetLeftMargin(.1);
159 gPad->SetTopMargin(.05);
160 gPad->SetRightMargin(.05);
163 for (j=0; j<pad.
fPlot.size(); ++
j) {
193 std::cerr <<
"find_by_name failed to find " 199 TAttLine*
l =
dynamic_cast<TAttLine*
>(obj);
200 TAttMarker*
m =
dynamic_cast<TAttMarker*
>(obj);
204 if (j>0) options +=
"same";
205 for (k=0; k<plot.
fOptions.size(); ++k) {
209 if (opt==
"logx") { gPad->SetLogx(); r=
true; }
210 if (opt==
"logy") { gPad->SetLogy(); r=
true; }
211 if (opt==
"logz") { gPad->SetLogz(); r=
true; }
212 if (opt==
"gridx") { gPad->SetGridx(); r=
true; }
213 if (opt==
"gridy") { gPad->SetGridy(); r=
true; }
214 if (r==
false && opt.find(
"=")!=std::string::npos) {
215 std::vector<std::string>
kv;
217 if (kv.size()!=2) abort();
218 if (kv[0]==
"lstyle") {
if (l) l->SetLineStyle(atoi(kv[1].c_str())); r=
true; }
219 if (kv[0]==
"lwidth") {
if (l) l->SetLineWidth(atoi(kv[1].c_str())); r=
true; }
220 if (kv[0]==
"lcolor") {
if (l) l->SetLineColor(atoi(kv[1].c_str())); r=
true; }
221 if (kv[0]==
"mstyle") {
if (m) m->SetMarkerStyle(atoi(kv[1].c_str())); r=
true; }
222 if (kv[0]==
"msize") {
if (m) m->SetMarkerSize(atof(kv[1].c_str())); r=
true; }
223 if (kv[0]==
"mcolor") {
if (m) m->SetMarkerColor(atoi(kv[1].c_str())); r=
true; }
225 if (r==
false) { options +=
","; options +=
opt; }
227 obj->Draw(options.c_str());
Options for which plots to draw on the PlotsView.
const art::Event * GetEvent() const
static void tokenize(const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters)
A view showing collections of plots related to this event.
Data for a single plotting pad.
static TObject * find_by_name(const std::string &n, art::Handle< std::vector< TH1F > > &th1f, art::Handle< std::vector< TH2F > > &th2f, art::Handle< std::vector< TH1D > > &th1d, art::Handle< std::vector< TH2D > > &th2d, art::Handle< std::vector< TProfile > > &tprofile, art::Handle< std::vector< TGraph > > &tgraph, art::Handle< std::vector< TGraphErrors > > &tgrapherrors)
TCanvas * fCanvas
The ROOT drawing canvas.
Manage all things related to colors for the event display.
Singleton to hold the current art::Event for the event display.
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic >::Index size_type
PlotView(TGMainFrame *mf)
static EventHolder * Instance()
std::vector< Plot > fPlot
const std::vector< Plot > plots
std::vector< std::string > fOptions
void Draw(const char *opt="")
Data for a single plot appearing in the view.
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
void Parse(std::vector< PlotPad > &pads)
std::vector< std::string > fPadDescription
What's in a pad?