115 const char *varexp0 = obj ? obj->
GetTitle() :
"";
116 obj =
fInput->FindObject(
"selection");
117 const char *selection = obj ? obj->
GetTitle() :
"";
121 char *hdefault = (
char *)
"htemp";
122 char *varexp =
nullptr;
130 bool profile =
false;
131 bool optSame =
false;
132 bool optEnlist =
false;
133 bool optEnlistArray =
false;
134 bool optpara =
false;
135 bool optcandle =
false;
143 if (opt.
Contains(
"entrylistarray")) {
144 optEnlistArray =
true;
162 TCut realSelection(selection);
165 evlist =
fTree->GetEventList();
166 if (evlist && inElist) {
181 realSelection *= inElist->
GetTitle();
194 bool canExtend =
true;
195 if (optSame) canExtend =
false;
197 Int_t nbinsx = 0, nbinsy = 0, nbinsz = 0;
201 char *hname =
nullptr;
204 if (varexp0 && strlen(varexp0)) {
205 for (
UInt_t k = strlen(varexp0) - 1; k > 0; k--) {
206 if (varexp0[k] ==
'>' && varexp0[k-1] ==
'>') {
207 i = (
int)(&(varexp0[k-1]) - varexp0);
208 hnamealloc = &(varexp0[k+1]);
209 hname = (
char *) hnamealloc.
Data();
217 varexp =
new char[i+1];
219 bool hnameplus =
false;
220 while (*hname ==
' ') hname++;
224 while (*hname ==
' ') hname++;
226 j = strlen(hname) - 1;
228 if (hname[j] !=
' ')
break;
234 strlcpy(varexp,varexp0,i+1);
236 Int_t mustdelete = 0;
253 const Int_t maxvalues = 9;
255 pstart = strchr(hname,
'(');
256 pend = strchr(hname,
')');
257 if (pstart !=
nullptr) {
262 if (pstart == strrchr(hname,
'(') && pend == strrchr(hname,
')')) {
267 cdummy = strchr(&cdummy[1],
',');
268 while (cdummy !=
nullptr) {
269 cdummy = strchr(&cdummy[1],
',');
273 if (ncomma + 1 > maxvalues) {
274 Error(
"DrawSelect",
"ncomma+1>maxvalues, ncomma=%d, maxvalues=%d", ncomma, maxvalues);
275 ncomma = maxvalues - 1;
283 for (j = 0; j < i; j++) {
285 && !((j > 0 && varexp[j-1] ==
':') || varexp[j+1] ==
':')
288 }
else if (varexp[j] ==
'?') {
294 Error(
"DrawSelect",
"ncols > 3, ncols=%d", ncols);
299 if (ncols * 3 < ncomma) {
300 Error(
"DrawSelect",
"ncols*3 < ncomma ncols=%d, ncomma=%d", ncols, ncomma);
305 for (j = 0; j < ncomma; j++) {
307 if (sscanf(cdummy,
" %lf ", &value) == 1) {
308 cdummy = strchr(&cdummy[1],
',');
312 nbinsx = (
Int_t)value;
314 gEnv->SetValue(
"Hist.Binning.1D.x", nbinsx);
315 }
else if (ncols < 3) {
316 gEnv->SetValue(
"Hist.Binning.2D.x", nbinsx);
317 gEnv->SetValue(
"Hist.Binning.2D.Prof", nbinsx);
319 gEnv->SetValue(
"Hist.Binning.3D.x", nbinsx);
320 gEnv->SetValue(
"Hist.Binning.3D.Profx", nbinsx);
331 nbinsy = (
Int_t)value;
332 if (ncols < 3)
gEnv->SetValue(
"Hist.Binning.2D.y", nbinsy);
334 gEnv->SetValue(
"Hist.Binning.3D.y", nbinsy);
335 gEnv->SetValue(
"Hist.Binning.3D.Profy", nbinsy);
345 nbinsz = (
Int_t)value;
346 gEnv->SetValue(
"Hist.Binning.3D.z", nbinsz);
355 Error(
"DrawSelect",
"j>8");
361 Error(
"Begin",
"Two open or close brackets found, hname=%s", hname);
368 j = strlen(hname) - 1;
370 if (hname[j] !=
' ')
break;
379 abrt.
Form(
"An object of type '%s' has the same name as the requested histo (%s)", oldObject->
IsA()->
GetName(), hname);
388 Warning(
"Begin",
"Deleting old histogram, since (possibly new) limits and binnings have been given");
398 enlist = oldObject ?
dynamic_cast<TEntryList*
>(oldObject) :
nullptr;
400 if (!enlist && oldObject) {
401 abrt.
Form(
"An object of type '%s' has the same name as the requested event list (%s)",
408 if (optEnlistArray) {
416 if (enlist == inElist) {
419 if (optEnlistArray) {
425 fTree->SetEntryList(inElist);
437 evlist = oldObject ?
dynamic_cast<TEventList*
>(oldObject) :
nullptr;
439 if (!evlist && oldObject) {
440 abrt.
Form(
"An object of type '%s' has the same name as the requested event list (%s)",
451 if (evlist ==
fTree->GetEventList()) {
454 Abort(
"Input and output lists are the same!");
472 const size_t varexpLen = strlen(varexp0) + 1;
473 varexp =
new char[varexpLen];
474 strlcpy(varexp, varexp0, varexpLen);
483 abrt.
Form(
"Variable compilation failed: {%s,%s}", varexp, realSelection.
GetTitle());
489 Abort(
"Too many variables. Use the option \"para\", \"gl5d\" or \"candle\" to display more than 4 variables.");
493 if (
fDimension < 2 && (optpara || optcandle)) {
494 Abort(
"The options \"para\" and \"candle\" require at least 2 variables.");
500 Int_t nsel = strlen(selection);
502 htitle.
Form(
"%s {%s}", varexp, selection);
508 Int_t mustdelete = 0;
519 if (!profile || olddim !=
fDimension) mustdelete = 1;
526 Warning(
"Begin",
"Deleting old histogram with different dimensions");
535 gROOT->MakeDefCanvas();
537 Abort(
"Creation of default canvas failed");
548 fNbins[0] =
gEnv->GetValue(
"Hist.Binning.1D.x", 100);
549 if (
gPad && optSame) {
552 TH1 *oldhtemp =
nullptr;
553 while ((op = np()) && !oldhtemp) {
575 TString precision =
gEnv->GetValue(
"Hist.Precision.1D",
"float");
602 }
else if (
fDimension == 2 && !(optpara || optcandle)) {
605 fNbins[0] =
gEnv->GetValue(
"Hist.Binning.2D.y", 40);
606 fNbins[1] =
gEnv->GetValue(
"Hist.Binning.2D.x", 40);
609 TH1 *oldhtemp = (
TH1*)
gPad->FindObject(hdefault);
618 fNbins[1] =
gEnv->GetValue(
"Hist.Binning.2D.x", 40);
621 fNbins[0] =
gEnv->GetValue(
"Hist.Binning.2D.y", 40);
634 if (profile || opt.
Contains(
"prof")) {
649 TH1 *oldhtemp = (
TH1*)
gPad->FindObject(hdefault);
688 TString precision =
gEnv->GetValue(
"Hist.Precision.2D",
"float");
716 if (
l == 0 || optSame) graph =
true;
720 if (opt.
Contains(
"box")) graph =
false;
733 fNbins[0] =
gEnv->GetValue(
"Hist.Binning.3D.z", 20);
734 fNbins[1] =
gEnv->GetValue(
"Hist.Binning.3D.y", 20);
735 fNbins[2] =
gEnv->GetValue(
"Hist.Binning.3D.x", 20);
737 fNbins[1] =
gEnv->GetValue(
"Hist.Binning.3D.Profy", 20);
738 fNbins[2] =
gEnv->GetValue(
"Hist.Binning.3D.Profx", 20);
740 fNbins[0] =
gEnv->GetValue(
"Hist.Binning.2D.y", 40);
741 fNbins[1] =
gEnv->GetValue(
"Hist.Binning.2D.x", 40);
744 TH1 *oldhtemp = (
TH1*)
gPad->FindObject(hdefault);
758 Error(
"Begin",
"You cannot use option same when no 3D view exists");
765 fNbins[2] =
gEnv->GetValue(
"Hist.Binning.3D.z", 20);
768 fNbins[1] =
gEnv->GetValue(
"Hist.Binning.3D.y", 20);
771 fNbins[0] =
gEnv->GetValue(
"Hist.Binning.3D.x", 20);
861 TString precision =
gEnv->GetValue(
"Hist.Precision.3D",
"float");
863 h3 =
new TH3F(hname, htitle.
Data(),
fNbins[2],
fVmin[2],
fVmax[2],
fNbins[1],
fVmin[1],
fVmax[1],
fNbins[0],
fVmin[0],
fVmax[0]);
865 h3 =
new TH3D(hname, htitle.
Data(),
fNbins[2],
fVmin[2],
fVmax[2],
fNbins[1],
fVmin[1],
fVmax[1],
fNbins[0],
fVmin[0],
fVmax[0]);
895 Int_t noscat = strlen(option);
896 if (optSame) noscat -= 4;
906 fTree->SetEstimate(1);
911 fTree->SetEstimate(1);
913 }
else if (optcandle || optpara || opt5d) {
918 if (varexp)
delete[] varexp;
994 if (strlen(selection)) {
1005 nch = strlen(varexp);
1024 std::vector<TString> varnames;
1032 for (i = 0; i < ncols; ++i) {
1034 fVar[i]->SetQuickLoad(
true);
1116 for (
Int_t i = 0; i < oldsize; ++i)
1137 bool ternary =
false;
1140 if (varexp[i] ==
':'
1141 && !((i > 0 && varexp[i-1] ==
':') || varexp[i+1] ==
':')
1146 names.push_back(varexp(prev, i - prev));
1150 if (varexp[i] ==
'?') {
1154 names.push_back(varexp(prev, varexp.
Length() - prev));
1155 return names.size();
1167 if (
fVar[i])
fVar[i]->UpdateFormulaLeaves();
1253 if (
fVar[i])
fVar[i]->ResetLoading();
1258 for (
Int_t i = 1; i < ndata; i++) {
1261 if (subList && !subList->
Contains(i))
1266 if (ww == 0)
continue;
1307 for (
Int_t i = 0; i < ndata; i++) {
1316 if (ww == 0)
continue;
1322 void *obj =
fVar[0]->EvalObject(i);
1331 if (nextbit >= nbits)
break;
1342 "Not implemented for %s",
1343 cl ? cl->
GetName() :
"unknown class");
1367 delete []
fW;
fW =
nullptr;
1394 enlist->
Enter(enumb);
1405 for (i = 0; i <
fNfill; i++) {
1444 for (i = 0; i <
fNfill; i++) {
1466 for (col = 0; col < ncolors; col++) {
1468 gr->SetMarkerColor(
gStyle->GetColorPalette(col));
1469 gr->SetMarkerStyle(
fTree->GetMarkerStyle());
1470 gr->SetMarkerSize(
fTree->GetMarkerSize());
1478 for (i = 0; i <
fNfill; i++) {
1480 if (col < 0) col = 0;
1481 if (col > ncolors - 1) col = ncolors - 1;
1486 for (col = 0; col < ncolors; col++) {
1503 ncolors =
gStyle->GetNumberOfColors();
1513 for (col = 0; col < ncolors; col++) {
1518 pms->
AddAt(pm3d, col);
1524 for (i = 0; i <
fNfill; i++) {
1526 if (col > ncolors-1) col = ncolors-1;
1527 if (col < 0) col = 0;
1537 if (!
fOption.Contains(
"goff"))
1538 gROOT->ProcessLine(
TString::Format(
"TParallelCoord::BuildParallelCoord((TSelectorDraw*)0x%zx,0x%zx)",
1539 (
size_t)
this, (
size_t)candle));
1551 if (!
fTree->GetUpdate())
return;
1568 for (i = 0; i <
fValSize && i < 4; i++) {
1569 vminOld[i] =
fVmin[i];
1570 vmaxOld[i] =
fVmax[i];
1574 fVmax[i] = - DBL_MAX;
1579 if (
h1->CanExtendAllAxes()) {
1580 for (i = 0; i <
fNfill; i++) {
1591 for (i = 0; i <
fNfill; i++) {
1604 for (i = 0; i <
fNfill; i++) {
1617 for (i = 0; i <
fNfill; i++) {
1637 if (!strstr(
fOption.Data(),
"same") && !strstr(
fOption.Data(),
"goff")) {
1665 if (
fOption.Length() == 0 || strcasecmp(
fOption.Data(),
"same")==0) {
1692 bool process2 =
false;
1694 if (vminOld[2] == DBL_MAX)
1696 for (i = 0; i <
fValSize && i < 4; i++) {
1697 fVmin[i] = vminOld[i];
1698 fVmax[i] = vmaxOld[i];
1700 for (i = 0; i <
fNfill; i++) {
1723 for (i = 0; i <
fNfill; i++) {
1732 for (i = 0; i <
fNfill; i++) {
1747 if (!strstr(
fOption.Data(),
"same") && !strstr(
fOption.Data(),
"goff")) {
1766 gPad->Range(-1, -1, 1, 1);
1773 for (i = 0; i <
fNfill; i++) {
1785 for (i = 0; i <
fNfill; i++) {
1800 for (i = 0; i <
fValSize && i < 4; i++) {
1801 fVmin[i] = vminOld[i];
1802 fVmax[i] = vmaxOld[i];
1804 for (i = 0; i <
fNfill; i++) {
1817 for (i = 0; i <
fNfill; i++) {
int Int_t
Signed integer 4 bytes (int).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
double Double_t
Double 8 bytes.
long long Long64_t
Portable signed long integer 8 bytes.
const Int_t kCustomHistogram
virtual void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title.
virtual Float_t GetTitleOffset() const
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
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 void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
virtual void SetMarkerSize(Size_t msize=1)
Set the marker size.
Class to manage histogram axis.
virtual Int_t FindFixBin(Double_t x) const
Find bin number corresponding to abscissa x.
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width.
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
Int_t GetFirst() const
Return first bin on the axis i.e.
UInt_t FirstSetBit(UInt_t startBit=0) const
Return position of first non null bit (starting from position 0 and up).
TClass instances represent classes, structs and namespaces in the ROOT type system.
void SetName(const char *name)
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
static void InitializeColors()
A specialized string object used for TTree selections.
A list of entries and subentries in a TTree or TChain.
virtual bool Enter(Long64_t entry, TTree *tree, Long64_t subentry)
Add entry #entry (, #subentry) to the list.
virtual Int_t Contains(Long64_t entry, TTree *tree=nullptr)
virtual bool Enter(Long64_t entry, TTree *tree=nullptr)
virtual bool GetReapplyCut() const
<div class="legacybox"><h2>Legacy Code</h2> TEventList is a legacy interface: there will be no bug fi...
virtual void Reset(Option_t *option="")
Reset number of entries in event list.
virtual Int_t GetIndex(Long64_t entry) const
Return index in the list of element with value entry array is supposed to be sorted prior to this cal...
virtual void Enter(Long64_t entry)
Enter element entry into the list.
virtual void SetEditable(Bool_t editable=kTRUE)
virtual TH1F * GetHistogram() const
void Draw(Option_t *chopt="") override
Default Draw method for all objects.
1-D histogram with a double per channel (see TH1 documentation)
1-D histogram with a float per channel (see TH1 documentation)
TH1 is the base class of all histogram classes in ROOT.
virtual void SetDirectory(TDirectory *dir)
By default, when a histogram is created, it is added to the list of histogram objects in the current ...
@ kNoStats
Don't draw stats box.
virtual Bool_t CanExtendAllAxes() const
Returns true if all axes are extendable.
virtual void SetMaximum(Double_t maximum=-1111)
void Draw(Option_t *option="") override
Draw this histogram with options.
virtual void SetMinimum(Double_t minimum=-1111)
virtual UInt_t SetCanExtend(UInt_t extendBitMask)
Make the histogram axes extendable / not extendable according to the bit mask returns the previous bi...
TList * GetListOfFunctions() const
virtual TH1 * DrawCopy(Option_t *option="", const char *name_postfix="_copy") const
Copy this histogram and Draw in the current pad.
virtual void SetBins(Int_t nx, Double_t xmin, Double_t xmax)
Redefine x axis parameters.
virtual void Sumw2(Bool_t flag=kTRUE)
Create structure to store sum of squares of weights.
virtual void SetEntries(Double_t n)
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
2-D histogram with a double per channel (see TH1 documentation)
2-D histogram with a float per channel (see TH1 documentation)
Service class for 2-D histogram classes.
Int_t Fill(Double_t) override
Invalid Fill method.
3-D histogram with a double per channel (see TH1 documentation)
3-D histogram with a float per channel (see TH1 documentation)
The 3-D histogram classes derived from the 1-D histogram classes.
Int_t Fill(Double_t) override
Invalid Fill method.
static THLimitsFinder * GetLimitsFinder()
Return pointer to the current finder.
virtual Int_t FindGoodLimitsXY(TH1 *h, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Int_t newbinsx=0, Int_t newbinsy=0)
Compute the best axis limits for the X and Y axis if the corresponding newbins variable is set to 0,...
virtual Int_t FindGoodLimits(TH1 *h, Double_t xmin, Double_t xmax)
Compute the best axis limits for the X axis.
virtual Int_t FindGoodLimitsXYZ(TH1 *h, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Double_t zmin, Double_t zmax, Int_t newbinsx=0, Int_t newbinsy=0, Int_t newbinsz=0)
Compute the best axis limits and bins for the X, Y and Z axis if the corresponding newbins variable i...
TObject * FindObject(const char *name) const override
Find an object in this list using its name.
void Add(TObject *obj) override
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
void AddAt(TObject *obj, Int_t idx) override
Add object at position ids.
TObject * At(Int_t idx) const override
TObject * UncheckedAt(Int_t i) const
TObject * Remove(TObject *obj) override
Remove object from array.
Bool_t TestBit(UInt_t f) const
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual const char * GetTitle() const
Returns title of object.
virtual TClass * IsA() const
TObject()
TObject constructor.
@ kCanDelete
if object in a list can be deleted
void SetPoint(Int_t n, Double_t x, Double_t y, Double_t z)
Set point n to x, y, z.
virtual Int_t GetLastPoint() const
void Draw(Option_t *option="") override
Draws 3-D polymarker with its current attributes.
Profile2D histograms are used to display the mean value of Z and its error for each cell in X,...
Int_t Fill(const Double_t *v)
void FillN(Int_t, const Double_t *, const Double_t *, Int_t) override
Fill this histogram with an array x and weights w.
void ProcessFill(Long64_t entry) override
Called in the entry loop for all entries accepted by Select.
TEntryListArray * fTreeElistArray
! Pointer to Tree Event list array
virtual void SetEstimate(Long64_t n)
Set number of entries to estimate variable limits.
virtual void InitArrays(Int_t newsize)
Initialization of the primitive type arrays if the new size is bigger than the available space.
void Terminate() override
Called at the end of a loop on a TTree.
Int_t fAction
! Action type
Int_t GetMultiplicity() const
TTreeFormulaManager * fManager
Pointer to the formula manager.
TTreeFormula * GetVar(Int_t i) const
Return the TTreeFormula corresponding to the i-th component of the request formula (where the compone...
bool * fVarMultiple
![fDimension] True if fVar[i] has a variable index
~TSelectorDraw() override
Selector destructor.
TSelectorDraw()
Default selector constructor.
Double_t * fW
![fSelectedRows]Local buffer for weights
virtual UInt_t SplitNames(const TString &varexp, std::vector< TString > &names)
Build Index array for names in varexp.
Long64_t fCurrentSubEntry
Current subentry when fSelectMultiple is true. Used to fill TEntryListArray.
TTreeFormula * fSelect
Pointer to selection formula.
Long64_t fSelectedRows
Number of selected entries.
Int_t fForceRead
Force Read flag.
virtual void ClearFormula()
Delete internal buffers.
virtual void TakeAction()
Execute action for object obj fNfill times.
Long64_t fOldEstimate
Value of Tree fEstimate when selector is called.
Double_t fWeight
Tree weight (see TTree::SetWeight).
Int_t fNfill
! Total number of histogram fills
TH1 * fOldHistogram
! Pointer to previously used histogram
virtual bool CompileVariables(const char *varexp="", const char *selection="")
Compile input variables and selection expression.
Double_t * fVmax
![fDimension] Maxima of varexp columns
Int_t fMultiplicity
Indicator of the variability of the size of entries.
TTreeFormula ** fVar
![fDimension] Array of pointers to variables formula
virtual void ProcessFillMultiple(Long64_t entry)
Called in the entry loop for all entries accepted by Select.
bool fSelectMultiple
True if selection has a variable index.
TTree * fTree
Pointer to current Tree.
Int_t fDimension
Dimension of the current expression.
TObject * fTreeElist
Pointer to Tree Event list.
virtual Double_t * GetVal(Int_t i) const
Return the last values corresponding to the i-th component of the formula being processed (where the ...
Int_t * fNbins
![fDimension] Number of bins per dimension
Double_t ** fVal
![fSelectedRows][fDimension] Local buffer for the variables
Long64_t fDraw
! Last entry loop number when object was drawn
virtual void TakeEstimate()
Estimate limits for 1-D, 2-D or 3-D objects.
bool Notify() override
This function is called at the first entry of a new tree in a chain.
bool fCleanElist
True if original Tree elist must be saved.
bool fObjEval
True if fVar1 returns an object (or pointer to).
void Begin(TTree *tree) override
Called every time a loop on the tree(s) starts.
virtual void ProcessFillObject(Long64_t entry)
Called in the entry loop for all entries accepted by Select.
Double_t * fVmin
![fDimension] Minima of varexp columns
virtual void SetStatus(Long64_t status)
TList * fInput
List of objects available during processing.
TString fOption
Option given to TTree::Process.
virtual void Abort(const char *why, EAbort what=kAbortProcess)
Abort processing.
const char * GetOption() const override
TObject * fObject
! Current object if processing object (vs. TTree)
virtual void ResetAbort()
void ToLower()
Change string to lower-case.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
A TTree represents a columnar dataset.
virtual Double_t * GetRmax()=0
virtual Double_t * GetRmin()=0
static TView * CreateView(Int_t system=1, const Double_t *rmin=nullptr, const Double_t *rmax=nullptr)
Create a concrete default 3-d view via the plug-in manager.