ROOT logo
ROOT » GRAF2D » GRAF » TCutG

class TCutG: public TGraph


Graphical cut class

A Graphical cut.

A TCutG object is a closed polygon defining a closed region in a x,y plot. It can be created via the graphics editor option "CutG" or directly by invoking its constructor. The first and last points should be the same.

To create a TCutG via the graphics editor, use the left button to select the points building the contour of the cut. Click on the right button to close the TCutG. When it is created via the graphics editor, the TCutG object is named "CUTG". It is recommended to immediatly change the name by using the context menu item "SetName". When the graphics editor is used, the names of the variables X,Y are automatically taken from the current pad title.

Example:

Assume a TTree object T and:

     Root > T.Draw("abs(fMomemtum)%fEtot")
the TCutG members fVarX, fVary will be set to:
     fVarx = fEtot
     fVary = abs(fMomemtum)
A graphical cut can be used in a TTree selection expression:
    Root > T.Draw("fEtot","cutg1")
where "cutg1" is the name of an existing graphical cut.

Note that, as shown in the example above, a graphical cut may be used in a selection expression when drawing TTrees expressions of 1-d, 2-d or 3-dimensions. The expressions used in TTree::Draw can reference the variables in the fVarX, fVarY of the graphical cut plus other variables.

When the TCutG object is created, it is added to the list of special objects in the main TROOT object pointed by gROOT. To retrieve a pointer to this object from the code or command line, do:

    TCutG *mycutg;
    mycutg = (TCutG*)gROOT->GetListOfSpecials()->FindObject("CUTG")
    mycutg->SetName("mycutg");
Example of use of a TCutG in TTree::Draw:
       tree.Draw("x:y","mycutg && z>0 %% sqrt(x)>1")

A Graphical cut may be drawn via TGraph::Draw. It can be edited like a normal TGraph.

A Graphical cut may be saved to a file via TCutG::Write.

 

Function Members (Methods)

public:
TCutG()
TCutG(const TCutG& cutg)
TCutG(const char* name, Int_t n)
TCutG(const char* name, Int_t n, const Float_t* x, const Float_t* y)
TCutG(const char* name, Int_t n, const Double_t* x, const Double_t* y)
virtual~TCutG()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTGraph::Apply(TF1* f)
virtual voidTGraph::Browse(TBrowser* b)
virtual Double_tTGraph::Chisquare(const TF1* f1) const
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTNamed::Clear(Option_t* option = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
static Bool_tTGraph::CompareArg(const TGraph* gr, Int_t left, Int_t right)
static Bool_tTGraph::CompareRadius(const TGraph* gr, Int_t left, Int_t right)
static Bool_tTGraph::CompareX(const TGraph* gr, Int_t left, Int_t right)
static Bool_tTGraph::CompareY(const TGraph* gr, Int_t left, Int_t right)
virtual voidTGraph::ComputeRange(Double_t& xmin, Double_t& ymin, Double_t& xmax, Double_t& ymax) const
virtual voidTNamed::Copy(TObject& named) const
virtual voidTObject::Delete(Option_t* option = "")MENU
Int_tTAttLine::DistancetoLine(Int_t px, Int_t py, Double_t xp1, Double_t yp1, Double_t xp2, Double_t yp2)
virtual Int_tTGraph::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTGraph::Draw(Option_t* chopt = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTGraph::DrawGraph(Int_t n, const Int_t* x, const Int_t* y, Option_t* option = "")
virtual voidTGraph::DrawGraph(Int_t n, const Float_t* x, const Float_t* y, Option_t* option = "")
virtual voidTGraph::DrawGraph(Int_t n, const Double_t* x = 0, const Double_t* y = 0, Option_t* option = "")
virtual voidTGraph::DrawPanel()MENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual Double_tTGraph::Eval(Double_t x, TSpline* spline = 0, Option_t* option = "") const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTGraph::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTGraph::Expand(Int_t newsize)
virtual voidTGraph::Expand(Int_t newsize, Int_t step)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual voidTNamed::FillBuffer(char*& buffer)
virtual TObject*TGraph::FindObject(const char* name) const
virtual TObject*TGraph::FindObject(const TObject* obj) const
virtual TFitResultPtrTGraph::Fit(const char* formula, Option_t* option = "", Option_t* goption = "", Axis_t xmin = 0, Axis_t xmax = 0)MENU
virtual TFitResultPtrTGraph::Fit(TF1* f1, Option_t* option = "", Option_t* goption = "", Axis_t xmin = 0, Axis_t xmax = 0)
virtual voidTGraph::FitPanel()MENU
virtual Double_tTGraph::GetCorrelationFactor() const
virtual Double_tTGraph::GetCovariance() const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
Bool_tTGraph::GetEditable() const
virtual Double_tTGraph::GetErrorX(Int_t bin) const
virtual Double_tTGraph::GetErrorXhigh(Int_t bin) const
virtual Double_tTGraph::GetErrorXlow(Int_t bin) const
virtual Double_tTGraph::GetErrorY(Int_t bin) const
virtual Double_tTGraph::GetErrorYhigh(Int_t bin) const
virtual Double_tTGraph::GetErrorYlow(Int_t bin) const
virtual Double_t*TGraph::GetEX() const
virtual Double_t*TGraph::GetEXhigh() const
virtual Double_t*TGraph::GetEXhighd() const
virtual Double_t*TGraph::GetEXlow() const
virtual Double_t*TGraph::GetEXlowd() const
virtual Double_t*TGraph::GetEY() const
virtual Double_t*TGraph::GetEYhigh() const
virtual Double_t*TGraph::GetEYhighd() const
virtual Double_t*TGraph::GetEYlow() const
virtual Double_t*TGraph::GetEYlowd() const
virtual Color_tTAttFill::GetFillColor() const
virtual Style_tTAttFill::GetFillStyle() const
TF1*TGraph::GetFunction(const char* name) const
TH1F*TGraph::GetHistogram() const
virtual const char*TObject::GetIconName() const
virtual Color_tTAttLine::GetLineColor() const
virtual Style_tTAttLine::GetLineStyle() const
virtual Width_tTAttLine::GetLineWidth() const
TList*TGraph::GetListOfFunctions() const
virtual Color_tTAttMarker::GetMarkerColor() const
virtual Size_tTAttMarker::GetMarkerSize() const
virtual Style_tTAttMarker::GetMarkerStyle() const
Double_tTGraph::GetMaximum() const
Int_tTGraph::GetMaxSize() const
virtual Double_tTGraph::GetMean(Int_t axis = 1) const
Double_tTGraph::GetMinimum() const
Int_tTGraph::GetN() const
virtual const char*TNamed::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
TObject*GetObjectX() const
TObject*GetObjectY() const
virtual Option_t*TObject::GetOption() const
virtual Int_tTGraph::GetPoint(Int_t i, Double_t& x, Double_t& y) const
virtual Double_tTGraph::GetRMS(Int_t axis = 1) const
virtual const char*TNamed::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
const char*GetVarX() const
const char*GetVarY() const
Double_t*TGraph::GetX() const
TAxis*TGraph::GetXaxis() const
Double_t*TGraph::GetY() const
TAxis*TGraph::GetYaxis() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTGraph::InitExpo(Double_t xmin = 0, Double_t xmax = 0)
virtual voidTGraph::InitGaus(Double_t xmin = 0, Double_t xmax = 0)
virtual voidTGraph::InitPolynom(Double_t xmin = 0, Double_t xmax = 0)
virtual Int_tTGraph::InsertPoint()MENU
virtual voidTObject::Inspect() constMENU
virtual Double_tTGraph::Integral(Int_t first = 0, Int_t last = -1) const
Double_tIntegralHist(TH2* h, Option_t* option = "") const
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTGraph::IsEditable() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
virtual Int_tIsInside(Double_t x, Double_t y) const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTNamed::IsSortable() const
virtual Bool_tTAttFill::IsTransparent() const
Bool_tTObject::IsZombie() const
virtual voidTGraph::LeastSquareFit(Int_t m, Double_t* a, Double_t xmin = 0, Double_t xmax = 0)
virtual voidTGraph::LeastSquareLinearFit(Int_t n, Double_t& a0, Double_t& a1, Int_t& ifail, Double_t xmin = 0, Double_t xmax = 0)
virtual voidTNamed::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual Int_tTGraph::Merge(TCollection* list)
virtual voidTAttLine::Modify()
virtual Bool_tTObject::Notify()
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TCutG&operator=(const TCutG&)
virtual voidTGraph::Paint(Option_t* chopt = "")
voidTGraph::PaintGraph(Int_t npoints, const Double_t* x, const Double_t* y, Option_t* chopt)
voidTGraph::PaintGrapHist(Int_t npoints, const Double_t* x, const Double_t* y, Option_t* chopt)
virtual voidTGraph::PaintStats(TF1* fit)
virtual voidTObject::Pop()
virtual voidTGraph::Print(Option_t* chopt = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTGraph::RecursiveRemove(TObject* obj)
virtual Int_tTGraph::RemovePoint()MENU
virtual Int_tTGraph::RemovePoint(Int_t ipoint)
virtual voidTAttFill::ResetAttFill(Option_t* option = "")
virtual voidTAttLine::ResetAttLine(Option_t* option = "")
virtual voidTAttMarker::ResetAttMarker(Option_t* toption = "")
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTAttFill::SaveFillAttributes(ostream& out, const char* name, Int_t coldef = 1, Int_t stydef = 1001)
virtual voidTAttLine::SaveLineAttributes(ostream& out, const char* name, Int_t coldef = 1, Int_t stydef = 1, Int_t widdef = 1)
virtual voidTAttMarker::SaveMarkerAttributes(ostream& out, const char* name, Int_t coldef = 1, Int_t stydef = 1, Int_t sizdef = 1)
virtual voidSavePrimitive(ostream& out, Option_t* option = "")
virtual voidTGraph::Set(Int_t n)
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
virtual voidTGraph::SetEditable(Bool_t editable = kTRUE)TOGGLE GETTER
virtual voidTAttFill::SetFillAttributes()MENU
virtual voidTAttFill::SetFillColor(Color_t fcolor)
virtual voidTAttFill::SetFillStyle(Style_t fstyle)
virtual voidTGraph::SetHistogram(TH1* h)
virtual voidTAttLine::SetLineAttributes()MENU
virtual voidTAttLine::SetLineColor(Color_t lcolor)
virtual voidTAttLine::SetLineStyle(Style_t lstyle)
virtual voidTAttLine::SetLineWidth(Width_t lwidth)
virtual voidTAttMarker::SetMarkerAttributes()MENU
virtual voidTAttMarker::SetMarkerColor(Color_t tcolor = 1)
virtual voidTAttMarker::SetMarkerSize(Size_t msize = 1)
virtual voidTAttMarker::SetMarkerStyle(Style_t mstyle = 1)
virtual voidTGraph::SetMaximum(Double_t maximum = -1111)MENU
virtual voidTGraph::SetMinimum(Double_t minimum = -1111)MENU
virtual voidTNamed::SetName(const char* name)MENU
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidSetObjectX(TObject* obj)
virtual voidSetObjectY(TObject* obj)
virtual voidTGraph::SetPoint(Int_t i, Double_t x, Double_t y)
virtual voidTGraph::SetTitle(const char* title = "")MENU
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidSetVarX(const char* varx)MENU
virtual voidSetVarY(const char* vary)MENU
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual Int_tTNamed::Sizeof() const
virtual voidTGraph::Sort(Bool_t (*)(const TGraph*, Int_t, Int_t) greater = &TGraph::CompareX, Bool_t ascending = kTRUE, Int_t low = 0, Int_t high = -1111)
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTGraph::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
voidTGraph::Zero(Int_t& k, Double_t AZ, Double_t BZ, Double_t E2, Double_t& X, Double_t& Y, Int_t maxiterations)
protected:
virtual Double_t**TGraph::Allocate(Int_t newsize)
Double_t**TGraph::AllocateArrays(Int_t Narrays, Int_t arraySize)
virtual voidTGraph::CopyAndRelease(Double_t** newarrays, Int_t ibegin, Int_t iend, Int_t obegin)
virtual Bool_tTGraph::CopyPoints(Double_t** newarrays, Int_t ibegin, Int_t iend, Int_t obegin)
Bool_tTGraph::CtorAllocate()
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
Double_t**TGraph::ExpandAndCopy(Int_t size, Int_t iend)
virtual voidTGraph::FillZero(Int_t begin, Int_t end, Bool_t from_ctor = kTRUE)
voidTObject::MakeZombie()
Double_t**TGraph::ShrinkAndCopy(Int_t size, Int_t iend)
virtual voidTGraph::SwapPoints(Int_t pos1, Int_t pos2)
static voidTGraph::SwapValues(Double_t* arr, Int_t pos1, Int_t pos2)

Data Members

protected:
Color_tTAttFill::fFillColorfill area color
Style_tTAttFill::fFillStylefill area style
TList*TGraph::fFunctionsPointer to list of functions (fits and user)
TH1F*TGraph::fHistogramPointer to histogram used for drawing axis
Color_tTAttLine::fLineColorline color
Style_tTAttLine::fLineStyleline style
Width_tTAttLine::fLineWidthline width
Color_tTAttMarker::fMarkerColorMarker color index
Size_tTAttMarker::fMarkerSizeMarker size
Style_tTAttMarker::fMarkerStyleMarker style
Int_tTGraph::fMaxSize!Current dimension of arrays fX and fY
Double_tTGraph::fMaximumMaximum value for plotting along y
Double_tTGraph::fMinimumMinimum value for plotting along y
TStringTNamed::fNameobject identifier
Int_tTGraph::fNpointsNumber of points <= fMaxSize
TObject*fObjectX!pointer to an object corresponding to X
TObject*fObjectY!pointer to an object corresponding to Y
TStringTNamed::fTitleobject title
TStringfVarXX variable
TStringfVarYY variable
Double_t*TGraph::fX[fNpoints] array of X points
Double_t*TGraph::fY[fNpoints] array of Y points

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TCutG()
 TCutG default constructor.
TCutG(const TCutG& cutg)
 TCutG copy constructor
TCutG(const char* name, Int_t n)
 TCutG normal constructor.
TCutG(const char *name, Int_t n, const Float_t *x, const Float_t *y)
 TCutG normal constructor.
TCutG(const char *name, Int_t n, const Double_t *x, const Double_t *y)
 TCutG normal constructor.
~TCutG()
 TCutG destructor.
Double_t IntegralHist(TH2* h, Option_t* option = "") const
 Compute the integral of 2-d histogram h for all bins inside the cut
 if option "width" is specified, the integral is the sum of
 the bin contents multiplied by the bin width in x and in y.
Int_t IsInside(Double_t x, Double_t y) const
 Function which returns 1 if point x,y lies inside the polygon defined by
 the graph points 0 otherwise. This function assumes that the first and
 the last point of the TCutG are the same (closed polygon).

 Algorithm:
 The loop is executed with the end-point coordinates of a line segment
 (X1,Y1)-(X2,Y2) and the Y-coordinate of a horizontal line.
 The counter inter is incremented if the line (X1,Y1)-(X2,Y2) intersects
 the horizontal line. In this case XINT is set to the X-coordinate of the
 intersection point. If inter is an odd number, then the point x,y is within
 the polygon.

 This function is based on an original algorithm developed by R.Nierhaus.
void SavePrimitive(ostream& out, Option_t* option = "")
 Save primitive as a C++ statement(s) on output stream out.
void SetVarX(const char* varx)
 Set X variable.
void SetVarY(const char* vary)
 Set Y variable.
void Streamer(TBuffer& b)
 Stream an object of class TCutG.
TObject * GetObjectX() const
{return fObjectX;}
TObject * GetObjectY() const
{return fObjectY;}
const char * GetVarX() const
{return fVarX.Data();}
const char * GetVarY() const
{return fVarY.Data();}
void SetObjectX(TObject* obj)
{fObjectX = obj;}
void SetObjectY(TObject* obj)
{fObjectY = obj;}