ATTPCROOT  0.3.0-alpha
A ROOT-based framework for analyzing data from active target detectors
AtPadArray.cxx
Go to the documentation of this file.
1 #include "AtPadArray.h"
2 
3 #include <TH1.h> // for TH1D
4 
5 std::unique_ptr<AtPadBase> AtPadArray::Clone() const
6 {
7  return std::make_unique<AtPadArray>(*this);
8 }
9 
10 std::unique_ptr<TH1D> AtPadArray::GetHist(std::string name) const
11 {
12  auto hist = std::make_unique<TH1D>(name.c_str(), name.c_str(), fArray.size(), 0, fArray.size() - 1);
13  hist->SetDirectory(nullptr); // Pass ownership to the pointer instead of current ROOT directory
14  for (int i = 0; i < fArray.size(); ++i)
15  hist->SetBinContent(i + 1, fArray[i]);
16  return hist;
17 }
AtPadArray::GetHist
std::unique_ptr< TH1D > GetHist(std::string name) const
Definition: AtPadArray.cxx:10
ClassImp
ClassImp(AtPadArray)
AtPadArray.h
AtPadArray::fArray
traceDouble fArray
Definition: AtPadArray.h:29
AtPadArray
Holds an addition array of doubles for an AtPad.
Definition: AtPadArray.h:24
AtPadArray::Clone
virtual std::unique_ptr< AtPadBase > Clone() const override
Definition: AtPadArray.cxx:5