Belle II Software development
RefHistObject.cc
1
2/**************************************************************************
3 * basf2 (Belle II Analysis Software Framework) *
4 * Author: The Belle II Collaboration *
5 * *
6 * See git log for contributors and copyright holders. *
7 * This file is licensed under LGPL-3.0, see LICENSE.md. *
8 **************************************************************************/
9#include "dqm/analysis/RefHistObject.h"
10
11using namespace Belle2;
12
14{
15 auto orgref = m_refHist.get();
16 if (m_refCopy != nullptr) {
17 // if it exists already (->second call), we clear it only.
18 // thus the pointer is not changed!
19 m_refCopy->Reset();
20 m_refCopy->Add(orgref);
21 } else {
22 // is orgref is nullptr, just make a copy
23 if (orgref && (orgref->InheritsFrom("TH1C") or orgref->InheritsFrom("TH1S"))) {
24 m_refCopy = std::unique_ptr<TH1> (new TH1F()); // we want it a float for better scaling
25 orgref->Copy(*m_refCopy.get());
26 } else if (orgref && (orgref->InheritsFrom("TH1I") or orgref->InheritsFrom("TH1L"))) {
27 m_refCopy = std::unique_ptr<TH1> (new TH1D()); // we want it a float for better scaling
28 orgref->Copy(*m_refCopy.get());
29 } else {
30 // keep TProfile, TH1F or TH1D
31 m_refCopy = std::unique_ptr<TH1> ((TH1*)orgref->Clone());
32 }
33 m_refCopy->SetLineStyle(2);
34 m_refCopy->SetLineColor(3);
35 m_refCopy->SetFillColor(0);
36 m_refCopy->SetStats(kFALSE);
37 }
38}
39
41{
43 return m_refCopy.get();
44}
std::unique_ptr< TH1 > m_refCopy
Pointer to scaled reference histogram.
Definition: RefHistObject.h:28
std::unique_ptr< TH1 > m_refHist
Pointer to reference histogram.
Definition: RefHistObject.h:27
TH1 * getReference(void)
Get reference pointer for copy.
void makeReferenceCopy(void)
Make a reference copy.
Abstract base class for different kinds of events.