ATLAS Offline Software
SimpleShape.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
11 #ifndef LArSamples_SimpleShape_H
12 #define LArSamples_SimpleShape_H
13 
14 #include "LArCafJobs/AbsShape.h"
15 #include <vector>
17 #include <memory>
18 class TH1D;
19 class TGraph;
20 
21 namespace LArSamples {
22 
23  class ShapeInfo;
24 
26 
27  public:
28 
30  SimpleShape(const std::vector<double>& values, const std::vector<double>& errors,
31  double timeInterval = 25, double startTime = 0);
32 
33  SimpleShape(unsigned int nPoints, double timeInterval = 25, double startTime = 0);
34 
36  AbsShape(),
37  m_values(other.m_values), m_errors(other.m_errors),
38  m_timeInterval(other.m_timeInterval), m_startTime(other.m_startTime) { }
39 
40  SimpleShape(const ShapeInfo& shapeInfo, double scale = 1, double shift = 0, bool samplingTimeOnly = false);
41  SimpleShape(const AbsShape& other, double scale = 1, double shift = 0);
42 
43  virtual ~SimpleShape() { }
44 
45  double timeInterval() const { return m_timeInterval; }
46  double startTime() const { return m_startTime; }
47 
48  unsigned int nPoints() const { return m_values.size(); }
49  double value(unsigned int i) const { return (i < m_values.size() ? m_values[i] : -1E99); }
50  double time(unsigned int i) const;
51  double covariance(unsigned int i, unsigned int j) const { return (i == j ? m_errors[i]*m_errors[i] : 0); }
52 
53  void set(unsigned int i, double value, double error = -1) { m_values[i] = value; if (error > 0) m_errors[i] = error; }
54  void setError(unsigned int i, double error) { m_errors[i] = error; }
55 
56  SimpleShape* diff() const;
57 
58  bool add(unsigned int k, double value, double error);
59  SimpleShape* add(const AbsShape& other, double scale = 1, double shift = 0);
60  SimpleShape* createEmpty() const;
61  TH1D* histogram(const char* name = "shape", const char* title = "", bool timeInUnitOfSamples = false) const;
62 
63  static bool add(std::unique_ptr<SimpleShape>& s1, const AbsShape& s2);
64  static bool scaleAndShift(std::unique_ptr<SimpleShape>& s1, double scale, double shift = 0);
65 
66  private:
67 
68  std::vector<double> m_values, m_errors;
69  double m_timeInterval{}, m_startTime{};
70 
71  SimpleShape& operator= (const SimpleShape&);
72  };
73 }
74 
75 #endif
76 
LArSamples::SimpleShape::m_values
std::vector< double > m_values
Definition: SimpleShape.h:68
AbsShape.h
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
LArSamples::SimpleShape::~SimpleShape
virtual ~SimpleShape()
Definition: SimpleShape.h:43
lumiFormat.startTime
startTime
Definition: lumiFormat.py:95
LArSamples::SimpleShape
Definition: SimpleShape.h:25
mc.diff
diff
Definition: mc.SFGenPy8_MuMu_DD.py:14
athena.value
value
Definition: athena.py:124
LArSamples::SimpleShape::nPoints
unsigned int nPoints() const
Definition: SimpleShape.h:48
LArSamples
Definition: AbsShape.h:24
yodamerge_tmp.scale
scale
Definition: yodamerge_tmp.py:138
LArSamples::ShapeInfo
Definition: ShapeInfo.h:24
python.Bindings.values
values
Definition: Control/AthenaPython/python/Bindings.py:805
LArSamples::SimpleShape::set
void set(unsigned int i, double value, double error=-1)
Definition: SimpleShape.h:53
LArSamples::SimpleShape::startTime
double startTime() const
Definition: SimpleShape.h:46
LArSamples::SimpleShape::covariance
double covariance(unsigned int i, unsigned int j) const
Definition: SimpleShape.h:51
lumiFormat.i
int i
Definition: lumiFormat.py:85
LArSamples::SimpleShape::timeInterval
double timeInterval() const
Definition: SimpleShape.h:45
covarianceTool.title
title
Definition: covarianceTool.py:542
add
bool add(const std::string &hname, TKey *tobj)
Definition: fastadd.cxx:55
mergePhysValFiles.errors
list errors
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:43
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
LArSamples::SimpleShape::SimpleShape
SimpleShape(const SimpleShape &other)
Definition: SimpleShape.h:35
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
LArSamples::AbsShape
Definition: AbsShape.h:28
ReadCellNoiseFromCoolCompare.s2
s2
Definition: ReadCellNoiseFromCoolCompare.py:379
LArSamples::SimpleShape::setError
void setError(unsigned int i, double error)
Definition: SimpleShape.h:54
get_generator_info.error
error
Definition: get_generator_info.py:40
checker_macros.h
Define macros for attributes used to control the static checker.
LArSamples::SimpleShape::value
double value(unsigned int i) const
Definition: SimpleShape.h:49
error
Definition: IImpactPoint3dEstimator.h:70
histogram
std::string histogram
Definition: chains.cxx:52
fitman.k
k
Definition: fitman.py:528