ATLAS Offline Software
FPGATrackSimConstGenAlgo.cxx
Go to the documentation of this file.
1 // Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
11 #include "GaudiKernel/MsgStream.h"
12 #include "GaudiKernel/ITHistSvc.h"
13 
17 #include "FPGATrackSimMatrixIO.h"
18 
19 #include "TH1F.h"
20 #include "TTree.h"
21 #include "TFile.h"
22 #include "TMath.h"
23 #include "TROOT.h"
24 #include "TMatrixD.h"
25 
26 #include <sstream>
27 #include <iostream>
28 #include <fstream>
29 #include <cmath>
30 #include <string>
31 #include <stdio.h>
32 #include <math.h>
33 #include <stdlib.h>
34 #include <cassert>
35 
36 #include <TVectorD.h>
37 #include <TDecompLU.h>
38 
39 #define MIN_TRACK_SEC 50 // min number of tracks per sector
40 
41 using namespace std;
42 
43 namespace {
44  template<typename ...Ptr>
45  bool
46  anyNullPtr(Ptr&&...p){
47  return ((p!=nullptr) && ...) ;
48  }
49 }
50 
52 // Initialize
54 
55 FPGATrackSimConstGenAlgo::FPGATrackSimConstGenAlgo(const std::string& name, ISvcLocator* pSvcLocator) :
56  AthAlgorithm(name, pSvcLocator)
57 {
58 }
59 
60 
62 {
63  ATH_MSG_DEBUG("initialize()");
64  ATH_MSG_DEBUG("Are we going to dump missing hist constants? " << m_dumpMissingHitsConstants);
65  ATH_CHECK(m_FPGATrackSimMapping.retrieve());
66  m_pmap = (m_isSecondStage ? m_FPGATrackSimMapping->PlaneMap_2nd(0) : m_FPGATrackSimMapping->PlaneMap_1st(0) );
67 
68  ATH_CHECK(m_tHistSvc.retrieve());
70 
71  // Input file
72  ATH_MSG_DEBUG("reading " << m_cfpath.value());
73  m_mafile = TFile::Open(m_cfpath.value().c_str());
74  gROOT->cd();
75  // Copy the slice tree
77 
78  // Read sizing
79  m_matrix_tree = (TTree*)m_mafile->Get(("am" + std::to_string(0)).c_str());
80  m_matrix_tree->SetBranchAddress("ndim", &m_nCoords);
81  m_matrix_tree->SetBranchAddress("nplanes", &m_nLayers);
82  m_matrix_tree->GetEntry(0);
86 
87  if (static_cast<size_t>(m_nLayers) == m_FPGATrackSimMapping->PlaneMap_2nd(0)->getNLogiLayers())
88  m_pmap = m_FPGATrackSimMapping->PlaneMap_2nd(0);
89  else if (static_cast<size_t>(m_nLayers) == m_FPGATrackSimMapping->PlaneMap_1st(0)->getNLogiLayers())
90  m_pmap = m_FPGATrackSimMapping->PlaneMap_1st(0);
91  else
92  ATH_MSG_ERROR("nLayers " << m_nLayers << " doesn't match any pmap");
93 
95 
96  // Read skip list
97  if (!m_skipFile.empty()) readSkipList(m_matrix_tree->GetEntries());
98 
99  // Prepare output contstants tree
101 
102  // Create the good tree
103  std::string tree_name = "am" + std::to_string(0);
104  std::string tree_title = "Ambank " + std::to_string(0) + " matrices";
105  m_good_tree = new TTree(tree_name.c_str(), tree_title.c_str());
106  ATH_CHECK(m_tHistSvc->regTree(("/TRIGFPGATrackSimTREEGOODOUT/"+tree_name).c_str(), m_good_tree));
107 
108  // Run the constant generation
110 
111  return StatusCode::SUCCESS;
112 }
113 
114 
116 {
117  //usage guide:
118  //https://acode-browser.usatlas.bnl.gov/lxr/source/Gaudi/GaudiSvc/src/THistSvc/README.md
119  auto h_vc = std::make_unique<TH1F>("h_vc","h_vc",500,-1e-4,1e-4);
120  auto h_vd = std::make_unique<TH1F>("h_vd","h_vd",500,-1e-2,1e-2);
121  auto h_vf = std::make_unique<TH1F>("h_vf","h_vf",500,-1e-2,1e-2);
122  auto h_vz = std::make_unique<TH1F>("h_vz","h_vz",500,-1e-2,1e-2);
123  auto h_veta = std::make_unique<TH1F>("h_veta","h_veta",500,-1e-2,1e-2);
124  ATH_CHECK(m_tHistSvc->regHist("/TRIGFPGATrackSimTREEGOODOUT/h_vc",std::move(h_vc)));
125  ATH_CHECK(m_tHistSvc->regHist("/TRIGFPGATrackSimTREEGOODOUT/h_vd",std::move(h_vd)));
126  ATH_CHECK(m_tHistSvc->regHist("/TRIGFPGATrackSimTREEGOODOUT/h_vf",std::move(h_vf)));
127  ATH_CHECK(m_tHistSvc->regHist("/TRIGFPGATrackSimTREEGOODOUT/h_vz",std::move(h_vz)));
128  ATH_CHECK(m_tHistSvc->regHist("/TRIGFPGATrackSimTREEGOODOUT/h_veta",std::move(h_veta)));
129 
130  return StatusCode::SUCCESS;
131 }
132 
133 
135 {
136  // Read old tree
137  TTree *old_tree = (TTree*)file->Get("slice");
138  old_tree->SetBranchAddress("c_max", &m_sliceMax.qOverPt);
139  old_tree->SetBranchAddress("c_min", &m_sliceMin.qOverPt);
140  old_tree->SetBranchAddress("c_slices", &m_sliceNBins.qOverPt);
141 
142  old_tree->SetBranchAddress("phi_max", &m_sliceMax.phi);
143  old_tree->SetBranchAddress("phi_min", &m_sliceMin.phi);
144  old_tree->SetBranchAddress("phi_slices", &m_sliceNBins.phi);
145 
146  old_tree->SetBranchAddress("d0_max", &m_sliceMax.d0);
147  old_tree->SetBranchAddress("d0_min", &m_sliceMin.d0);
148  old_tree->SetBranchAddress("d0_slices", &m_sliceNBins.d0);
149 
150  old_tree->SetBranchAddress("z0_max", &m_sliceMax.z0);
151  old_tree->SetBranchAddress("z0_min", &m_sliceMin.z0);
152  old_tree->SetBranchAddress("z0_slices", &m_sliceNBins.z0);
153 
154  old_tree->SetBranchAddress("eta_max", &m_sliceMax.eta);
155  old_tree->SetBranchAddress("eta_min", &m_sliceMin.eta);
156  old_tree->SetBranchAddress("eta_slices", &m_sliceNBins.eta);
157 
158  old_tree->GetEntry(0);
159 
160  // Write new tree
161  TTree *new_tree = new TTree("slice", "Slice boundaries");
162  ATH_CHECK(m_tHistSvc->regTree("/TRIGFPGATrackSimTREEGOODOUT/slice", new_tree));
163 
164  new_tree->Branch("c_max", &m_sliceMax.qOverPt);
165  new_tree->Branch("c_min", &m_sliceMin.qOverPt);
166  new_tree->Branch("c_slices", &m_sliceNBins.qOverPt);
167 
168  new_tree->Branch("phi_max", &m_sliceMax.phi);
169  new_tree->Branch("phi_min", &m_sliceMin.phi);
170  new_tree->Branch("phi_slices", &m_sliceNBins.phi);
171 
172  new_tree->Branch("d0_max", &m_sliceMax.d0);
173  new_tree->Branch("d0_min", &m_sliceMin.d0);
174  new_tree->Branch("d0_slices", &m_sliceNBins.d0);
175 
176  new_tree->Branch("z0_max", &m_sliceMax.z0);
177  new_tree->Branch("z0_min", &m_sliceMin.z0);
178  new_tree->Branch("z0_slices", &m_sliceNBins.z0);
179 
180  new_tree->Branch("eta_max", &m_sliceMax.eta);
181  new_tree->Branch("eta_min", &m_sliceMin.eta);
182  new_tree->Branch("eta_slices", &m_sliceNBins.eta);
183 
184  new_tree->Fill();
185 
186  return StatusCode::SUCCESS;
187 }
188 
189 
191 {
192  // Dummy variables for typing
193  int anInt;
194  float aFloat;
195  double aDouble;
196 
197  std::string tree_name = "am" + std::to_string(0);
198  std::string tree_title = "Ambank " + std::to_string(0) + " constants";
199  m_ctree = new TTree(tree_name.c_str(), tree_title.c_str());
200 
201  m_ctree->Branch("ndim", &m_nCoords, "ndim/I");
202  m_ctree->Branch("ndim2", &m_nCoords_2, "ndim2/I");
203  m_ctree->Branch("nkernel", &m_nKernel, "nkernel/I");
204  m_ctree->Branch("nkaverages", &m_nKAverages, "nkaverages/I");
205  m_ctree->Branch("nplane", &m_nLayers, "nplane/I");
206 
207  m_ctree->Branch("sectorID", &anInt, "sectorID[nplane]/I");
208  m_ctree->Branch("hashID", &anInt, "hashID[nplane]/I");
209  m_ctree->Branch("nhit", &aFloat, "nhit/F");
210 
211  m_ctree->Branch("Cd", &aDouble, "Cd/D");
212  m_ctree->Branch("Cc", &aDouble, "Cc/D");
213  m_ctree->Branch("Cf", &aDouble, "Cf/D");
214  m_ctree->Branch("Cz0", &aDouble, "Cz0/D");
215  m_ctree->Branch("Co", &aDouble, "Co/D");
216 
217  m_ctree->Branch("Vc", &aDouble, "Vc[ndim]/D");
218  m_ctree->Branch("Vd", &aDouble, "Vd[ndim]/D");
219  m_ctree->Branch("Vf", &aDouble, "Vf[ndim]/D");
220  m_ctree->Branch("Vz0", &aDouble, "Vz0[ndim]/D");
221  m_ctree->Branch("Vo", &aDouble, "Vo[ndim]/D");
222 
223  m_ctree->Branch("kernel", &aDouble, "kernel[nkernel]/D");
224  m_ctree->Branch("kaverages", &aDouble, "kaverages[nkaverages]/D");
225 
226  ATH_CHECK(m_tHistSvc->regTree(("/TRIGFPGATrackSimCTREEOUT/"+tree_name).c_str(), m_ctree));
227  return StatusCode::SUCCESS;
228 }
229 
230 
232 {
233  m_skipList.resize(nSectors);
234 
235  std::ifstream file(m_skipFile);
236  if (!file.is_open()) return;
237 
238  size_t count = 0;
239  size_t sector;
240  while (file >> sector)
241  {
242  if (sector >= nSectors)
243  {
244  ATH_MSG_ERROR("Bad sector " << sector << "/" << nSectors);
245  return;
246  }
247  m_skipList[sector] = true;
248  count++;
249  }
250  ATH_MSG_INFO("Skipping " << count << " sectors out of " << nSectors);
251  file.close();
252 }
253 
254 
255 
256 // Main function. Generates constants into m_geo_consts, and copies the good matrices into m_good_tree.
258 {
261  for (size_t entry = 0; entry < (size_t)m_matrix_tree->GetEntries(); entry++)
262  {
263  // Read the entry
264  if (!m_skipList.empty() && m_skipList[entry]) continue;
265  reader.readEntry(entry);
266  std::vector<module_t> & modules = reader.getModules();
267  FPGATrackSimMatrixAccumulator & acc = reader.getAccumulator();
268 
269  // Check for sufficient statistics
270  if (acc.track_bins.size() < MIN_TRACK_SEC)
271  {
272  ATH_MSG_DEBUG("Insufficient tracks in sector " << reader.getEntry());
273  continue;
274  }
275 
276  // Scale and normalize the accumulated variables
278 
279  // Create the constants
281  bool success = GetConstants(acc_norm, geo, entry);
282  if (!success) continue;
283 
284  // Fill the constant tree and good matrix tree
285  fillConstTree(modules, acc, geo);
286  writer.fill(modules, acc);
287  m_geo_consts.push_back(geo);
288 
289  // If needed, we generate the same as above but dropping/ignoring each potential hit
291  }
292 }
293 
295 {
296  for (int ip = 0; ip < m_nLayers; ip++)
297  {
298  int missing = m_pmap->getCoordOffset(ip); // this is the coordinate we are missing
299  if (!acc_norm.coords_usable[missing]) // just skip ahead if we aren't using this coordinate already
300  {
301  geo_constants emptyGeo(m_nCoords);
302  m_geo_consts_with_missinghit[ip].push_back(emptyGeo);
303  continue;
304  }
305 
306  unsigned int nusable = acc_norm.nusable() - 1;
307  std::vector<bool> coordsToUse = acc_norm.coords_usable;
308  coordsToUse[missing] = false;
309 
310  if (m_pmap->getDim(ip) == 2)
311  {
312  coordsToUse[missing+1] = false;
313  nusable--;
314  }
315 
316 
318  bool success = GetConstants(acc_norm, geo, entry, coordsToUse, nusable);
319  if (!success)
320  {
321  // push this back to keep the order correct (ie same numbering as nominal constants)
322  geo_constants emptyGeo(m_nCoords);
323  m_geo_consts_with_missinghit[ip].push_back(emptyGeo);
324  }
325  else
326  {
327  m_geo_consts_with_missinghit[ip].push_back(geo);
328  }
329  }
330 }
331 
333 {
334  return GetConstants(acc_norm, geo, entryNumber, acc_norm.coords_usable, acc_norm.nusable());
335 }
336 
337 bool FPGATrackSimConstGenAlgo::GetConstants(FPGATrackSimMatrixAccumulator const &acc_norm, geo_constants &geo, int entryNumber, std::vector<bool> const &coordsToUse, unsigned int nusable)
338 {
339  // Get the reduced matrix and invert it
340  TMatrixD mtx_reduced = getReducedMatrix(m_nCoords, acc_norm.covariance, coordsToUse, nusable);
341  if (isSingular(mtx_reduced))
342  {
343  ATH_MSG_DEBUG("Singular matrix in sector " << entryNumber);
344  return false;
345  }
346  std::vector<double> inv_covariance = invert(m_nCoords, mtx_reduced, coordsToUse);
347 
348  // Calculate the eigen system
349  std::vector<double> eigvals;
350  vector2D<double> eigvecs;
351 
352  eigen(nusable, m_nCoords, mtx_reduced, coordsToUse, eigvals, eigvecs);
353 
354  // Calculate the constants
355  geo = makeConsts(acc_norm, coordsToUse, inv_covariance, eigvals, eigvecs);
356 
357  if (failedConstants(geo, coordsToUse))
358  {
359  ATH_MSG_DEBUG("Failed constants in sector " << entryNumber);
360  return false;
361  }
362 
363  return true;
364 }
365 
367 {
368  float coverage = static_cast<float>(acc.track_bins.size());
369  m_ctree->SetBranchAddress("sectorID", acc.FTK_modules.data());
370  m_ctree->SetBranchAddress("hashID", modules.data());
371  m_ctree->SetBranchAddress("nhit", &coverage);
372 
373  m_ctree->SetBranchAddress("Cc", &geo.pars.qOverPt);
374  m_ctree->SetBranchAddress("Cd", &geo.pars.d0);
375  m_ctree->SetBranchAddress("Cf", &geo.pars.phi);
376  m_ctree->SetBranchAddress("Cz0", &geo.pars.z0);
377  m_ctree->SetBranchAddress("Co", &geo.pars.eta);
378 
379  m_ctree->SetBranchAddress("Vc", geo.Vcurvature.data());
380  m_ctree->SetBranchAddress("Vd", geo.Vd0.data());
381  m_ctree->SetBranchAddress("Vf", geo.Vphi.data());
382  m_ctree->SetBranchAddress("Vz0", geo.Vz0.data());
383  m_ctree->SetBranchAddress("Vo", geo.Veta.data());
384 
385  m_ctree->SetBranchAddress("kaverages", geo.kaverages.data());
386  m_ctree->SetBranchAddress("kernel", geo.kernel.data());
387 
388  m_ctree->Fill();
389 
390  if (m_Monitor)
391  {
392  const std::string prefix{"/TRIGFPGATrackSimTREEGOODOUT/"};
393  auto getHistogram = [&](const std::string & suffix)->TH1*{
394  TH1 * ptr{};
395  const auto sc = m_tHistSvc->getHist(prefix+suffix, ptr);
396  return (sc == StatusCode::SUCCESS) ? ptr: nullptr;
397  };
398  auto h_vc = getHistogram("h_vc");
399  auto h_vd = getHistogram("h_vd");
400  auto h_vf = getHistogram("h_vf");
401  auto h_vz = getHistogram("h_vz");
402  auto h_veta = getHistogram("h_veta");
403  if (anyNullPtr(h_vc, h_vd, h_vf, h_vz, h_veta)){
404  ATH_MSG_ERROR("FPGATrackSimConstGenAlgo::fillConstTree; nullptr");
405  return;
406  }
407  for (int i = 0; i < m_nCoords; i++)
408  {
409  h_vc->Fill(geo.Vcurvature[i]);
410  h_vd->Fill(geo.Vd0[i]);
411  h_vf->Fill(geo.Vphi[i]);
412  h_vz->Fill(geo.Vz0[i]);
413  h_veta->Fill(geo.Veta[i]);
414  }
415  }
416 }
417 
418 
419 bool FPGATrackSimConstGenAlgo::isNAN(double value, const char* name)
420 {
421  if (TMath::IsNaN(value))
422  {
423  ATH_MSG_WARNING("NaN found in " << name);
424  return true;
425  }
426  return false;
427 }
428 
429 #define CHECK_NAN(var) (isNAN((var), #var))
430 
431 // Check if constants are bad (eg, contain "nan")
432 bool FPGATrackSimConstGenAlgo::failedConstants(geo_constants const & geo, std::vector<bool> const & usable)
433 {
435 
436  if (CHECK_NAN(gco.pars.qOverPt)) return true;
437  if (CHECK_NAN(geo.pars.qOverPt)) return true;
438  if (CHECK_NAN(gco.pars.d0)) return true;
439  if (CHECK_NAN(geo.pars.d0)) return true;
440  if (CHECK_NAN(gco.pars.phi)) return true;
441  if (CHECK_NAN(geo.pars.phi)) return true;
442  if (CHECK_NAN(gco.pars.z0)) return true;
443  if (CHECK_NAN(geo.pars.z0)) return true;
444  if (CHECK_NAN(gco.pars.eta)) return true;
445  if (CHECK_NAN(geo.pars.eta)) return true;
446 
447  for (int i = 0; i < m_nCoords; i++)
448  {
449  if (CHECK_NAN(gco.Vcurvature[i])) return true;
450  if (CHECK_NAN(geo.Vcurvature[i])) return true;
451  if (CHECK_NAN(gco.Vd0[i])) return true;
452  if (CHECK_NAN(geo.Vd0[i])) return true;
453  if (CHECK_NAN(gco.Vphi[i])) return true;
454  if (CHECK_NAN(geo.Vphi[i])) return true;
455  if (CHECK_NAN(gco.Vz0[i])) return true;
456  if (CHECK_NAN(geo.Vz0[i])) return true;
457  if (CHECK_NAN(gco.Veta[i])) return true;
458  if (CHECK_NAN(geo.Veta[i])) return true;
459  }
460 
461  for (int i = 0; i < m_nCoords - FPGATrackSimTrackPars::NPARS; i++)
462  {
463  if (CHECK_NAN(geo.kaverages[i])) return true;
464  for (int j = 0; j < m_nCoords; j++)
465  if (CHECK_NAN(geo.kernel(i,j))) return true;
466  }
467 
468  return false;
469 }
470 
471 
473 // Arithmetic Functions
475 
476 /*
477  * This function normalizes the accumulated variables in acc_raw into the actual
478  * averages needed for constant generation. The pars and hit_coords are averaged
479  * using the coverage. The covariance field, which currently stores sum(x_i x_j),
480  * is converted into the actual covariance matrix. The hix_x_par fields are
481  * converted from sum(x_k p_i) to <x_k p_i> - <x_k> <p_i>.
482  */
484 {
486  double coverage = static_cast<double>(acc.track_bins.size());
487  size_t nCoords = acc.hit_coords.size();
488 
489  for (unsigned i = 0; i < FPGATrackSimTrackPars::NPARS; i++)
490  acc.pars[i] /= coverage;
491 
492  for (unsigned i = 0; i < nCoords; i++)
493  {
494  acc.hit_coords[i] /= coverage;
495  if (std::abs(acc.hit_coords[i]) < MTX_TOLERANCE) acc.coords_usable[i] = false;
496  else acc.coords_usable[i] = true;
497  }
498 
499  // Divide by n-1 for the sample variance (Bessel's correction)
500  for (unsigned i = 0; i < nCoords; i++)
501  {
502  acc.hit_x_QoP[i] = (acc.hit_x_QoP[i] - acc.hit_coords[i] * acc.pars.qOverPt * coverage) / (coverage-1);
503  acc.hit_x_d0[i] = (acc.hit_x_d0[i] - acc.hit_coords[i] * acc.pars.d0 * coverage) / (coverage-1);
504  acc.hit_x_z0[i] = (acc.hit_x_z0[i] - acc.hit_coords[i] * acc.pars.z0 * coverage) / (coverage-1);
505  acc.hit_x_phi[i] = (acc.hit_x_phi[i] - acc.hit_coords[i] * acc.pars.phi * coverage) / (coverage-1);
506  acc.hit_x_eta[i] = (acc.hit_x_eta[i] - acc.hit_coords[i] * acc.pars.eta * coverage) / (coverage-1);
507 
508  // Covariance (and symmetrize)
509  for (unsigned j = i ; j < nCoords; ++j)
510  {
511  acc.covariance[j * nCoords + i] = acc.covariance[i * nCoords + j] =
512  (acc.covariance[i * nCoords + j] - acc.hit_coords[i] * acc.hit_coords[j] * coverage) / (coverage-1);
513  }
514  }
515 
516  return acc;
517 }
518 
519 
521  std::vector<double> const & inv_covariance,
522  std::vector<double> const & eigvals, vector2D<double> const & eigvecs)
523 {
524  size_t nCoords = acc.hit_coords.size();
525  geo_constants geo(nCoords);
526 
527  geo.Vcurvature = matrix_multiply(inv_covariance, acc.hit_x_QoP);
528  geo.Vd0 = matrix_multiply(inv_covariance, acc.hit_x_d0);
529  geo.Vphi = matrix_multiply(inv_covariance, acc.hit_x_phi);
530  geo.Vz0 = matrix_multiply(inv_covariance, acc.hit_x_z0);
531  geo.Veta = matrix_multiply(inv_covariance, acc.hit_x_eta);
532 
533  for (size_t i = 0; i < nCoords - FPGATrackSimTrackPars::NPARS; i++)
534  {
535  if (!usable[i]) continue; // vectors are filled with 0's by default
536  for (size_t j = 0; j < nCoords; j++)
537  {
538  if (!usable[j]) continue;
539  if (eigvals[i] > 0)
540  geo.kernel(i, j) = eigvecs(i, j) / sqrt(eigvals[i]);
541 
542  geo.kaverages[i] += -geo.kernel(i, j) * acc.hit_coords[j];
543  }
544  }
545 
546  geo.pars = acc.pars;
547  for (size_t i = 0; i < nCoords; i++)
548  {
549  geo.pars.d0 += -geo.Vd0[i] * acc.hit_coords[i];
550  geo.pars.qOverPt += -geo.Vcurvature[i] * acc.hit_coords[i];
551  geo.pars.phi += -geo.Vphi[i] * acc.hit_coords[i];
552  geo.pars.z0 += -geo.Vz0[i] * acc.hit_coords[i];
553  geo.pars.eta += -geo.Veta[i] * acc.hit_coords[i];
554  }
555 
556  geo.real = static_cast<int>(acc.track_bins.size());
557  return geo;
558 }
559 
560 
561 /*
562  * Calculates matrix multiplication x = A * b;
563  *
564  * @param A - (n*n) matrix
565  * @param b - length-n vector
566  * @return A * b (length-n vector)
567  */
568 std::vector<double> FPGATrackSimConstGenAlgo::matrix_multiply(std::vector<double> const & A, std::vector<double> const & b)
569 {
570  size_t n = b.size();
571  std::vector<double> x(n);
572 
573  for (size_t i = 0; i < n; i++)
574  for (size_t j = 0; j < n; j++)
575  x[i] += A[i * n + j] * b[j];
576 
577  return x;
578 }
579 
580 
582 {
583  TDecompLU dc(mtx); // note mtx is a copy
584  bool ok = dc.InvertLU(mtx, MTX_TOLERANCE);
585  return !ok;
586 }
587 
588 
597 TMatrixD FPGATrackSimConstGenAlgo::getReducedMatrix(size_t n, std::vector<double> const & mtx_v, std::vector<bool> const & usable, size_t nDimToUse)
598 {
599  TMatrixD mtx(n, n, mtx_v.data());
600  TMatrixD newmtx(nDimToUse, nDimToUse);
601 
602  size_t counteri = 0;
603  for (size_t i = 0; i < n; i++)
604  {
605  if (!usable[i]) continue;
606 
607  size_t counterj = 0;
608  for (size_t j = 0; j < n; j++)
609  {
610  if (!usable[j]) continue;
611  newmtx[counteri][counterj] = mtx[i][j]; // if we use this coordinate, copy it over
612  counterj++; // iterate counter
613  }
614  assert(counterj == nDimToUse);
615  counteri++;
616  }
617  assert(counteri == nDimToUse);
618 
619  return newmtx;
620 }
621 
622 
630 std::vector<double> FPGATrackSimConstGenAlgo::invert(size_t n_full, TMatrixD mtx, std::vector<bool> const & usable)
631 {
632  // Output
633  std::vector<double> inv(n_full * n_full); // filled with 0s
634 
635  mtx.Invert();
636 
637  size_t counteri = 0;
638  for (size_t i = 0; i < n_full; i++)
639  {
640  if (!usable[i]) continue;
641 
642  size_t counterj = 0;
643  for (size_t j = 0; j < n_full; j++)
644  {
645  if (!usable[j]) continue;
646  inv[i*n_full + j] = mtx[counteri][counterj];
647  counterj++;
648  }
649  counteri++;
650  }
651 
652  return inv;
653 }
654 
655 
656 /*
657  * Calculates the eigensystem of mtx_v, storing it into eigvals_v and eigvecs_v.
658  * This functions accepts a reduced matrix (0 rows and columns removed) but
659  * returns the full-size eigensystem (padding with 0s as defined by usable).
660  * The eigensystem is sorted by increasing |eigenvalue|.
661  *
662  * @param n_redu - Size of reduced system
663  * @param n_full - Size of full system
664  * @param mtx_v - Input matrix (n_redu * n_redu)
665  * @param usable - List of usable rows/columns in the full matrix (n_full)
666  * @param eigvals_v - Output eigenvalues (n_full), with !usable indices filled with 0
667  * @param eigvecs_v - Output eigenvectors (n_full * n_full, ROW! oriented), with !usable rows & columns filled with 0
668  */
669 void FPGATrackSimConstGenAlgo::eigen(size_t n_redu, size_t n_full, TMatrixD &mtx, std::vector<bool> const & usable, std::vector<double> & eigvals_full, vector2D<double> & eigvecs_full)
670 {
671 
672  // Reduced system (these are sorted by decreasing |eigenvalue|)
673  TVectorD eigvals_redu;
674  TMatrixD eigvecs_redu = mtx.EigenVectors(eigvals_redu);
675 
676  // Full system (to be copied into)
677  eigvals_full.resize(n_full, 0);
678  eigvecs_full.resize(n_full, n_full, 0);
679 
680  // Reverse order AND transpose. First row in eigvecs_full = last column in eigvecs_redu.
681  // Here, i = row index, j = column index.
682  size_t j_redu = n_redu - 1;
683  for (size_t i_full = 0; i_full < n_full; i_full++)
684  {
685  if (!usable[i_full]) continue;
686 
687  size_t i_redu = 0;
688  for (size_t j_full = 0; j_full < n_full; j_full++)
689  {
690  if (!usable[j_full]) continue;
691  eigvecs_full(i_full, j_full) = eigvecs_redu[i_redu][j_redu];
692  i_redu++;
693  }
694  eigvals_full[i_full] = eigvals_redu[j_redu];
695  j_redu--;
696  }
697 }
698 
699 
700 double FPGATrackSimConstGenAlgo::dot(const double* vec1, const double* vec2, size_t size)
701 {
702  double total = 0;
703  for (size_t i = 0; i < size; i++)
704  total += vec1[i] * vec2[i];
705  return total;
706 }
707 
708 
709 geo_constants FPGATrackSimConstGenAlgo::calculate_gcorth(geo_constants geo, int nCoords, std::vector<bool> const & usable)
710 {
711  for (int i = 0; i < nCoords - FPGATrackSimTrackPars::NPARS;i++)
712  {
713  if (!usable[i]) continue;
714  double norm = dot(geo.kernel[i], geo.kernel[i], nCoords);
715 
716  auto project = [&](std::vector<double> & hit_x_par, double & par)
717  {
718  double pr = dot(hit_x_par.data(), geo.kernel[i], nCoords) / norm;
719  for (int j = 0; j < nCoords; j++) hit_x_par[j] += -geo.kernel(i,j) * pr;
720  par += -geo.kaverages[i] * pr;
721  };
722 
723  project(geo.Vd0, geo.pars.d0);
724  project(geo.Vcurvature, geo.pars.qOverPt);
725  project(geo.Vphi, geo.pars.phi);
726  project(geo.Vz0, geo.pars.z0);
727  project(geo.Veta, geo.pars.eta);
728  }
729 
730  return geo;
731 }
732 
733 
735 {
736  // Do nothing; this class does not process events. The main algorithm is
737  // called in initialize() and finalize().
738  return StatusCode::SUCCESS;
739 }
740 
741 
743 // Finalize
745 
746 
748 {
749  ATH_MSG_DEBUG("finalize()");
750 
751  std::string filename = "corrgen_raw_" + std::to_string(m_nLayers) + "L_reg" + std::to_string(m_region) + "_checkGood" + std::to_string(m_CheckGood2ndStage) + ".gcon";
752 
754 
756  for (int missing = 0; missing < m_nLayers; missing++) {
757  filename = "corrgen_raw_" + std::to_string(m_nLayers) + "L_reg" + std::to_string(m_region) + "_checkGood" + std::to_string(m_CheckGood2ndStage) + "_skipPlane" + std::to_string(missing) + ".gcon";
758  // pick up only the ones for this missing plane
760  }
761  }
762 
763  writeSectors();
764 
765  ATH_CHECK(m_tHistSvc->finalize());
766  m_mafile->Close();
767 
768  return StatusCode::SUCCESS;
769 }
770 
771 
773 {
774  // Create FPGATrackSimSectorSlice
777  FPGATrackSimSectorSlice slice(m_geo_consts.size(), m_sliceNBins, copymin, copymax);
778 
779  // Open files
780  std::string sector_filename = "sectors_raw_" + std::to_string(m_nLayers) + "L_reg" + std::to_string(m_region) + "_checkGood" + std::to_string(m_CheckGood2ndStage) + ".patt";
781  std::string sectorHW_filename = "sectorsHW_raw_" + std::to_string(m_nLayers) + "L_reg" + std::to_string(m_region) + "_checkGood" + std::to_string(m_CheckGood2ndStage) + ".patt";
782  FILE *sector_file = fopen(sector_filename.c_str(),"w");
783  FILE *sectorHW_file = fopen(sectorHW_filename.c_str(),"w");
784 
785  fprintf(sector_file,"%zu %d\n",m_geo_consts.size(),m_nLayers);
786  fprintf(sectorHW_file,"%zu %d\n",m_geo_consts.size(),m_nLayers);
787 
788  // Write sectors
790  while (reader.nextEntry())
791  {
792  FPGATrackSimMatrixAccumulator const & acc = reader.getAccumulator();
793  size_t sector = reader.getEntry();
794 
795  fprintf(sector_file,"%zu ", sector);
796  fprintf(sectorHW_file,"%zu ", sector);
797  for(int i=0;i<m_nLayers;i++)
798  {
799  fprintf(sector_file,"%d ", acc.FTK_modules[i]);
800  fprintf(sectorHW_file,"%d ", reader.getModules()[i]);
801  }
802  fprintf(sector_file,"0 %zu", acc.track_bins.size());
803  fprintf(sector_file,"\n");
804  fprintf(sectorHW_file,"0 %zu", acc.track_bins.size());
805  fprintf(sectorHW_file,"\n");
806 
807  for (FPGATrackSimTrackParsI const & pars : acc.track_bins)
808  slice.addSectorToSlice(sector, pars);
809  }
810 
811  fclose(sector_file);
812  fclose(sectorHW_file);
813  std::string slice_filename = "slices_" + std::to_string(m_nLayers) + "L_reg" + std::to_string(m_region) + ".root";
814  slice.saveSlices(slice_filename);
815 }
816 
817 
818 // ASCII file writeout
819 void FPGATrackSimConstGenAlgo::DumpConstants(std::vector<geo_constants> &geo_consts, std::string & filename)
820 {
821  FILE *const_file = fopen(filename.c_str(),"w");
822 
823  fprintf(const_file,"! *** RECONSTRUCTION GEOMETRY CONSTANTS ***\n");
824  fprintf(const_file,"\n");
825  fprintf(const_file,"Version 2 ! File format version number\n");
826  fprintf(const_file,"\n");
827  fprintf(const_file,"! *** PHI is now in GLOBAL coordinate system ***\n");
828  fprintf(const_file," NPLANES\n");
829  fprintf(const_file," %d\n",m_nLayers);
830  fprintf(const_file," NSECTORS\n");
831  fprintf(const_file,"%zu\n",geo_consts.size());
832  fprintf(const_file," NDIM\n");
833  fprintf(const_file," 2\n");
834 
835  std::string str_hex;
836 
837  for (size_t sector = 0; sector < geo_consts.size(); sector++)
838  {
839  //gcon file
840  fprintf(const_file,"sector\n");
841  fprintf(const_file,"%zu\n", sector);
842 
843  fprintf(const_file," Vc \n");
844  for(int i=0;i<m_nCoords;i++){
845  fprintf(const_file,"%e\n",geo_consts[sector].Vcurvature[i]);
846  }
847 
848  fprintf(const_file," Vd \n");
849  for(int i=0;i<m_nCoords;i++){
850  fprintf(const_file,"%e\n",geo_consts[sector].Vd0[i]);
851  }
852 
853  fprintf(const_file," Vf \n");
854  for(int i=0;i<m_nCoords;i++){
855  fprintf(const_file,"%e\n",geo_consts[sector].Vphi[i]);
856  }
857 
858  fprintf(const_file," Vz0 \n");
859  for(int i=0;i<m_nCoords;i++){
860  fprintf(const_file,"%e\n",geo_consts[sector].Vz0[i]);
861  }
862 
863  fprintf(const_file," Vo \n");
864  for(int i=0;i<m_nCoords;i++){
865  fprintf(const_file,"%e\n",geo_consts[sector].Veta[i]);
866  }
867 
868  fprintf(const_file,"kaverages\n");
870  fprintf(const_file,"%e\n",m_geo_consts[sector].kaverages[i]);
871  }
872 
873  fprintf(const_file,"kernel\n");
875  for(int j=0;j<m_nCoords;j++){
876  fprintf(const_file,"%e\n",geo_consts[sector].kernel(i, j));
877  }
878  }
879 
880  fprintf(const_file,"Cc\n");
881  fprintf(const_file,"%e\n",geo_consts[sector].pars.qOverPt);
882 
883  fprintf(const_file,"Cd\n");
884  fprintf(const_file,"%e\n",geo_consts[sector].pars.d0);
885 
886  fprintf(const_file,"Cf\n");
887  fprintf(const_file,"%e\n",geo_consts[sector].pars.phi);
888 
889  fprintf(const_file,"Cz0\n");
890  fprintf(const_file,"%e\n",geo_consts[sector].pars.z0);
891 
892  fprintf(const_file,"Co\n");
893  fprintf(const_file,"%e\n",geo_consts[sector].pars.eta);
894  }
895 
896  fclose(const_file);
897 
898 }
899 
FPGATrackSimConstGenAlgo.h
Algorithm to generate fit constants.
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
FPGATrackSimConstGenAlgo::m_good_tree
TTree * m_good_tree
Definition: FPGATrackSimConstGenAlgo.h:120
FPGATrackSimConstGenAlgo::m_mafile
TFile * m_mafile
Definition: FPGATrackSimConstGenAlgo.h:117
FPGATrackSimConstGenAlgo::generate_constants
void generate_constants()
Definition: FPGATrackSimConstGenAlgo.cxx:257
D3PDMakerTestInstan::vec2
std::vector< D3PDTest::MyVec2 > vec2
Definition: D3PDMakerTestDict.h:14
PlotCalibFromCool.norm
norm
Definition: PlotCalibFromCool.py:100
FPGATrackSimConstGenAlgo::m_CheckGood2ndStage
Gaudi::Property< bool > m_CheckGood2ndStage
Definition: FPGATrackSimConstGenAlgo.h:109
FPGATrackSimTrackPars::phi
double phi
Definition: FPGATrackSimTrackPars.h:24
hotSpotInTAG.suffix
string suffix
Definition: hotSpotInTAG.py:186
FPGATrackSimConstGenAlgo::calculate_gcorth
geo_constants calculate_gcorth(geo_constants geo, int nCoords, std::vector< bool > const &usable)
Definition: FPGATrackSimConstGenAlgo.cxx:709
FPGATrackSimConstGenAlgo::eigen
void eigen(size_t n_redu, size_t n_full, TMatrixD &mtx, std::vector< bool > const &usable, std::vector< double > &eigvals_v, vector2D< double > &eigvecs_v)
Definition: FPGATrackSimConstGenAlgo.cxx:669
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
FPGATrackSimTrackParsI::eta
int eta
Definition: FPGATrackSimTrackPars.h:62
FPGATrackSimMatrixAccumulator::coords_usable
std::vector< bool > coords_usable
Definition: FPGATrackSimMatrixAccumulator.h:57
FPGATrackSimPlaneMap.h
Maps physical layers to logical layers.
FPGATrackSimConstGenAlgo::isNAN
bool isNAN(double value, const char *name)
Definition: FPGATrackSimConstGenAlgo.cxx:419
FPGATrackSimTrackPars
Definition: FPGATrackSimTrackPars.h:22
FPGATrackSimTrackPars::qOverPt
double qOverPt
Definition: FPGATrackSimTrackPars.h:25
FPGATrackSimConstGenAlgo::m_skipFile
Gaudi::Property< std::string > m_skipFile
Definition: FPGATrackSimConstGenAlgo.h:106
FPGATrackSimConstGenAlgo::dot
double dot(const double *vec1, const double *vec2, size_t size)
Definition: FPGATrackSimConstGenAlgo.cxx:700
FPGATrackSimConstGenAlgo::execute
StatusCode execute() override
Definition: FPGATrackSimConstGenAlgo.cxx:734
FPGATrackSimConstGenAlgo::m_nCoords
int m_nCoords
Definition: FPGATrackSimConstGenAlgo.h:136
FPGATrackSimMatrixWriter
Definition: FPGATrackSimMatrixIO.h:87
FPGATrackSimConstGenAlgo::m_Monitor
Gaudi::Property< bool > m_Monitor
Definition: FPGATrackSimConstGenAlgo.h:107
FPGATrackSimTrackPars::d0
double d0
Definition: FPGATrackSimTrackPars.h:26
FPGATrackSimSectorSlice.h
Stores the range of eta/phi/etc. of each sector.
FPGATrackSimConstGenAlgo::DumpConstants
void DumpConstants(std::vector< geo_constants > &geo_consts, std::string &filename)
Definition: FPGATrackSimConstGenAlgo.cxx:819
FPGATrackSimConstGenAlgo::m_sliceMax
FPGATrackSimTrackPars m_sliceMax
Definition: FPGATrackSimConstGenAlgo.h:128
FPGATrackSimConstGenAlgo::m_tHistSvc
ServiceHandle< ITHistSvc > m_tHistSvc
Definition: FPGATrackSimConstGenAlgo.h:97
athena.value
value
Definition: athena.py:124
FPGATrackSimTrackParsI::d0
int d0
Definition: FPGATrackSimTrackPars.h:60
CHECK_NAN
#define CHECK_NAN(var)
Definition: FPGATrackSimConstGenAlgo.cxx:429
FPGATrackSimConstGenAlgo::initialize
StatusCode initialize() override
Definition: FPGATrackSimConstGenAlgo.cxx:61
FPGATrackSimConstGenAlgo::m_region
Gaudi::Property< int > m_region
Definition: FPGATrackSimConstGenAlgo.h:108
FPGATrackSimConstGenAlgo::GetConstants
bool GetConstants(FPGATrackSimMatrixAccumulator const &acc_norm, geo_constants &geo, int entryNumber)
Definition: FPGATrackSimConstGenAlgo.cxx:332
FPGATrackSimConstGenAlgo::m_skipList
std::vector< bool > m_skipList
Definition: FPGATrackSimConstGenAlgo.h:151
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
FPGATrackSimConstGenAlgo::m_pmap
const FPGATrackSimPlaneMap * m_pmap
Definition: FPGATrackSimConstGenAlgo.h:99
FPGATrackSimConstGenAlgo::m_isSecondStage
Gaudi::Property< bool > m_isSecondStage
Definition: FPGATrackSimConstGenAlgo.h:111
FPGATrackSimTrackPars::eta
double eta
Definition: FPGATrackSimTrackPars.h:28
x
#define x
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
FPGATrackSimConstGenAlgo::m_nCoords_2
int m_nCoords_2
Definition: FPGATrackSimConstGenAlgo.h:137
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
FPGATrackSimConstants.h
FPGATrackSimConstGenAlgo::matrix_multiply
std::vector< double > matrix_multiply(std::vector< double > const &A, std::vector< double > const &b)
Definition: FPGATrackSimConstGenAlgo.cxx:568
FPGATrackSimPlaneMap::getDim
uint32_t getDim(size_t logiLayer) const
Definition: FPGATrackSimPlaneMap.h:78
FPGATrackSimConstGenAlgo::m_nLayers
int m_nLayers
Definition: FPGATrackSimConstGenAlgo.h:133
FPGATrackSimConstGenAlgo::getReducedMatrix
TMatrixD getReducedMatrix(size_t n, std::vector< double > const &mtx_v, std::vector< bool > const &usable, size_t nDimToUse)
Removes the rows/columns specified by !usable.
Definition: FPGATrackSimConstGenAlgo.cxx:597
FPGATrackSimPlaneMap::getCoordOffset
uint32_t getCoordOffset(size_t logiLayer) const
Definition: FPGATrackSimPlaneMap.h:92
FPGATrackSimConstGenAlgo::normalize
FPGATrackSimMatrixAccumulator normalize(FPGATrackSimMatrixAccumulator const &acc_raw)
Definition: FPGATrackSimConstGenAlgo.cxx:483
FPGATrackSimConstGenAlgo::finalize
StatusCode finalize() override
Definition: FPGATrackSimConstGenAlgo.cxx:747
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
A
FPGATrackSimMatrixIO.h
Classes to read/write matrix files event by event.
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
vector2D< double >
FPGATrackSimConstGenAlgo::m_nKAverages
int m_nKAverages
Definition: FPGATrackSimConstGenAlgo.h:135
FPGATrackSimMatrixAccumulator::covariance
std::vector< double > covariance
Definition: FPGATrackSimMatrixAccumulator.h:84
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
perfmonmt-refit.slice
slice
Definition: perfmonmt-refit.py:52
lumiFormat.i
int i
Definition: lumiFormat.py:85
FPGATrackSimSectorSlice
Definition: FPGATrackSimSectorSlice.h:32
beamspotman.n
n
Definition: beamspotman.py:731
FPGATrackSimConstGenAlgo::m_sliceNBins
FPGATrackSimTrackParsI m_sliceNBins
Definition: FPGATrackSimConstGenAlgo.h:126
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
geo_constants::Vcurvature
std::vector< double > Vcurvature
Definition: FPGATrackSimConstGenAlgo.h:50
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
FPGATrackSimMatrixAccumulator
Definition: FPGATrackSimMatrixAccumulator.h:36
FPGATrackSimConstGenAlgo::m_geo_consts_with_missinghit
std::vector< std::vector< geo_constants > > m_geo_consts_with_missinghit
Definition: FPGATrackSimConstGenAlgo.h:148
geo_constants::Vd0
std::vector< double > Vd0
Definition: FPGATrackSimConstGenAlgo.h:49
TileDCSDataPlotter.pr
pr
Definition: TileDCSDataPlotter.py:922
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
file
TFile * file
Definition: tile_monitor.h:29
FPGATrackSimConstGenAlgo::m_geo_consts
std::vector< geo_constants > m_geo_consts
Definition: FPGATrackSimConstGenAlgo.h:144
find_tgc_unfilled_channelids.ip
ip
Definition: find_tgc_unfilled_channelids.py:3
AthenaPoolTestRead.acc
acc
Definition: AthenaPoolTestRead.py:16
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
FPGATrackSimConstGenAlgo::FPGATrackSimConstGenAlgo
FPGATrackSimConstGenAlgo(const std::string &name, ISvcLocator *pSvcLocator)
Definition: FPGATrackSimConstGenAlgo.cxx:55
geo_constants::pars
FPGATrackSimTrackPars pars
Definition: FPGATrackSimConstGenAlgo.h:58
FPGATrackSimMatrixReader
Definition: FPGATrackSimMatrixIO.h:41
FPGATrackSimConstGenAlgo::failedConstants
bool failedConstants(geo_constants const &geo, std::vector< bool > const &usable)
Definition: FPGATrackSimConstGenAlgo.cxx:432
AthAlgorithm
Definition: AthAlgorithm.h:47
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
FPGATrackSimConstGenAlgo::m_sliceMin
FPGATrackSimTrackPars m_sliceMin
Definition: FPGATrackSimConstGenAlgo.h:127
MIN_TRACK_SEC
#define MIN_TRACK_SEC
Definition: FPGATrackSimConstGenAlgo.cxx:39
MTX_TOLERANCE
#define MTX_TOLERANCE
Definition: FPGATrackSimConstants.h:10
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
createCoolChannelIdFile.par
par
Definition: createCoolChannelIdFile.py:29
FPGATrackSimConstGenAlgo::isSingular
bool isSingular(TMatrixD mtx)
Definition: FPGATrackSimConstGenAlgo.cxx:581
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
geo_constants::Vz0
std::vector< double > Vz0
Definition: FPGATrackSimConstGenAlgo.h:52
FPGATrackSimConstGenAlgo::m_ctree
TTree * m_ctree
Definition: FPGATrackSimConstGenAlgo.h:118
FPGATrackSimConstGenAlgo::createMissingHitsConstants
void createMissingHitsConstants(FPGATrackSimMatrixAccumulator const &acc_norm, size_t entry)
Definition: FPGATrackSimConstGenAlgo.cxx:294
FPGATrackSimConstGenAlgo::m_matrix_tree
TTree * m_matrix_tree
Definition: FPGATrackSimConstGenAlgo.h:119
project
T_ResultType project(ParameterMapping::type< N > parameter_map, const T_Matrix &matrix)
Definition: MeasurementSelector.h:149
FPGATrackSimConstGenAlgo::makeConsts
geo_constants makeConsts(FPGATrackSimMatrixAccumulator const &acc, std::vector< bool > const &usable, std::vector< double > const &inv_covariance, std::vector< double > const &eigvals, vector2D< double > const &eigvecs)
Definition: FPGATrackSimConstGenAlgo.cxx:520
FPGATrackSimTrackParsI::phi
int phi
Definition: FPGATrackSimTrackPars.h:58
geo_constants::Veta
std::vector< double > Veta
Definition: FPGATrackSimConstGenAlgo.h:53
FPGATrackSimConstGenAlgo::m_nKernel
int m_nKernel
Definition: FPGATrackSimConstGenAlgo.h:134
FPGATrackSimConstGenAlgo::invert
std::vector< double > invert(size_t n_full, TMatrixD mtx, std::vector< bool > const &usable)
Inverts a reduced matrix, then pads with zeros to recover a full-sized matrix.
Definition: FPGATrackSimConstGenAlgo.cxx:630
FPGATrackSimConstGenAlgo::bookHistograms
StatusCode bookHistograms()
Definition: FPGATrackSimConstGenAlgo.cxx:115
FPGATrackSimConstGenAlgo::m_FPGATrackSimMapping
ServiceHandle< IFPGATrackSimMappingSvc > m_FPGATrackSimMapping
Definition: FPGATrackSimConstGenAlgo.h:96
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
LArCellConditions.geo
bool geo
Definition: LArCellConditions.py:46
geo_constants
Definition: FPGATrackSimConstGenAlgo.h:47
FPGATrackSimTrackPars::z0
double z0
Definition: FPGATrackSimTrackPars.h:27
vector2D::resize
void resize(size_t x1, size_t x2, T const &t=T())
Definition: FPGATrackSimVectors.h:51
FPGATrackSimTrackPars::NPARS
@ NPARS
Definition: FPGATrackSimTrackPars.h:49
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
FPGATrackSimTrackParsI::z0
int z0
Definition: FPGATrackSimTrackPars.h:61
FPGATrackSimConstGenAlgo::writeSectors
void writeSectors()
Definition: FPGATrackSimConstGenAlgo.cxx:772
collisions.reader
reader
read the goodrunslist xml file(s)
Definition: collisions.py:22
FPGATrackSimTrackParsI::qOverPt
int qOverPt
Definition: FPGATrackSimTrackPars.h:59
FPGATrackSimTrackParsI
Definition: FPGATrackSimTrackPars.h:56
FPGATrackSimConstGenAlgo::readSkipList
void readSkipList(size_t nEntries)
Definition: FPGATrackSimConstGenAlgo.cxx:231
example.writer
writer
show summary of content
Definition: example.py:36
FPGATrackSimConstGenAlgo::m_dumpMissingHitsConstants
Gaudi::Property< bool > m_dumpMissingHitsConstants
Definition: FPGATrackSimConstGenAlgo.h:112
geo_constants::Vphi
std::vector< double > Vphi
Definition: FPGATrackSimConstGenAlgo.h:51
FPGATrackSimConstGenAlgo::prepareOutputTree
StatusCode prepareOutputTree()
Definition: FPGATrackSimConstGenAlgo.cxx:190
FPGATrackSimConstGenAlgo::copySliceTree
StatusCode copySliceTree(TFile *file)
Definition: FPGATrackSimConstGenAlgo.cxx:134
FPGATrackSimConstGenAlgo::m_cfpath
Gaudi::Property< std::string > m_cfpath
Definition: FPGATrackSimConstGenAlgo.h:105
FPGATrackSimMatrixAccumulator::nusable
size_t nusable() const
Definition: FPGATrackSimMatrixAccumulator.h:58
FPGATrackSimConstGenAlgo::fillConstTree
void fillConstTree(std::vector< module_t > &modules, FPGATrackSimMatrixAccumulator &acc, geo_constants &geo)
Definition: FPGATrackSimConstGenAlgo.cxx:366