ATLAS Offline Software
LArCalorimeter
LArCafJobs
src
ShapeInfo.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
LArCafJobs/ShapeInfo.h
"
6
7
#include "
LArCafJobs/ClassCounts.h
"
8
#include "TH1D.h"
9
#include "TGraph.h"
10
#include "TMath.h"
11
12
#include <iostream>
13
using
std::cout;
14
using
std::endl;
15
16
using namespace
LArSamples
;
17
18
19
double
ShapeInfo::m_timeShift
= 0;
20
21
// Samples, phases :
22
// 5samples, 17phases means that for each sample we have 17 points ........x........ where x is the sample
23
// However the edge points correspond to the samples before and after so we have
24
// For 5 samples ........x.......x.......x.......x.......x........ (7 points in-between but 8 before and after)
25
// So for N samples, P phases, we have Npoints = P' + (N- 1)*P' + 1 + P' = (N+1)*P' + 1
26
// where P' = (P-1)/2.
27
28
ShapeInfo::ShapeInfo
(
unsigned
char
nSamples
,
unsigned
char
binSize,
unsigned
char
nPhases,
float
shift)
29
: m_nSamples(
nSamples
), m_binSize(binSize), m_nPhases(nPhases), m_shift(shift)
30
{
31
ClassCounts::incrementInstanceCount
(
"ShapeInfo"
);
32
unsigned
int
nPoints
=
nIntervals
()*(
nSamples
- 1) +
nPhases
;
33
m_values
.resize(
nPoints
, 0);
34
}
35
36
37
ShapeInfo::ShapeInfo
(
const
ShapeInfo
&
other
)
38
: m_values(
other
.m_values),
39
m_nSamples(
other
.m_nSamples), m_binSize(
other
.m_binSize),
40
m_nPhases(
other
.m_nPhases), m_shift(
other
.m_shift)
41
{
42
ClassCounts::incrementInstanceCount
(
"ShapeInfo"
);
43
}
44
45
46
ShapeInfo::~ShapeInfo
()
47
{
48
ClassCounts::decrementInstanceCount
(
"ShapeInfo"
);
49
}
50
51
52
bool
ShapeInfo::isValid
()
const
53
{
54
return
(!
m_values
.empty());
55
}
56
57
58
double
ShapeInfo::value
(
unsigned
int
i
)
const
59
{
60
if
(
i
<
m_values
.size())
return
double
(
m_values
[
i
])/32767;
61
if
(
i
==
m_values
.size() &&
m_values
.size() >= 2)
62
return
2*
value
(
i
- 1) -
value
(
i
- 2);
63
return
-1E99;
64
}
65
66
unsigned
char
ShapeInfo::phase
(
unsigned
int
i
)
const
67
{
68
return
(
i
%
nIntervals
());
69
}
70
71
72
void
ShapeInfo::set
(
unsigned
char
iSample,
unsigned
char
iPhase,
float
value
)
73
{
74
unsigned
int
index
= iPhase + iSample*
nIntervals
();
75
m_values
[
index
] =
int
(
value
*32767 + 0.5) + (
value
> 0 ? 0 : -1);
76
}
LArSamples::ShapeInfo::nIntervals
unsigned int nIntervals() const
Definition:
ShapeInfo.h:41
LArSamples::ShapeInfo::nPhases
unsigned char nPhases() const
Definition:
ShapeInfo.h:40
LArSamples::ShapeInfo::nPoints
unsigned int nPoints() const
Definition:
ShapeInfo.h:37
CaloCellPos2Ntuple.int
int
Definition:
CaloCellPos2Ntuple.py:24
LArSamples::ShapeInfo::phase
unsigned char phase(unsigned int i) const
Definition:
ShapeInfo.cxx:66
index
Definition:
index.py:1
LArSamples::ShapeInfo::m_timeShift
static double m_timeShift
Definition:
ShapeInfo.h:72
LArSamples::ShapeInfo::~ShapeInfo
~ShapeInfo()
Definition:
ShapeInfo.cxx:46
LArSamples::ShapeInfo::isValid
bool isValid() const
Definition:
ShapeInfo.cxx:52
athena.value
value
Definition:
athena.py:124
LArSamples
Definition:
AbsShape.h:24
LArSamples::ShapeInfo::set
void set(unsigned char iSample, unsigned char iPhase, float value)
Definition:
ShapeInfo.cxx:72
LArSamples::ShapeInfo
Definition:
ShapeInfo.h:24
LArSamples::ShapeInfo::value
double value(unsigned int i) const
Definition:
ShapeInfo.cxx:58
LArSamples::ShapeInfo::m_values
std::vector< short > m_values
Definition:
ShapeInfo.h:69
LArSamples::ShapeInfo::nSamples
unsigned char nSamples() const
Definition:
ShapeInfo.h:39
ShapeInfo.h
LArSamples::ShapeInfo::ShapeInfo
ShapeInfo(unsigned char nSamples=5, unsigned char binSize=3, unsigned char nPhases=8, float shift=0)
Constructor
Definition:
ShapeInfo.cxx:28
lumiFormat.i
int i
Definition:
lumiFormat.py:85
LArSamples::ClassCounts::decrementInstanceCount
void decrementInstanceCount() const
Definition:
LArCafJobs/LArCafJobs/ClassCounts.h:33
xAOD::double
double
Definition:
CompositeParticle_v1.cxx:159
LArSamples::ClassCounts::incrementInstanceCount
void incrementInstanceCount() const
Definition:
LArCafJobs/LArCafJobs/ClassCounts.h:32
DeMoScan.index
string index
Definition:
DeMoScan.py:364
InDetDD::other
@ other
Definition:
InDetDD_Defs.h:16
LArDigits2NtupleDumper.nSamples
nSamples
Definition:
LArDigits2NtupleDumper.py:70
ClassCounts.h
Generated on Sun Dec 22 2024 21:18:04 for ATLAS Offline Software by
1.8.18