5#ifndef SHIPDATA_EVENTHISTOGRAM_H_
6#define SHIPDATA_EVENTHISTOGRAM_H_
12#include "TDirectory.h"
15#include "TMatrixDSym.h"
55 Double_t xlow, Double_t xup, Bool_t covariance = kFALSE,
58 const Double_t* edges, Bool_t covariance = kFALSE,
66 void Fill(Double_t x, Double_t w = 1.);
69 void EndEvent(ULong64_t eventKey = 0);
81 TH1D*
MakeResult(
const char* name =
nullptr)
const;
83 TH1D*
MakeNaive(
const char* name =
nullptr)
const;
86 TH1D*
MakeNeff(
const char* name =
nullptr)
const;
97 void Write(TDirectory* dir = gDirectory)
const;
98 static std::unique_ptr<EventHistogram>
Read(TDirectory* dir,
102 return (run << 32) ^ event;
110 void Init(Bool_t covariance, Int_t nReplicas);
113 TH1D*
MakePerEvent(
const char* name,
const char* suffix)
const;
EventHistogram(const EventHistogram &)=delete
std::vector< bool > fIsTouched
per bin: listed in fTouched
TH1D * MakeNeff(const char *name=nullptr) const
void Fill(Double_t x, Double_t w=1.)
Add one branch of the current event.
std::unique_ptr< TH2D > fCov
optional: sum t_a t_b
Long64_t GetNEvents() const
TH1D * MakePerEvent(const char *name, const char *suffix) const
void Init(Bool_t covariance, Int_t nReplicas)
static std::unique_ptr< EventHistogram > Read(TDirectory *dir, const char *name)
static Int_t ReplicaWeight(ULong64_t key, Int_t replica)
TH1D * MakeResult(const char *name=nullptr) const
Contents per generated event with event-level errors.
std::unique_ptr< TH1D > fSum
contents sum t, sumw2 sum t^2
void AddEmptyEvents(Long64_t n)
Generated events that left no entry still count in the normalisation.
std::unique_ptr< TH2D > fBoot
optional: (bin, replica) sum r t
EventHistogram(const char *name, const char *title, Int_t nbins, Double_t xlow, Double_t xup, Bool_t covariance=kFALSE, Int_t nReplicas=0)
void EndEvent(ULong64_t eventKey=0)
void Add(const EventHistogram &other)
std::vector< Double_t > fCurrent
t_b of the open event, incl. flows
TH1D * MakeNaive(const char *name=nullptr) const
Same contents with sqrt(sum w^2)/N errors, for comparison only.
std::unique_ptr< TH1D > fNaive
contents sum w, sumw2 sum w^2
Bool_t HasOpenEvent() const
EventHistogram & operator=(const EventHistogram &)=delete
void CheckClosed(const char *where) const
TMatrixDSym GetCovariance() const
std::vector< Double_t > GetBootstrapErrors() const
std::vector< Int_t > fTouched
bins filled in the open event
void Write(TDirectory *dir=gDirectory) const
static ULong64_t MakeEventKey(ULong64_t run, ULong64_t event)