ATLAS Offline Software
Loading...
Searching...
No Matches
DerivationFramework::HIGlobalAugmentationTool Class Reference

#include <HIGlobalAugmentationTool.h>

Inheritance diagram for DerivationFramework::HIGlobalAugmentationTool:
Collaboration diagram for DerivationFramework::HIGlobalAugmentationTool:

Public Member Functions

virtual StatusCode initialize () override final
virtual StatusCode finalize () override final
virtual StatusCode addBranches (const EventContext &ctx) const override final

Private Attributes

Gaudi::Property< int > m_nHarmonic {this, "nHarmonic", 1, "Flow harmonic starting from v2"}
Gaudi::Property< bool > m_doTopoClusDec {this, "doTopoClusDec", false, "Decorate with CaloTopoCluster FCal cut, non-HI mode only"}
SG::ReadHandleKey< xAOD::EventInfom_eventInfoKey { this, "EventInfoKey", "EventInfo", "" }
SG::ReadHandleKey< xAOD::TrackParticleContainerm_TP_key {this, "InDetTrackParticlesKey", "InDetTrackParticles"}
SG::ReadHandleKey< xAOD::HIEventShapeContainerm_eventShapeKey {this, "HIEventShapeKey", "HIEventShape", ""}
SG::ReadHandleKey< xAOD::CaloClusterContainerm_caloClusterKey {this, "CaloClusterKey", "", "Only needed if doTopoClusDec is true"}
PublicToolHandleArray< InDet::IInDetTrackSelectionToolm_trkSelTools {this, "TrackSelectionTools", {}, "Track selection tools (optional)"}
 track selection tool which can be optionally used for N_trk and sum pt cuts
Gaudi::Property< std::vector< std::string > > m_cutLevels {this, "cutLevels", {}, "Cut levels"}
std::vector< SG::AuxElement::Decorator< float > > m_decFCalEtA_Qnx
std::vector< SG::AuxElement::Decorator< float > > m_decFCalEtA_Qny
std::vector< SG::AuxElement::Decorator< float > > m_decFCalEtC_Qnx
std::vector< SG::AuxElement::Decorator< float > > m_decFCalEtC_Qny
std::vector< SG::AuxElement::Decorator< float > > m_decHalfFCalEtA_Qnx
std::vector< SG::AuxElement::Decorator< float > > m_decHalfFCalEtA_Qny
std::vector< SG::AuxElement::Decorator< float > > m_decHalfFCalEtC_Qnx
std::vector< SG::AuxElement::Decorator< float > > m_decHalfFCalEtC_Qny
std::vector< SG::AuxElement::Decorator< int > > m_decTrack_count

Detailed Description

Definition at line 28 of file HIGlobalAugmentationTool.h.

Member Function Documentation

◆ addBranches()

StatusCode DerivationFramework::HIGlobalAugmentationTool::addBranches ( const EventContext & ctx) const
finaloverridevirtual

Definition at line 48 of file HIGlobalAugmentationTool.cxx.

49 {
50 SG::ReadHandle<xAOD::EventInfo> eventInfo (m_eventInfoKey, ctx);
51
52 //Load track particle container
53 SG::ReadHandle<xAOD::TrackParticleContainer> tracks(m_TP_key, ctx);
54 if (!tracks.isValid()) {
55 ATH_MSG_ERROR ("Couldn't retrieve TrackParticleContainer with key " << m_TP_key);
56 return StatusCode::FAILURE;
57 }
58
59 //Count tracks
60 unsigned int nTrackSels = m_trkSelTools.size();
61 std::vector <int> TrackParticleMultiplicity(nTrackSels,0);
62 for (const auto* tp : *tracks) {
63 if (tp) {
64 for (unsigned int its = 0; its < nTrackSels; ++its) {
65 if (m_trkSelTools[its]->accept(*tp)) ++TrackParticleMultiplicity[its];
66 }
67 }
68 }
69 //decorate eventInfo with track multiplicity
70 for (unsigned int its = 0; its < nTrackSels; ++its) {
71 (m_decTrack_count[its])(*eventInfo) = TrackParticleMultiplicity[its];
72 }
73
74 float FCalEtA = 0;
75 float FCalEtC = 0;
76
77 std::vector<float> FCalEtA_Qnx(m_nHarmonic,0);
78 std::vector<float> FCalEtA_Qny(m_nHarmonic,0);
79 std::vector<float> FCalEtC_Qnx(m_nHarmonic,0);
80 std::vector<float> FCalEtC_Qny(m_nHarmonic,0);
81
82 float HalfFCalEtA = 0;
83 float HalfFCalEtC = 0;
84
85 std::vector<float> HalfFCalEtA_Qnx(m_nHarmonic,0);
86 std::vector<float> HalfFCalEtA_Qny(m_nHarmonic,0);
87 std::vector<float> HalfFCalEtC_Qnx(m_nHarmonic,0);
88 std::vector<float> HalfFCalEtC_Qny(m_nHarmonic,0);
89
90 // Set up the decorators for FCal Et
91 SG::AuxElement::Decorator< float > decFCalEtA("FCalEtA");
92 SG::AuxElement::Decorator< float > decFCalEtC("FCalEtC");
93
94 SG::AuxElement::Decorator< float > decHalfFCalEtA("HalfFCalEtA");
95 SG::AuxElement::Decorator< float > decHalfFCalEtC("HalfFCalEtC");
96
97 //Retrieve HIEventShape
98 SG::ReadHandle<xAOD::HIEventShapeContainer> eventShape(m_eventShapeKey, ctx);
99 if (!eventShape.isValid()){
100 ATH_MSG_ERROR ("Cannot retrieve HIEventShape");
101 return StatusCode::FAILURE;
102 }
103
104 //Calculate FCal A and FCal C sums
105 for(const auto* ptrEvtShp : *eventShape){
106 if(ptrEvtShp->layer()!=21 && ptrEvtShp->layer()!=22 &&
107 ptrEvtShp->layer()!=23) continue;
108
109 float eta = ptrEvtShp->etaMin();
110 const std::vector<float>&c1 = ptrEvtShp->etCos();
111 const std::vector<float>&s1 = ptrEvtShp->etSin();
112
113 if (eta > 0) {
114 FCalEtA += ptrEvtShp->et();
115 for (int vn = 1; vn <= m_nHarmonic; ++vn){
116 FCalEtA_Qnx.at(vn-1) += c1.at(vn);
117 FCalEtA_Qny.at(vn-1) += s1.at(vn);
118 }
119 if(eta > 4.0) {
120 HalfFCalEtA += ptrEvtShp->et();
121 for (int vn = 1; vn <= m_nHarmonic; ++vn){
122 HalfFCalEtA_Qnx.at(vn-1) += c1.at(vn);
123 HalfFCalEtA_Qny.at(vn-1) += s1.at(vn);
124 }
125 }
126 } else if (eta < 0) {
127 FCalEtC += ptrEvtShp->et();
128 for (int vn = 1; vn <= m_nHarmonic; ++vn){
129 FCalEtC_Qnx.at(vn-1) += c1.at(vn);
130 FCalEtC_Qny.at(vn-1) += s1.at(vn);
131 }
132 if(eta < -4.0){
133 HalfFCalEtC += ptrEvtShp->et();
134 for (int vn = 1; vn <= m_nHarmonic; ++vn){
135 HalfFCalEtC_Qnx.at(vn-1) += c1.at(vn);
136 HalfFCalEtC_Qny.at(vn-1) += s1.at(vn);
137 }
138 }
139 }
140 }
141
142 if (m_doTopoClusDec) {
143 // Setup the decorator for TopoCaloCluster cut
144 // If this is true, the event is not compatible with UPC topologies in the FCal
145 SG::AuxElement::Decorator< bool > decTopoClusterFCalCut("passUPCTopoCaloCut");
146 //Default decoration set to false
147 decTopoClusterFCalCut(*eventInfo) = false;
148
149 //access topoClusters
150 SG::ReadHandle<xAOD::CaloClusterContainer> topos(m_caloClusterKey, ctx);
151 bool hasTowerA{false};
152 bool hasTowerC{false};
153 for (const auto topo : *topos) {
154 float topo_eta = topo->eta();
155 if (abs(topo_eta) > 3.2 && abs(topo_eta) < 4.9) {
156 float topo_pt = topo->pt() * 1e-3;
157 if (topo_pt > 0.4) {
158 if (topo_eta > 0) {
159 hasTowerA = true;
160 } else {
161 hasTowerC = true;
162 }
163 }
164 }
165 }
166 //decorate
167 decTopoClusterFCalCut(*eventInfo) = (hasTowerA && hasTowerC);
168 }
169
170
171 //decorate
172 decFCalEtA(*eventInfo) = FCalEtA;
173 decFCalEtC(*eventInfo) = FCalEtC;
174 decHalfFCalEtA(*eventInfo) = HalfFCalEtA;
175 decHalfFCalEtC(*eventInfo) = HalfFCalEtC;
176
177 for (int vn = 0; vn < m_nHarmonic; ++vn){
178 (m_decFCalEtA_Qnx[vn])(*eventInfo) = FCalEtA_Qnx.at(vn);
179 (m_decFCalEtA_Qny[vn])(*eventInfo) = FCalEtA_Qny.at(vn);
180 (m_decFCalEtC_Qnx[vn])(*eventInfo) = FCalEtC_Qnx.at(vn);
181 (m_decFCalEtC_Qny[vn])(*eventInfo) = FCalEtC_Qny.at(vn);
182 (m_decHalfFCalEtA_Qnx[vn])(*eventInfo) = HalfFCalEtA_Qnx.at(vn);
183 (m_decHalfFCalEtA_Qny[vn])(*eventInfo) = HalfFCalEtA_Qny.at(vn);
184 (m_decHalfFCalEtC_Qnx[vn])(*eventInfo) = HalfFCalEtC_Qnx.at(vn);
185 (m_decHalfFCalEtC_Qny[vn])(*eventInfo) = HalfFCalEtC_Qny.at(vn);
186 }
187
188 return StatusCode::SUCCESS;
189 }
Scalar eta() const
pseudorapidity method
#define ATH_MSG_ERROR(x)
std::vector< SG::AuxElement::Decorator< float > > m_decFCalEtC_Qnx
std::vector< SG::AuxElement::Decorator< float > > m_decHalfFCalEtA_Qnx
std::vector< SG::AuxElement::Decorator< float > > m_decFCalEtA_Qnx
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_caloClusterKey
std::vector< SG::AuxElement::Decorator< float > > m_decFCalEtC_Qny
std::vector< SG::AuxElement::Decorator< float > > m_decHalfFCalEtC_Qnx
SG::ReadHandleKey< xAOD::HIEventShapeContainer > m_eventShapeKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_TP_key
std::vector< SG::AuxElement::Decorator< float > > m_decHalfFCalEtC_Qny
std::vector< SG::AuxElement::Decorator< float > > m_decHalfFCalEtA_Qny
std::vector< SG::AuxElement::Decorator< int > > m_decTrack_count
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
PublicToolHandleArray< InDet::IInDetTrackSelectionTool > m_trkSelTools
track selection tool which can be optionally used for N_trk and sum pt cuts
std::vector< SG::AuxElement::Decorator< float > > m_decFCalEtA_Qny
StatusCode accept(const xAOD::Muon *mu)

◆ finalize()

StatusCode DerivationFramework::HIGlobalAugmentationTool::finalize ( )
finaloverridevirtual

Definition at line 39 of file HIGlobalAugmentationTool.cxx.

40 {
41 for (auto trkSelTool : m_trkSelTools ) {
42 ATH_CHECK(trkSelTool->finalize());
43 }
44
45 return StatusCode::SUCCESS;
46 }
#define ATH_CHECK
Evaluate an expression and check for errors.

◆ initialize()

StatusCode DerivationFramework::HIGlobalAugmentationTool::initialize ( )
finaloverridevirtual

Definition at line 11 of file HIGlobalAugmentationTool.cxx.

12 {
13 ATH_CHECK( m_eventInfoKey.initialize() );
14 ATH_CHECK( m_TP_key.initialize() );
15 ATH_CHECK( m_eventShapeKey.initialize() );
16 ATH_CHECK( m_caloClusterKey.initialize(SG::AllowEmpty) ); // Only needed if m_doTopoClusDec = True
17 unsigned int nTrackSels = m_trkSelTools.size();
18 for (unsigned int its = 0; its < nTrackSels; ++its) {
20 m_decTrack_count.emplace_back(SG::AuxElement::Decorator<int>("TrackParticleMultiplicity_" + m_cutLevels[its] ));
21 }
22 //initilize decorators for flow vectors
23 for (int vn = 1; vn <= m_nHarmonic; ++vn) {
24 m_decFCalEtA_Qnx.emplace_back(SG::AuxElement::Decorator<float>(std::format("FCalEtA_Q{}x", vn + 1)));
25 m_decFCalEtA_Qny.emplace_back(SG::AuxElement::Decorator<float>(std::format("FCalEtA_Q{}y", vn + 1)));
26 m_decFCalEtC_Qnx.emplace_back(SG::AuxElement::Decorator<float>(std::format("FCalEtC_Q{}x", vn + 1)));
27 m_decFCalEtC_Qny.emplace_back(SG::AuxElement::Decorator<float>(std::format("FCalEtC_Q{}y", vn + 1)));
28
29 // half FCal is for FCal with eta > 4.0 only
30 m_decHalfFCalEtA_Qnx.emplace_back(SG::AuxElement::Decorator<float>(std::format("HalfFCalEtA_Q{}x", vn + 1)));
31 m_decHalfFCalEtA_Qny.emplace_back(SG::AuxElement::Decorator<float>(std::format("HalfFCalEtA_Q{}y", vn + 1)));
32 m_decHalfFCalEtC_Qnx.emplace_back(SG::AuxElement::Decorator<float>(std::format("HalfFCalEtC_Q{}x", vn + 1)));
33 m_decHalfFCalEtC_Qny.emplace_back(SG::AuxElement::Decorator<float>(std::format("HalfFCalEtC_Q{}y", vn + 1)));
34 }
35
36
37 return StatusCode::SUCCESS;
38 }
Gaudi::Property< std::vector< std::string > > m_cutLevels
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

Member Data Documentation

◆ m_caloClusterKey

SG::ReadHandleKey<xAOD::CaloClusterContainer> DerivationFramework::HIGlobalAugmentationTool::m_caloClusterKey {this, "CaloClusterKey", "", "Only needed if doTopoClusDec is true"}
private

Definition at line 46 of file HIGlobalAugmentationTool.h.

46{this, "CaloClusterKey", "", "Only needed if doTopoClusDec is true"};

◆ m_cutLevels

Gaudi::Property<std::vector<std::string> > DerivationFramework::HIGlobalAugmentationTool::m_cutLevels {this, "cutLevels", {}, "Cut levels"}
private

Definition at line 48 of file HIGlobalAugmentationTool.h.

48{this, "cutLevels", {}, "Cut levels"};

◆ m_decFCalEtA_Qnx

std::vector< SG::AuxElement::Decorator< float > > DerivationFramework::HIGlobalAugmentationTool::m_decFCalEtA_Qnx
private

Definition at line 51 of file HIGlobalAugmentationTool.h.

◆ m_decFCalEtA_Qny

std::vector< SG::AuxElement::Decorator< float > > DerivationFramework::HIGlobalAugmentationTool::m_decFCalEtA_Qny
private

Definition at line 52 of file HIGlobalAugmentationTool.h.

◆ m_decFCalEtC_Qnx

std::vector< SG::AuxElement::Decorator< float > > DerivationFramework::HIGlobalAugmentationTool::m_decFCalEtC_Qnx
private

Definition at line 53 of file HIGlobalAugmentationTool.h.

◆ m_decFCalEtC_Qny

std::vector< SG::AuxElement::Decorator< float > > DerivationFramework::HIGlobalAugmentationTool::m_decFCalEtC_Qny
private

Definition at line 54 of file HIGlobalAugmentationTool.h.

◆ m_decHalfFCalEtA_Qnx

std::vector< SG::AuxElement::Decorator< float > > DerivationFramework::HIGlobalAugmentationTool::m_decHalfFCalEtA_Qnx
private

Definition at line 56 of file HIGlobalAugmentationTool.h.

◆ m_decHalfFCalEtA_Qny

std::vector< SG::AuxElement::Decorator< float > > DerivationFramework::HIGlobalAugmentationTool::m_decHalfFCalEtA_Qny
private

Definition at line 57 of file HIGlobalAugmentationTool.h.

◆ m_decHalfFCalEtC_Qnx

std::vector< SG::AuxElement::Decorator< float > > DerivationFramework::HIGlobalAugmentationTool::m_decHalfFCalEtC_Qnx
private

Definition at line 58 of file HIGlobalAugmentationTool.h.

◆ m_decHalfFCalEtC_Qny

std::vector< SG::AuxElement::Decorator< float > > DerivationFramework::HIGlobalAugmentationTool::m_decHalfFCalEtC_Qny
private

Definition at line 59 of file HIGlobalAugmentationTool.h.

◆ m_decTrack_count

std::vector< SG::AuxElement::Decorator< int > > DerivationFramework::HIGlobalAugmentationTool::m_decTrack_count
private

Definition at line 61 of file HIGlobalAugmentationTool.h.

◆ m_doTopoClusDec

Gaudi::Property<bool> DerivationFramework::HIGlobalAugmentationTool::m_doTopoClusDec {this, "doTopoClusDec", false, "Decorate with CaloTopoCluster FCal cut, non-HI mode only"}
private

Definition at line 42 of file HIGlobalAugmentationTool.h.

42{this, "doTopoClusDec", false, "Decorate with CaloTopoCluster FCal cut, non-HI mode only"};

◆ m_eventInfoKey

SG::ReadHandleKey<xAOD::EventInfo> DerivationFramework::HIGlobalAugmentationTool::m_eventInfoKey { this, "EventInfoKey", "EventInfo", "" }
private

Definition at line 43 of file HIGlobalAugmentationTool.h.

43{ this, "EventInfoKey", "EventInfo", "" };

◆ m_eventShapeKey

SG::ReadHandleKey<xAOD::HIEventShapeContainer> DerivationFramework::HIGlobalAugmentationTool::m_eventShapeKey {this, "HIEventShapeKey", "HIEventShape", ""}
private

Definition at line 45 of file HIGlobalAugmentationTool.h.

45{this, "HIEventShapeKey", "HIEventShape", ""};

◆ m_nHarmonic

Gaudi::Property<int> DerivationFramework::HIGlobalAugmentationTool::m_nHarmonic {this, "nHarmonic", 1, "Flow harmonic starting from v2"}
private

Definition at line 41 of file HIGlobalAugmentationTool.h.

41{this, "nHarmonic", 1, "Flow harmonic starting from v2"};

◆ m_TP_key

SG::ReadHandleKey<xAOD::TrackParticleContainer> DerivationFramework::HIGlobalAugmentationTool::m_TP_key {this, "InDetTrackParticlesKey", "InDetTrackParticles"}
private

Definition at line 44 of file HIGlobalAugmentationTool.h.

44{this, "InDetTrackParticlesKey", "InDetTrackParticles"};

◆ m_trkSelTools

PublicToolHandleArray< InDet::IInDetTrackSelectionTool > DerivationFramework::HIGlobalAugmentationTool::m_trkSelTools {this, "TrackSelectionTools", {}, "Track selection tools (optional)"}
private

track selection tool which can be optionally used for N_trk and sum pt cuts

Definition at line 47 of file HIGlobalAugmentationTool.h.

47{this, "TrackSelectionTools", {}, "Track selection tools (optional)"};

The documentation for this class was generated from the following files: