ATLAS Offline Software
Loading...
Searching...
No Matches
CBNTAA_TBADCRaw.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_TBADCRaw.h"
6
8#include <vector>
9
10CBNTAA_TBADCRaw::CBNTAA_TBADCRaw(const std::string & name, ISvcLocator * pSvcLocator) : CBNT_TBRecBase(name, pSvcLocator)
11{
12 declareProperty("NeverReturnFailure", m_neverReturnFailure=false);
13 declareProperty("ContainerKey1",m_containerKey1="ADCRawCont");
14 m_adc=NULL;
15}
16
18{//Clean up arrays of ntuple entries (if they have been booked)
19 delete m_adc;
20}
21
23{
24 ATH_MSG_DEBUG ( "in initialize()" );
25
26 addBranch("TBADCRaw",m_adc);
27 return StatusCode::SUCCESS;
28
29}
30
32{
33 const TBADCRawCont * adcCont;
34 StatusCode sc = evtStore()->retrieve(adcCont,m_containerKey1);
35 if (sc.isFailure())
36 {
37 ATH_MSG_ERROR ( "\033[31m" << " Cannot read TBADCRawCont from StoreGate! key= " << m_containerKey1 << "\033[0m" );
39 return StatusCode::SUCCESS;
40 } else {
41 return StatusCode::FAILURE;
42 }
43 }
44 else
45 {
46 ATH_MSG_DEBUG ( "\033[31m" << "Going over TBADCRawCont channels ..."<< "\033[0m" );
47
48 const unsigned nADC = (TBADCRawCont::size_type)adcCont->size();
49 m_adc->resize(nADC);
50
51 unsigned NtupleVectorIndex = 0;
52 for (const TBADCRaw* adc : *adcCont) {
53 (*m_adc)[NtupleVectorIndex] = adc->getADC();
54 }
55 }
56
57 return StatusCode::SUCCESS;
58}
59
61{
62 if (m_adc)
63 m_adc->clear();
64
65 return StatusCode::SUCCESS;
66}
67
69{
70 ATH_MSG_DEBUG ( "in finalize()" );
71 return StatusCode::SUCCESS;
72}
73
74std::string CBNTAA_TBADCRaw::add_name(const char* base, const std::string& extension) {
75 std::string retval(base);
76 for (unsigned i=0;i<extension.size();i++) {
77 const char& ch=extension[i];
78 if (ch=='=' || ch==':' || ch=='/')
79 continue; //Inore these characters
80 else if (ch=='-')
81 retval.append("m");//replace by letter m
82 else if (ch=='+')
83 retval.append("p");//replace by letter p
84 else
85 retval.append(1,ch);
86 }
87 return retval;
88}
#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::string add_name(const char *base, const std::string &extension)
virtual ~CBNTAA_TBADCRaw()
std::string m_containerKey1
virtual StatusCode CBNT_execute() override
virtual StatusCode CBNT_finalize() override
virtual StatusCode CBNT_initialize() override
CBNTAA_TBADCRaw(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode CBNT_clear() override
std::vector< unsigned int > * m_adc
void addBranch(const std::string &branchname, T &obj, const std::string &leaflist)
CBNT_TBRecBase(const std::string &name, ISvcLocator *pSvcLocator)
typename DataVectorBase< TBADCRaw >::Base::size_type size_type
Definition DataVector.h:814
size_type size() const noexcept
Returns the number of elements in the collection.
"TBEvent/TBADCRawCont.h"
Data object holding adc measurement.
Definition TBADCRaw.h:21
std::string base
Definition hcg.cxx:81