ATLAS Offline Software
Loading...
Searching...
No Matches
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
10
11#ifndef LArSamples_SimpleShape_H
12#define LArSamples_SimpleShape_H
13
14#include "LArCafJobs/AbsShape.h"
15#include <vector>
17#include <memory>
18class TH1D;
19class TGraph;
20
21namespace 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
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
void diff(const Jet &rJet1, const Jet &rJet2, std::map< std::string, double > varDiff)
Difference between jets - Non-Class function required by trigger.
Definition Jet.cxx:631
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
TVectorD values(int lwb, int upb) const
Definition AbsShape.cxx:135
unsigned int nPoints() const
Definition SimpleShape.h:48
SimpleShape(const std::vector< double > &values, const std::vector< double > &errors, double timeInterval=25, double startTime=0)
Constructor.
SimpleShape(const SimpleShape &other)
Definition SimpleShape.h:35
double timeInterval() const
Definition SimpleShape.h:45
void set(unsigned int i, double value, double error=-1)
Definition SimpleShape.h:53
std::vector< double > m_errors
Definition SimpleShape.h:68
double startTime() const
Definition SimpleShape.h:46
void setError(unsigned int i, double error)
Definition SimpleShape.h:54
double covariance(unsigned int i, unsigned int j) const
Definition SimpleShape.h:51
std::vector< double > m_values
Definition SimpleShape.h:68
double value(unsigned int i) const
Definition SimpleShape.h:49
bool add(const std::string &hname, TKey *tobj)
Definition fastadd.cxx:55