ATLAS Offline Software
Loading...
Searching...
No Matches
LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
9
10#ifndef LArSamples_Residual_H
11#define LArSamples_Residual_H
12
16#include "TVectorD.h"
17#include <vector>
18#include <map>
20
21class TH1D;
22
23namespace LArSamples
24{
25 class ShapeErrorData;
26
27
29 {
30 public:
31
32 Residual(const TVectorD& deltas = TVectorD(),
33 int run = 0, int event = 0,
34 double adcMax = -1, double time = 0);
35
36 virtual ~Residual();
37
38 const TVectorD& deltas() const { return m_deltas; }
39 int run() const { return m_run; }
40 int event() const { return m_event; }
41 double adcMax() const { return m_adcMax; }
42 double time() const { return m_time; }
43 double scaledDelta(short i) const;
44
45 TVectorD scaledDeltas() const;
46 TVectorD scaledDeltasAndTime() const;
47
48 int lwb() const { return m_deltas.GetLwb(); }
49 int upb() const { return m_deltas.GetUpb(); }
50
51 static bool test();
52
53 private:
54
55 TVectorD m_deltas;
58 };
59
61 {
62 public:
63 ResidualCompare(int sampling) : m_sampling(sampling) { }
64 bool operator() (const Residual& r1, const Residual& r2) const;
65 private:
67 };
68
70
72 {
73 public:
75 Residuals(const std::vector<Residual>& r)
76 : m_residuals(r) { }
77
78 virtual ~Residuals() { }
79
80 unsigned int size() const { return m_residuals.size(); }
81 const Residual* residual(unsigned int i) const { return (i < size() ? &m_residuals[i] : 0); }
82
83 int lwb() const { return (size() > 0 ? residual(0)->lwb() : 0); }
84 int upb() const { return (size() > 0 ? residual(0)->upb() : 0); }
85
86 bool add(const Residual& residual) { m_residuals.push_back(residual); return true; }
87
88 bool medianVars(TVectorD& medians, TVectorD& widths) const;
89 Residuals* truncate(double nWidthsRes, double nWidthsTime = -1, unsigned int nMax = 0) const;
90
91 ResidualCalculator* calculator(bool weigh = false) const;
92
93 TH1D* histogram(short sample, const TString& name, int nBins, double xMin, double xMax) const;
94
95 private:
96 std::vector<Residual> m_residuals;
97 };
98
99
101 {
102 public:
103
105
106 ResidualCalculator(unsigned int l, unsigned int u, bool weigh = false)
107 : m_regresser(l, u + 1), m_weigh(weigh) { }
108
111
113
114 int lwb() const { return regresser()->lwb(); }
115 int upb() const { return regresser()->upb() - 1; }
116
117 unsigned int size() const { return m_events.size(); }
118
119 const Averager* regresser() const { return &m_regresser; }
120 bool weigh() const { return m_weigh; }
121 double weight(const Residual& residual) const;
122
123 bool fill(const Residual& residual);
124 bool remove(const Residual& residual);
125
126 bool append(const ResidualCalculator& other);
127
128 ShapeErrorData* shapeErrorData() const;
129 TString description() const;
130
131 int run(unsigned int i) const { return m_runs[i]; }
132 int event(unsigned int i) const { return m_events[i]; }
133
134 int find(int run, int event) const;
135 bool add(int run, int event);
136
137 private:
138
139 bool fill_with_weight(const Residual& residual, double w);
140
142 //std::map< std::pair<int, int >, bool > m_events;
143 std::vector<int> m_runs, m_events;
145 };
146
147
148}
149
150#endif
std::string histogram
Definition chains.cxx:52
Define macros for attributes used to control the static checker.
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
storage of the time histories of all the cells
Definition Averager.h:23
storage of the time histories of all the cells
Definition IndexRange.h:19
ResidualCalculator(unsigned int l, unsigned int u, bool weigh=false)
ResidualCalculator(const Averager &regresser, bool weigh=false)
Residual(const TVectorD &deltas=TVectorD(), int run=0, int event=0, double adcMax=-1, double time=0)
const Residual * residual(unsigned int i) const
bool add(const std::string &hname, TKey *tobj)
Definition fastadd.cxx:55
int r
Definition globals.cxx:22
std::string description
glabal timer - how long have I taken so far?
Definition hcg.cxx:91
std::string find(const std::string &s)
return a remapped string
Definition hcg.cxx:138
Definition run.py:1
void fill(H5::Group &out_file, size_t iterations)