11 , ISvcLocator* pSvcLocator )
33 return StatusCode::SUCCESS;
47 <<
". In theory this should not be called, but may happen"
48 <<
" if multiple concurrent events are being processed out of order.");
50 return StatusCode::SUCCESS;
56 std::unique_ptr<TRTCond::AverageT0> writeCdo{std::make_unique<TRTCond::AverageT0>()};
60 int countAverageT0 = 0;
62 double averageT0 = 0.;
64 for (std::vector<Identifier>::const_iterator it =
m_trtId->straw_layer_begin(); it !=
m_trtId->straw_layer_end(); ++it ) {
66 int nStrawsInLayer =
m_trtId->straw_max(*it);
68 for (
int i = 0; i <= nStrawsInLayer; i++) {
70 if (std::abs(
m_trtId->barrel_ec(
id)) != 1)
continue;
81 if (countAverageT0 != 0){
82 averageT0 /= double(countAverageT0);
87 if (countAverageT0 != 0) {
88 rtShift /= double(countAverageT0);
93 double evtPhaseT0 = averageT0-20.+rtShift;
95 ATH_MSG_INFO(
" Subtracting: " << evtPhaseT0 <<
" ns (average T0: " << averageT0 <<
" ns, average t(r=0): " << rtShift <<
" ns )");
97 writeCdo->update(evtPhaseT0);
104 if(T0Container==
nullptr) {
106 return StatusCode::FAILURE;
110 if(!T0ReadHandle.
range(rangeW)) {
111 ATH_MSG_ERROR(
"Failed to retrieve validity range for " << T0ReadHandle.
key());
112 return StatusCode::FAILURE;
117 if(writeHandle.
record(rangeW,std::move(writeCdo)).isFailure()) {
119 <<
" with EventRange " << rangeW
120 <<
" into Conditions Store");
121 return StatusCode::FAILURE;
124 <<
" with EventRange " << rangeW
125 <<
" into Conditions Store");
128 return StatusCode::SUCCESS;
134 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
abstract base class for rt-relations
This is an Identifier helper class for the TRT subdetector.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const ServiceHandle< StoreGateSvc > & detStore() const
Base class for conditions algorithms.
bool range(EventIDRange &r)
const std::string & key() const
const std::string & key() const
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
const DataObjID & fullKey() const
Base class for rt-relations in the TRT.
virtual float drifttime(float radius) const =0
drifttime for given radius
TRTPhaseCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode finalize() override
ToolHandle< ITRT_CalDbTool > m_caldbtool
SG::ReadCondHandleKey< StrawT0Container > m_T0ReadKey
virtual StatusCode initialize() override
TRTCond::StrawT0MultChanContainer StrawT0Container
virtual StatusCode execute(const EventContext &ctx) const override
SG::WriteCondHandleKey< TRTCond::AverageT0 > m_T0WriteKey
virtual ~TRTPhaseCondAlg() override