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