ATLAS Offline Software
Loading...
Searching...
No Matches
TBScintillatorRec.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
6#include "TBScintillatorRec.h"
7
10
11
13 ISvcLocator* pSvcLocator) :
14 AthAlgorithm(name,pSvcLocator)
15 {
16 // job options
17
18 declareProperty("SGkey", m_SGkey="ScintillatorRawCont");
19 declareProperty("SGrecordkey", m_SGrecordkey="ScintillatorCont");
20
21 declareProperty("SCINTnames", m_scint_names);
22 declareProperty("SCINTtimecalib", m_scint_timecalib);
23 declareProperty("SCINTtimeped", m_scint_ped);
24
25
26 }
27
30
31StatusCode
33{
34 ATH_MSG_DEBUG ( "Size of knowns scintillator list = " <<m_scint_names.size() );
35 return StatusCode::SUCCESS;
36}
37
38StatusCode
40{
41 ATH_MSG_DEBUG ( "In execute()" );
42
43 TBScintillatorRawCont * scintrawCont;
44 StatusCode sc = evtStore()->retrieve(scintrawCont, m_SGkey);
45 if (sc.isFailure()){
46 ATH_MSG_DEBUG ( "TBObjectReco: Retrieval of "<<m_SGkey<<" failed" );
47
48 }else {
49
50 TBScintillatorCont * scintCont = new TBScintillatorCont();
51
52 // Loop over Scintillators
53 for (const TBScintillatorRaw * scintraw : *scintrawCont) {
54 std::string name = scintraw->getDetectorName();
55 unsigned int ind=0;
56 // Find calibration index for this Scint
57
58 while(ind<m_scint_names.size())
59 {
60 if(name==m_scint_names[ind]) break;
61 else ind++;
62 }
63 if(ind==m_scint_names.size()) {
64 ATH_MSG_DEBUG( "No calibrations for Scintillator " <<name);
65 continue;
66 }
67
68 TBScintillator * scint = new TBScintillator();
69 scint->setDetectorName(name);
70 scint->setSignal(1.*scintraw->getADCSignal());
71 scint->setTimeSignal(m_scint_timecalib[ind]*(scintraw->getTDCSignal()-m_scint_ped[ind]));
72
73 ATH_MSG_DEBUG ( name << " ADC=" << scintraw->getADCSignal() << " TDC="<<scintraw->getTDCSignal()<< " ADCOf=" << scintraw->isADCOverflow()<< " TDCOf=" << scintraw->isTDCOverflow());
74
75 scint->setSignalOverflow(scintraw->isADCOverflow());
76 scint->setTimeOverflow(scintraw->isTDCOverflow());
77
78
79 scintCont->push_back(scint);
80 }
81
82
83 sc = evtStore()->record(scintCont,m_SGrecordkey);
84 if ( sc.isFailure( ) ) {
85 ATH_MSG_FATAL ( "Cannot record ScintCont" );
86 }
87 }
88
89 if ( sc.isFailure( ) ) {
90 setFilterPassed(false);
91 } else {
92 setFilterPassed(true);
93 }
94
95 return StatusCode::SUCCESS;
96
97
98}
99
100
101StatusCode
103{
104 return StatusCode::SUCCESS;
105}
#define ATH_MSG_FATAL(x)
#define ATH_MSG_DEBUG(x)
static Double_t sc
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
value_type push_back(value_type pElem)
Add an element to the end of the collection.
virtual void setDetectorName(const std::string &tbBeamDetectorName)
"TBEvent/TBScintillatorCont.h"
"TBEvent/TBScintillatorRawCont.h"
std::string m_SGrecordkey
std::vector< float > m_scint_timecalib
TBScintillatorRec(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode initialize() override
virtual StatusCode execute() override
std::vector< float > m_scint_ped
virtual StatusCode finalize() override
std::vector< std::string > m_scint_names
virtual void setSignal(float theSignal)
virtual void setSignalOverflow(bool signal_overflow)
virtual void setTimeOverflow(bool time_overflow)
virtual void setTimeSignal(float theSignal)