ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
TestBeam
TBRec
src
CBNTAA_TBTDCRaw.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
CBNTAA_TBTDCRaw.h
"
6
#include "
TBEvent/TBTDCRawCont.h
"
7
#include <vector>
8
9
CBNTAA_TBTDCRaw::CBNTAA_TBTDCRaw
(
const
std::string & name, ISvcLocator * pSvcLocator) :
CBNT_TBRecBase
(name, pSvcLocator)
10
{
11
declareProperty
(
"NeverReturnFailure"
,
m_neverReturnFailure
=
false
);
12
declareProperty
(
"ContainerKey1"
,
m_containerKey1
=
"TDCRawCont"
);
13
m_tdc
=NULL;
14
m_underThreshold
=NULL;
15
}
16
17
CBNTAA_TBTDCRaw::~CBNTAA_TBTDCRaw
()
18
{
//Clean up arrays of ntuple entries (if they have been booked)
19
if
(
m_tdc
)
20
delete
m_tdc
;
21
if
(
m_underThreshold
)
22
delete
m_underThreshold
;
23
}
24
25
StatusCode
CBNTAA_TBTDCRaw::CBNT_initialize
()
26
{
27
ATH_MSG_DEBUG
(
"in initialize()"
);
28
29
addBranch
(
"TBTDCRaw"
,
m_tdc
);
30
addBranch
(
"TBTDCRaw_underThreshold"
,
m_underThreshold
);
31
32
return
StatusCode::SUCCESS;
33
34
}
35
36
StatusCode
CBNTAA_TBTDCRaw::CBNT_execute
()
37
{
38
const
TBTDCRawCont
* tdcCont;
39
StatusCode
sc
=
evtStore
()->retrieve(tdcCont,
m_containerKey1
);
40
if
(
sc
.isFailure())
41
{
42
ATH_MSG_ERROR
(
"\033[31m"
<<
" Cannot read TBTDCRawCont from StoreGate! key= "
<<
m_containerKey1
<<
"\033[0m"
);
43
if
(
m_neverReturnFailure
) {
44
return
StatusCode::SUCCESS;
45
}
else
{
46
return
StatusCode::FAILURE;
47
}
48
}
49
else
50
{
51
ATH_MSG_DEBUG
(
"\033[31m"
<<
"Going over TBTDCRawCont channels ..."
<<
"\033[0m"
);
52
53
const
unsigned
nTDC = (
TBTDCRawCont::size_type
)tdcCont->
size
();
54
m_tdc
->resize(nTDC);
55
m_underThreshold
->resize(nTDC);
56
57
unsigned
NtupleVectorIndex = 0;
58
for
(
const
TBTDCRaw
* tdc : *tdcCont) {
59
(*m_tdc)[NtupleVectorIndex] = tdc->getTDC();
60
(*m_underThreshold)[NtupleVectorIndex] = tdc->isUnderThreshold();
61
}
62
}
63
64
return
StatusCode::SUCCESS;
65
}
66
67
StatusCode
CBNTAA_TBTDCRaw::CBNT_clear
()
68
{
69
if
(
m_tdc
)
70
m_tdc
->clear();
71
if
(
m_underThreshold
)
72
m_underThreshold
->clear();
73
74
return
StatusCode::SUCCESS;
75
}
76
77
StatusCode
CBNTAA_TBTDCRaw::CBNT_finalize
()
78
{
79
ATH_MSG_DEBUG
(
"in finalize()"
);
80
return
StatusCode::SUCCESS;
81
}
82
83
std::string
CBNTAA_TBTDCRaw::add_name
(
const
char
*
base
,
const
std::string& extension) {
84
std::string retval(
base
);
85
for
(
unsigned
i=0;i<extension.size();i++) {
86
const
char
& ch=extension[i];
87
if
(ch==
'='
|| ch==
':'
|| ch==
'/'
)
88
continue
;
//Inore these characters
89
else
if
(ch==
'-'
)
90
retval.append(
"m"
);
//replace by letter m
91
else
if
(ch==
'+'
)
92
retval.append(
"p"
);
//replace by letter p
93
else
94
retval.append(1,ch);
95
}
96
return
retval;
97
}
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x,...)
Definition
AthMsgStreamMacros.h:47
CBNTAA_TBTDCRaw.h
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
TBTDCRawCont.h
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthCommonAlgorithm< Gaudi::Algorithm >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
Definition
AthCommonDataStore.h:85
CBNTAA_TBTDCRaw::m_tdc
std::vector< unsigned int > * m_tdc
Definition
CBNTAA_TBTDCRaw.h:37
CBNTAA_TBTDCRaw::CBNT_execute
virtual StatusCode CBNT_execute() override
Definition
CBNTAA_TBTDCRaw.cxx:36
CBNTAA_TBTDCRaw::~CBNTAA_TBTDCRaw
virtual ~CBNTAA_TBTDCRaw()
Definition
CBNTAA_TBTDCRaw.cxx:17
CBNTAA_TBTDCRaw::CBNTAA_TBTDCRaw
CBNTAA_TBTDCRaw(const std::string &name, ISvcLocator *pSvcLocator)
Definition
CBNTAA_TBTDCRaw.cxx:9
CBNTAA_TBTDCRaw::m_underThreshold
std::vector< bool > * m_underThreshold
Definition
CBNTAA_TBTDCRaw.h:38
CBNTAA_TBTDCRaw::CBNT_initialize
virtual StatusCode CBNT_initialize() override
Definition
CBNTAA_TBTDCRaw.cxx:25
CBNTAA_TBTDCRaw::CBNT_finalize
virtual StatusCode CBNT_finalize() override
Definition
CBNTAA_TBTDCRaw.cxx:77
CBNTAA_TBTDCRaw::CBNT_clear
virtual StatusCode CBNT_clear() override
Definition
CBNTAA_TBTDCRaw.cxx:67
CBNTAA_TBTDCRaw::add_name
std::string add_name(const char *base, const std::string &extension)
Definition
CBNTAA_TBTDCRaw.cxx:83
CBNTAA_TBTDCRaw::m_containerKey1
std::string m_containerKey1
Definition
CBNTAA_TBTDCRaw.h:39
CBNTAA_TBTDCRaw::m_neverReturnFailure
bool m_neverReturnFailure
Definition
CBNTAA_TBTDCRaw.h:35
CBNT_TBRecBase::addBranch
void addBranch(const std::string &branchname, T &obj, const std::string &leaflist)
Definition
CBNT_TBRecBase.h:44
CBNT_TBRecBase::CBNT_TBRecBase
CBNT_TBRecBase(const std::string &name, ISvcLocator *pSvcLocator)
Definition
CBNT_TBRecBase.cxx:12
DataVector< TBTDCRaw >::size_type
typename DataVectorBase< TBTDCRaw >::Base::size_type size_type
Definition
DataVector.h:814
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
TBTDCRawCont
"TBEvent/TBTDCRawCont.h"
Definition
TBTDCRawCont.h:21
TBTDCRaw
Data object holding tdc measurement.
Definition
TBTDCRaw.h:21
base
std::string base
Definition
hcg.cxx:83
Generated on
for ATLAS Offline Software by
1.17.0