ATLAS Offline Software
Loading...
Searching...
No Matches
LArShapeComplete.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3*/
4
5
7
8const std::vector<float> LArShapeComplete::m_empty;
9
12
14
15/* Fill transient object in ATHENA *****************************************
16 */
17void LArShapeComplete::set(const HWIdentifier& CellID, int gain,
18 const std::vector<std::vector<float> >& vShape,
19 const std::vector<std::vector<float> >& vShapeDer,
20 float timeOffset, float timeBinWidth)
21{
22 LArShapeP2 t (timeOffset, timeBinWidth, vShape, vShapeDer);
23 setPdata(CellID, t, gain) ;
24}
25
26/* retrieve Shape for a given tbin using online ID ****************************
27 */
30 int gain,
31 int tbin,
32 int /*mode*/) const
33{
34 // 'mode' setting is ignored
35 CONTAINER::ConstReference t = get(CellID,gain) ;
36 if (!t.isValid() || tbin<0 || tbin>=(int)t.shapeSize())
37 return m_empty;
38 return t.shape (tbin);
39}
40
41/* retrieve Shape derivative for a given tbin using online ID ****************************
42 */
45 int gain,
46 int tbin,
47 int /*mode*/) const
48{
49 // 'mode' setting is ignored
50 CONTAINER::ConstReference t = get(CellID,gain) ;
51 if (!t.isValid() || tbin<0 || tbin>=(int)t.shapeDerSize())
52 return m_empty;
53 return t.shapeDer (tbin);
54}
55
56
57
58//retrieving time offset using onlineID
59float LArShapeComplete::timeOffset(const HWIdentifier& CellID, int gain) const {
60 if (gain<0 || gain>3) {
61 std::cout << "ERROR! LArShapeComplete::timeOffset time offset called for gain " << gain << std::endl;
62 std::cout.flush();
63 return 0;
64 }
65
66 CONTAINER::ConstReference t = get(CellID,gain) ;
67 if (!t.isValid()) return 0;
68 return t.timeOffset();
69}
70
71//For the TB / cosmic case: retrieve the number of time-bins (aka "phases")
72unsigned LArShapeComplete::nTimeBins(const HWIdentifier& CellID, int gain) const {
73 if (gain<0 || gain>3) {
74 std::cout << "ERROR! LArShapeComplete::nTimeBins time offset called for gain " << gain << std::endl;
75 std::cout.flush();
76 }
77 CONTAINER::ConstReference t = get(CellID,gain) ;
78 if (!t.isValid()) return 0;
79 return t.shapeSize(); //Check also b-coefficient?
80}
81
82//For the TB / cosmic case: retrieve the width of the time bin (default 24 bins in 25 ns)
83float LArShapeComplete::timeBinWidth(const HWIdentifier& CellID, int gain) const {
84 if (gain<0 || gain>3) {
85 std::cout << "ERROR! LArShapeComplete::timeBinWidth time offset called for gain " << gain << std::endl;
86 std::cout.flush();
87 }
88 CONTAINER::ConstReference t = get(CellID,gain) ;
89 if (!t.isValid()) return 0;
90 return t.timeBinWidth();
91}
void setPdata(const HWIdentifier id, const LArShapeP2 &payload, unsigned int gain=0)
ConstReference get(const HWIdentifier id, unsigned int gain=0) const
void set(const HWIdentifier &CellID, int gain, const std::vector< std::vector< float > > &vShape, const std::vector< std::vector< float > > &vShapeDer, float timeOffset=0, float timeBinWidth=25./24.)
virtual ShapeRef_t ShapeDer(const HWIdentifier &CellID, int gain, int tbin=0, int mode=0) const override
virtual float timeBinWidth(const HWIdentifier &CellID, int gain) const
virtual unsigned nTimeBins(const HWIdentifier &CellID, int gain) const
virtual float timeOffset(const HWIdentifier &CellID, int gain) const
virtual ShapeRef_t Shape(const HWIdentifier &CellID, int gain, int tbin=0, int mode=0) const override
static const std::vector< float > m_empty
ILArShape::ShapeRef_t ShapeRef_t
c-struct reproducing the structure of the persistent data
Definition LArShapeP2.h:21