ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
ViewCreatorCentredOnIParticleROITool Class Reference

#include <ViewCreatorCentredOnIParticleROITool.h>

Inheritance diagram for ViewCreatorCentredOnIParticleROITool:
Collaboration diagram for ViewCreatorCentredOnIParticleROITool:

Public Member Functions

 ViewCreatorCentredOnIParticleROITool (const std::string &type, const std::string &name, const IInterface *parent)
 
virtual ~ViewCreatorCentredOnIParticleROITool ()=default
 
virtual StatusCode initialize () override
 
virtual StatusCode attachROILinks (TrigCompositeUtils::DecisionContainer &decisions, const EventContext &ctx) const override
 Tool interface method. More...
 

Public Attributes

SG::WriteHandleKey< TrigRoiDescriptorCollectionm_roisWriteHandleKey
 
Gaudi::Property< std::string > m_iParticleLinkName
 
Gaudi::Property< double > m_roiEtaWidth
 
Gaudi::Property< double > m_roiPhiWidth
 
Gaudi::Property< double > m_roiZedWidth
 
Gaudi::Property< double > m_roiZedSinThetaFlag
 
Gaudi::Property< bool > m_useZedPosition
 
Gaudi::Property< bool > m_useBeamspot
 

Detailed Description

Creates a new ROI centred on an object deriving from xAOD::IParticle.

Stores this new ROI in the output container, and links it to the Decision Object

The new EventView spawned by the parent EventViewCreatorAlgorithm of this tool will process in this new ROI.

In the majority of cases, this tool will be used to create the new ROI centred on the "feature" from the previous Step.

Definition at line 24 of file ViewCreatorCentredOnIParticleROITool.h.

Constructor & Destructor Documentation

◆ ViewCreatorCentredOnIParticleROITool()

ViewCreatorCentredOnIParticleROITool::ViewCreatorCentredOnIParticleROITool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 15 of file ViewCreatorCentredOnIParticleROITool.cxx.

16  : base_class(type, name, parent)
17  {}

◆ ~ViewCreatorCentredOnIParticleROITool()

virtual ViewCreatorCentredOnIParticleROITool::~ViewCreatorCentredOnIParticleROITool ( )
virtualdefault

Member Function Documentation

◆ attachROILinks()

StatusCode ViewCreatorCentredOnIParticleROITool::attachROILinks ( TrigCompositeUtils::DecisionContainer decisions,
const EventContext &  ctx 
) const
overridevirtual

Tool interface method.

1/sin(theta) = cosh( eta )

Definition at line 26 of file ViewCreatorCentredOnIParticleROITool.cxx.

26  {
28 
29  for ( Decision* outputDecision : decisions ) {
30 
31  std::set<const Decision*> cache;
32  std::vector<SG::sgkey_t> keys;
33  std::vector<uint32_t> clids;
34  std::vector<Decision::index_type> indices;
35  std::vector<const Decision*> sources;
36  typelessFindLinks(outputDecision, m_iParticleLinkName, keys, clids, indices, sources, TrigDefs::lastFeatureOfType, &cache);
37 
38  //expect only one link per decision
39  if(keys.size()!=1){
40  ATH_MSG_ERROR("Did not find exactly one object having searched for a link named '"<<m_iParticleLinkName<<"'. Found "<<keys.size()<<" instead");
41  return StatusCode::FAILURE;
42  }
43 
44  //first check if we've found a MET feature, and attach a FS RoI if so
46  ATH_MSG_DEBUG("Encountered a MET feature in the CentredOnIParticle ROITool. Cannot centre an ROI on this. Attaching a FullScan RoI");
47  roisWriteHandle->push_back( new TrigRoiDescriptor( RoiDescriptor::FULLSCAN ) );
48  const ElementLink<TrigRoiDescriptorCollection> roiEL = ElementLink<TrigRoiDescriptorCollection>(*roisWriteHandle, roisWriteHandle->size() - 1, ctx);
49  outputDecision->setObjectLink(roiString(), roiEL);
50  continue;
51  }
52 
53  //If not MET, we should have an IParticle
54  const ElementLink<xAOD::IParticleContainer> p4EL(keys.at(0), indices.at(0), ctx);
55  ATH_CHECK(p4EL.isValid());
56 
57  const double reta = (*p4EL)->eta();
58  const double retap = reta + m_roiEtaWidth;
59  const double retam = reta - m_roiEtaWidth;
60  const double rphi = (*p4EL)->phi();
61  const double rphip = rphi + m_roiPhiWidth;
62  const double rphim = rphi - m_roiPhiWidth;
63 
64  TrigRoiDescriptor *newROI = nullptr;
65 
66  if ( m_roiZedWidth >= 0 ) {
67 
68  const xAOD::Muon* muon = dynamic_cast< const xAOD::Muon*>(*p4EL); //get muon of this found object
69  double zed0 = 0.0; //initialization
70 
71  bool update_z_width = true;
72 
73  if ( m_useZedPosition ) {
74  if ( muon && muon->primaryTrackParticle() ) {
75  zed0 = muon->primaryTrackParticle()->z0();
76  if ( m_useBeamspot ) zed0 += muon->primaryTrackParticle()->vz();
77  }
78  else update_z_width = false;
79  }
80 
81  if ( update_z_width ) {
82 
83  double zed0p = zed0 + m_roiZedWidth; // in mm
84  double zed0m = zed0 - m_roiZedWidth; // in mm
85 
86  if ( m_roiZedSinThetaFlag ) {
88  double cosheta = std::cosh( (*p4EL)->eta() );
89  zed0p = zed0 + m_roiZedWidth*cosheta; // in mm
90  zed0m = zed0 - m_roiZedWidth*cosheta; // in mm
91  }
92 
93  ATH_MSG_DEBUG( "New ROI for xAOD::Particle ET="<< (*p4EL)->p4().Et()
94  << " eta="<< (*p4EL)->eta() << " +- " << m_roiEtaWidth
95  << " phi="<< (*p4EL)->phi() << " +- " << m_roiPhiWidth
96  << " zed0="<< zed0 << " +- " << m_roiZedWidth );
97 
98  newROI = new TrigRoiDescriptor( reta, retam, retap,
99  rphi, rphim, rphip,
100  zed0, zed0m, zed0p );
101  }
102  else {
103  newROI = new TrigRoiDescriptor( reta, retam, retap,
104  rphi, rphim, rphip);
105  }
106  }
107  else {
108  newROI = new TrigRoiDescriptor( reta, retam, retap,
109  rphi, rphim, rphip);
110  }
111 
112  roisWriteHandle->push_back( newROI );
113 
114  const ElementLink<TrigRoiDescriptorCollection> roiEL = ElementLink<TrigRoiDescriptorCollection>(*roisWriteHandle, roisWriteHandle->size() - 1, ctx);
115 
116  outputDecision->setObjectLink(roiString(), roiEL);
117  }
118 
119  return StatusCode::SUCCESS;
120 }

◆ initialize()

StatusCode ViewCreatorCentredOnIParticleROITool::initialize ( )
overridevirtual

Definition at line 20 of file ViewCreatorCentredOnIParticleROITool.cxx.

20  {
22  return StatusCode::SUCCESS;
23 }

Member Data Documentation

◆ m_iParticleLinkName

Gaudi::Property< std::string > ViewCreatorCentredOnIParticleROITool::m_iParticleLinkName
Initial value:
{this,"IParticleLinkName","feature",
"Name of linked IParticle object to centre the new ROI on. Normally the 'feature' from the previous Step."}

Definition at line 41 of file ViewCreatorCentredOnIParticleROITool.h.

◆ m_roiEtaWidth

Gaudi::Property< double > ViewCreatorCentredOnIParticleROITool::m_roiEtaWidth
Initial value:
{this,"RoIEtaWidth",0.1,
"Extent of the ROI in eta from its centre"}

Definition at line 44 of file ViewCreatorCentredOnIParticleROITool.h.

◆ m_roiPhiWidth

Gaudi::Property< double > ViewCreatorCentredOnIParticleROITool::m_roiPhiWidth
Initial value:
{this,"RoIPhiWidth",0.1,
"Extent of the ROI in phi from its centre"}

Definition at line 47 of file ViewCreatorCentredOnIParticleROITool.h.

◆ m_roisWriteHandleKey

SG::WriteHandleKey< TrigRoiDescriptorCollection > ViewCreatorCentredOnIParticleROITool::m_roisWriteHandleKey
Initial value:
{this,"RoisWriteHandleKey","",
"Name of the ROI collection produced by this tool."}

Definition at line 38 of file ViewCreatorCentredOnIParticleROITool.h.

◆ m_roiZedSinThetaFlag

Gaudi::Property< double > ViewCreatorCentredOnIParticleROITool::m_roiZedSinThetaFlag
Initial value:
{this,"RoIZedSinThetaFlag", false,
"use a delta zed/sin\theta width rather than just a zed width"}

Definition at line 53 of file ViewCreatorCentredOnIParticleROITool.h.

◆ m_roiZedWidth

Gaudi::Property< double > ViewCreatorCentredOnIParticleROITool::m_roiZedWidth
Initial value:
{this,"RoIZedWidth",-999,
"Extent of the ROI in zed from its centre"}

Definition at line 50 of file ViewCreatorCentredOnIParticleROITool.h.

◆ m_useBeamspot

Gaudi::Property< bool > ViewCreatorCentredOnIParticleROITool::m_useBeamspot
Initial value:
{this,"UseBeamSpot", true,
"correct for the pointlessly adjusted average beamspot z"}

Definition at line 59 of file ViewCreatorCentredOnIParticleROITool.h.

◆ m_useZedPosition

Gaudi::Property< bool > ViewCreatorCentredOnIParticleROITool::m_useZedPosition
Initial value:
{this,"UseZedPosition", true,
"use IParticle z position"}

Definition at line 56 of file ViewCreatorCentredOnIParticleROITool.h.


The documentation for this class was generated from the following files:
xAOD::muon
@ muon
Definition: TrackingPrimitives.h:196
Trk::indices
std::pair< long int, long int > indices
Definition: AlSymMatBase.h:24
TrigRoiDescriptor
nope - should be used for standalone also, perhaps need to protect the class def bits #ifndef XAOD_AN...
Definition: TrigRoiDescriptor.h:56
TrigCompositeUtils::roiString
const std::string & roiString()
Definition: TrigCompositeUtils.h:418
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
xAOD::Muon_v1
Class describing a Muon.
Definition: Muon_v1.h:38
ViewCreatorCentredOnIParticleROITool::m_iParticleLinkName
Gaudi::Property< std::string > m_iParticleLinkName
Definition: ViewCreatorCentredOnIParticleROITool.h:41
ViewCreatorCentredOnIParticleROITool::m_roiZedWidth
Gaudi::Property< double > m_roiZedWidth
Definition: ViewCreatorCentredOnIParticleROITool.h:50
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ViewCreatorCentredOnIParticleROITool::m_useZedPosition
Gaudi::Property< bool > m_useZedPosition
Definition: ViewCreatorCentredOnIParticleROITool.h:56
TrigCompositeUtils::typelessFindLinks
bool typelessFindLinks(const Decision *start, const std::string &linkName, std::vector< sgkey_t > &keyVec, std::vector< uint32_t > &clidVec, std::vector< Decision::index_type > &indexVec, std::vector< const Decision * > &sourceVec, const unsigned int behaviour, std::set< const Decision * > *fullyExploredFrom)
search back the TC links for the object of type T linked to the one of TC (recursively) Returns the l...
Definition: TrigCompositeUtilsRoot.cxx:603
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ViewCreatorCentredOnIParticleROITool::m_useBeamspot
Gaudi::Property< bool > m_useBeamspot
Definition: ViewCreatorCentredOnIParticleROITool.h:59
ClassID_traits
Default, invalid implementation of ClassID_traits.
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:37
TrigCompositeUtils::createAndStoreNoAux
SG::WriteHandle< CONT > createAndStoreNoAux(const SG::WriteHandleKey< CONT > &key, const EventContext &ctx)
Creates and right away records the Container CONT with the key.
ViewCreatorCentredOnIParticleROITool::m_roiEtaWidth
Gaudi::Property< double > m_roiEtaWidth
Definition: ViewCreatorCentredOnIParticleROITool.h:44
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
xAOD::TrigComposite_v1
Class used to describe composite objects in the HLT.
Definition: TrigComposite_v1.h:49
xAOD::decisions
decisions
Definition: TrigComposite_v1.cxx:101
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
SG::WriteHandle< TrigRoiDescriptorCollection >
ViewCreatorCentredOnIParticleROITool::m_roiPhiWidth
Gaudi::Property< double > m_roiPhiWidth
Definition: ViewCreatorCentredOnIParticleROITool.h:47
RoiDescriptor::FULLSCAN
static constexpr bool FULLSCAN
convenient
Definition: RoiDescriptor.h:45
TrigRoiDescriptor
Athena::TPCnvVers::Current TrigRoiDescriptor
Definition: TrigSteeringEventTPCnv.cxx:68
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:801
ViewCreatorCentredOnIParticleROITool::m_roiZedSinThetaFlag
Gaudi::Property< double > m_roiZedSinThetaFlag
Definition: ViewCreatorCentredOnIParticleROITool.h:53
ViewCreatorCentredOnIParticleROITool::m_roisWriteHandleKey
SG::WriteHandleKey< TrigRoiDescriptorCollection > m_roisWriteHandleKey
Definition: ViewCreatorCentredOnIParticleROITool.h:38
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.