ATLAS Offline Software
FPGATrackSimDataFlowTool.cxx
Go to the documentation of this file.
1 // Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
4 
12 
15 #include "CxxUtils/bitscan.h"
16 
17 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
18 FPGATrackSimDataFlowTool::FPGATrackSimDataFlowTool(std::string const & algname, std::string const & name, IInterface const * ifc) :
19  AthAlgTool(algname, name, ifc)
20 {
21 }
22 
23 
24 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
26 {
27  ATH_MSG_INFO("FPGATrackSimDataFlowTool::initialize()");
28 
29  ATH_CHECK(m_tHistSvc.retrieve());
30  ATH_CHECK(m_FPGATrackSimMapping.retrieve());
31  ATH_CHECK(m_evtSel.retrieve());
32 
33  m_nLayers_1st = m_FPGATrackSimMapping->PlaneMap_1st(0)->getNLogiLayers();
34 
37 
38  return StatusCode::SUCCESS;
39 }
40 
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
44  std::vector<FPGATrackSimCluster> const & clusters_1st,
45  const std::vector<std::shared_ptr<const FPGATrackSimRoad>> & roads_1st, std::vector<FPGATrackSimTrack> const & tracks_1st,
46  const std::vector<std::shared_ptr<const FPGATrackSimRoad>> & roads_2nd, std::vector<FPGATrackSimTrack> const & tracks_2nd)
47 {
48  info->nMappedHits_1st_layer.resize(m_nLayers_1st);
49  for (int i=0; i<header_1st->towers().at(0).nHits(); i++) {
50  info->nMappedHits_1st_total++;
51  }
52 
53  info->nClusters_1st_layer.resize(m_nLayers_1st);
54  info->nClusters_1st_total = clusters_1st.size();
55 
56  info->nRoads_1st_total = roads_1st.size();
57  for (const auto & r : roads_1st) {
58  if (CxxUtils::count_ones(r->getHitLayers()) == m_nLayers_1st - 1) info->nRoads_1st_7hits++;
59  if (CxxUtils::count_ones(r->getHitLayers()) == m_nLayers_1st) info->nRoads_1st_8hits++;
60  }
61 
62  std::unordered_map<int, size_t> pattID_nTracks_1st;
63  std::unordered_map<int, size_t> pattID_nTracks_1st_passChi2;
64  std::unordered_map<int, size_t> pattID_nTracks_1st_afterOR;
65 
66  std::unordered_map<int, size_t> sectID_nTracks_1st;
67  std::unordered_map<int, size_t> sectID_nTracks_1st_passChi2;
68  std::unordered_map<int, size_t> sectID_nTracks_1st_afterOR;
69 
70  info->nTracks_1st_total = tracks_1st.size();
71  for (FPGATrackSimTrack const & t : tracks_1st) {
72  if (t.getChi2ndof() <= m_cut_chi2ndof) {
73  info->nTracks_1st_passChi2++;
74  pattID_nTracks_1st_passChi2[t.getPatternID()]++;
75  sectID_nTracks_1st_passChi2[t.getFirstSectorID()]++;
76  }
77  if (t.passedOR() == 1) {
78  info->nTracks_1st_afterOR++;
79  pattID_nTracks_1st_afterOR[t.getPatternID()]++;
80  sectID_nTracks_1st_afterOR[t.getFirstSectorID()]++;
81  }
82  pattID_nTracks_1st[t.getPatternID()]++;
83  sectID_nTracks_1st[t.getFirstSectorID()]++;
84  }
85  for (const auto& [ID, ntrack]: pattID_nTracks_1st) {
86  info->nTracks_1st_per_patt_total.push_back(ntrack);
87  }
88  for (const auto& [ID, ntrack]: pattID_nTracks_1st_passChi2) {
89  info->nTracks_1st_per_patt_passChi2.push_back(ntrack);
90  }
91  for (const auto& [ID, ntrack]: pattID_nTracks_1st_afterOR) {
92  info->nTracks_1st_per_patt_afterOR.push_back(ntrack);
93  }
94 
95  info->nConstants_1st_fitter = sectID_nTracks_1st.size();
96  info->nConstants_1st_passChi2 = sectID_nTracks_1st_passChi2.size();
97  info->nConstants_1st_afterOR = sectID_nTracks_1st_afterOR.size();
98 
99  if (m_runSecondStage) {
100  info->nRoads_2nd_total = roads_2nd.size();
101 
102  std::unordered_map<int, size_t> sectID_nTracks_2nd;
103  std::unordered_map<int, size_t> sectID_nTracks_2nd_passChi2;
104  std::unordered_map<int, size_t> sectID_nTracks_2nd_afterOR;
105 
106  info->nTracks_2nd_total = tracks_2nd.size();
107  for (FPGATrackSimTrack const & t : tracks_2nd) {
108  if (t.getChi2ndof() <= m_cut_chi2ndof) {
109  info->nTracks_2nd_passChi2++;
110  sectID_nTracks_2nd_passChi2[t.getSecondSectorID()]++;
111  }
112  if (t.passedOR() == 1) {
113  info->nTracks_2nd_afterOR++;
114  sectID_nTracks_2nd_afterOR[t.getSecondSectorID()]++;
115  }
116  sectID_nTracks_2nd[t.getSecondSectorID()]++;
117  }
118 
119  info->nConstants_2nd_fitter = sectID_nTracks_2nd.size();
120  info->nConstants_2nd_passChi2 = sectID_nTracks_2nd_passChi2.size();
121  info->nConstants_2nd_afterOR = sectID_nTracks_2nd_afterOR.size();
122  }
123 
124  for (FPGATrackSimTruthTrack const & truth_t : header_1st->optional().getTruthTracks()) {
125  if (m_evtSel->passCuts(truth_t)) info->nTruthTracks++;
126  }
127 
128  for (FPGATrackSimOfflineTrack const & offline_t : header_1st->optional().getOfflineTracks()) {
129  if (m_evtSel->passCuts(offline_t)) info->nOfflineTracks++;
130  }
131 
132  if (info->nOfflineTracks > 0) {
133  info->nTracks_1st_over_nOfflineTracks = (float)tracks_1st.size() / (float)info->nOfflineTracks;
134  if (m_runSecondStage) info->nTracks_2nd_over_nOfflineTracks = (float)tracks_2nd.size() / (float)info->nOfflineTracks;
135  }
136 
138 
139  return StatusCode::SUCCESS;
140 }
141 
142 
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
145 {
146  m_nEvents++;
147 
148  for (size_t i = 0; i < m_nLayers_1st; i++) {
149  ATH_CHECK(addDataFlow(info.nMappedHits_1st_layer[i], "nMappedHitsL" + std::to_string(i) + "_1st"));
150  }
151  ATH_CHECK(addDataFlow(info.nMappedHits_1st_total, "nMappedHits_1st per layer")); // We fill the total number here. It will be divided by the number of layers later.
152 
153  for (size_t i = 0; i < m_nLayers_1st; i++) {
154  ATH_CHECK(addDataFlow(info.nClusters_1st_layer[i], "nClustersL" + std::to_string(i) + "_1st"));
155  }
156  ATH_CHECK(addDataFlow(info.nClusters_1st_total, "nClusters_1st per layer")); // We fill the total number here. It will be divided by the number of layers later.
157 
158  ATH_CHECK(addDataFlow(info.nRoads_1st_total, "nRoads_1st(Total)"));
159  ATH_CHECK(addDataFlow(info.nRoads_1st_7hits, "nRoads_1st(7/8)"));
160  ATH_CHECK(addDataFlow(info.nRoads_1st_8hits, "nRoads_1st(8/8)"));
161 
162  ATH_CHECK(addDataFlow(info.nTracks_1st_total, "nTracks_1st(Total)"));
163  ATH_CHECK(addDataFlow(info.nTracks_1st_passChi2, "nTracks_1st(Chi2ndof<40)"));
164  ATH_CHECK(addDataFlow(info.nTracks_1st_afterOR, "nTracks_1st(passing OR)"));
165 
166  for (size_t n : info.nTracks_1st_per_patt_total) {
167  ATH_CHECK(addDataFlow(n, "nTracks_1st per patt(Total)"));
168  }
169  for (size_t n : info.nTracks_1st_per_patt_passChi2) {
170  ATH_CHECK(addDataFlow(n, "nTracks_1st per patt(Chi2ndof<40)"));
171  }
172  for (size_t n : info.nTracks_1st_per_patt_afterOR) {
173  ATH_CHECK(addDataFlow(n, "nTracks_1st per patt(passing OR)"));
174  }
175 
176  ATH_CHECK(addDataFlow(info.nConstants_1st_fitter, "nConstants_1st(Fitter)"));
177  ATH_CHECK(addDataFlow(info.nConstants_1st_passChi2, "nConstants_1st(Chi2ndof<40)"));
178  ATH_CHECK(addDataFlow(info.nConstants_1st_afterOR, "nConstants_1st(after OR)"));
179 
180  if (m_runSecondStage) {
181  ATH_CHECK(addDataFlow(info.nRoads_2nd_total, "nRoads_2nd(Total)"));
182 
183  ATH_CHECK(addDataFlow(info.nTracks_2nd_total, "nTracks_2nd(Total)"));
184  ATH_CHECK(addDataFlow(info.nTracks_2nd_passChi2, "nTracks_2nd(Chi2ndof<40)"));
185  ATH_CHECK(addDataFlow(info.nTracks_2nd_afterOR, "nTracks_2nd(passing OR)"));
186 
187  ATH_CHECK(addDataFlow(info.nConstants_2nd_extrapolate, "nConstants_2nd(Extrapolate)"));
188  ATH_CHECK(addDataFlow(info.nConstants_2nd_fitter, "nConstants_2nd(Fitter)"));
189  ATH_CHECK(addDataFlow(info.nConstants_2nd_passChi2, "nConstants_2nd(Chi2ndof<40)"));
190  ATH_CHECK(addDataFlow(info.nConstants_2nd_afterOR, "nConstants_2nd(after OR)"));
191  }
192 
193  ATH_CHECK(addDataFlow(info.nTruthTracks, "nTruthTracks"));
194  ATH_CHECK(addDataFlow(info.nOfflineTracks, "nOfflineTracks"));
195 
196  if (info.nOfflineTracks > 0) {
197  ATH_CHECK(addDataFlow(info.nTracks_1st_over_nOfflineTracks, "nTracks_1st(Total)/nOfflineTracks", false));
198  if (m_runSecondStage) {
199  ATH_CHECK(addDataFlow(info.nTracks_2nd_over_nOfflineTracks, "nTracks_2nd(Total)/nOfflineTracks", false));
200  }
201  }
202 
203  return StatusCode::SUCCESS;
204 }
205 
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
209 {
210  m_dataFlowTxt << std::left << std::setw(m_tableTypeWidth) << "Type"
211  << std::setw(m_tableDataWidth) << "Stage"
212  << std::setw(m_tableDataWidth) << "Mean"
213  << std::setw(m_tableDataWidth) << "RMS"
214  << std::setw(m_tableDataWidth) << "RMS95"
215  << std::setw(m_tableDataWidth) << "Min"
216  << std::setw(m_tableDataWidth) << "Max" << std::endl;
217 
218  m_dataFlowTeX << "\\documentclass[12pt]{article}" << std::endl;
219  m_dataFlowTeX << "\\begin{document}" << std::endl;
220  m_dataFlowTeX << "\\begin{table}" << std::endl;
221  m_dataFlowTeX << "\\makebox[\\linewidth]{" << std::endl;
222  m_dataFlowTeX << "\\begin{tabular}{|c|c|c|c|c|c|c|}" << std::endl;
223  m_dataFlowTeX << "\\hline" << std::endl;
224  m_dataFlowTeX << "Type & Stage & Mean & RMS & RMS95 & Min & Max \\\\" << std::endl;
225 
226  addTableBreak();
227 
228  for (size_t i = 0; i < m_nLayers_1st; i++) {
229  ATH_CHECK(printDataFlow("nMappedHitsL" + std::to_string(i) + "_1st"));
230  }
231  ATH_CHECK(printDataFlow("nMappedHits_1st per layer", m_nLayers_1st));
232 
233  addTableBreak();
234 
235  for (size_t i = 0; i < m_nLayers_1st; i++) {
236  ATH_CHECK(printDataFlow("nClustersL" + std::to_string(i) + "_1st"));
237  }
238  ATH_CHECK(printDataFlow("nClusters_1st per layer", m_nLayers_1st));
239 
240  addTableBreak();
241 
242  ATH_CHECK(printDataFlow("nRoads_1st(Total)"));
243  ATH_CHECK(printDataFlow("nRoads_1st(7/8)"));
244  ATH_CHECK(printDataFlow("nRoads_1st(8/8)"));
245 
246  addTableBreak();
247 
248  ATH_CHECK(printDataFlow("nTracks_1st(Total)"));
249  ATH_CHECK(printDataFlow("nTracks_1st(Chi2ndof<40)"));
250  ATH_CHECK(printDataFlow("nTracks_1st(passing OR)"));
251 
252  addTableBreak();
253 
254  ATH_CHECK(printDataFlow("nTracks_1st per patt(Total)"));
255  ATH_CHECK(printDataFlow("nTracks_1st per patt(Chi2ndof<40)"));
256  ATH_CHECK(printDataFlow("nTracks_1st per patt(passing OR)"));
257 
258  addTableBreak();
259 
260  ATH_CHECK(printDataFlow("nConstants_1st(Fitter)"));
261  ATH_CHECK(printDataFlow("nConstants_1st(Chi2ndof<40)"));
262  ATH_CHECK(printDataFlow("nConstants_1st(after OR)"));
263 
264  addTableBreak();
265 
266  if (m_runSecondStage) {
267  ATH_CHECK(printDataFlow("nRoads_2nd(Total)"));
268 
269  addTableBreak();
270 
271  ATH_CHECK(printDataFlow("nTracks_2nd(Total)"));
272  ATH_CHECK(printDataFlow("nTracks_2nd(Chi2ndof<40)"));
273  ATH_CHECK(printDataFlow("nTracks_2nd(passing OR)"));
274 
275  addTableBreak();
276 
277  ATH_CHECK(printDataFlow("nConstants_2nd(Extrapolate)"));
278  ATH_CHECK(printDataFlow("nConstants_2nd(Fitter)"));
279  ATH_CHECK(printDataFlow("nConstants_2nd(Chi2ndof<40)"));
280  ATH_CHECK(printDataFlow("nConstants_2nd(after OR)"));
281 
282  addTableBreak();
283  }
284 
285  ATH_CHECK(printDataFlow("nTruthTracks"));
286  ATH_CHECK(printDataFlow("nOfflineTracks"));
287  ATH_CHECK(printDataFlow("nTracks_1st(Total)/nOfflineTracks"));
288  if (m_runSecondStage) ATH_CHECK(printDataFlow("nTracks_2nd(Total)/nOfflineTracks"));
289 
290  std::string str_sample;
291  std::string str_PU;
292 
293  switch (m_evtSel->getSampleType()) {
294  case SampleType::singleElectrons : str_sample = " single electron"; break;
295  case SampleType::singleMuons : str_sample = " single muon"; break;
296  case SampleType::singlePions : str_sample = " single pion"; break;
297  default : str_sample = ""; break;
298  }
299 
300  str_PU = m_evtSel->checkPU() ? " with pile-up" : "";
301 
302  m_dataFlowTxt << "--------------" << std::endl;
303  m_dataFlowTxt << "Data flow for " << m_nEvents << str_sample << " events" << str_PU << ". "
304  << "(" << roundTo(100. * m_max_frac, m_nSigDigits) << "%" << " acceptance)" << std::endl;
305 
306  m_dataFlowTeX << "\\hline" << std::endl;
307  m_dataFlowTeX << "\\end{tabular}}" << std::endl;
308  m_dataFlowTeX << "\\caption{Data flow for " << m_nEvents << str_sample << " events" << str_PU << ". "
309  << "(" << roundTo(100. * m_max_frac, m_nSigDigits) << "\\%" << " acceptance)} " << std::endl;
310  m_dataFlowTeX << "\\end{table}" << std::endl;
311  m_dataFlowTeX << "\\end{document}" << std::endl;
312 
313  m_dataFlowTxt.close();
314  m_dataFlowTeX.close();
315 
316  return StatusCode::SUCCESS;
317 }
318 
319 
320 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
322 {
323  ATH_MSG_INFO("FPGATrackSimDataFlowTool::finalize()");
325  return StatusCode::SUCCESS;
326 }
327 
328 
329 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
330 StatusCode FPGATrackSimDataFlowTool::addDataFlow(float const n, std::string const & key, bool const isInt)
331 {
332  if (isInt) {
333  if (m_dataFlowDataI_min.find(key) == m_dataFlowDataI_min.end()) {
334  m_dataFlowDataI_min.insert({key, n});
335  }
336  else if (n < m_dataFlowDataI_min.find(key)->second) {
337  m_dataFlowDataI_min.find(key)->second = n;
338  }
339 
340  if (m_dataFlowDataI_max.find(key) == m_dataFlowDataI_max.end()) {
341  m_dataFlowDataI_max.insert({key, n});
342  }
343  else if (n > m_dataFlowDataI_max.find(key)->second) {
344  m_dataFlowDataI_max.find(key)->second = n;
345  }
346  }
347  else {
348  if (m_dataFlowDataF_min.find(key) == m_dataFlowDataF_min.end()) {
349  m_dataFlowDataF_min.insert({key, n});
350  }
351  else if (n < m_dataFlowDataF_min.find(key)->second) {
352  m_dataFlowDataF_min.find(key)->second = n;
353  }
354 
355  if (m_dataFlowDataF_max.find(key) == m_dataFlowDataF_max.end()) {
356  m_dataFlowDataF_max.insert({key, n});
357  }
358  else if (n > m_dataFlowDataF_max.find(key)->second) {
359  m_dataFlowDataF_max.find(key)->second = n;
360  }
361  }
362 
363  if ((isInt && m_dataFlowHistsI.find(key) == m_dataFlowHistsI.end()) ||
364  (!isInt && m_dataFlowHistsF.find(key) == m_dataFlowHistsF.end())) {
365  std::string hname = "h_dataflow_" + key;
366  if (!m_outputtag.value().empty()) hname += ("_" + m_outputtag.value());
367  findAndReplaceAll(hname, "/", "_over_");
368 
369  setHistDir("/DataFlowHist/");
370  TH1* h;
371  if (isInt)
372  h = new TH1I(hname.c_str(), key.c_str(), n + 1, -0.5, n + 0.5);
373  else
374  h = new TH1F(hname.c_str(), key.c_str(), (round(n) + 1) * 100, -0.5, round(n) + 0.5);
376  clearHistDir();
377 
378  h->Fill(n);
379 
380  if (isInt)
381  m_dataFlowHistsI.insert({key, dynamic_cast<TH1I*>(h)});
382  else
383  m_dataFlowHistsF.insert({key, dynamic_cast<TH1F*>(h)});
384  }
385  else {
386  if (m_dataFlowDataI_max.find(key) != m_dataFlowDataI_max.end()) {
387  int max = m_dataFlowDataI_max.find(key)->second;
388  TH1I* h = m_dataFlowHistsI.find(key)->second;
389  h->SetBins(max + 1, -0.5, max + 0.5);
390  h->Fill(n);
391  }
392  else if (m_dataFlowDataF_max.find(key) != m_dataFlowDataF_max.end()) {
393  float max = m_dataFlowDataF_max.find(key)->second;
394  TH1F* h = m_dataFlowHistsF.find(key)->second;
395  h->SetBins((round(max) + 1) * 100, -0.5, round(max) + 0.5);
396  h->Fill(n);
397  }
398  }
399 
400  return StatusCode::SUCCESS;
401 }
402 
403 
404 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
405 StatusCode FPGATrackSimDataFlowTool::printDataFlow(std::string const & key, int const div)
406 {
407  bool isInt = false;
408  if (m_dataFlowHistsI.find(key) != m_dataFlowHistsI.end())
409  isInt = true;
410  else if (m_dataFlowHistsF.find(key) == m_dataFlowHistsF.end())
411  return StatusCode::SUCCESS;
412 
413  double min = isInt ? m_dataFlowDataI_min.find(key)->second : m_dataFlowDataF_min.find(key)->second;
414  double max = isInt ? m_dataFlowDataI_max.find(key)->second : m_dataFlowDataF_max.find(key)->second;
415 
416  TH1* h;
417  if (isInt)
418  h = m_dataFlowHistsI.find(key)->second;
419  else
420  h = m_dataFlowHistsF.find(key)->second;
421 
423 
424  std::string str_stage = "", str_key = key;
425  if (key.find("_1st") != std::string::npos) {
426  str_stage = "FIRST";
427  str_key.erase(key.find("_1st"), std::string("_1st").length());
428  }
429  else if (key.find("_2nd") != std::string::npos) {
430  str_stage = "SECOND";
431  str_key.erase(key.find("_2nd"), std::string("_2nd").length());
432  }
433  else {
434  str_stage = "UNKNOWN";
435  }
436 
437  double mean = h->GetMean() / div;
438  double rms = h->GetRMS() / div;
439  double rms95_n = rms95(h) / div;
440  min = min / div;
441  max = max / div;
442 
443  m_dataFlowTxt << std::left << std::setw(m_tableTypeWidth) << str_key
444  << std::setw(m_tableDataWidth) << str_stage
445  << std::setw(m_tableDataWidth) << roundTo(mean, m_nSigDigits)
446  << std::setw(m_tableDataWidth) << roundTo(rms, m_nSigDigits)
447  << std::setw(m_tableDataWidth) << roundTo(rms95_n, m_nSigDigits)
448  << std::setw(m_tableDataWidth) << roundTo(min, m_nSigDigits)
449  << std::setw(m_tableDataWidth) << roundTo(max, m_nSigDigits) << std::endl;
450 
451  // Replace all "<" by "$<$" in the key to make the type text for tex.
452  // If there are other characters in the future, we can make a vector to store all of them.
453  std::string key_tex = str_key;
454  findAndReplaceAll(key_tex, "<", "$<$");
455 
456  m_dataFlowTeX << key_tex << " & " << str_stage << " & " << roundTo(mean, m_nSigDigits)
457  << " & " << roundTo(rms, m_nSigDigits)
458  << " & " << roundTo(rms95(h), m_nSigDigits)
459  << " & " << roundTo(min, m_nSigDigits)
460  << " & " << roundTo(max, m_nSigDigits) << " \\\\" << std::endl;
461 
462  return StatusCode::SUCCESS;
463 }
464 
465 
466 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
468 {
469  for (unsigned i = 0; i < n; i++) {
470  m_dataFlowTxt << "--------------" << std::endl;
471  m_dataFlowTeX << "\\hline" << std::endl;
472  }
473 }
474 
475 
476 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
477 void FPGATrackSimDataFlowTool::findAndReplaceAll(std::string & data, std::string const & toFind, std::string const & replaceStr) const
478 {
479  size_t pos = data.find(toFind);
480  while (pos != std::string::npos) {
481  data.replace(pos, toFind.size(), replaceStr);
482  pos = data.find(toFind, pos + replaceStr.size());
483  }
484 }
485 
486 
487 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
488 void FPGATrackSimDataFlowTool::setMaxAcceptance(TH1* h, double const max_frac, double& max_value) const
489 {
490  double total = h->Integral();
491  for (int i = 1; i <= h->GetNbinsX(); i++) {
492  double partial = h->Integral(1, i);
493  if (partial / total > max_frac) {
494  max_value = h->GetBinCenter(i);
495  h->GetXaxis()->SetRange(1, i);
496  break;
497  }
498  }
499 }
500 
501 
502 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
503 double FPGATrackSimDataFlowTool::roundTo(double const v, int const nSigDigits) const
504 {
505  int sigDigit = v != 0 ? trunc(log10(fabs(v))) : 0;
506  if (nSigDigits >= 1) {
507  double factor = pow(10., nSigDigits - sigDigit - 1);
508  return round(v * factor) / factor;
509  }
510 
511  return v;
512 }
513 
grepfile.info
info
Definition: grepfile.py:38
beamspotman.r
def r
Definition: beamspotman.py:676
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
getMenu.algname
algname
Definition: getMenu.py:54
FPGATrackSimLogicalEventInputHeader
Definition: FPGATrackSimLogicalEventInputHeader.h:21
FPGATrackSimOptionalEventInfo::getOfflineTracks
const std::vector< FPGATrackSimOfflineTrack > & getOfflineTracks() const
Definition: FPGATrackSimOptionalEventInfo.h:32
mean
void mean(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
Definition: dependence.cxx:254
FPGATrackSimDataFlowTool::m_nLayers_1st
unsigned m_nLayers_1st
Definition: FPGATrackSimDataFlowTool.h:80
FPGATrackSimDataFlowTool.h
FPGATrackSimDataFlowTool::FPGATrackSimDataFlowTool
FPGATrackSimDataFlowTool(std::string const &, std::string const &, IInterface const *)
Definition: FPGATrackSimDataFlowTool.cxx:18
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
ID
std::vector< Identifier > ID
Definition: CalibHitIDCheck.h:24
FPGATrackSimDataFlowTool::m_FPGATrackSimMapping
ServiceHandle< IFPGATrackSimMappingSvc > m_FPGATrackSimMapping
Definition: FPGATrackSimDataFlowTool.h:62
FPGATrackSimTrack
Definition: FPGATrackSimTrack.h:18
FPGATrackSimPlaneMap.h
Maps physical layers to logical layers.
dqt_zlumi_pandas.hname
string hname
Definition: dqt_zlumi_pandas.py:279
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
IFPGATrackSimMappingSvc.h
FPGATrackSimTruthTrack
Definition: FPGATrackSimTruthTrack.h:14
FPGATrackSimDataFlowTool::makeDataFlowTable
StatusCode makeDataFlowTable()
Definition: FPGATrackSimDataFlowTool.cxx:208
MuonGM::round
float round(const float toRound, const unsigned int decimals)
Definition: Mdt.cxx:27
FPGATrackSimDataFlowTool::m_dataFlowDataI_max
std::unordered_map< std::string, int > m_dataFlowDataI_max
Definition: FPGATrackSimDataFlowTool.h:89
FPGATrackSimDataFlowTool::m_dataFlowHistsI
std::unordered_map< std::string, TH1I * > m_dataFlowHistsI
Definition: FPGATrackSimDataFlowTool.h:93
FPGATrackSimDataFlowTool::addTableBreak
void addTableBreak(unsigned const n=1)
Definition: FPGATrackSimDataFlowTool.cxx:467
SampleType::singleElectrons
@ singleElectrons
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
FPGATrackSimDataFlowTool::m_evtSel
ServiceHandle< IFPGATrackSimEventSelectionSvc > m_evtSel
Definition: FPGATrackSimDataFlowTool.h:63
FPGATrackSimDataFlowTool::m_tHistSvc
ServiceHandle< ITHistSvc > m_tHistSvc
Definition: FPGATrackSimDataFlowTool.h:61
FPGATrackSimOptionalEventInfo::getTruthTracks
const std::vector< FPGATrackSimTruthTrack > & getTruthTracks() const
Definition: FPGATrackSimOptionalEventInfo.h:37
FPGATrackSimDataFlowTool::m_dataFlowTeXName
std::string const m_dataFlowTeXName
Definition: FPGATrackSimDataFlowTool.h:72
FPGATrackSimDataFlowTool::m_tableDataWidth
unsigned const m_tableDataWidth
Definition: FPGATrackSimDataFlowTool.h:85
FPGATrackSimLogicalEventInputHeader::optional
FPGATrackSimOptionalEventInfo const & optional() const
Definition: FPGATrackSimLogicalEventInputHeader.h:32
FPGATrackSimDataFlowTool::initialize
virtual StatusCode initialize() override
Definition: FPGATrackSimDataFlowTool.cxx:25
FPGATrackSimDataFlowTool::getHistDir
std::string const & getHistDir()
Definition: FPGATrackSimDataFlowTool.h:57
FPGATrackSimDataFlowTool::roundTo
double roundTo(double const v, int const nSigDigits) const
Definition: FPGATrackSimDataFlowTool.cxx:503
FPGATrackSimDataFlowTool::addDataFlow
StatusCode addDataFlow(float const n, std::string const &key, bool const isInt=true)
Definition: FPGATrackSimDataFlowTool.cxx:330
FPGATrackSimDataFlowInfo
Definition: FPGATrackSimDataFlowInfo.h:18
FPGATrackSimDataFlowTool::m_cut_chi2ndof
Gaudi::Property< float > m_cut_chi2ndof
Definition: FPGATrackSimDataFlowTool.h:68
lumiFormat.i
int i
Definition: lumiFormat.py:85
FPGATrackSimDataFlowTool::m_runSecondStage
Gaudi::Property< bool > m_runSecondStage
Definition: FPGATrackSimDataFlowTool.h:66
FPGATrackSimDataFlowTool::clearHistDir
void clearHistDir()
Definition: FPGATrackSimDataFlowTool.h:58
FPGATrackSimDataFlowTool::getDataFlowInfo
StatusCode getDataFlowInfo(FPGATrackSimDataFlowInfo const &info)
Definition: FPGATrackSimDataFlowTool.cxx:144
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
extractSporadic.h
list h
Definition: extractSporadic.py:97
FPGATrackSimDataFlowTool::setMaxAcceptance
void setMaxAcceptance(TH1 *h, double const max_frac, double &max_value) const
Definition: FPGATrackSimDataFlowTool.cxx:488
FPGATrackSimDataFlowInfo.h
Structs that store the data flow information per event.
FPGATrackSimDataFlowTool::finalize
virtual StatusCode finalize() override
Definition: FPGATrackSimDataFlowTool.cxx:321
FPGATrackSimDataFlowTool::m_tableTypeWidth
unsigned const m_tableTypeWidth
Definition: FPGATrackSimDataFlowTool.h:84
FPGATrackSimDataFlowTool::m_dataFlowDataF_max
std::unordered_map< std::string, float > m_dataFlowDataF_max
Definition: FPGATrackSimDataFlowTool.h:91
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
FPGATrackSimDataFlowTool::regHist
StatusCode regHist(std::string const &dir, TH1 *h)
Definition: FPGATrackSimDataFlowTool.h:59
CxxUtils::count_ones
constexpr unsigned count_ones(unsigned x)
Count number of set bits.
Definition: bitscan.h:141
FPGATrackSimDataFlowTool::m_dataFlowHistsF
std::unordered_map< std::string, TH1F * > m_dataFlowHistsF
Definition: FPGATrackSimDataFlowTool.h:94
FPGATrackSimOfflineTrack
Definition: FPGATrackSimOfflineTrack.h:12
FPGATrackSimDataFlowTool::setHistDir
void setHistDir(std::string const &dir)
Definition: FPGATrackSimDataFlowTool.h:56
FPGATrackSimDataFlowTool::m_max_frac
double const m_max_frac
Definition: FPGATrackSimDataFlowTool.h:86
FPGATrackSimDataFlowTool::calculateDataFlow
StatusCode calculateDataFlow(FPGATrackSimDataFlowInfo *info, FPGATrackSimLogicalEventInputHeader const *header_1st, std::vector< FPGATrackSimCluster > const &clusters_1st, const std::vector< std::shared_ptr< const FPGATrackSimRoad >> &roads_1st, std::vector< FPGATrackSimTrack > const &tracks_1st, const std::vector< std::shared_ptr< const FPGATrackSimRoad >> &roads_2nd, std::vector< FPGATrackSimTrack > const &tracks_2nd)
Definition: FPGATrackSimDataFlowTool.cxx:43
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
FPGATrackSimDataFlowTool::m_outputtag
Gaudi::Property< std::string > m_outputtag
Definition: FPGATrackSimDataFlowTool.h:67
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
FPGATrackSimDataFlowTool::printDataFlow
StatusCode printDataFlow(std::string const &key, int const div=1)
Definition: FPGATrackSimDataFlowTool.cxx:405
FPGATrackSimFunctions.h
FPGATrackSimDataFlowTool::m_dataFlowTxtName
std::string const m_dataFlowTxtName
Definition: FPGATrackSimDataFlowTool.h:71
rms95
double rms95(TH1 const *h)
This function is used to calculate RMS95 value for 1D histograms.
Definition: FPGATrackSimFunctions.cxx:60
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
FPGATrackSimDataFlowTool::findAndReplaceAll
void findAndReplaceAll(std::string &data, std::string const &toFind, std::string const &replaceStr) const
Definition: FPGATrackSimDataFlowTool.cxx:477
python.PyAthena.v
v
Definition: PyAthena.py:154
FPGATrackSimDataFlowTool::m_dataFlowTxt
std::ofstream m_dataFlowTxt
Definition: FPGATrackSimDataFlowTool.h:73
h
IFPGATrackSimEventSelectionSvc.h
FPGATrackSimDataFlowTool::m_dataFlowDataI_min
std::unordered_map< std::string, int > m_dataFlowDataI_min
Definition: FPGATrackSimDataFlowTool.h:88
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:567
beamspotnt.rms
rms
Definition: bin/beamspotnt.py:1266
FPGATrackSimDataFlowTool::m_nSigDigits
unsigned const m_nSigDigits
Definition: FPGATrackSimDataFlowTool.h:83
FPGATrackSimLogicalEventInputHeader::towers
const std::vector< FPGATrackSimTowerInputHeader > & towers() const
Definition: FPGATrackSimLogicalEventInputHeader.h:36
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
FPGATrackSimRoad.h
Defines a class for roads.
python.CaloScaleNoiseConfig.default
default
Definition: CaloScaleNoiseConfig.py:79
AthAlgTool
Definition: AthAlgTool.h:26
FPGATrackSimDataFlowTool::m_nEvents
size_t m_nEvents
Definition: FPGATrackSimDataFlowTool.h:79
SampleType::singlePions
@ singlePions
FPGATrackSimLogicalEventInputHeader.h
FPGATrackSimDataFlowTool::m_dataFlowTeX
std::ofstream m_dataFlowTeX
Definition: FPGATrackSimDataFlowTool.h:74
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15
SampleType::singleMuons
@ singleMuons
bitscan.h
Bit scanning functions.
readCCLHist.float
float
Definition: readCCLHist.py:83
FPGATrackSimTrack.h
FPGATrackSimCluster.h
FPGATrackSimDataFlowTool::m_dataFlowDataF_min
std::unordered_map< std::string, float > m_dataFlowDataF_min
Definition: FPGATrackSimDataFlowTool.h:90
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37