24 m_inputTrackCollection(
"Tracks"),
25 m_trackTruthCollection(
"TrackTruthCollection"),
26 m_truthToTrack(
"Trk::TruthToTrack/TruthToTrack"),
29 m_nHundred(4),m_nFifty(4),m_nTwenty(4),m_nTen(4),m_nFakeOrLost(4),
30 m_tHundred(4),m_tFifty(4),m_tTwenty(4),m_tTen(4),m_tFakeOrLost(4)
53 if (
sc.isFailure()) { }
56 if ( !m_trackSelector.empty() ) {
57 sc = m_trackSelector.retrieve();
59 msg(
MSG::FATAL) <<
"Could not retrieve "<< m_trackSelector <<
" (to select the tracks which are to be counted) "<<
endmsg;
60 msg(MSG::INFO) <<
"Set the ToolHandle to None if track selection is supposed to be disabled" <<
endmsg;
64 sc = m_truthToTrack.retrieve();
72 return StatusCode::FAILURE;
76 return StatusCode::SUCCESS;
88 return StatusCode::SUCCESS;
100 if (!m_inputTrackCollection.empty()) {
101 sc = evtStore()->retrieve(trackCollection,m_inputTrackCollection);
103 ATH_MSG_ERROR(
"TrackCollection "<<m_inputTrackCollection<<
" not found!" );
105 ATH_MSG_VERBOSE(
"TrackCollection " << m_inputTrackCollection<<
" found." );
109 return StatusCode::FAILURE;
113 if (!m_trackTruthCollection.empty()) {
114 sc = evtStore()->retrieve(trackTruthCollection, m_trackTruthCollection);
116 ATH_MSG_ERROR(
"TruthCollection "<<m_trackTruthCollection<<
" not found!" );
118 ATH_MSG_VERBOSE(
"TruthCollection " << m_trackTruthCollection<<
" found." );
121 return StatusCode::FAILURE;
126 for (;trackIterator!=trackCollection->
end();++trackIterator) {
128 if (!m_trackSelector.empty() && (*trackIterator)!=
nullptr &&
129 m_trackSelector->decision(**trackIterator) ) {
135 TrackTruthCollection::const_iterator truthIterator
136 = trackTruthCollection->find( trackIterator - (*trackCollection).begin() );
137 if ( truthIterator == trackTruthCollection->end() ){
140 trackTruth = &((*truthIterator).second);
142 if (msgLvl(
MSG::DEBUG))
msg(
MSG::DEBUG) <<
"Link to generated particle information is not there - assuming a lost G4 particle ('fake fake')." <<
endmsg;
150 if ( genParticle && genParticle->pdg_id() == 0 ) {
152 <<
" does not conform to PDG requirements... ignore it!" <<
endmsg;
153 genParticle =
nullptr;
159 "Associated Particle ID: " << genParticle->pdg_id() <<
endmsg;
161 if ( genParticle->production_vertex() )
162 generatedTrackPerigee = m_truthToTrack->makePerigeeParameters( genParticle );
166 bool track_has_trthits(
false);
168 = (*trackIterator)->trackStateOnSurfaces();
170 = currentTSOSList->
begin();
171 for (;itTSOS!=currentTSOSList->
end();++itTSOS) {
174 if (
id.is_valid() && m_idHelper->is_trt(
id)) {
175 track_has_trthits=
true;
179 const TrackParameters* reconstructedPerigee = (*trackIterator)->perigeeParameters();
181 if (generatedTrackPerigee !=
nullptr) {
183 if (!reconstructedPerigee)
return StatusCode::FAILURE;
185 double this_eta = reconstructedPerigee->
eta();
187 double truth_over_recP = generatedTrackPerigee->parameters()[
Trk::qOverP]
189 if ( (truth_over_recP > 0.9) && (truth_over_recP < 1.1)) {
190 monitorTrackFits(m_nTen,this_eta);
191 monitorTrackFits(m_nTwenty,this_eta);
192 monitorTrackFits(m_nFifty,this_eta);
193 monitorTrackFits(m_nHundred,this_eta);
194 if (track_has_trthits) {
195 monitorTrackFits(m_tTen, this_eta);
196 monitorTrackFits(m_tTwenty, this_eta);
197 monitorTrackFits(m_tFifty, this_eta);
198 monitorTrackFits(m_tHundred, this_eta);
201 }
else if ( (truth_over_recP > 0.8) && (truth_over_recP < 1.2) ) {
202 monitorTrackFits(m_nTwenty,this_eta);
203 monitorTrackFits(m_nFifty,this_eta);
204 monitorTrackFits(m_nHundred,this_eta);
205 if (track_has_trthits) {
206 monitorTrackFits(m_tTwenty, this_eta);
207 monitorTrackFits(m_tFifty, this_eta);
208 monitorTrackFits(m_tHundred, this_eta);
210 }
else if ( (truth_over_recP > 0.5) && (truth_over_recP < 1.5) ) {
211 monitorTrackFits(m_nFifty,this_eta);
212 monitorTrackFits(m_nHundred,this_eta);
213 if (track_has_trthits) {
214 monitorTrackFits(m_tFifty, this_eta);
215 monitorTrackFits(m_tHundred, this_eta);
218 monitorTrackFits(m_nHundred,this_eta);
219 if (track_has_trthits) monitorTrackFits(m_tHundred, this_eta);
222 delete generatedTrackPerigee;
224 double this_eta = reconstructedPerigee->
eta();
225 monitorTrackFits(m_nFakeOrLost, this_eta);
226 if (track_has_trthits) monitorTrackFits(m_tFakeOrLost, this_eta);
234 return StatusCode::SUCCESS;
252 for (
unsigned int iref=100; iref<m_nHundred[iAll]; iref*=10, ++iw,
d+=
" ") {}
253 std::cout <<
"---------------------------------------------------------------------------------" << std::endl;
254 std::cout <<
" "<<
name() <<
" results "
255 << (m_trackSelector.empty() ?
" " :
"(with track selection)") << std::endl;
256 std::cout <<
"---------------------------------------------------------------------------------" << std::endl;
257 std::cout <<
" q/p truth vicinity -- Any "<<
d<<
" 50% "<<
d<<
" 20% "<<
d<<
" 10%"<<
d<<
"noTruth " << std::endl;
258 std::cout <<
"---------------------------------------------------------------------------------" << std::endl;
259 std::cout <<
" total (Si+TRT) :" << std::setiosflags(std::ios::dec) << std::setw(iw+1)
260 << m_nHundred[iAll] <<
" ("<< std::setw(iw)<<m_tHundred[iAll]<<
") "
261 << std::setiosflags(std::ios::dec) << std::setw(iw+1)
262 << m_nFifty[iAll] <<
" ("<< std::setw(iw)<<m_tFifty[iAll]<<
") "
263 << std::setiosflags(std::ios::dec) << std::setw(iw+1)
264 << m_nTwenty[iAll] <<
" ("<< std::setw(iw)<<m_tTwenty[iAll]<<
") "
265 << std::setiosflags(std::ios::dec) << std::setw(iw+1)
266 << m_nTen[iAll] <<
" ("<< std::setw(iw)<<m_tTen[iAll]<<
") "
267 << std::setiosflags(std::ios::dec) << std::setw(iw+1)
268 << m_nFakeOrLost[iAll] <<
" ("<< std::setw(iw)<<m_tFakeOrLost[iAll]<<
") "
270 std::cout <<
" barrel (Si+TRT) :" << std::setiosflags(std::ios::dec) << std::setw(iw+1)
271 << m_nHundred[iBarrel] <<
" ("<< std::setw(iw)<<m_tHundred[iBarrel]<<
") "
272 << std::setiosflags(std::ios::dec) << std::setw(iw+1)
273 << m_nFifty[iBarrel] <<
" ("<< std::setw(iw)<<m_tFifty[iBarrel]<<
") "
274 << std::setiosflags(std::ios::dec) << std::setw(iw+1)
275 << m_nTwenty[iBarrel] <<
" ("<< std::setw(iw)<<m_tTwenty[iBarrel]<<
") "
276 << std::setiosflags(std::ios::dec) << std::setw(iw+1)
277 << m_nTen[iBarrel] <<
" ("<< std::setw(iw)<<m_tTen[iBarrel]<<
") "
278 << std::setiosflags(std::ios::dec) << std::setw(iw+1)
279 << m_nFakeOrLost[iBarrel] <<
" ("<< std::setw(iw)<<m_tFakeOrLost[iBarrel]<<
") "
281 std::cout <<
" transition :" << std::setiosflags(std::ios::dec) << std::setw(iw+1)
282 << m_nHundred[iTransi] <<
" ("<< std::setw(iw)<<m_tHundred[iTransi]<<
") "
283 << std::setiosflags(std::ios::dec) << std::setw(iw+1)
284 << m_nFifty[iTransi] <<
" ("<< std::setw(iw)<<m_tFifty[iTransi]<<
") "
285 << std::setiosflags(std::ios::dec) << std::setw(iw+1)
286 << m_nTwenty[iTransi] <<
" ("<< std::setw(iw)<<m_tTwenty[iTransi]<<
") "
287 << std::setiosflags(std::ios::dec) << std::setw(iw+1)
288 << m_nTen[iTransi] <<
" ("<< std::setw(iw)<<m_tTen[iTransi]<<
") "
289 << std::setiosflags(std::ios::dec) << std::setw(iw+1)
290 << m_nFakeOrLost[iTransi] <<
" ("<< std::setw(iw)<<m_tFakeOrLost[iTransi]<<
") "
292 std::cout <<
" endcap (Si+TRT) :" << std::setiosflags(std::ios::dec) << std::setw(iw+1)
293 << m_nHundred[iEndcap] <<
" ("<< std::setw(iw)<<m_tHundred[iEndcap]<<
") "
294 << std::setiosflags(std::ios::dec) << std::setw(iw+1)
295 << m_nFifty[iEndcap] <<
" ("<< std::setw(iw)<<m_tFifty[iEndcap]<<
") "
296 << std::setiosflags(std::ios::dec) << std::setw(iw+1)
297 << m_nTwenty[iEndcap] <<
" ("<< std::setw(iw)<<m_tTwenty[iEndcap]<<
") "
298 << std::setiosflags(std::ios::dec) << std::setw(iw+1)
299 << m_nTen[iEndcap] <<
" ("<< std::setw(iw)<<m_tTen[iEndcap]<<
") "
300 << std::setiosflags(std::ios::dec) << std::setw(iw+1)
301 << m_nFakeOrLost[iEndcap] <<
" ("<< std::setw(iw)<<m_tFakeOrLost[iEndcap]<<
") "
303 std::cout <<
"---------------------------------------------------------------------------------" << std::endl << std::endl;