ATLAS Offline Software
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 
29 { }
30 
33 {
34  ATH_MSG_DEBUG ( "Size of knowns scintillator list = " <<m_scint_names.size() );
35  return StatusCode::SUCCESS;
36 }
37 
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 
101 StatusCode
103 {
104  return StatusCode::SUCCESS;
105 }
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
TBScintillatorCont.h
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
TBScintillatorRec::m_scint_ped
std::vector< float > m_scint_ped
Definition: TBScintillatorRec.h:45
TBScintillatorRec::m_SGrecordkey
std::string m_SGrecordkey
Definition: TBScintillatorRec.h:36
TBScintillatorCont
Definition: TBScintillatorCont.h:19
TBScintillator::setSignalOverflow
virtual void setSignalOverflow(bool signal_overflow)
Definition: TBScintillator.h:69
TBScintillatorRec::TBScintillatorRec
TBScintillatorRec(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TBScintillatorRec.cxx:12
TBScintillatorRawCont.h
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
TBScintillatorRec.h
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
TBBeamDetector::setDetectorName
virtual void setDetectorName(const std::string &tbBeamDetectorName)
Definition: TBBeamDetector.h:48
TBScintillatorRec::m_scint_timecalib
std::vector< float > m_scint_timecalib
Definition: TBScintillatorRec.h:44
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TBScintillatorRaw
Definition: TBScintillatorRaw.h:26
TBScintillatorRec::finalize
virtual StatusCode finalize() override
Definition: TBScintillatorRec.cxx:102
AthAlgorithm
Definition: AthAlgorithm.h:47
TBScintillator::setSignal
virtual void setSignal(float theSignal)
Definition: TBScintillator.h:65
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
TBScintillatorRec::m_scint_names
std::vector< std::string > m_scint_names
Definition: TBScintillatorRec.h:43
TBScintillator::setTimeOverflow
virtual void setTimeOverflow(bool time_overflow)
Definition: TBScintillator.h:79
TBScintillator
Definition: TBScintillator.h:25
TBScintillatorRec::~TBScintillatorRec
virtual ~TBScintillatorRec()
Definition: TBScintillatorRec.cxx:28
TBScintillatorRawCont
Definition: TBScintillatorRawCont.h:18
TBScintillatorRec::execute
virtual StatusCode execute() override
Definition: TBScintillatorRec.cxx:39
checkFileSG.ind
list ind
Definition: checkFileSG.py:118
TBScintillatorRec::initialize
virtual StatusCode initialize() override
Definition: TBScintillatorRec.cxx:32
TBScintillator::setTimeSignal
virtual void setTimeSignal(float theSignal)
Definition: TBScintillator.h:75
TBScintillatorRec::m_SGkey
std::string m_SGkey
Definition: TBScintillatorRec.h:36