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 14 of file ViewCreatorCentredOnIParticleROITool.cxx.

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

◆ ~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 25 of file ViewCreatorCentredOnIParticleROITool.cxx.

25  {
27 
28  for ( Decision* outputDecision : decisions ) {
29  const std::vector<LinkInfo<xAOD::IParticleContainer>> myFeature = findLinks<xAOD::IParticleContainer>(outputDecision, m_iParticleLinkName, TrigDefs::lastFeatureOfType);
30 
31  if (myFeature.size() != 1) {
32  ATH_MSG_ERROR("Did not find exactly one most-recent xAOD::IParticle '" << m_iParticleLinkName << "' for Decision object index " << outputDecision->index()
33  << ", found " << myFeature.size());
34  return StatusCode::FAILURE;
35  }
36  ATH_CHECK(myFeature.at(0).isValid());
37 
38  const ElementLink<xAOD::IParticleContainer> p4EL = myFeature.at(0).link;
39 
40  const double reta = (*p4EL)->eta();
41  const double retap = reta + m_roiEtaWidth;
42  const double retam = reta - m_roiEtaWidth;
43  const double rphi = (*p4EL)->phi();
44  const double rphip = rphi + m_roiPhiWidth;
45  const double rphim = rphi - m_roiPhiWidth;
46 
47  TrigRoiDescriptor *newROI = nullptr;
48 
49  if ( m_roiZedWidth >= 0 ) {
50 
51  const xAOD::Muon* muon = dynamic_cast< const xAOD::Muon*>(*p4EL); //get muon of this found object
52  double zed0 = 0.0; //initialization
53 
54  bool update_z_width = true;
55 
56  if ( m_useZedPosition ) {
57  if ( muon && muon->primaryTrackParticle() ) {
58  zed0 = muon->primaryTrackParticle()->z0();
59  if ( m_useBeamspot ) zed0 += muon->primaryTrackParticle()->vz();
60  }
61  else update_z_width = false;
62  }
63 
64  if ( update_z_width ) {
65 
66  double zed0p = zed0 + m_roiZedWidth; // in mm
67  double zed0m = zed0 - m_roiZedWidth; // in mm
68 
69  if ( m_roiZedSinThetaFlag ) {
71  double cosheta = std::cosh( (*p4EL)->eta() );
72  zed0p = zed0 + m_roiZedWidth*cosheta; // in mm
73  zed0m = zed0 - m_roiZedWidth*cosheta; // in mm
74  }
75 
76  ATH_MSG_DEBUG( "New ROI for xAOD::Particle ET="<< (*p4EL)->p4().Et()
77  << " eta="<< (*p4EL)->eta() << " +- " << m_roiEtaWidth
78  << " phi="<< (*p4EL)->phi() << " +- " << m_roiPhiWidth
79  << " zed0="<< zed0 << " +- " << m_roiZedWidth );
80 
81  newROI = new TrigRoiDescriptor( reta, retam, retap,
82  rphi, rphim, rphip,
83  zed0, zed0m, zed0p );
84  }
85  else {
86  newROI = new TrigRoiDescriptor( reta, retam, retap,
87  rphi, rphim, rphip);
88  }
89  }
90  else {
91  newROI = new TrigRoiDescriptor( reta, retam, retap,
92  rphi, rphim, rphip);
93  }
94 
95  roisWriteHandle->push_back( newROI );
96 
97  const ElementLink<TrigRoiDescriptorCollection> roiEL = ElementLink<TrigRoiDescriptorCollection>(*roisWriteHandle, roisWriteHandle->size() - 1, ctx);
98 
99  outputDecision->setObjectLink(roiString(), roiEL);
100  }
101 
102  return StatusCode::SUCCESS;
103 }

◆ initialize()

StatusCode ViewCreatorCentredOnIParticleROITool::initialize ( )
overridevirtual

Definition at line 19 of file ViewCreatorCentredOnIParticleROITool.cxx.

19  {
21  return StatusCode::SUCCESS;
22 }

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:195
TrigRoiDescriptor
nope - should be used for standalone also, perhaps need to protect the class def bits #ifndef XAOD_AN...
Definition: TrigRoiDescriptor.h:56
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
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ViewCreatorCentredOnIParticleROITool::m_useBeamspot
Gaudi::Property< bool > m_useBeamspot
Definition: ViewCreatorCentredOnIParticleROITool.h:59
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
TrigCompositeUtils::createAndStoreNoAux
SG::WriteHandle< CONT > createAndStoreNoAux(const SG::WriteHandleKey< CONT > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Creates and right away records the Container CONT with the key.
xAOD::TrigComposite_v1
Class used to describe composite objects in the HLT.
Definition: TrigComposite_v1.h:52
xAOD::decisions
decisions
Definition: TrigComposite_v1.cxx:101
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
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
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TrigCompositeUtils::roiString
const std::string & roiString()
Definition: TrigCompositeUtilsRoot.cxx:876
TrigRoiDescriptor
Athena::TPCnvVers::Current TrigRoiDescriptor
Definition: TrigSteeringEventTPCnv.cxx:68
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.