ATLAS Offline Software
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 
10 #ifndef LArSamples_Residual_H
11 #define LArSamples_Residual_H
12 
14 #include "LArCafJobs/Definitions.h"
15 #include "LArSamplesMon/Averager.h"
16 #include "TVectorD.h"
17 #include <vector>
18 #include <map>
20 
21 class TH1D;
22 
23 namespace 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;
56  int m_run, m_event;
57  double m_adcMax, m_time;
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 
69  class ResidualCalculator;
70 
72  {
73  public:
74  Residuals() { }
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 
104  ResidualCalculator() : m_weigh(false) { }
105 
106  ResidualCalculator(unsigned int l, unsigned int u, bool weigh = false)
107  : m_regresser(l, u + 1), m_weigh(weigh) { }
108 
109  ResidualCalculator(const Averager& regresser, bool weigh = false)
110  : m_regresser(regresser), m_weigh(weigh) { }
111 
112  virtual ~ResidualCalculator() { }
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;
144  bool m_weigh;
145  };
146 
147 
148 }
149 
150 #endif
LArSamples::ResidualCalculator::m_runs
std::vector< int > m_runs
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:143
LArSamples::ResidualCalculator::m_regresser
Averager m_regresser
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:141
beamspotman.r
def r
Definition: beamspotman.py:676
LArSamples::ResidualCompare::ResidualCompare
ResidualCompare(int sampling)
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:63
LArSamples::Residual::event
int event() const
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:40
LArSamples::ResidualCalculator::lwb
int lwb() const
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:114
IndexRange.h
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
LArSamples::Residuals::residual
const Residual * residual(unsigned int i) const
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:81
ATLAS_NOT_THREAD_SAFE
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
Definition: checker_macros.h:212
ClusterSeg::residual
@ residual
Definition: ClusterNtuple.h:20
LArSamples::Residuals::~Residuals
virtual ~Residuals()
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:78
LArSamples::Residuals::m_residuals
std::vector< Residual > m_residuals
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:96
LArSamples::ResidualCalculator::weigh
bool weigh() const
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:120
LArSamples::ResidualCalculator::ResidualCalculator
ResidualCalculator(const Averager &regresser, bool weigh=false)
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:109
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
LArSamples
Definition: AbsShape.h:24
LArSamples::ResidualCalculator::regresser
const Averager * regresser() const
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:119
TrigInDetValidation_Base.test
test
Definition: TrigInDetValidation_Base.py:147
LArSamples::Averager
storage of the time histories of all the cells
Definition: Averager.h:23
LArSamples::ResidualCalculator::size
unsigned int size() const
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:117
LArSamples::ResidualCalculator
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:101
LArSamples::ResidualCalculator::run
int run(unsigned int i) const
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:131
dumpHVPathFromNtuple.append
bool append
Definition: dumpHVPathFromNtuple.py:91
LArSamples::Residual::m_deltas
TVectorD m_deltas
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:55
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
Averager.h
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
PixelModuleFeMask_create_db.remove
string remove
Definition: PixelModuleFeMask_create_db.py:83
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
FullCPAlgorithmsTest_eljob.sample
sample
Definition: FullCPAlgorithmsTest_eljob.py:113
lumiFormat.i
int i
Definition: lumiFormat.py:85
ShapeErrorData
Liquid Argon class for standalone storage of cell shape information.
LArSamples::Residuals::Residuals
Residuals(const std::vector< Residual > &r)
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:75
LArSamples::Residual::upb
int upb() const
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:49
add
bool add(const std::string &hname, TKey *tobj)
Definition: fastadd.cxx:55
run
Definition: run.py:1
LArSamples::Residual::lwb
int lwb() const
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:48
LArSamples::Residual
storage of a pulse shape residual set
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:29
LArSamples::ResidualCalculator::ResidualCalculator
ResidualCalculator(unsigned int l, unsigned int u, bool weigh=false)
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:106
LArSamples::Residuals
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:72
fill
void fill(H5::Group &out_file, size_t iterations)
Definition: test-hdf5-writer.cxx:95
dumpTgcDigiJitter.nBins
list nBins
Definition: dumpTgcDigiJitter.py:29
LArSamples::Residual::m_time
double m_time
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:57
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
LArSamples::ResidualCalculator::~ResidualCalculator
virtual ~ResidualCalculator()
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:112
LArSamples::ResidualCalculator::ResidualCalculator
ResidualCalculator()
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:104
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
LArSamples::Residuals::size
unsigned int size() const
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:80
LArSamples::Residuals::add
bool add(const Residual &residual)
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:86
LArSamples::ResidualCompare::m_sampling
int m_sampling
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:66
LArSamples::ResidualCalculator::upb
int upb() const
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:115
LArSamples::ResidualCalculator::m_weigh
bool m_weigh
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:144
LArSamples::IndexRange
storage of the time histories of all the cells
Definition: IndexRange.h:19
Definitions.h
LArSamples::Residual::m_run
int m_run
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:56
LArSamples::Residuals::upb
int upb() const
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:84
LArSamples::ShapeErrorData
Definition: ShapeErrorData.h:19
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
checker_macros.h
Define macros for attributes used to control the static checker.
LArSamples::Residuals::lwb
int lwb() const
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:83
LArSamples::ResidualCompare
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:61
histogram
std::string histogram
Definition: chains.cxx:52
LArSamples::Residual::time
double time() const
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:42
description
std::string description
glabal timer - how long have I taken so far?
Definition: hcg.cxx:88
LArSamples::ResidualCalculator::event
int event(unsigned int i) const
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:132
LArSamples::Residuals::Residuals
Residuals()
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:74
LArSamples::Residual::run
int run() const
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:39
LArSamples::Residual::adcMax
double adcMax() const
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:41
LArG4ShowerLibProcessing.truncate
truncate
Definition: LArG4ShowerLibProcessing.py:39
LArSamples::Residual::deltas
const TVectorD & deltas() const
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:38