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 static const std::string cone15Str{"cone_015"};
142 thisEfRecTrack->addAlternativeClusterMatch(trackClusterLink, cone15Str);
143 }
144 static const std::string cone2Str{"cone_02"};
145 thisEfRecTrack->addAlternativeClusterMatch(trackClusterLink, cone2Str);
146 }
147
148
150 for (auto thePair : matchedClusters) {
152 if (
m_addCPData) deltaRPrime.push_back(std::sqrt(thePair.second));
153 }
154 }
155 else {
156 const std::vector<eflowTrackClusterLink*>* matchedClusters_02 = thisEfRecTrack->getAlternativeClusterMatches("cone_02");
157 if (!matchedClusters_02) continue;
158 else bestClusters = *matchedClusters_02;
159 }
160
161 if (bestClusters.empty()) continue;
162
163 if (msgLvl(MSG::DEBUG))
164 {
165 for (auto *thisClusterLink : bestClusters ) {
167 ATH_MSG_DEBUG(
"Matched this track to cluster with e,pt, eta and phi " << thisCluster->
e() <<
", " << thisCluster->
pt() <<
", " << thisCluster->
eta() <<
" and " << thisCluster->
phi());
168 }
169 }
170
171 nMatches++;
172
173
175 for (auto *trkClusLink : bestClusters){
176
177 eflowRecCluster *thisEFRecCluster = trkClusLink->getCluster();
178
180
181 if (std::find(
data.clusters.begin(),
data.clusters.end(), trkClusLink->getCluster()) ==
data.clusters.end()) {
183 continue;
184 }
185 }
186
188 thisEfRecTrack->addClusterMatch(trackClusterLink);
190 thisEfRecTrack->addDeltaRPrime(deltaRPrime[linkIndex]);
191 }
193 }
195 }
196
197
198 std::vector<eflowRecCluster *>
clusters(
data.clusters.begin(),
data.clusters.end());
201 ATH_MSG_DEBUG(
"Created " << nCaloObjects <<
" eflowCaloObjects.");
202 if (msgLvl(MSG::DEBUG)){
203 for (
auto thisEFlowCaloObject : *(
data.caloObjects)){
204 ATH_MSG_DEBUG(
"This eflowCaloObject has " << thisEFlowCaloObject->nTracks() <<
" tracks and " << thisEFlowCaloObject->nClusters() <<
" clusters ");
205 for (
unsigned int count = 0;
count < thisEFlowCaloObject->nTracks();
count++){
207 ATH_MSG_DEBUG(
"Have track with e, pt, eta and phi of " << thisTrack->
e() <<
", " << thisTrack->
pt() <<
", " << thisTrack->
eta() <<
" and " << thisTrack->
phi());
208 }
209 for (
unsigned int count = 0;
count < thisEFlowCaloObject->nClusters();
count++){
211 ATH_MSG_DEBUG(
"Have cluster with e, pt, eta and phi of " << thisCluster->
e() <<
", " << thisCluster->
pt() <<
", " << thisCluster->
eta() <<
" and " << thisCluster->
phi());
212 }
213 }
214 }
215
217 else return nCaloObj;
218}
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: