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.
97 {
98
99
100 unsigned int nMatches(0);
101
102
103 const unsigned int nCaloObj =
data.caloObjects->size();
104
105
106 for (
auto *thisEfRecTrack :
data.tracks)
107 {
109 if (!thisEfRecTrack->hasBin()) {
110 std::unique_ptr<eflowCaloObject> thisEflowCaloObject = std::make_unique<eflowCaloObject>();
111 thisEflowCaloObject->addTrack(thisEfRecTrack);
112 data.caloObjects->push_back(std::move(thisEflowCaloObject));
113 continue;
114 }
115
116 if (msgLvl(MSG::DEBUG))
117 {
120 }
121
122 std::vector<eflowTrackClusterLink*> bestClusters;
123 std::vector<float> deltaRPrime;
124
131 for (auto &matchpair : bestClusters_02)
132 {
133 eflowRecCluster *theCluster = matchpair.first;
134 float distancesq = matchpair.second;
136 if (distancesq < 0.15 * 0.15)
137 {
138
139
140 static const std::string cone15Str{"cone_015"};
141 thisEfRecTrack->addAlternativeClusterMatch(trackClusterLink, cone15Str);
142 }
143 static const std::string cone2Str{"cone_02"};
144 thisEfRecTrack->addAlternativeClusterMatch(trackClusterLink, cone2Str);
145 }
146
147
149 for (auto thePair : matchedClusters) {
151 if (
m_addCPData) deltaRPrime.push_back(std::sqrt(thePair.second));
152 }
153 }
154 else {
155 const std::vector<eflowTrackClusterLink*>* matchedClusters_02 = thisEfRecTrack->getAlternativeClusterMatches("cone_02");
156 if (!matchedClusters_02) continue;
157 else bestClusters = *matchedClusters_02;
158 }
159
160 if (bestClusters.empty()) continue;
161
162 if (msgLvl(MSG::DEBUG))
163 {
164 for (auto *thisClusterLink : bestClusters ) {
166 ATH_MSG_DEBUG(
"Matched this track to cluster with e,pt, eta and phi " << thisCluster->
e() <<
", " << thisCluster->
pt() <<
", " << thisCluster->
eta() <<
" and " << thisCluster->
phi());
167 }
168 }
169
170 nMatches++;
171
172
174 for (auto *trkClusLink : bestClusters){
175
176 eflowRecCluster *thisEFRecCluster = trkClusLink->getCluster();
177
179
180 if (std::find(
data.clusters.begin(),
data.clusters.end(), trkClusLink->getCluster()) ==
data.clusters.end()) {
182 continue;
183 }
184 }
185
187 thisEfRecTrack->addClusterMatch(trackClusterLink);
189 thisEfRecTrack->addDeltaRPrime(deltaRPrime[linkIndex]);
190 }
192 }
194 }
195
196
197 std::vector<eflowRecCluster *>
clusters(
data.clusters.begin(),
data.clusters.end());
200 ATH_MSG_DEBUG(
"Created " << nCaloObjects <<
" eflowCaloObjects.");
201 if (msgLvl(MSG::DEBUG)){
202 for (
auto thisEFlowCaloObject : *(
data.caloObjects)){
203 ATH_MSG_DEBUG(
"This eflowCaloObject has " << thisEFlowCaloObject->nTracks() <<
" tracks and " << thisEFlowCaloObject->nClusters() <<
" clusters ");
204 for (
unsigned int count = 0;
count < thisEFlowCaloObject->nTracks();
count++){
206 ATH_MSG_DEBUG(
"Have track with e, pt, eta and phi of " << thisTrack->
e() <<
", " << thisTrack->
pt() <<
", " << thisTrack->
eta() <<
" and " << thisTrack->
phi());
207 }
208 for (
unsigned int count = 0;
count < thisEFlowCaloObject->nClusters();
count++){
210 ATH_MSG_DEBUG(
"Have cluster with e, pt, eta and phi of " << thisCluster->
e() <<
", " << thisCluster->
pt() <<
", " << thisCluster->
eta() <<
" and " << thisCluster->
phi());
211 }
212 }
213 }
214
216 else return nCaloObj;
217}
#define ATH_MSG_DEBUG(x,...)
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: