ATLAS Offline Software
Loading...
Searching...
No Matches
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
10TBTailCatcherRec::TBTailCatcherRec(const std::string& name,
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
24
25StatusCode
27{
28 return StatusCode::SUCCESS;
29}
30
31StatusCode
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;
62 scint->setSignal(m_tailcatch_calib[ind]*(adc - m_tailcatch_ped[ind]));
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
84StatusCode
86{
87 return StatusCode::SUCCESS;
88}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_DEBUG(x)
static Double_t sc
#define WTC_ADC_MAX
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
size_type size() const noexcept
Returns the number of elements in the collection.
virtual void setDetectorName(const std::string &tbBeamDetectorName)
virtual void setSignal(float theSignal)
virtual void setSignalOverflow(bool signal_overflow)
std::vector< float > m_tailcatch_calib
virtual StatusCode initialize() override
virtual StatusCode finalize() override
TBTailCatcherRec(const std::string &name, ISvcLocator *pSvcLocator)
std::vector< float > m_tailcatch_ped
virtual StatusCode execute() override