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) {
83 newPoint->
SetPointX(0, _gr->GetPointX(i - 1));
88 newPoint->
Draw(
"z0p");
89 select->SetPoint(0, _gr->GetPointX(i - 1), _gr->GetPointY(i - 1));
92 select->
SetPointX(0, _gr->GetPointX(i - 1));
96 ->SetPoint(0, i - 1, _gr->GetPointY(i - 1));
102 auto _node =
dynamic_cast<xRooNode *
>(
gPad->GetPrimitive(
"node"));
105 RooArgSet _pars(_node->pars().argList());
106 std::unique_ptr<RooArgSet> snap(_pars.
snapshot());
109 for (
int i = 1; i <= _h->GetNbinsX(); i++) {
110 std::string parName = _h->GetXaxis()->GetBinLabel(i);
115 g &&
g->GetN() > 0) {
117 g->GetPointY(0) * _h->GetBinError(i) + _h->GetBinContent(i);
121 _pars.
setRealValue(parName.c_str(),
static_cast<TGraph *
>(
gPad->GetPrimitive(
"nominal"))->GetPointY(i - 1) *
123 _h->GetBinContent(i));
132 gPad->GetMother()->GetMother()->cd(1);
135 static_cast<TAttLine &
>(*gStyle) = bak;
136 static_cast<TAttFill &
>(*gStyle) = bak2;
138 _tmpPad->GetCanvas()->cd();
140 gPad->GetCanvas()->Update();
144void xRooNode::Interactive_PLLPlot()
152 auto _pull_pad =
gPad->GetPad(1);
153 auto _hidden_pad =
gPad->GetPad(2);
155 if (!_pull_pad || strcmp(_pull_pad->GetName(),
"pulls") != 0)
162 int px =
gPad->GetEventX();
168 gPad->SetUniqueID(px);
169 float upx =
gPad->AbsPixeltoX(px);
170 float x =
gPad->PadtoX(upx);
174 for (
auto g : *_hidden_pad->GetListOfPrimitives()) {
187 if (
auto line =
dynamic_cast<TGraph *
>(
gPad->GetListOfPrimitives()->FindObject(
"markerLine"));
line) {
188 line->SetPointX(0, _x);
189 line->SetPointX(1, _x);
193 line->SetName(
"markerLine");
195 line->SetPoint(0, _x, -100);
196 line->SetPoint(1, _x, 100);
201 for (
auto o : *_pull_pad->GetListOfPrimitives()) {
202 if (!o->InheritsFrom(
"TGraph"))
204 if (_hidden_pad->GetListOfPrimitives()->FindObject(o) ||
TString(o->GetName()).
EndsWith(
"_pull")) {
206 _pull_pad->GetListOfPrimitives()->Remove(o);
212 foundGraph->
Draw(
"pz0 same");
214 _pull_pad->Modified();
225 if (!
g->IsHighlight())
231 auto selPad =
dynamic_cast<TVirtualPad *
>(frPad->GetPrimitive(
"selected"));
232 if (_pad && selPad) {
234 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