ATLAS Offline Software
Loading...
Searching...
No Matches
RoiUpdaterTool.cxx
Go to the documentation of this file.
1
2/*
3Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
4*/
5
7#include "RoiUpdaterTool.h"
8
9
10
11RoiUpdaterTool::RoiUpdaterTool(const std::string& type, const std::string& name, const IInterface* parent)
12 : base_class(type, name, parent), m_update(false)
13{}
14
15
16
18
19 ATH_MSG_DEBUG("initialize()");
20
21 if ( m_etaWidth!=-999 || m_phiWidth!=-999 || m_zedWidth!=-999 ) m_update = true;
22
23 if ( m_useBeamspot ) {
24 m_update = true;
25 ATH_CHECK( m_beamspotKey.initialize( m_useBeamspot ) );
26 }
27
28 return StatusCode::SUCCESS;
29}
30
31
32
33void zrange( double nsigma, double fence, double& zed, double& zedMinus, double& zedPlus, const SG::ReadCondHandleKey<InDet::BeamSpotData>& bs, const EventContext& ctx ) {
34
35 SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle( bs, ctx );
36
37 uint32_t bitmap = beamSpotHandle->beamStatus();
38
40 if ( ( (bitmap & 0x7) == 0x7 ) || !(bitmap & 0x4) ) {
41 double zsigma = beamSpotHandle->beamSigma(2);
42 double zpos = beamSpotHandle->beamPos()[2];
43
44 zed = zpos;
45 zedMinus = zpos - nsigma*zsigma - fence;
46 zedPlus = zpos + nsigma*zsigma + fence;
47 }
48 else {
49 zedMinus = -RoiDescriptor::zedWidthDefault();
51 }
52
53}
54
55
56
57
58std::unique_ptr<TrigRoiDescriptor> RoiUpdaterTool::execute( const EventContext& ctx ) const {
61 return execute( &troi, ctx );
62}
63
64
65std::unique_ptr<TrigRoiDescriptor> RoiUpdaterTool::execute( const IRoiDescriptor* iroi, const EventContext& ctx ) const {
66
67 ATH_MSG_DEBUG( "execute()" );
68
71 if ( !m_update ) return std::make_unique<TrigRoiDescriptor>( *iroi );
72
77 if ( iroi->composite() ) {
78 ATH_MSG_WARNING( "Will not update composite Roi parameters: " << *iroi );
79 return std::make_unique<TrigRoiDescriptor>( *iroi );
80 }
81
82 double eta = iroi->eta();
83 double etaMinus = iroi->etaMinus();
84 double etaPlus = iroi->etaPlus();
85
86 double phi = iroi->phi();
87 double phiMinus = iroi->phiMinus();
88 double phiPlus = iroi->phiPlus();
89
90 double zed = iroi->zed();
91 double zedMinus = iroi->zedMinus();
92 double zedPlus = iroi->zedPlus();
93
94 if ( m_etaWidth!=-999 ) {
95 etaMinus = eta - m_etaWidth;
96 etaPlus = eta + m_etaWidth;
97 }
98
99 if ( m_phiWidth!=-999 ) {
102 phiMinus = phi - m_phiWidth;
103 phiPlus = phi + m_phiWidth;
104 }
105
106 if ( m_zedWidth!=-999 ) {
107 zedMinus = zed - m_zedWidth;
108 zedPlus = zed + m_zedWidth;
109 }
110
112 if ( m_useBeamspot ) zrange( m_nsigma, m_fence, zed, zedMinus, zedPlus, m_beamspotKey, ctx );
113
115 if ( zedMinus<-RoiDescriptor::zedWidthDefault() ) zedMinus = -RoiDescriptor::zedWidthDefault();
117
124 return std::make_unique<TrigRoiDescriptor>( eta, etaMinus, etaPlus, phi, phiMinus, phiPlus, zed, zedMinus, zedPlus );
125
126}
127
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
void zrange(double nsigma, double fence, double &zed, double &zedMinus, double &zedPlus, const SG::ReadCondHandleKey< InDet::BeamSpotData > &bs, const EventContext &ctx)
Describes the API of the Region of Ineterest geometry.
virtual double eta() const =0
virtual double phiPlus() const =0
extreme phi values
virtual double zedPlus() const =0
the zed and eta values at the most forward and most rear ends of the RoI
virtual double phiMinus() const =0
virtual double phi() const =0
Methods to retrieve data members.
virtual double zedMinus() const =0
virtual double zed() const =0
virtual double etaMinus() const =0
virtual double etaPlus() const =0
virtual bool composite() const =0
Super RoI access methods.
Describes the Region of Ineterest geometry It has basically 9 parameters.
static double zedWidthDefault()
static constexpr bool FULLSCAN
convenient
bool m_update
whether to update the RoiDescritor or not - determiuned from whether any of update parameters are set
Gaudi::Property< double > m_fence
RoiUpdaterTool(const std::string &type, const std::string &name, const IInterface *parent)
Gaudi::Property< double > m_zedWidth
Gaudi::Property< double > m_etaWidth
don't want these parameters used if not set
std::unique_ptr< TrigRoiDescriptor > execute(const EventContext &ctx) const override
Gaudi::Property< double > m_nsigma
default settings - should be retuned with data
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamspotKey
do we need an mm unit here ?
Gaudi::Property< double > m_phiWidth
Gaudi::Property< bool > m_useBeamspot
virtual StatusCode initialize() override