This matches ID tracks and CaloClusters, and then creates eflowCaloObjects.
Add cluster matches needed for pull calculation (in eflowCaloObject::simulateShowers) which is used to determine whether to run the charged shower subtraction or not. / Clusters in both a cone of 0.15 and 0.2 are needed for this. / The clusters in a cone of 0.2 are also used as the matched cluster list for recover split showers mode.
98 {
99
100
101 unsigned int nMatches(0);
102
103
104 const unsigned int nCaloObj =
data.caloObjects->size();
105
106
107 for (
auto *thisEfRecTrack :
data.tracks)
108 {
110 if (!thisEfRecTrack->hasBin()) {
111 std::unique_ptr<eflowCaloObject> thisEflowCaloObject = std::make_unique<eflowCaloObject>();
112 thisEflowCaloObject->addTrack(thisEfRecTrack);
113 data.caloObjects->push_back(std::move(thisEflowCaloObject));
114 continue;
115 }
116
117 if (msgLvl(MSG::DEBUG))
118 {
121 }
122
123 std::vector<eflowTrackClusterLink*> bestClusters;
124 std::vector<float> deltaRPrime;
125
132 for (auto &matchpair : bestClusters_02)
133 {
134 eflowRecCluster *theCluster = matchpair.first;
135 float distancesq = matchpair.second;
137 if (distancesq < 0.15 * 0.15)
138 {
139
140
141 thisEfRecTrack->addAlternativeClusterMatch(trackClusterLink, "cone_015");
142 }
143 thisEfRecTrack->addAlternativeClusterMatch(trackClusterLink, "cone_02");
144 }
145
146
148 for (auto thePair : matchedClusters) {
150 if (
m_addCPData) deltaRPrime.push_back(std::sqrt(thePair.second));
151 }
152 }
153 else {
154 const std::vector<eflowTrackClusterLink*>* matchedClusters_02 = thisEfRecTrack->getAlternativeClusterMatches("cone_02");
155 if (!matchedClusters_02) continue;
156 else bestClusters = *matchedClusters_02;
157 }
158
159 if (bestClusters.empty()) continue;
160
161 if (msgLvl(MSG::DEBUG))
162 {
163 for (auto *thisClusterLink : bestClusters ) {
165 ATH_MSG_DEBUG(
"Matched this track to cluster with e,pt, eta and phi " << thisCluster->
e() <<
", " << thisCluster->
pt() <<
", " << thisCluster->
eta() <<
" and " << thisCluster->
phi());
166 }
167 }
168
169 nMatches++;
170
171
173 for (auto *trkClusLink : bestClusters){
174
175 eflowRecCluster *thisEFRecCluster = trkClusLink->getCluster();
176
178
179 if (std::find(
data.clusters.begin(),
data.clusters.end(), trkClusLink->getCluster()) ==
data.clusters.end()) {
181 continue;
182 }
183 }
184
186 thisEfRecTrack->addClusterMatch(trackClusterLink);
188 thisEfRecTrack->addDeltaRPrime(deltaRPrime[linkIndex]);
189 }
191 }
193 }
194
195
196 std::vector<eflowRecCluster *>
clusters(
data.clusters.begin(),
data.clusters.end());
199 ATH_MSG_DEBUG(
"Created " << nCaloObjects <<
" eflowCaloObjects.");
200 if (msgLvl(MSG::DEBUG)){
201 for (
auto thisEFlowCaloObject : *(
data.caloObjects)){
202 ATH_MSG_DEBUG(
"This eflowCaloObject has " << thisEFlowCaloObject->nTracks() <<
" tracks and " << thisEFlowCaloObject->nClusters() <<
" clusters ");
203 for (
unsigned int count = 0;
count < thisEFlowCaloObject->nTracks();
count++){
205 ATH_MSG_DEBUG(
"Have track with e, pt, eta and phi of " << thisTrack->
e() <<
", " << thisTrack->
pt() <<
", " << thisTrack->
eta() <<
" and " << thisTrack->
phi());
206 }
207 for (
unsigned int count = 0;
count < thisEFlowCaloObject->nClusters();
count++){
209 ATH_MSG_DEBUG(
"Have cluster with e, pt, eta and phi of " << thisCluster->
e() <<
", " << thisCluster->
pt() <<
", " << thisCluster->
eta() <<
" and " << thisCluster->
phi());
210 }
211 }
212 }
213
215 else return nCaloObj;
216}
char data[hepevt_bytes_allocation_ATLAS]
static unsigned int makeTrkCluCaloObjects(eflowRecTrackContainer *eflowTrackContainer, eflowRecClusterContainer *eflowClusterContainer, eflowCaloObjectContainer *caloObjectContainer)
void addTrackMatch(eflowTrackClusterLink *trackMatch)
static eflowTrackClusterLink * getInstance(eflowRecTrack *track, eflowRecCluster *cluster, const EventContext &ctx)
virtual double pt() const
The transverse momentum ( ) of the particle (negative for negative-energy clusters).
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double e() const
The total energy of the particle.
virtual double phi() const
The azimuthal angle ( ) 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.
virtual double e() const override final
The total energy of the particle.
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string
@ linkIndex
link index for multiple track and vertex matches
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
TrackParticle_v1 TrackParticle
Reference the current persistent version: