33 const TString opt = args.size() > 2 ? args[2] :
"";
35 if (gPad ==
nullptr) {
36 Info(
"Cmd",
"warning: no pad");
40 TObject *hist_now = gPad->GetPrimitive(
"htemp");
42 hist_now = TCatHistManager::Instance()->GetCurrent();
43 if (!hist_now || !hist_now->InheritsFrom(
"TH1")) {
44 Info(
"Cmd",
"warning: no hist, please check using ls command");
49 if (hist_now->InheritsFrom(TH2::Class())) {
50 Info(
"Cmd",
"warning: The current hist does not inherit from TH1 class (TH2)");
54 Int_t nid = (gDirectory->GetList())->GetEntries();
56 Info(
"Run",
"id = %d hist is created", nid);
57 TCatHistManager::Instance()->DrawObject(nid);
64 Double_t x1 = 0., y1 = 0., x2 = 0., y2 = 0.;
65 Info(
"Run",
"click on the lowest edge: ");
66 TCatCmdXval::Instance()->Run(&x1, &y1);
68 Info(
"Run",
"click on the highest edge: ");
69 TCatCmdXval::Instance()->Run(&x2, &y2);
77 Info(
"Run",
"X1: %g, X2: %g", x1, x2);
79 Int_t x1bin, x2bin, nbinsx;
82 const TString namesuffix =
" blo", titlesuffix =
" blo";
84 x1bin = h1->GetXaxis()->FindBin(x1);
85 x2bin = h1->GetXaxis()->FindBin(x2);
87 nbinsx = (x2bin - x1bin) + 1;
89 TH1F *hnew =
new TH1F(
"name",
"title", nbinsx, x1, x2);
92 for (Int_t nx = x1bin; nx <= x2bin; nx++) {
93 bc = h1->GetBinContent(nx);
94 hnew->SetBinContent(nx - x1bin, bc);
98 hnew->SetName(TString(h1->GetName()) + namesuffix);
99 hnew->SetTitle(TString(h1->GetTitle()) + titlesuffix);
100 hnew->SetEntries(btotal);