ATLAS Offline Software
FPGATrackSimTrackStream.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include <iostream>
8 #include <iomanip>
9 using namespace std;
10 
12  m_run_number(0ul), m_event_number(0ul),
13  m_ntracks(0), m_ncombs(0), m_nfits(0), m_nfits_maj(0),
14  m_nfits_maj_SCT(0),
15  m_nfits_maj_pix(0),
16  m_nfits_rec(0), m_nfits_addrec(0), m_nfits_bad(0), m_nfits_rej(0),
17  m_nfits_badmaj(0), m_nfits_rejmaj(0),
18  m_ntracksI(0), m_ncombsI(0), m_nfitsI(0), m_nfits_majI(0),
19  m_nfits_majI_SCT(0),
20  m_nfits_majI_pix(0),
21  m_nfits_recI(0), m_nfits_addrecI(0), m_nfits_badI(0), m_nfits_rejI(0),
22  m_nfits_badmajI(0), m_nfits_rejmajI(0), m_nconn(0), m_nextrapolatedTracks(0)
23 {
24  m_tracks = new TClonesArray("FPGATrackSimTrack", 1000);
25  m_tracksI = new TClonesArray("FPGATrackSimTrack", 1000);
26 }
27 
29 {
30  if (this != &in) {
33  m_ntracks = in.m_ntracks;
34  m_ncombs = in.m_ncombs;
35  m_nfits = in.m_nfits;
46  m_ncombsI = in.m_ncombsI;
47  m_nfitsI = in.m_nfitsI;
57  m_nconn = in.m_nconn;
59  m_tracks = new TClonesArray("FPGATrackSimTrack", 1000);
60  m_tracksI = new TClonesArray("FPGATrackSimTrack", 1000);
61  for (int i = 0; i < in.m_ntracks; i++) {
62  FPGATrackSimTrack* trackP = in.getTrack(i);
63  const FPGATrackSimTrack track = *trackP;
64  addTrack(track);
65  }
66  for (int i = 0; i < in.m_ntracksI; i++) {
67  FPGATrackSimTrack* trackP = in.getTrackI(i);
68  const FPGATrackSimTrack track = *trackP;
70  }
71  }
72 
73  return *this;
74 }
75 
77 {
78  m_tracks->Delete();
79  delete m_tracks;
80  m_tracksI->Delete();
81  delete m_tracksI;
82 }
83 
84 // copy constructor
88  m_ntracks = in.m_ntracks;
89  m_ncombs = in.m_ncombs;
90  m_nfits = in.m_nfits;
100  m_ntracksI = in.m_ntracksI;
101  m_ncombsI = in.m_ncombsI;
102  m_nfitsI = in.m_nfitsI;
112  m_nconn = in.m_nconn;
114  m_tracks = new TClonesArray("FPGATrackSimTrack", 1000);
115  m_tracksI = new TClonesArray("FPGATrackSimTrack", 1000);
116  for (int i = 0; i < in.m_ntracks; i++) {
117  FPGATrackSimTrack* trackP = in.getTrack(i);
118  const FPGATrackSimTrack track = *trackP;
119  addTrack(track);
120  }
121  for (int i = 0; i < in.m_ntracksI; i++) {
122  FPGATrackSimTrack* trackP = in.getTrackI(i);
123  const FPGATrackSimTrack track = *trackP;
124  addTrackI(track);
125  }
126 }
127 
128 
131 {
132  new ((*m_tracks)[m_ntracks++]) FPGATrackSimTrack(track);
133  m_trackIdMap[std::make_pair(track.getTrackID(), track.getBankID())] = m_ntracks - 1;
134 }
135 
136 
140 {
141  if (ipos >= m_ntracks) return 0;
142  else return (FPGATrackSimTrack*)m_tracks->At(ipos);
143 }
144 
147 int FPGATrackSimTrackStream::findTrack(int trackid, int bankid)
148 {
149  if (!m_trackIdMap.size())
150  buildTrackMap();
151 
152  std::map< std::pair<int, int>, int >::iterator it = m_trackIdMap.find(std::make_pair(trackid, bankid));
153  if (it != m_trackIdMap.end())
154  return it->second;
155  else
156  return -1;
157 }
158 
159 
162 {
163  new ((*m_tracksI)[m_ntracksI++]) FPGATrackSimTrack(track);
164 }
165 
166 
170 {
171  if (ipos >= m_ntracksI) return 0;
172  else return (FPGATrackSimTrack*)m_tracksI->At(ipos);
173 }
174 
178 {
179  m_run_number = 0ul;
180  m_event_number = 0ul;
181 
182  m_tracks->Delete();
183  m_ntracks = 0;
184  m_tracksI->Delete();
185  m_ntracksI = 0;
186 
187  m_ncombs = 0;
188  m_nfits = 0;
189  m_nconn = 0;
191  m_nfits_maj = 0;
192  m_nfits_maj_pix = 0;
193  m_nfits_maj_SCT = 0;
194  m_nfits_bad = 0;
195  m_nfits_badmaj = 0;
196  m_nfits_rec = 0;
197  m_nfits_addrec = 0;
198  m_nfits_rej = 0;
199  m_nfits_rejmaj = 0;
200 
201  m_ncombsI = 0;
202  m_nfitsI = 0;
203  m_nfits_majI = 0;
204  m_nfits_majI_pix = 0;
205  m_nfits_majI_SCT = 0;
206  m_nfits_badI = 0;
207  m_nfits_badmajI = 0;
208  m_nfits_recI = 0;
209  m_nfits_addrecI = 0;
210  m_nfits_rejI = 0;
211  m_nfits_rejmajI = 0;
212 
213  m_trackIdMap.clear();
214 }
215 
216 
223 {
224  int printed(0);
225  out << "*** Run/Event " << m_run_number << "/" << m_event_number << " ***" << endl;
226  out << "*** Tracks (lvl=" << level << "): ***" << endl;
227  out << "*** mntracks: " << m_ntracks << endl;
228  // for (int it=0;it<m_ntracks;++it) {
229  // FPGATrackSimTrack *tmpt = getTrack(it);
230  // }
231  if (printed == 0) out << " [ NO TRACKS ] " << endl;
232  out << endl;
233 
234  return printed;
235 }
236 
238  m_trackIdMap.clear();
239  for (int itrack = 0;itrack != m_ntracks;++itrack) { // loop over the tracks
240  FPGATrackSimTrack* cur_track = getTrack(itrack);
241 
242  if (!cur_track) continue; // a null pointer is possible
243  m_trackIdMap[std::make_pair(cur_track->getTrackID(), cur_track->getBankID())] = itrack;
244  }
245 
246 }
FPGATrackSimTrackStream::m_nfits_maj_SCT
int m_nfits_maj_SCT
Definition: FPGATrackSimTrackStream.h:106
FPGATrackSimTrackStream::getTrackI
FPGATrackSimTrack * getTrackI(int) const
return a given track, identified by its position in the list
Definition: FPGATrackSimTrackStream.cxx:169
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
FPGATrackSimTrackStream::findTrack
int findTrack(int trackid, int bankid)
this method, passing a track ID and a bank ID, return the ID of the corresponding track.
Definition: FPGATrackSimTrackStream.cxx:147
FPGATrackSimTrackStream::m_nfits_maj
int m_nfits_maj
Definition: FPGATrackSimTrackStream.h:105
FPGATrackSimTrackStream::m_nfits_majI
int m_nfits_majI
Definition: FPGATrackSimTrackStream.h:125
FPGATrackSimTrackStream::m_nconn
int m_nconn
Definition: FPGATrackSimTrackStream.h:134
FPGATrackSimTrackStream::m_nextrapolatedTracks
int m_nextrapolatedTracks
Definition: FPGATrackSimTrackStream.h:135
FPGATrackSimTrack::getTrackID
int getTrackID() const
Definition: FPGATrackSimTrack.h:33
FPGATrackSimTrackStream::m_nfits_majI_SCT
int m_nfits_majI_SCT
Definition: FPGATrackSimTrackStream.h:126
FPGATrackSimTrack
Definition: FPGATrackSimTrack.h:18
FPGATrackSimTrackStream::m_nfits_rejI
int m_nfits_rejI
Definition: FPGATrackSimTrackStream.h:131
skel.it
it
Definition: skel.GENtoEVGEN.py:396
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
FPGATrackSimTrackStream::m_nfits_rejmaj
int m_nfits_rejmaj
Definition: FPGATrackSimTrackStream.h:113
FPGATrackSimTrackStream::m_ntracks
int m_ntracks
Definition: FPGATrackSimTrackStream.h:100
FPGATrackSimTrackStream::m_nfits_addrecI
int m_nfits_addrecI
Definition: FPGATrackSimTrackStream.h:129
FPGATrackSimTrackStream.h
FPGATrackSimTrackStream::FPGATrackSimTrackStream
FPGATrackSimTrackStream()
Definition: FPGATrackSimTrackStream.cxx:11
FPGATrackSimTrackStream::m_nfits_badI
int m_nfits_badI
Definition: FPGATrackSimTrackStream.h:130
FPGATrackSimTrackStream::m_event_number
unsigned long m_event_number
Definition: FPGATrackSimTrackStream.h:98
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
FPGATrackSimTrackStream::~FPGATrackSimTrackStream
virtual ~FPGATrackSimTrackStream()
Definition: FPGATrackSimTrackStream.cxx:76
FPGATrackSimTrackStream::m_nfits_badmaj
int m_nfits_badmaj
Definition: FPGATrackSimTrackStream.h:112
FPGATrackSimTrackStream::Print
int Print(int level=0, std::ostream &out=std::cout)
print a debug message summaryzing the information for the tracks found in one event for a given bank.
Definition: FPGATrackSimTrackStream.cxx:222
FPGATrackSimTrackStream::m_nfits_badmajI
int m_nfits_badmajI
Definition: FPGATrackSimTrackStream.h:132
FPGATrackSimTrackStream::m_trackIdMap
std::map< std::pair< int, int >, int > m_trackIdMap
Definition: FPGATrackSimTrackStream.h:137
lumiFormat.i
int i
Definition: lumiFormat.py:85
FPGATrackSimTrackStream::m_nfitsI
int m_nfitsI
Definition: FPGATrackSimTrackStream.h:124
FPGATrackSimTrackStream::m_nfits
int m_nfits
Definition: FPGATrackSimTrackStream.h:104
FPGATrackSimTrackStream::addTrackI
void addTrackI(const FPGATrackSimTrack &)
add a track in the final list
Definition: FPGATrackSimTrackStream.cxx:161
FPGATrackSimTrackStream::addTrack
void addTrack(const FPGATrackSimTrack &)
add a track in the final list
Definition: FPGATrackSimTrackStream.cxx:130
FPGATrackSimTrackStream::m_nfits_rej
int m_nfits_rej
Definition: FPGATrackSimTrackStream.h:111
FPGATrackSimTrackStream::m_run_number
unsigned long m_run_number
Definition: FPGATrackSimTrackStream.h:97
detail::ul
unsigned long ul
Definition: PrimitiveHelpers.h:46
FPGATrackSimTrackStream::operator=
FPGATrackSimTrackStream & operator=(const FPGATrackSimTrackStream &s)
Definition: FPGATrackSimTrackStream.cxx:28
FPGATrackSimTrackStream::m_nfits_maj_pix
int m_nfits_maj_pix
Definition: FPGATrackSimTrackStream.h:107
FPGATrackSimTrackStream::clear
void clear()
reset the list of the tracks and the statistical informatino collected for this event
Definition: FPGATrackSimTrackStream.cxx:177
FPGATrackSimTrackStream::m_ncombs
int m_ncombs
Definition: FPGATrackSimTrackStream.h:103
FPGATrackSimTrackStream::m_nfits_bad
int m_nfits_bad
Definition: FPGATrackSimTrackStream.h:110
FPGATrackSimTrackStream::m_nfits_majI_pix
int m_nfits_majI_pix
Definition: FPGATrackSimTrackStream.h:127
FPGATrackSimTrackStream::getTrack
FPGATrackSimTrack * getTrack(int) const
return a given track, identified by its position in the list
Definition: FPGATrackSimTrackStream.cxx:139
FPGATrackSimTrackStream::m_nfits_rec
int m_nfits_rec
Definition: FPGATrackSimTrackStream.h:108
FPGATrackSimTrackStream::buildTrackMap
void buildTrackMap()
Definition: FPGATrackSimTrackStream.cxx:237
FPGATrackSimTrackStream::m_tracks
TClonesArray * m_tracks
Definition: FPGATrackSimTrackStream.h:101
FPGATrackSimTrackStream::m_ntracksI
int m_ntracksI
Definition: FPGATrackSimTrackStream.h:117
FPGATrackSimTrackStream
Definition: FPGATrackSimTrackStream.h:15
FPGATrackSimTrackStream::m_nfits_addrec
int m_nfits_addrec
Definition: FPGATrackSimTrackStream.h:109
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
FPGATrackSimTrackStream::m_ncombsI
int m_ncombsI
Definition: FPGATrackSimTrackStream.h:123
FPGATrackSimTrackStream::m_tracksI
TClonesArray * m_tracksI
Definition: FPGATrackSimTrackStream.h:119
FPGATrackSimTrackStream::m_nfits_rejmajI
int m_nfits_rejmajI
Definition: FPGATrackSimTrackStream.h:133
FPGATrackSimTrack::getBankID
int getBankID() const
Definition: FPGATrackSimTrack.h:28
FPGATrackSimTrackStream::m_nfits_recI
int m_nfits_recI
Definition: FPGATrackSimTrackStream.h:128