40 {
41
42
43 for (
unsigned int iTrack = 0; iTrack < energyFlowCaloObject.
nTracks(); ++iTrack) {
44
45 const eflowRecTrack* efRecTrack = energyFlowCaloObject.
efRecTrack(iTrack);
46
47
49
50
52 chargedFlowElementContainerWriteHandle->push_back(thisFE);
54
55
56
57 ElementLink<xAOD::TrackParticleContainer> theTrackLink = efRecTrack->
getTrackElemLink();
58 ElementLink< xAOD::IParticleContainer > theIParticleTrackLink (theTrackLink);
59 std::vector<ElementLink<xAOD::IParticleContainer> > vecIParticleTrackLinkContainer;
60 vecIParticleTrackLinkContainer.push_back(theIParticleTrackLink);
62
63
66
67 std::pair<double,double> etaPhi(0.0,0.0);
68
70
71
73
74
77
80
83
86 } else {
87
90 }
91
92
94
95 ATH_MSG_DEBUG(
"Created charged PFO with E, pt, eta and phi of " << thisFE->
e() <<
", " << thisFE->
pt() <<
", " << thisFE->
eta() <<
" and " << thisFE->
phi());
96
97
98 const static SG::AuxElement::Accessor<float> accTracksExpectedEnergyDeposit("TracksExpectedEnergyDeposit");
99 accTracksExpectedEnergyDeposit(*thisFE) = efRecTrack->
getEExpect();
101
102
103
106
107
108 if (addClusters){
109
110 std::vector<std::pair<eflowTrackClusterLink*,std::pair<float,float> > > trackClusterLinkPairs = energyFlowCaloObject.
efRecLink();
111
112 ATH_MSG_DEBUG(
"Have got " << trackClusterLinkPairs.size() <<
" trackClusterLinkPairs");
113
114 std::vector<eflowTrackClusterLink*> thisTracks_trackClusterLinks = efRecTrack->
getClusterMatches();
115
116 ATH_MSG_DEBUG(
"Have got " << thisTracks_trackClusterLinks.size() <<
" cluster matches");
117
121
122 std::vector<eflowTrackClusterLink*> thisTracks_trackClusterLinksSubtracted;
123
124
125 std::vector<std::pair<ElementLink<xAOD::CaloClusterContainer>, double> > vectorClusterToSubtractedEnergies;
126
127 for (auto& trackClusterLink : thisTracks_trackClusterLinks){
128 for (auto& trackClusterLinkPair : trackClusterLinkPairs){
129
130
131 if (!
m_eOverPMode && trackClusterLinkPair.first == trackClusterLink && !std::isnan(trackClusterLinkPair.second.first)) {
132 thisTracks_trackClusterLinksSubtracted.push_back(trackClusterLink);
133 eflowRecCluster* efRecCluster = trackClusterLinkPair.first->getCluster();
135 ElementLink<xAOD::CaloClusterContainer> theSisterClusterLink = (*theOriginalClusterLink)->getSisterClusterLink();
136 ATH_MSG_DEBUG(
"Will add cluster with E, ratio and absolute subtracted energy " << (*theOriginalClusterLink)->e() <<
", " << trackClusterLinkPair.second.first <<
", " << trackClusterLinkPair.second.second);
137 if (theSisterClusterLink.
isValid()) vectorClusterToSubtractedEnergies.emplace_back(std::pair(theSisterClusterLink,trackClusterLinkPair.second.second));
138 else vectorClusterToSubtractedEnergies.emplace_back(std::pair(theOriginalClusterLink,trackClusterLinkPair.second.second));
139 }
140 else if (
m_eOverPMode && trackClusterLinkPair.first == trackClusterLink){
141 thisTracks_trackClusterLinksSubtracted.push_back(trackClusterLink);
142 eflowRecCluster* efRecCluster = trackClusterLinkPair.first->
getCluster();
144 ElementLink<xAOD::CaloClusterContainer> theSisterClusterLink = (*theOriginalClusterLink)->getSisterClusterLink();
145 ATH_MSG_DEBUG(
"Will add cluster with E, ratio and absolute subtracted energy " << (*theOriginalClusterLink)->e() <<
", " << 1.0 <<
", " << 0.0);
146 if (theSisterClusterLink.
isValid()) vectorClusterToSubtractedEnergies.emplace_back(theSisterClusterLink,0.0);
147 else vectorClusterToSubtractedEnergies.emplace_back(theOriginalClusterLink,0.0);
148 }
149 }
150 }
151
152
153 std::sort(vectorClusterToSubtractedEnergies.begin(),vectorClusterToSubtractedEnergies.end(), [](
auto const&
a,
auto const&b){return a.second > b.second;});
154
155 std::vector<ElementLink<xAOD::IParticleContainer> > theClusters;
156 std::vector<float> theClusterWeights;
157 for (auto thePair : vectorClusterToSubtractedEnergies){
158 ElementLink< xAOD::IParticleContainer > theIParticleTrackLink(thePair.first);
159 theClusters.push_back(theIParticleTrackLink);
160 theClusterWeights.push_back(thePair.second);
161 }
162
163
165
166 }
167
168
170 const static SG::AuxElement::Accessor<float> accEtaEM2("EtaEM2");
172
173 const static SG::AuxElement::Accessor<float> accPhiEM2("PhiEM2");
175
176 const static SG::AuxElement::Accessor<char> accIsRecovered("isRecovered");
177 accIsRecovered(*thisFE) = efRecTrack->
isRecovered();
178
181
184
185 const static SG::AuxElement::Accessor<float > accPull15("Pull15");
186 accPull15(*thisFE) = efRecTrack->
getpull15();
187
190 }
191
192 }
193
194}
bool isValid() const
Test to see if the link can be dereferenced.
Gaudi::Property< bool > m_eOverPMode
Toggle EOverP algorithm mode, whereby no charged shower subtraction is performed.
Gaudi::Property< bool > m_addCPData
Toggle whether to decorate FlowElements with addutional data for Combined Performance studies.
SG::Accessor< T, ALLOC > Accessor
const eflowRecTrack * efRecTrack(int i) const
const std::vector< std::pair< eflowTrackClusterLink *, std::pair< float, float > > > & efRecLink() const
ElementLink< xAOD::CaloClusterContainer > getOriginalClusElementLink() const
xAOD::CaloCluster * getCluster()
double getEExpect() const
const std::vector< float > & getDRPrimes() const
const std::vector< eflowTrackClusterLink * > & getClusterMatches() const
const std::vector< float > & getRadiusCellOrderVector() const
bool isSubtracted() const
const xAOD::TrackParticle * getTrack() const
const eflowTrackCaloPoints & getTrackCaloPoints() const
const std::vector< int > & getLayerCellOrderVector() const
const std::vector< std::pair< ElementLink< CaloCellContainer >, double > > & getSubtractedCaloCells() const
bool isInDenseEnvironment() const
const std::vector< float > & getAvgEDensityCellOrderVector() const
ElementLink< xAOD::TrackParticleContainer > getTrackElemLink() const
const std::pair< float, float > getEM2etaPhi() const
virtual double pt() const override
void setP4(float pt, float eta, float phi, float m)
virtual double phi() const override
The azimuthal angle ( ) of the particle.
virtual double eta() const override
The pseudorapidity ( ) of the particle.
void setChargedObjectLinks(const std::vector< ElementLink< IParticleContainer > > &elV)
void setSignalType(signal_t t)
void setOtherObjectLinks(const std::vector< ElementLink< IParticleContainer > > &elV)
virtual double e() const override
The total energy of the particle.
virtual double m() const override final
The invariant mass of the particle..
virtual double phi() const override final
The azimuthal angle ( ) of the particle (has range to .)
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
float charge() const
Returns the charge.
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
FlowElement_v1 FlowElement
Definition of the current "pfo version".