ATLAS Offline Software
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
LWHist Class Referenceabstract

#include <LWHist.h>

Inheritance diagram for LWHist:
Collaboration diagram for LWHist:

Classes

class  LWHistAxis
 
class  LWHistDecorations
 

Public Member Functions

void SetName (const char *)
 
void SetTitle (const char *)
 
void SetNameTitle (const char *name, const char *title)
 
const char * GetName () const
 
const char * GetTitle () const
 
virtual unsigned GetEntries () const =0
 
virtual void SetEntries (unsigned)=0
 
virtual void Reset ()=0
 
LWHistAxisGetXaxis ()
 
LWHistAxisGetYaxis ()
 
LWHistAxisGetZaxis ()
 
short GetMarkerColor () const
 
short GetMarkerStyle () const
 
float GetMarkerSize () const
 
void SetMarkerColor (short c=1)
 
void SetMarkerStyle (short s=1)
 
void SetMarkerSize (float sz=1)
 
void SetXTitle (const char *)
 
void SetYTitle (const char *)
 
void SetZTitle (const char *)
 
void SetMinimum (const double &minimum=-1111)
 
void SetMaximum (const double &maximum=-1111)
 
void SetOption (const char *option=" ")
 
virtual double Integral () const =0
 
void setCustomData (void *data)
 
const void * getCustomData () const
 
void * getCustomData ()
 
virtual TH1getROOTHistBase ()=0
 
bool usingROOTBackend () const
 
bool ownsROOTHisto () const
 
void setOwnsROOTHisto (bool b)
 

Static Public Member Functions

static void safeDelete (LWHist *)
 

Protected Member Functions

 LWHist (const char *name, const char *title, bool rootbackend)
 
virtual ~LWHist ()
 
virtual bool apply (TH1 *) const
 
virtual void clearKeptROOTHist ()=0
 
virtual const TH1getROOTHistBaseNoAlloc () const =0
 
virtual TH1getROOTHistBaseNoAlloc ()=0
 
virtual void clear ()
 
virtual double actualGetBinCenterX (int bin) const =0
 
virtual double actualGetBinCenterY (int bin) const =0
 
virtual unsigned actualFindBinX (const double &) const =0
 
virtual unsigned actualFindBinY (const double &) const =0
 
virtual unsigned actualGetNBinsX () const =0
 
virtual unsigned actualGetNBinsY () const =0
 

Protected Attributes

unsigned short m_nBytesFromPool
 

Private Member Functions

 LWHist (const LWHist &)
 
LWHistoperator= (const LWHist &)
 
void ensureInitDecorations ()
 

Private Attributes

const bool m_usingROOTBackend
 
bool m_ownsRootHisto
 
char * m_name
 
char * m_title
 
LWHistDecorationsm_decorations
 
void * m_customData
 

Detailed Description

Definition at line 26 of file LWHist.h.

Constructor & Destructor Documentation

◆ LWHist() [1/2]

LWHist::LWHist ( const char *  name,
const char *  title,
bool  rootbackend 
)
protected

Definition at line 189 of file LWHist.cxx.

192  : m_nBytesFromPool(0),
193  m_usingROOTBackend(rootbackend),
194  m_ownsRootHisto(true),
195  m_name(0),
196  m_title(0),
197  m_decorations(0),
198  m_customData(0)
199 {
200  //Fixme: Sanity check of input parameters
201  assert(typeid(short)==typeid(Color_t));
202  assert(typeid(short)==typeid(Style_t));
203  assert(typeid(float)==typeid(Size_t));
204  if (!m_usingROOTBackend) {
207  }
209  static std::once_flag first_flag;
210  std::call_once (first_flag,
211  []() { std::cout<<"LWHists INFO: Using light weight histograms"<<std::endl; });
212 }

◆ ~LWHist()

LWHist::~LWHist ( )
protectedvirtual

Definition at line 215 of file LWHist.cxx.

216 {
217  LWHist::clear();
219 }

◆ LWHist() [2/2]

LWHist::LWHist ( const LWHist )
private

Member Function Documentation

◆ actualFindBinX()

virtual unsigned LWHist::actualFindBinX ( const double &  ) const
protectedpure virtual

◆ actualFindBinY()

virtual unsigned LWHist::actualFindBinY ( const double &  ) const
protectedpure virtual

◆ actualGetBinCenterX()

virtual double LWHist::actualGetBinCenterX ( int  bin) const
protectedpure virtual

◆ actualGetBinCenterY()

virtual double LWHist::actualGetBinCenterY ( int  bin) const
protectedpure virtual

◆ actualGetNBinsX()

virtual unsigned LWHist::actualGetNBinsX ( ) const
protectedpure virtual

Implemented in TProfile2D_LW, TProfile_LW, LWHist2D, and LWHist1D.

◆ actualGetNBinsY()

virtual unsigned LWHist::actualGetNBinsY ( ) const
protectedpure virtual

Implemented in TProfile2D_LW, TProfile_LW, LWHist2D, and LWHist1D.

◆ apply()

bool LWHist::apply ( TH1 h) const
protectedvirtual

Reimplemented in LWHist2D, and LWHist1D.

Definition at line 256 of file LWHist.cxx.

257 {
258  if (!h)
259  return false;
260  assert(!m_usingROOTBackend);
261 
262  if (!LWStrUtils::stringsEqual(h->GetTitle(),GetTitle()))
263  h->SetTitle(GetTitle());
264 
266  TAxis * a = h->GetXaxis();
267  assert(a);
269  a->SetTitle(m_decorations->m_xAxis->m_title);
270  if (m_decorations->m_xAxis->m_labelSize!=a->GetLabelSize())
271  a->SetLabelSize(m_decorations->m_xAxis->m_labelSize);
274  }
276  TAxis * a = h->GetYaxis();
277  assert(a);
279  a->SetTitle(m_decorations->m_yAxis->m_title);
280  if (m_decorations->m_yAxis->m_labelSize!=a->GetLabelSize())
281  a->SetLabelSize(m_decorations->m_yAxis->m_labelSize);
284  }
286  TAxis * a = h->GetZaxis();
287  assert(a);
289  a->SetTitle(m_decorations->m_zAxis->m_title);
290  if (m_decorations->m_zAxis->m_labelSize!=a->GetLabelSize())
291  a->SetLabelSize(m_decorations->m_zAxis->m_labelSize);
294  }
295  h->SetMarkerColor( GetMarkerColor() );
296  h->SetMarkerStyle( GetMarkerStyle() );
297  h->SetMarkerSize( GetMarkerSize() );
299  h->SetMinimum(m_decorations->m_minimum);
301  h->SetMaximum(m_decorations->m_maximum);
303  h->SetOption(m_decorations->m_option);
304 
305  return true;
306 }

◆ clear()

void LWHist::clear ( )
protectedvirtual

Reimplemented in TProfile2D_LW, TH2D_LW, TH2F_LW, TH2I_LW, TProfile_LW, TH1D_LW, TH1F_LW, and TH1I_LW.

Definition at line 474 of file LWHist.cxx.

475 {
476  if (m_decorations) {
477  if (usingROOTBackend()) {
478  delete m_decorations->m_xAxis;
480  delete m_decorations->m_yAxis;
482  delete m_decorations->m_zAxis;
484  delete m_decorations;
485  } else {
487  }
488  m_decorations = 0;
489  }
492 }

◆ clearKeptROOTHist()

virtual void LWHist::clearKeptROOTHist ( )
protectedpure virtual

◆ ensureInitDecorations()

void LWHist::ensureInitDecorations ( )
private

Definition at line 90 of file LWHist.cxx.

91 {
92  if (!m_decorations)
93  m_decorations = usingROOTBackend() ? new LWHistDecorations : MP_NEW(LWHistDecorations);
94 }

◆ getCustomData() [1/2]

void* LWHist::getCustomData ( )
inline

Definition at line 71 of file LWHist.h.

71 { return m_customData; }

◆ getCustomData() [2/2]

const void* LWHist::getCustomData ( ) const
inline

Definition at line 70 of file LWHist.h.

70 { return m_customData; }

◆ GetEntries()

virtual unsigned LWHist::GetEntries ( ) const
pure virtual

◆ GetMarkerColor()

short LWHist::GetMarkerColor ( ) const

Definition at line 96 of file LWHist.cxx.

97 {
98  const TH1 * hroot= getROOTHistBaseNoAlloc();
99  if (hroot)
100  return hroot->GetMarkerColor();
101 
103 }

◆ GetMarkerSize()

float LWHist::GetMarkerSize ( ) const

Definition at line 113 of file LWHist.cxx.

114 {
115  const TH1 * hroot= getROOTHistBaseNoAlloc();
116  if (hroot)
117  return hroot->GetMarkerSize();
119 }

◆ GetMarkerStyle()

short LWHist::GetMarkerStyle ( ) const

Definition at line 105 of file LWHist.cxx.

106 {
107  const TH1 * hroot= getROOTHistBaseNoAlloc();
108  if (hroot)
109  return hroot->GetMarkerStyle();
111 }

◆ GetName()

const char * LWHist::GetName ( ) const

Definition at line 366 of file LWHist.cxx.

367 {
368  const TH1 * hroot = getROOTHistBaseNoAlloc();
369  return hroot ? hroot->GetName() : m_name;
370 }

◆ getROOTHistBase()

virtual TH1* LWHist::getROOTHistBase ( )
pure virtual

◆ getROOTHistBaseNoAlloc() [1/2]

virtual const TH1* LWHist::getROOTHistBaseNoAlloc ( ) const
protectedpure virtual

◆ getROOTHistBaseNoAlloc() [2/2]

virtual TH1* LWHist::getROOTHistBaseNoAlloc ( )
protectedpure virtual

◆ GetTitle()

const char * LWHist::GetTitle ( ) const

Definition at line 372 of file LWHist.cxx.

373 {
374  const TH1 * hroot = getROOTHistBaseNoAlloc();
375  return hroot ? hroot->GetTitle() : m_title;
376 }

◆ GetXaxis()

LWHist::LWHistAxis * LWHist::GetXaxis ( )

Definition at line 309 of file LWHist.cxx.

310 {
311  this->ensureInitDecorations();
312  if (!m_decorations->m_xAxis)
313  this->m_decorations->m_xAxis = usingROOTBackend() ? new LWHistAxis(this) : MP_NEW(LWHistAxis)(this);
314 
315  return m_decorations->m_xAxis;
316 }

◆ GetYaxis()

LWHist::LWHistAxis * LWHist::GetYaxis ( )

Definition at line 319 of file LWHist.cxx.

320 {
321  this->ensureInitDecorations();
322  if (!m_decorations->m_yAxis)
323  this->m_decorations->m_yAxis = usingROOTBackend() ? new LWHistAxis(this) : MP_NEW(LWHistAxis)(this);
324  return m_decorations->m_yAxis;
325 }

◆ GetZaxis()

LWHist::LWHistAxis * LWHist::GetZaxis ( )

Definition at line 328 of file LWHist.cxx.

329 {
330  this->ensureInitDecorations();
331  if (!m_decorations->m_zAxis)
332  this->m_decorations->m_zAxis = usingROOTBackend() ? new LWHistAxis(this) : MP_NEW(LWHistAxis)(this);
333  return m_decorations->m_zAxis;
334 }

◆ Integral()

virtual double LWHist::Integral ( ) const
pure virtual

◆ operator=()

LWHist& LWHist::operator= ( const LWHist )
private

◆ ownsROOTHisto()

bool LWHist::ownsROOTHisto ( ) const
inline

Definition at line 74 of file LWHist.h.

74 { return m_ownsRootHisto; }

◆ Reset()

virtual void LWHist::Reset ( )
pure virtual

◆ safeDelete()

void LWHist::safeDelete ( LWHist h)
static

Definition at line 30 of file LWHist.cxx.

31 {
32  if (!h) {
33  //std::cout<<"LWHist::safeDelete ERROR: Called with null pointer!"<<std::endl;
34  return;
35  }
36  if (h->m_nBytesFromPool) {
37  h->~LWHist();
38  LWPools::release(reinterpret_cast<char*>(h),h->m_nBytesFromPool);
40  std::cout<<"LWHists INFO: Last active histogram deleted. Triggering complete pool cleanup."<<std::endl;
42  }
43  } else {
44  delete h;
45  }
46 }

◆ setCustomData()

void LWHist::setCustomData ( void *  data)
inline

Definition at line 69 of file LWHist.h.

69 { m_customData = data; }

◆ SetEntries()

virtual void LWHist::SetEntries ( unsigned  )
pure virtual

◆ SetMarkerColor()

void LWHist::SetMarkerColor ( short  c = 1)

Definition at line 121 of file LWHist.cxx.

122 {
123  TH1 * hroot= getROOTHistBaseNoAlloc();
124  if (hroot) {
125  hroot->SetMarkerColor(c);
126  return;
127  }
129  return;
132 }

◆ SetMarkerSize()

void LWHist::SetMarkerSize ( float  sz = 1)

Definition at line 150 of file LWHist.cxx.

150  {
151  TH1 * hroot= getROOTHistBaseNoAlloc();
152  if (hroot) {
153  hroot->SetMarkerSize(sz);
154  return;
155  }
157  return;
160 }

◆ SetMarkerStyle()

void LWHist::SetMarkerStyle ( short  s = 1)

Definition at line 133 of file LWHist.cxx.

134 {
135  TH1 * hroot= getROOTHistBaseNoAlloc();
136  if (hroot) {
137  hroot->SetMarkerStyle(s);
138  assert(GetMarkerStyle()==s);
139  return;
140  }
142  assert(GetMarkerStyle()==s);
143  return;
144  }
147  assert(GetMarkerStyle()==s);
148 }

◆ SetMaximum()

void LWHist::SetMaximum ( const double &  maximum = -1111)

Definition at line 175 of file LWHist.cxx.

176 {
177  TH1 * hroot= getROOTHistBaseNoAlloc();
178  if (hroot) {
179  hroot->SetMaximum(m);
180  return;
181  }
182  if (!m_decorations&&fabs(m-DEFAULT_MAXIMUM)<1.0e-5)
183  return;
186 }

◆ SetMinimum()

void LWHist::SetMinimum ( const double &  minimum = -1111)

Definition at line 162 of file LWHist.cxx.

163 {
164  TH1 * hroot= getROOTHistBaseNoAlloc();
165  if (hroot) {
166  hroot->SetMinimum(m);
167  return;
168  }
169  if (!m_decorations&&fabs(m-DEFAULT_MINIMUM)<1.0e-5)
170  return;
173 }

◆ SetName()

void LWHist::SetName ( const char *  n)

Definition at line 222 of file LWHist.cxx.

223 {
224  TH1 * hroot= getROOTHistBaseNoAlloc();
225  if (hroot) {
226  hroot->SetName(n);
227  return;
228  }
230 }

◆ SetNameTitle()

void LWHist::SetNameTitle ( const char *  name,
const char *  title 
)

Definition at line 244 of file LWHist.cxx.

245 {
246  TH1 * hroot= getROOTHistBaseNoAlloc();
247  if (hroot) {
248  hroot->SetNameTitle(n,t);
249  return;
250  }
253 }

◆ SetOption()

void LWHist::SetOption ( const char *  option = " ")

Definition at line 460 of file LWHist.cxx.

461 {
462  TH1 * hroot= getROOTHistBaseNoAlloc();
463  if (hroot) {
464  hroot->SetOption(option);
465  return;
466  }
469 }

◆ setOwnsROOTHisto()

void LWHist::setOwnsROOTHisto ( bool  b)
inline

Definition at line 75 of file LWHist.h.

75 { m_ownsRootHisto = b; }

◆ SetTitle()

void LWHist::SetTitle ( const char *  t)

Definition at line 233 of file LWHist.cxx.

234 {
235  TH1 * hroot= getROOTHistBaseNoAlloc();
236  if (hroot) {
237  hroot->SetTitle(t);
238  return;
239  }
241 }

◆ SetXTitle()

void LWHist::SetXTitle ( const char *  t)

Definition at line 431 of file LWHist.cxx.

432 {
433  TH1 * hroot= getROOTHistBaseNoAlloc();
434  if (hroot) {
435  hroot->SetXTitle(t);
436  return;
437  }
438  GetXaxis()->SetTitle(t);
439 }

◆ SetYTitle()

void LWHist::SetYTitle ( const char *  t)

Definition at line 440 of file LWHist.cxx.

441 {
442  TH1 * hroot= getROOTHistBaseNoAlloc();
443  if (hroot) {
444  hroot->SetYTitle(t);
445  return;
446  }
447  GetYaxis()->SetTitle(t);
448 }

◆ SetZTitle()

void LWHist::SetZTitle ( const char *  t)

Definition at line 449 of file LWHist.cxx.

450 {
451  TH1 * hroot= getROOTHistBaseNoAlloc();
452  if (hroot) {
453  hroot->SetZTitle(t);
454  return;
455  }
456  GetZaxis()->SetTitle(t);
457 }

◆ usingROOTBackend()

bool LWHist::usingROOTBackend ( ) const
inline

Definition at line 73 of file LWHist.h.

73 { return m_usingROOTBackend; }

Member Data Documentation

◆ m_customData

void* LWHist::m_customData
private

Definition at line 103 of file LWHist.h.

◆ m_decorations

LWHistDecorations* LWHist::m_decorations
private

Definition at line 102 of file LWHist.h.

◆ m_name

char* LWHist::m_name
private

Definition at line 99 of file LWHist.h.

◆ m_nBytesFromPool

unsigned short LWHist::m_nBytesFromPool
protected

Definition at line 91 of file LWHist.h.

◆ m_ownsRootHisto

bool LWHist::m_ownsRootHisto
private

Definition at line 95 of file LWHist.h.

◆ m_title

char* LWHist::m_title
private

Definition at line 100 of file LWHist.h.

◆ m_usingROOTBackend

const bool LWHist::m_usingROOTBackend
private

Definition at line 94 of file LWHist.h.


The documentation for this class was generated from the following files:
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
LWHist::GetZaxis
LWHistAxis * GetZaxis()
Definition: LWHist.cxx:328
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
fitman.sz
sz
Definition: fitman.py:527
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
LWHist::m_ownsRootHisto
bool m_ownsRootHisto
Definition: LWHist.h:95
LWHist::ensureInitDecorations
void ensureInitDecorations()
Definition: LWHist.cxx:90
DEFAULT_MAXIMUM
#define DEFAULT_MAXIMUM
Definition: LWHist.cxx:52
LWStrUtils::releaseString
static void releaseString(char *&c)
Definition: LWStrUtils.h:70
LWHist::GetMarkerSize
float GetMarkerSize() const
Definition: LWHist.cxx:113
LWStrUtils::stringsEqual
static bool stringsEqual(const char *c1, const char *c2)
Definition: LWStrUtils.h:79
LWPools::release
static void release(char *, unsigned length)
DEFAULT_MINIMUM
#define DEFAULT_MINIMUM
Definition: LWHist.cxx:51
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
DEFAULT_MARKERSIZE
#define DEFAULT_MARKERSIZE
Definition: LWHist.cxx:48
LWHist::LWHistDecorations::m_markerStyle
short m_markerStyle
Definition: LWHist.cxx:81
LWHist::LWHistDecorations::m_xAxis
LWHist::LWHistAxis * m_xAxis
Definition: LWHist.cxx:74
LWHist::LWHistDecorations::m_yAxis
LWHist::LWHistAxis * m_yAxis
Definition: LWHist.cxx:75
LWHist::GetMarkerColor
short GetMarkerColor() const
Definition: LWHist.cxx:96
LWHist::GetXaxis
LWHistAxis * GetXaxis()
Definition: LWHist.cxx:309
LWHist::usingROOTBackend
bool usingROOTBackend() const
Definition: LWHist.h:73
LWHist::GetTitle
const char * GetTitle() const
Definition: LWHist.cxx:372
LWHist::LWHistDecorations::m_markerColor
short m_markerColor
Definition: LWHist.cxx:80
LWHist::m_customData
void * m_customData
Definition: LWHist.h:103
MP_NEW
#define MP_NEW(Class)
Definition: LWPools.h:26
LWHist::LWHistAxis::m_title
char * m_title
Definition: LWHist.h:133
LWHist::LWHistAxis::SetTitle
void SetTitle(const char *)
Definition: LWHist.cxx:359
beamspotman.n
n
Definition: beamspotman.py:731
extractSporadic.h
list h
Definition: extractSporadic.py:97
MP_DELETE
#define MP_DELETE(Ptr)
Definition: LWPools.h:27
LWHist::m_name
char * m_name
Definition: LWHist.h:99
LWHist::LWHistDecorations::m_minimum
float m_minimum
Definition: LWHist.cxx:77
DEFAULT_MARKERSTYLE
#define DEFAULT_MARKERSTYLE
Definition: LWHist.cxx:50
LWStrUtils::setStringFromInput
static void setStringFromInput(const char *input, char *&target)
Definition: LWStrUtils.h:58
LWHist::m_usingROOTBackend
const bool m_usingROOTBackend
Definition: LWHist.h:94
LWHistControls::releaseAllHeldMemory
static void releaseAllHeldMemory()
Definition: LWHistControls.cxx:41
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
LWHist::clear
virtual void clear()
Definition: LWHist.cxx:474
LWHist::m_title
char * m_title
Definition: LWHist.h:100
LWHist::LWHistAxis::m_labelSize
float m_labelSize
Definition: LWHist.h:132
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
a
TList * a
Definition: liststreamerinfos.cxx:10
h
DEFAULT_MARKERCOLOR
#define DEFAULT_MARKERCOLOR
Definition: LWHist.cxx:49
LWHist::LWHistDecorations::m_markerSize
float m_markerSize
Definition: LWHist.cxx:79
TH1
Definition: rootspy.cxx:268
LWHist::getROOTHistBaseNoAlloc
virtual const TH1 * getROOTHistBaseNoAlloc() const =0
LWHist::LWHistDecorations::m_zAxis
LWHist::LWHistAxis * m_zAxis
Definition: LWHist.cxx:76
LWHist::LWHistDecorations::m_maximum
float m_maximum
Definition: LWHist.cxx:78
LWHist::m_decorations
LWHistDecorations * m_decorations
Definition: LWHist.h:101
LWHist::LWHistAxis::m_binLabels
LWBinLabels * m_binLabels
Definition: LWHist.h:134
LWHist::GetMarkerStyle
short GetMarkerStyle() const
Definition: LWHist.cxx:105
LWBinLabels::apply
void apply(TAxis *) const
Definition: LWBinLabels.cxx:38
LWHist::m_nBytesFromPool
unsigned short m_nBytesFromPool
Definition: LWHist.h:91
python.compressB64.c
def c
Definition: compressB64.py:93
LWHist::GetYaxis
LWHistAxis * GetYaxis()
Definition: LWHist.cxx:319
LWHistStats::s_nActiveHists
static std::atomic< long > s_nActiveHists
Definition: LWHistStats.h:36
LWHist::LWHistDecorations::m_option
char * m_option
Definition: LWHist.cxx:73