ATLAS Offline Software
TBTailCatcherRec.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 "TBTailCatcherRec.h"
6 
7 #define WTC_ADC_MAX 1024
8 
9 
11  ISvcLocator* pSvcLocator) :
12  AthAlgorithm(name,pSvcLocator)
13  {
14  // job options
15 
16  declareProperty("SGkey", m_SGkey="TailCatcherRaw");
17  declareProperty("TailCatcherCalib", m_tailcatch_calib);
18  declareProperty("TailCatcherPed", m_tailcatch_ped);
19 
20  }
21 
23 { }
24 
27 {
28  return StatusCode::SUCCESS;
29 }
30 
33 {
34  ATH_MSG_DEBUG ( "In execute()" );
35 
36  TBTailCatcherRaw * tailcatchraw;
37  StatusCode sc = evtStore()->retrieve(tailcatchraw, m_SGkey);
38  if (sc.isFailure()){
39  ATH_MSG_DEBUG ( "TBObjectReco: Retrieval of "<<m_SGkey<<" failed" );
40  setFilterPassed(false);
41  return StatusCode::SUCCESS;
42  }else {
43 
44  if(m_tailcatch_calib.size()!=tailcatchraw->size()){
45  ATH_MSG_ERROR ( "Calib factor number : "<<m_tailcatch_calib.size()
46  << " != "<<tailcatchraw->size()<<" = number of scints in TailCatcherRaw");
47  setFilterPassed(false);
48  return StatusCode::SUCCESS;
49  }
50 
51  std::vector< TBScintillator* > theScints;
52 
53  int ind=0;
54  for (const TBScintillatorRaw * scintraw : *tailcatchraw) {
55  std::string name = scintraw->getDetectorName();
56 
57  TBScintillator * scint = new TBScintillator();
58  scint->setDetectorName(name);
59  // No time signal in TalCatcher, only ADC
60  unsigned int adc = scintraw->getADCSignal();
61  if (scintraw->isADCOverflow()) adc = WTC_ADC_MAX;
63 
64  scint->setSignalOverflow(scintraw->isADCOverflow());
65 
66  theScints.push_back(scint);
67  ind++;
68  }
69  TBTailCatcher * tailcatch = new TBTailCatcher(tailcatchraw->getDetectorName(),tailcatchraw->isOverflow(),theScints);
70  sc = evtStore()->record(tailcatch,"TailCatcher");
71  if ( sc.isFailure( ) ) {
72  ATH_MSG_FATAL ( "Cannot record TailCatcher " );
73  }
74  }
75  if ( sc.isFailure( ) ) {
76  setFilterPassed(false);
77  } else {
78  setFilterPassed(true);
79  }
80  return StatusCode::SUCCESS;
81 }
82 
83 
86 {
87  return StatusCode::SUCCESS;
88 }
TBTailCatcherRec::finalize
virtual StatusCode finalize() override
Definition: TBTailCatcherRec.cxx:85
TBTailCatcherRec::execute
virtual StatusCode execute() override
Definition: TBTailCatcherRec.cxx:32
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
TBScintillator::setSignalOverflow
virtual void setSignalOverflow(bool signal_overflow)
Definition: TBScintillator.h:69
TBTailCatcherRec::~TBTailCatcherRec
virtual ~TBTailCatcherRec()
Definition: TBTailCatcherRec.cxx:22
TBTailCatcher
Definition: TBTailCatcher.h:25
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
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
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
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
TBTailCatcherRec::m_SGkey
std::string m_SGkey
Definition: TBTailCatcherRec.h:39
TBScintillatorRaw
Definition: TBScintillatorRaw.h:26
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:221
TBTailCatcherRec::m_tailcatch_ped
std::vector< float > m_tailcatch_ped
Definition: TBTailCatcherRec.h:46
WTC_ADC_MAX
#define WTC_ADC_MAX
Definition: TBTailCatcherRec.cxx:7
TBTailCatcherRec::initialize
virtual StatusCode initialize() override
Definition: TBTailCatcherRec.cxx:26
TBTailCatcherRec.h
TBTailCatcherRec::TBTailCatcherRec
TBTailCatcherRec(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TBTailCatcherRec.cxx:10
ReadFloatFromCool.adc
adc
Definition: ReadFloatFromCool.py:48
TBScintillator
Definition: TBScintillator.h:25
TBTailCatcherRaw
Definition: TBTailCatcherRaw.h:25
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
TBTailCatcherRec::m_tailcatch_calib
std::vector< float > m_tailcatch_calib
Definition: TBTailCatcherRec.h:45
checkFileSG.ind
list ind
Definition: checkFileSG.py:118