Execute method.
51 {
52
53
54
57
58
59 auto outputTracks = std::make_unique< TRACKCONTAINER >();
60 auto outputAuxTracks = std::make_unique< TRACKAUXCONTAINER>();
61 outputTracks->setStore( outputAuxTracks.get() );
62
63
64
67 for(; trackItr != trackEnd; ++trackItr ){
69 if(!track){
ATH_MSG_INFO(
"Not a valid track");
continue; }
70
72
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
106 for(; trackItr2 != trackEnd2; ++trackItr2 ){
107 if(trackItr==trackItr2) continue;
108 const TRACK* track2 = *trackItr2;
109 double dif_eta =
track->eta() - track2->
eta();
110 double dif_phi =
track->phi() - track2->
phi();
111 if(dif_phi<0) dif_phi=-dif_phi;
112 if(dif_phi>
M_PI){dif_phi=2*
M_PI-dif_phi;}
113 double deltaR = sqrt(dif_eta*dif_eta+dif_phi*dif_phi);
115 }
118 tmpTrack->makePrivateStore( track );
119 outputTracks->push_back(tmpTrack);
120 }
121 }
122 }
123 }
124
125 ATH_MSG_DEBUG(
"Number of selected tracks: " << outputTracks->size());
126
127
130
131
132 auto outputClusters = std::make_unique< xAOD::CaloClusterContainer>();
133 auto outputAuxClusters = std::make_unique< xAOD::CaloClusterAuxContainer>();
134 outputClusters->setStore( outputAuxClusters.get() );
135
136
137
140
141
142
143
144
145
148 for(;clusterItr != clusterEnd; ++clusterItr){
149 const CLUSTER* cluster = *clusterItr;
152 ASSOCCONTAINER::iterator assocItr = trackClusters->begin();
153 for( ; trackItr != trackEnd; ++trackItr ){
155 vector< vector<double> > etrack =
m_trackInCalo->getXYZEtaPhiPerLayer(track);
157 for(int cell_sid=0;cell_sid<CaloSampling::Unknown;cell_sid++){
158 int lay=-1;
159 if (cell_sid==0 || cell_sid==4 ){lay=0;}
160 else if(cell_sid==1 || cell_sid==5 ){lay=1;}
161 else if(cell_sid==2 || cell_sid==6 ){lay=2;}
162 else if(cell_sid==3 || cell_sid==7 ){lay=3;}
163 else if(cell_sid==12 || cell_sid==18){lay=4;}
164 else if(cell_sid==13 || cell_sid==19){lay=5;}
165 else if(cell_sid==15 || cell_sid==17){lay=5;}
166 else if(cell_sid==14 || cell_sid==20){lay=6;}
167 else if(cell_sid==16) {lay=6;}
168 else if(cell_sid==8 ){lay=7;}
169 else if(cell_sid==9 ){lay=8;}
170 else if(cell_sid==10 ){lay=9;}
171 else if(cell_sid==11 ){lay=10;}
172 if(lay==-1) continue;
175 if(dif_phi<0) dif_phi=-dif_phi;
176 if(dif_phi>
M_PI){dif_phi=2*
M_PI-dif_phi;}
177 double tmp = sqrt(dif_eta*dif_eta+dif_phi*dif_phi);
179 }
182 while(i!=outputClusters->size()){
if(outputClusters->at(i)==cluster){
break;}
i++;}
183 if(i==outputClusters->size()){
185 tmpCluster->makePrivateStore( cluster );
186 outputClusters->push_back(tmpCluster);
187 }
188
189 assocItr->push_back(i);
190 }
191 ++assocItr;
192 }
193 }
194
195 ATH_MSG_DEBUG(
"Number of selected clusters: " << outputClusters->size());
196
197
200
201
202 ConstDataVector<CELLCONTAINER>* outputCells =
new ConstDataVector<CELLCONTAINER>(
SG::VIEW_ELEMENTS );
204
205
208
209
210 clusterItr = outputClusters->begin();
211 clusterEnd = outputClusters->end();
212 ASSOCCONTAINER::iterator assocItr = clusterCells->begin();
213
214 for(;clusterItr != clusterEnd; ++clusterItr){
215 const CLUSTER* cluster = *clusterItr;
219 for(;cellItr != cellEnd; ++cellItr){
222 while(i!=outputCells->size()){
if(outputCells->
at(i)==cell){
break;}
i++;}
223 if(i==outputCells->size()){
225 }
226
227 assocItr->push_back(i);
228 }
229 }
230 ++assocItr;
231 }
232
233
236
237
238
239 trackItr = outputTracks->begin();
240 trackEnd = outputTracks->end();
241 assocItr = trackCells->begin();
242
243 for( ; trackItr != trackEnd; ++trackItr ){
245 vector< vector<double> > etrack =
m_trackInCalo->getXYZEtaPhiPerLayer(track);
246
249 for(;cellItr != cellEnd; ++cellItr){
252
253 int lay=-1;
254 if (cell_sid==0 || cell_sid==4 ){lay=0;}
255 else if(cell_sid==1 || cell_sid==5 ){lay=1;}
256 else if(cell_sid==2 || cell_sid==6 ){lay=2;}
257 else if(cell_sid==3 || cell_sid==7 ){lay=3;}
258 else if(cell_sid==12 || cell_sid==18){lay=4;}
259 else if(cell_sid==13 || cell_sid==19){lay=5;}
260 else if(cell_sid==15 || cell_sid==17){lay=5;}
261 else if(cell_sid==14 || cell_sid==20){lay=6;}
262 else if(cell_sid==16) {lay=6;}
263 else if(cell_sid==8 ){lay=7;}
264 else if(cell_sid==9 ){lay=8;}
265 else if(cell_sid==10 ){lay=9;}
266 else if(cell_sid==11 ){lay=10;}
267 if(lay==-1) continue;
268 double dif_eta =
cell->eta() - etrack[lay][3];
269 double dif_phi =
cell->phi() - etrack[lay][4];
270 if(dif_phi<0) dif_phi=-dif_phi;
271 if(dif_phi>
M_PI){dif_phi=2*
M_PI-dif_phi;}
272 double deltaR = sqrt(dif_eta*dif_eta+dif_phi*dif_phi);
275 while(i!=outputCells->size()){
if(outputCells->
at(i)==cell){
break;}
i++;}
276 if(i==outputCells->size()){
278 }
279 assocItr->push_back(i);
280 }
281 }
282 ++assocItr;
283 }
284
285 ATH_MSG_DEBUG(
"Number of selected cells: " << outputCells->size());
286
291
292
293 return StatusCode::SUCCESS;
294
295}
Scalar deltaR(const MatrixBase< Derived > &vec) const
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_INFO(x,...)
#define CHECK(...)
Evaluate an expression and check for errors.
std::vector< std::vector< int > > ASSOCCONTAINER
#define ASSOCCONTAINER_CONSTRUCTOR(size)
ServiceHandle< StoreGateSvc > & evtStore()
value_type push_back(value_type pElem)
Add an element to the end of the collection.
ElementProxy at(size_type n)
Access an element, as an lvalue.
DataModel_detail::const_iterator< DataVector > const_iterator
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
const CaloClusterCellLink * getCellLinks() const
Get a pointer to the CaloClusterCellLink object (const version).
float phiSample(const CaloSample sampling) const
Retrieve barycenter in a given sample.
CaloClusterCellLink::const_iterator const_cell_iterator
Iterator of the underlying CaloClusterCellLink (explicitly const version).
const_cell_iterator cell_end() const
const_cell_iterator cell_begin() const
Iterator of the underlying CaloClusterCellLink (const version).
float etaSample(const CaloSample sampling) const
Retrieve barycenter in a given sample.
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.
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts