23 #include "TDirectory.h"
41 const
Int_t kCustomHistogram =
BIT(17);
54 fNbins =
new Int_t[fValSize];
55 fVarMultiple =
new Bool_t[fValSize];
57 for (
Int_t i = 0; i < fValSize; ++i) {
78 fCurrentSubEntry = -1;
115 const char *varexp0 = obj ? obj->
GetTitle() :
"";
117 const char *selection = obj ? obj->
GetTitle() :
"";
121 char *hdefault = (
char *)
"htemp";
122 char *varexp =
nullptr;
143 if (opt.
Contains(
"entrylistarray")) {
144 optEnlistArray =
kTRUE;
162 TCut realSelection(selection);
166 if (evlist && inElist) {
181 realSelection *= inElist->
GetTitle();
195 if (optSame) canExtend =
kFALSE;
197 Int_t nbinsx = 0, nbinsy = 0, nbinsz = 0;
202 char *hnamealloc = 0;
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 =
new char[strlen(&(varexp0[k+1])) + 1];
210 strcpy(hname, &(varexp0[k+1]));
218 varexp =
new char[i+1];
221 while (*hname ==
' ') hname++;
225 while (*hname ==
' ') hname++;
227 j = strlen(hname) - 1;
229 if (hname[j] !=
' ')
break;
235 strlcpy(varexp,varexp0,i+1);
237 Int_t mustdelete = 0;
254 const Int_t maxvalues = 9;
256 pstart = strchr(hname,
'(');
257 pend = strchr(hname,
')');
263 if (pstart == strrchr(hname,
'(') && pend == strrchr(hname,
')')) {
268 cdummy = strchr(&cdummy[1],
',');
269 while (cdummy != 0) {
270 cdummy = strchr(&cdummy[1],
',');
274 if (ncomma + 1 > maxvalues) {
275 Error(
"DrawSelect",
"ncomma+1>maxvalues, ncomma=%d, maxvalues=%d", ncomma, maxvalues);
276 ncomma = maxvalues - 1;
284 for (j = 0; j < i; j++) {
286 && !((j > 0 && varexp[j-1] ==
':') || varexp[j+1] ==
':')
292 Error(
"DrawSelect",
"ncols > 3, ncols=%d", ncols);
297 if (ncols * 3 < ncomma) {
298 Error(
"DrawSelect",
"ncols*3 < ncomma ncols=%d, ncomma=%d", ncols, ncomma);
303 for (j = 0; j < ncomma; j++) {
305 if (sscanf(cdummy,
" %lf ", &value) == 1) {
306 cdummy = strchr(&cdummy[1],
',');
310 nbinsx = (
Int_t)value;
313 }
else if (ncols < 3) {
329 nbinsy = (
Int_t)value;
330 if (ncols < 3)
gEnv->
SetValue(
"Hist.Binning.2D.y", nbinsy);
343 nbinsz = (
Int_t)value;
353 Error(
"DrawSelect",
"j>8");
359 Error(
"Begin",
"Two open or close brackets found, hname=%s", hname);
366 j = strlen(hname) - 1;
368 if (hname[j] !=
' ')
break;
377 abrt.
Form(
"An object of type '%s' has the same name as the requested histo (%s)", oldObject->IsA()->
GetName(), hname);
385 Warning(
"Begin",
"Deleting old histogram, since (possibly new) limits and binnings have been given");
395 enlist = oldObject ?
dynamic_cast<TEntryList*
>(oldObject) : 0;
397 if (!enlist && oldObject) {
398 abrt.
Form(
"An object of type '%s' has the same name as the requested event list (%s)",
399 oldObject->IsA()->
GetName(), hname);
404 if (optEnlistArray) {
412 if (enlist == inElist) {
415 if (optEnlistArray) {
433 evlist = oldObject ?
dynamic_cast<TEventList*
>(oldObject) : 0;
435 if (!evlist && oldObject) {
436 abrt.
Form(
"An object of type '%s' has the same name as the requested event list (%s)",
437 oldObject->IsA()->
GetName(), hname);
449 Abort(
"Input and output lists are the same!");
467 const size_t varexpLen = strlen(varexp0) + 1;
468 varexp =
new char[varexpLen];
469 strlcpy(varexp, varexp0, varexpLen);
478 abrt.
Form(
"Variable compilation failed: {%s,%s}", varexp, realSelection.
GetTitle());
483 if (
fDimension > 4 && !(optpara || optcandle || opt5d)) {
484 Abort(
"Too many variables. Use the option \"para\", \"gl5d\" or \"candle\" to display more than 4 variables.");
490 Int_t nsel = strlen(selection);
492 htitle.
Form(
"%s {%s}", varexp, selection);
498 Int_t mustdelete = 0;
509 if (!profile || olddim !=
fDimension) mustdelete = 1;
516 Warning(
"Begin",
"Deleting old histogram with different dimensions");
525 gROOT->MakeDefCanvas();
527 Abort(
"Creation of default canvas failed");
538 if (
gPad && optSame) {
542 while ((op = np()) && !oldhtemp) {
585 }
else if (
fDimension == 2 && !(optpara || optcandle)) {
592 TH1 *oldhtemp = (
TH1*)
gPad->FindObject(hdefault);
617 if (profile || opt.
Contains(
"prof")) {
632 TH1 *oldhtemp = (
TH1*)
gPad->FindObject(hdefault);
692 if (l == 0 || optSame) graph =
kTRUE;
721 TH1 *oldhtemp = (
TH1*)
gPad->FindObject(hdefault);
735 Error(
"Begin",
"You cannot use option same when no 3D view exists");
836 h3 =
new TH3F(hname, htitle.
Data(),
fNbins[2],
fVmin[2],
fVmax[2],
fNbins[1], fVmin[1], fVmax[1], fNbins[0], fVmin[0], fVmax[0]);
864 Int_t noscat = strlen(option);
865 if (optSame) noscat -= 4;
882 }
else if (optcandle || optpara || opt5d) {
887 if (varexp)
delete [] varexp;
888 if (hnamealloc)
delete [] hnamealloc;
964 if (strlen(selection)) {
975 nch = strlen(varexp);
994 std::vector<TString> varnames;
1002 for (i = 0; i < ncols; ++i) {
1086 for (
Int_t i = 0; i < oldsize; ++i)
1110 if (varexp[i] ==
':'
1111 && !((i > 0 && varexp[i-1] ==
':') || varexp[i+1] ==
':')
1116 names.push_back(varexp(prev, i - prev));
1120 if (varexp[i] ==
'?') {
1124 names.push_back(varexp(prev, varexp.
Length() - prev));
1125 return names.size();
1225 if (subList && !subList->
Contains(i))
continue;
1229 if (ww == 0)
continue;
1277 if (ww == 0)
continue;
1292 if (nextbit >= nbits)
break;
1303 "Not implemented for %s",
1304 cl ? cl->
GetName() :
"unknown class");
1329 delete []
fW;
fW = 0;
1356 enlist->
Enter(enumb);
1367 for (i = 0; i <
fNfill; i++) {
1406 for (i = 0; i <
fNfill; i++) {
1428 for (col = 0; col < ncolors; col++) {
1433 grs->
AddAt(gr, col);
1440 for (i = 0; i <
fNfill; i++) {
1442 if (col < 0) col = 0;
1443 if (col > ncolors - 1) col = ncolors - 1;
1448 for (col = 0; col < ncolors; col++) {
1475 for (col = 0; col < ncolors; col++) {
1480 pms->
AddAt(pm3d, col);
1486 for (i = 0; i <
fNfill; i++) {
1488 if (col > ncolors-1) col = ncolors-1;
1489 if (col < 0) col = 0;
1500 gROOT->ProcessLine(
TString::Format(
"TParallelCoord::BuildParallelCoord((TSelectorDraw*)0x%lx,0x%lx)",
1530 for (i = 0; i <
fValSize && i < 4; i++) {
1531 vminOld[i] =
fVmin[i];
1532 vmaxOld[i] =
fVmax[i];
1536 fVmax[i] = - DBL_MAX;
1542 for (i = 0; i <
fNfill; i++) {
1553 for (i = 0; i <
fNfill; i++) {
1566 for (i = 0; i <
fNfill; i++) {
1579 for (i = 0; i <
fNfill; i++) {
1592 if (xmin == 0 || ymin == 0) {
1655 if (vminOld[2] == DBL_MAX)
1657 for (i = 0; i < fValSize && i < 4; i++) {
1658 fVmin[i] = vminOld[i];
1659 fVmax[i] = vmaxOld[i];
1661 for (i = 0; i <
fNfill; i++) {
1678 if (xmin == 0 || ymin == 0) {
1684 for (i = 0; i <
fNfill; i++) {
1693 for (i = 0; i <
fNfill; i++) {
1726 gPad->Range(-1, -1, 1, 1);
1733 for (i = 0; i <
fNfill; i++) {
1745 for (i = 0; i <
fNfill; i++) {
1760 for (i = 0; i < fValSize && i < 4; i++) {
1761 fVmin[i] = vminOld[i];
1762 fVmax[i] = vmaxOld[i];
1764 for (i = 0; i <
fNfill; i++) {
1776 for (i = 0; i <
fNfill; i++) {
virtual const char * GetOption() const
Int_t GetFirst() const
Return first bin on the axis i.e.
virtual void InitArrays(Int_t newsize)
Initialization of the primitive type arrays if the new size is bigger than the available space...
virtual void Enter(Long64_t entry)
Enter element entry into the list.
virtual void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title Offset is a correction factor with respect to the "s...
virtual const char * GetTitle() const
Returns title of object.
virtual Style_t GetLineStyle() const
virtual Style_t GetFillStyle() const
virtual void SetLineWidth(Width_t lwidth)
TList * GetListOfFunctions() const
virtual void Terminate()
Called at the end of a loop on a TTree.
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 ...
virtual void SetMaximum(Double_t maximum=-1111)
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
A list of entries and subentries in a TTree or TChain.
virtual void SetDirectory(TDirectory *dir)
By default when an histogram is created, it is added to the list of histogram objects in the current ...
3-D histogram with a float per channel (see TH1 documentation)}
virtual Double_t * GetRmax()=0
TEventList * GetEventList() const
virtual void SetEstimate(Long64_t n)
Set number of entries to estimate variable limits.
virtual Long64_t GetReadEntry() const
TString & ReplaceAll(const TString &s1, const TString &s2)
TEntryListArray * fTreeElistArray
TTreeFormula * GetVar(Int_t i) const
Return the TTreeFormula corresponding to the i-th component of the request formula (where the compone...
R__EXTERN TStyle * gStyle
virtual Int_t GetDimension() const
virtual void ProcessFill(Long64_t entry)
Called in the entry loop for all entries accepted by Select.
virtual void SetBins(Int_t nx, Double_t xmin, Double_t xmax)
Redefine x axis parameters.
virtual TEntryList * GetEntryList()
Returns the entry list, set to this tree.
Int_t fAction
Pointer to previously used histogram.
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
virtual Bool_t Enter(Long64_t entry, TTree *tree, Long64_t subentry)
Add entry entry (, #subentry) to the list.
UInt_t FirstSetBit(UInt_t startBit=0) const
Return position of first non null bit (starting from position 0 and up)
Bool_t * fVarMultiple
[fSelectedRows]Local buffer for weights
virtual void SetMinimum(Double_t minimum=-1111)
TTreeFormulaManager * fManager
static THLimitsFinder * GetLimitsFinder()
Return pointer to the current finder.
virtual TObject * Remove(TObject *obj)
Remove object from array.
virtual void TakeAction()
Execute action for object obj fNfill times.
void ToLower()
Change string to lower-case.
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width.
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
virtual void SetFillStyle(Style_t fstyle)
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
virtual Long64_t GetEstimate() const
Long64_t fCurrentSubEntry
virtual Int_t FindGoodLimits(TH1 *h, Double_t xmin, Double_t xmax)
compute the best axis limits for the X axis.
TH1 * fOldHistogram
pointer to Tree Event list array
virtual void Draw(Option_t *chopt="")
Draw this graph with its current attributes.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual void Reset(Option_t *option="")
Reset this histogram: contents, errors, etc.
virtual Long64_t GetChainOffset() const
Int_t fValSize
[fSelectedRows][fDimension] Local buffer for the variables
virtual void SetValue(const char *name, const char *value, EEnvLevel level=kEnvChange, const char *type=0)
Set the value of a resource or create a new resource.
virtual TEntryListArray * GetSubListForEntry(Long64_t entry, TTree *tree=0)
Return the list holding the subentries for the given entry or 0.
const char * Data() const
Int_t Fill(const Double_t *v)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
virtual void SetMarkerColor(Color_t mcolor=1)
Int_t GetNumberOfColors() const
Return number of colors in the color palette.
std::vector< std::vector< double > > Data
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Double_t fWeight
[fDimension] Maxima of varexp columns
virtual TH1 * DrawCopy(Option_t *option="", const char *name_postfix="_copy") const
Copy this histogram and Draw in the current pad.
TTreeFormula * fSelect
[fDimension] Array of pointers to variables formula
The 3-D histogram classes derived from the 1-D histogram classes.
virtual Float_t GetTitleOffset() const
A specialized string object used for TTree selections.
TObject * UncheckedAt(Int_t i) const
Int_t fMultiplicity
Total number of histogram fills.
virtual void SetLineColor(Color_t lcolor)
virtual void Delete(Option_t *option="")
Delete this object.
virtual void Begin(TTree *tree)
Called everytime a loop on the tree(s) starts.
virtual Size_t GetMarkerSize() const
virtual Bool_t Notify()
This function is called at the first entry of a new tree in a chain.
virtual void SetEstimate(Long64_t nentries=1000000)
Set number of entries to estimate variable limits.
Service class for 2-Dim histogram classes.
Class to manage histogram axis.
virtual void Draw(Option_t *option="")
Draw this histogram with options.
virtual void SetFillColor(Color_t fcolor)
virtual void SetStatus(Long64_t status)
virtual void Abort(const char *why, EAbort what=kAbortProcess)
Abort processing.
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
virtual ~TSelectorDraw()
Selector destructor.
2-D histogram with a float per channel (see TH1 documentation)}
virtual Int_t GetValue(const char *name, Int_t dflt)
Returns the integer value for a resource.
virtual Color_t GetFillColor() const
virtual Bool_t CompileVariables(const char *varexp="", const char *selection="")
Compile input variables and selection expression.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Bool_t TestBit(UInt_t f) const
Double_t * fVmin
[fDimension] Number of bins per dimension
A TEventList object is a list of selected events (entries) in a TTree.
virtual const char * GetName() const
Returns name of object.
The ROOT global object gROOT contains a list of all defined classes.
virtual void SetMarkerStyle(Style_t mstyle=1)
Int_t Fill(Double_t)
Invalid Fill method.
void SetName(const char *name)
virtual Color_t GetLineColor() const
ClassImp(TSelectorDraw) const Int_t kCustomHistogram
virtual Int_t Contains(Long64_t entry, TTree *tree=0)
virtual void Draw(Option_t *option="")
Draws 3-D polymarker with its current attributes.
virtual void AddAt(TObject *obj, Int_t idx)
Add object at position ids.
virtual void SetMarkerSize(Size_t msize=1)
virtual Double_t * GetRmin()=0
Long64_t fDraw
Action type.
Int_t GetColorPalette(Int_t i) const
Return color number i in current palette.
A specialized TSelector for TTree::Draw.
void SetPoint(Int_t n, Double_t x, Double_t y, Double_t z)
Set point n to x, y, z.
virtual void ResetAbort()
virtual void SetEntryList(TEntryList *list, Option_t *opt="")
Set an EntryList.
virtual const char * GetName() const
Returns name of object.
Bool_t fSelectMultiple
[fDimension] true if fVar[i] has a variable index
virtual Int_t GetUpdate() const
Double_t * fVmax
[fDimension] Minima of varexp columns
virtual void ProcessFillMultiple(Long64_t entry)
Called in the entry loop for all entries accepted by Select.
virtual void ProcessFillObject(Long64_t entry)
Called in the entry loop for all entries accepted by Select.
virtual TTree * GetTree() const
virtual Bool_t Enter(Long64_t entry, TTree *tree=0)
Add entry entry to the list.
Profile2D histograms are used to display the mean value of Z and its RMS for each cell in X...
virtual void SetLineStyle(Style_t lstyle)
static TView * CreateView(Int_t system=1, const Double_t *rmin=0, const Double_t *rmax=0)
Create a concrete default 3-d view via the plug-in manager.
virtual UInt_t SetCanExtend(UInt_t extendBitMask)
make the histogram axes extendable / not extendable according to the bit mask returns the previous bi...
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...
Mother of all ROOT objects.
virtual void TakeEstimate()
Estimate limits for 1-D, 2-D or 3-D objects.
virtual Color_t GetMarkerColor() const
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
TList * fInput
Current object if processing object (vs. TTree)
virtual Int_t FindFixBin(Double_t x) const
Find bin number corresponding to abscissa x.
void FillN(Int_t, const Double_t *, const Double_t *, Int_t)
Fill this histogram with an array x and weights w.
virtual void Add(TObject *obj)
virtual void Reset()
Reset this list.
virtual void FillN(Int_t ntimes, const Double_t *x, const Double_t *w, Int_t stride=1)
Fill this histogram with an array x and weights w.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual void Sumw2(Bool_t flag=kTRUE)
Create structure to store sum of squares of weights.
A Graph is a graphics object made of two arrays X and Y with npoints each.
virtual Bool_t GetReapplyCut() const
Int_t fNfill
Last entry loop number when object was drawn.
virtual Bool_t CanExtendAllAxes() const
returns true if all axes are extendable
virtual void ClearFormula()
Delete internal buffers.
virtual UInt_t SplitNames(const TString &varexp, std::vector< TString > &names)
Build Index array for names in varexp.
virtual void SetEntries(Double_t n)
A TTree object has a header with a name and a title.
static void InitializeColors()
Initialize colors used by the TCanvas based graphics (via TColor objects).
virtual Double_t GetWeight() const
TObject * At(Int_t idx) const
virtual Style_t GetMarkerStyle() const
Int_t Fill(Double_t)
Invalid Fill method.
virtual Width_t GetLineWidth() const
virtual const char * GetTitle() const
Returns title of object.
virtual void SetTitle(const char *title="")
Change (i.e. set) the title of the TNamed.
virtual void SetEditable(Bool_t editable=kTRUE)
if editable=kFALSE, the graph cannot be modified with the mouse by default a TGraph is editable ...
A List of entry numbers in a TTree or TChain.
Int_t GetMultiplicity() const
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
virtual Int_t GetLastPoint() const
virtual void Reset(Option_t *option="")
Reset number of entries in event list.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.