30void xRooNode::Interactive_Pull()
32 static bool doRestore =
false;
33 auto select =
dynamic_cast<TGraph *
>(
gPad->GetSelected());
35 int event =
gPad->GetEvent();
39 }
else if (event == 11 || doRestore) {
40 if (!select || doRestore) {
42 auto _h =
static_cast<TGraph *
>(
gPad->GetPrimitive(
"nominal"))->GetHistogram();
43 for (
int i = 1; i <= _h->GetNbinsX(); i++) {
49 _gr->
SetPoint(0, i - 1,
static_cast<TGraph *
>(
gPad->GetPrimitive(
"nominal"))->GetPointY(i - 1));
51 gPad->GetMother()->GetMother()->cd();
58 TString _name = select->GetName();
62 _name = _name(0, _name.
Index(
";"));
64 auto _h =
static_cast<TH1 *
>(
gPad->GetPrimitive(
"nominal")->FindObject(
"scales"));
67 for (
int i = 1; i <= _h->GetNbinsX(); i++) {
68 if (_name == _h->GetXaxis()->GetBinLabel(i)) {
69 auto _gr =
static_cast<TGraph *
>(
gPad->GetPrimitive(
"nominal"));
70 if (_varyName ==
"") {
74 while (newPoint && newPoint->
GetN() > 0) {
84 newPoint->
SetPointX(0, _gr->GetPointX(i - 1));
89 newPoint->
Draw(
"z0p");
90 select->SetPoint(0, _gr->GetPointX(i - 1), _gr->GetPointY(i - 1));
93 select->
SetPointX(0, _gr->GetPointX(i - 1));
97 ->SetPoint(0, i - 1, _gr->GetPointY(i - 1));
103 auto _node =
dynamic_cast<xRooNode *
>(
gPad->GetPrimitive(
"node"));
106 RooArgSet _pars(_node->pars().argList());
107 std::unique_ptr<RooArgSet> snap(_pars.
snapshot());
110 for (
int i = 1; i <= _h->GetNbinsX(); i++) {
111 std::string parName = _h->GetXaxis()->GetBinLabel(i);
116 g &&
g->GetN() > 0) {
118 g->GetPointY(0) * _h->GetBinError(i) + _h->GetBinContent(i);
122 _pars.
setRealValue(parName.c_str(),
static_cast<TGraph *
>(
gPad->GetPrimitive(
"nominal"))->GetPointY(i - 1) *
124 _h->GetBinContent(i));
133 gPad->GetMother()->GetMother()->cd(1);
136 static_cast<TAttLine &
>(*gStyle) = bak;
137 static_cast<TAttFill &
>(*gStyle) = bak2;
139 _tmpPad->GetCanvas()->cd();
141 gPad->GetCanvas()->Update();
145void xRooNode::Interactive_PLLPlot()
153 auto _pull_pad =
gPad->GetPad(1);
154 auto _hidden_pad =
gPad->GetPad(2);
156 if (!_pull_pad || strcmp(_pull_pad->GetName(),
"pulls") != 0)
163 int px =
gPad->GetEventX();
169 gPad->SetUniqueID(px);
170 float upx =
gPad->AbsPixeltoX(px);
171 float x =
gPad->PadtoX(upx);
175 for (
auto g : *_hidden_pad->GetListOfPrimitives()) {
188 if (
auto line =
dynamic_cast<TGraph *
>(
gPad->GetListOfPrimitives()->FindObject(
"markerLine"));
line) {
189 line->SetPointX(0, _x);
190 line->SetPointX(1, _x);
194 line->SetName(
"markerLine");
196 line->SetPoint(0, _x, -100);
197 line->SetPoint(1, _x, 100);
202 for (
auto o : *_pull_pad->GetListOfPrimitives()) {
203 if (!o->InheritsFrom(
"TGraph"))
205 if (_hidden_pad->GetListOfPrimitives()->FindObject(o) ||
TString(o->GetName()).
EndsWith(
"_pull")) {
207 _pull_pad->GetListOfPrimitives()->Remove(o);
213 foundGraph->
Draw(
"pz0 same");
215 _pull_pad->Modified();
226 if (!
g->IsHighlight()) {
233 auto selPad =
dynamic_cast<TVirtualPad *
>(frPad->GetPrimitive(
"selected"));
234 if (_pad && selPad) {
236 prim->
Remove(prim->At(0));
R__EXTERN TStyle * gStyle
R__EXTERN TSystem * gSystem
The xRooNode class is designed to wrap over a TObject and provide functionality to aid with interacti...
bool setRealValue(const char *name, double newVal=0.0, bool verbose=false)
Set value of a RooAbsRealLValue stored in set with given name to newVal No error messages are printed...
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooArgSet * snapshot(bool deepCopy=true) const
Use RooAbsCollection::snapshot(), but return as RooArgSet.
Fill Area Attributes class.
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
virtual Color_t GetMarkerColor() const
Return the marker color.
const char * GetBinLabel(Int_t bin) const
Return label for bin.
TGraph with asymmetric error bars.
virtual void SetPointEYlow(Int_t i, Double_t eyl)
Set EYlow for point i.
virtual void SetPointEYhigh(Int_t i, Double_t eyh)
Set EYhigh for point i.
A TGraph is an object made of two arrays X and Y with npoints each.
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
void Draw(Option_t *chopt="") override
Draw this graph with its current attributes.
TAxis * GetXaxis() const
Get x axis of the graph.
virtual void SetPointX(Int_t i, Double_t x)
Set x value for point i.
TH1 is the base class of all histogram classes in ROOT.
TObject * Remove(TObject *obj) override
Remove object from the list.
A TMultiGraph is a collection of TGraph (or derived) objects.
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
virtual void Paint(Option_t *option="")
This method must be overridden if a class wants to paint itself.
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Double_t Atof() const
Return floating-point value contained in string.
const char * Data() const
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
TVirtualPad is an abstract base class for the Pad and Canvas classes.
virtual TList * GetListOfPrimitives() const =0
virtual TVirtualPad * GetMother() const =0
virtual TVirtualPad * GetPad(Int_t subpadnumber) const =0
virtual Int_t GetNumber() const =0
#define BEGIN_XROOFIT_NAMESPACE
#define END_XROOFIT_NAMESPACE