ATLAS Offline Software
Loading...
Searching...
No Matches
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"
7#include <vector>
8
9CBNTAA_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;
15}
16
18{//Clean up arrays of ntuple entries (if they have been booked)
19 if (m_tdc)
20 delete m_tdc;
22 delete m_underThreshold;
23}
24
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
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" );
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
68{
69 if (m_tdc)
70 m_tdc->clear();
72 m_underThreshold->clear();
73
74 return StatusCode::SUCCESS;
75}
76
78{
79 ATH_MSG_DEBUG ( "in finalize()" );
80 return StatusCode::SUCCESS;
81}
82
83std::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}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
static Double_t sc
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
std::vector< unsigned int > * m_tdc
virtual StatusCode CBNT_execute() override
virtual ~CBNTAA_TBTDCRaw()
CBNTAA_TBTDCRaw(const std::string &name, ISvcLocator *pSvcLocator)
std::vector< bool > * m_underThreshold
virtual StatusCode CBNT_initialize() override
virtual StatusCode CBNT_finalize() override
virtual StatusCode CBNT_clear() override
std::string add_name(const char *base, const std::string &extension)
std::string m_containerKey1
void addBranch(const std::string &branchname, T &obj, const std::string &leaflist)
CBNT_TBRecBase(const std::string &name, ISvcLocator *pSvcLocator)
typename DataVectorBase< TBTDCRaw >::Base::size_type size_type
Definition DataVector.h:814
size_type size() const noexcept
Returns the number of elements in the collection.
"TBEvent/TBTDCRawCont.h"
Data object holding tdc measurement.
Definition TBTDCRaw.h:21
std::string base
Definition hcg.cxx:81