Loading [MathJax]/extensions/tex2jax.js
 |
ATLAS Offline Software
|
#include <FPGATrackSimConstGenAlgo.h>
|
| FPGATrackSimConstGenAlgo (const std::string &name, ISvcLocator *pSvcLocator) |
|
virtual | ~FPGATrackSimConstGenAlgo ()=default |
|
StatusCode | initialize () override |
|
StatusCode | finalize () override |
|
StatusCode | execute () override |
|
StatusCode | bookHistograms () |
|
virtual StatusCode | sysInitialize () override |
| Override sysInitialize. More...
|
|
virtual const DataObjIDColl & | extraOutputDeps () const override |
| Return the list of extra output dependencies. More...
|
|
ServiceHandle< StoreGateSvc > & | evtStore () |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | evtStore () const |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | detStore () const |
| The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
virtual StatusCode | sysStart () override |
| Handle START transition. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | inputHandles () const override |
| Return this algorithm's input handles. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | outputHandles () const override |
| Return this algorithm's output handles. More...
|
|
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Property< T > &t) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc="none") |
| Declare a new Gaudi property. More...
|
|
void | updateVHKA (Gaudi::Details::PropertyBase &) |
|
MsgStream & | msg () const |
|
MsgStream & | msg (const MSG::Level lvl) const |
|
bool | msgLvl (const MSG::Level lvl) const |
|
|
StatusCode | copySliceTree (TFile *file) |
|
StatusCode | prepareOutputTree () |
|
void | readSkipList (size_t nEntries) |
|
void | generate_constants () |
|
void | fillConstTree (std::vector< module_t > &modules, FPGATrackSimMatrixAccumulator &acc, geo_constants &geo) |
|
bool | isNAN (double value, const char *name) |
|
bool | failedConstants (geo_constants const &geo, std::vector< bool > const &usable) |
|
void | DumpConstants (std::vector< geo_constants > &geo_consts, std::string &filename) |
|
void | writeSectors () |
|
bool | GetConstants (FPGATrackSimMatrixAccumulator const &acc_norm, geo_constants &geo, int entryNumber) |
|
bool | GetConstants (FPGATrackSimMatrixAccumulator const &acc_norm, geo_constants &geo, int entryNumber, std::vector< bool > const &coordsToUse, unsigned int nusable) |
|
void | createMissingHitsConstants (FPGATrackSimMatrixAccumulator const &acc_norm, size_t entry) |
|
FPGATrackSimMatrixAccumulator | normalize (FPGATrackSimMatrixAccumulator const &acc_raw) |
|
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) |
|
std::vector< double > | matrix_multiply (std::vector< double > const &A, std::vector< double > const &b) |
|
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) |
|
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. More...
|
|
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. More...
|
|
bool | isSingular (TMatrixD mtx) |
|
double | dot (const double *vec1, const double *vec2, size_t size) |
|
geo_constants | calculate_gcorth (geo_constants geo, int nCoords, std::vector< bool > const &usable) |
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &) |
| specialization for handling Gaudi::Property<SG::VarHandleKey> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &) |
| specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &) |
| specialization for handling Gaudi::Property<SG::VarHandleBase> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &) |
| specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
|
|
|
ServiceHandle< IFPGATrackSimMappingSvc > | m_FPGATrackSimMapping {this, "FPGATrackSimMappingSvc","FPGATrackSimMappingSvc"} |
|
ServiceHandle< IFPGATrackSimEventSelectionSvc > | m_EvtSel {this,"FPGATrackSimEventSelectionSvc","FPGATrackSimEventSelectionSvc"} |
|
ServiceHandle< ITHistSvc > | m_tHistSvc {this, "THistSvc","THistSvc"} |
|
const FPGATrackSimPlaneMap * | m_pmap = nullptr |
|
Gaudi::Property< std::string > | m_cfpath {this, "merged_file_path", "", "merged file"} |
|
Gaudi::Property< std::string > | m_skipFile {this, "skip_sectors", "File with list of sectors to skip"} |
|
Gaudi::Property< bool > | m_Monitor {this,"Monitor",false,"flag to enable the monitor"} |
|
Gaudi::Property< int > | m_region {this, "region",0,"region to run"} |
|
Gaudi::Property< bool > | m_CheckGood2ndStage {this,"CheckGood2ndStage",true,"Check goodness of 2nd stage fit constants?"} |
|
Gaudi::Property< bool > | m_useHitScaleFactor {this,"UseHitScaleFactor",false,"Scale factor for hits"} |
|
Gaudi::Property< bool > | m_isSecondStage {this,"IsSecondStage",false,"If false, we're doing a 1st stage fit, otherwise 2nd stage"} |
|
Gaudi::Property< bool > | m_dumpMissingHitsConstants {this, "missHitsConsts", false, "if this is true we dump constants assuming a missing hit in each layer, too"} |
|
TFile * | m_mafile = nullptr |
|
TTree * | m_ctree = nullptr |
|
TTree * | m_matrix_tree = nullptr |
|
TTree * | m_good_tree = nullptr |
|
FPGATrackSimTrackParsI | m_sliceNBins |
|
FPGATrackSimTrackPars | m_sliceMin |
|
FPGATrackSimTrackPars | m_sliceMax |
|
int | m_nLayers = 0 |
|
int | m_nKernel = 0 |
|
int | m_nKAverages = 0 |
|
int | m_nCoords = 0 |
|
int | m_nCoords_2 = 0 |
|
std::vector< geo_constants > | m_geo_consts |
|
std::vector< std::vector< geo_constants > > | m_geo_consts_with_missinghit |
|
std::vector< bool > | m_skipList |
|
DataObjIDColl | m_extendedExtraObjects |
|
StoreGateSvc_t | m_evtStore |
| Pointer to StoreGate (event store by default) More...
|
|
StoreGateSvc_t | m_detStore |
| Pointer to StoreGate (detector store by default) More...
|
|
std::vector< SG::VarHandleKeyArray * > | m_vhka |
|
bool | m_varHandleArraysDeclared |
|
Definition at line 78 of file FPGATrackSimConstGenAlgo.h.
◆ StoreGateSvc_t
◆ FPGATrackSimConstGenAlgo()
FPGATrackSimConstGenAlgo::FPGATrackSimConstGenAlgo |
( |
const std::string & |
name, |
|
|
ISvcLocator * |
pSvcLocator |
|
) |
| |
◆ ~FPGATrackSimConstGenAlgo()
virtual FPGATrackSimConstGenAlgo::~FPGATrackSimConstGenAlgo |
( |
| ) |
|
|
virtualdefault |
◆ bookHistograms()
StatusCode FPGATrackSimConstGenAlgo::bookHistograms |
( |
| ) |
|
Definition at line 116 of file FPGATrackSimConstGenAlgo.cxx.
120 auto h_vc = std::make_unique<TH1F>(
"h_vc",
"h_vc",500,-1
e-4,1
e-4);
121 auto h_vd = std::make_unique<TH1F>(
"h_vd",
"h_vd",500,-1
e-2,1
e-2);
122 auto h_vf = std::make_unique<TH1F>(
"h_vf",
"h_vf",500,-1
e-2,1
e-2);
123 auto h_vz = std::make_unique<TH1F>(
"h_vz",
"h_vz",500,-1
e-2,1
e-2);
124 auto h_veta = std::make_unique<TH1F>(
"h_veta",
"h_veta",500,-1
e-2,1
e-2);
131 return StatusCode::SUCCESS;
◆ calculate_gcorth()
Definition at line 710 of file FPGATrackSimConstGenAlgo.cxx.
714 if (!usable[
i])
continue;
717 auto project = [&](std::vector<double> & hit_x_par,
double &
par)
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;
◆ copySliceTree()
StatusCode FPGATrackSimConstGenAlgo::copySliceTree |
( |
TFile * |
file | ) |
|
|
private |
Definition at line 135 of file FPGATrackSimConstGenAlgo.cxx.
138 TTree *old_tree = (TTree*)
file->Get(
"slice");
159 old_tree->GetEntry(0);
162 TTree *new_tree =
new TTree(
"slice",
"Slice boundaries");
187 return StatusCode::SUCCESS;
◆ createMissingHitsConstants()
Definition at line 295 of file FPGATrackSimConstGenAlgo.cxx.
300 if (!acc_norm.coords_usable[missing])
307 unsigned int nusable = acc_norm.nusable() - 1;
308 std::vector<bool> coordsToUse = acc_norm.coords_usable;
309 coordsToUse[missing] =
false;
313 coordsToUse[missing+1] =
false;
◆ declareGaudiProperty() [1/4]
specialization for handling Gaudi::Property<SG::VarHandleKeyArray>
Definition at line 170 of file AthCommonDataStore.h.
175 hndl.documentation());
◆ declareGaudiProperty() [2/4]
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition at line 156 of file AthCommonDataStore.h.
161 hndl.documentation());
◆ declareGaudiProperty() [3/4]
specialization for handling Gaudi::Property<SG::VarHandleBase>
Definition at line 184 of file AthCommonDataStore.h.
189 hndl.documentation());
◆ declareGaudiProperty() [4/4]
◆ declareProperty() [1/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleBase
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 245 of file AthCommonDataStore.h.
250 this->declare(hndl.
vhKey());
251 hndl.
vhKey().setOwner(
this);
253 return PBASE::declareProperty(
name,hndl,
doc);
◆ declareProperty() [2/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleKey
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 221 of file AthCommonDataStore.h.
229 return PBASE::declareProperty(
name,hndl,
doc);
◆ declareProperty() [3/6]
◆ declareProperty() [4/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This is the generic version, for types that do not derive from SG::VarHandleKey
. It just forwards to the base class version of declareProperty
.
Definition at line 333 of file AthCommonDataStore.h.
338 return PBASE::declareProperty(
name, property,
doc);
◆ declareProperty() [5/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This dispatches to either the generic declareProperty
or the one for VarHandle/Key/KeyArray.
Definition at line 352 of file AthCommonDataStore.h.
◆ declareProperty() [6/6]
◆ detStore()
◆ dot()
double FPGATrackSimConstGenAlgo::dot |
( |
const double * |
vec1, |
|
|
const double * |
vec2, |
|
|
size_t |
size |
|
) |
| |
|
private |
◆ DumpConstants()
void FPGATrackSimConstGenAlgo::DumpConstants |
( |
std::vector< geo_constants > & |
geo_consts, |
|
|
std::string & |
filename |
|
) |
| |
|
private |
Definition at line 820 of file FPGATrackSimConstGenAlgo.cxx.
822 FILE *const_file = fopen(
filename.c_str(),
"w");
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");
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");
838 for (
size_t sector = 0; sector < geo_consts.size(); sector++)
841 fprintf(const_file,
"sector\n");
842 fprintf(const_file,
"%zu\n", sector);
844 fprintf(const_file,
" Vc \n");
846 fprintf(const_file,
"%e\n",geo_consts[sector].Vcurvature[
i]);
849 fprintf(const_file,
" Vd \n");
851 fprintf(const_file,
"%e\n",geo_consts[sector].Vd0[
i]);
854 fprintf(const_file,
" Vf \n");
856 fprintf(const_file,
"%e\n",geo_consts[sector].Vphi[
i]);
859 fprintf(const_file,
" Vz0 \n");
861 fprintf(const_file,
"%e\n",geo_consts[sector].Vz0[
i]);
864 fprintf(const_file,
" Vo \n");
866 fprintf(const_file,
"%e\n",geo_consts[sector].Veta[
i]);
869 fprintf(const_file,
"kaverages\n");
871 fprintf(const_file,
"%e\n",
m_geo_consts[sector].kaverages[
i]);
874 fprintf(const_file,
"kernel\n");
877 fprintf(const_file,
"%e\n",geo_consts[sector].kernel(
i, j));
881 fprintf(const_file,
"Cc\n");
882 fprintf(const_file,
"%e\n",geo_consts[sector].
pars.qOverPt);
884 fprintf(const_file,
"Cd\n");
885 fprintf(const_file,
"%e\n",geo_consts[sector].
pars.d0);
887 fprintf(const_file,
"Cf\n");
888 fprintf(const_file,
"%e\n",geo_consts[sector].
pars.phi);
890 fprintf(const_file,
"Cz0\n");
891 fprintf(const_file,
"%e\n",geo_consts[sector].
pars.z0);
893 fprintf(const_file,
"Co\n");
894 fprintf(const_file,
"%e\n",geo_consts[sector].
pars.eta);
◆ eigen()
void FPGATrackSimConstGenAlgo::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 |
|
) |
| |
|
private |
Definition at line 670 of file FPGATrackSimConstGenAlgo.cxx.
674 TVectorD eigvals_redu;
675 TMatrixD eigvecs_redu = mtx.EigenVectors(eigvals_redu);
678 eigvals_full.resize(n_full, 0);
679 eigvecs_full.resize(n_full, n_full, 0);
683 size_t j_redu = n_redu - 1;
684 for (
size_t i_full = 0; i_full < n_full; i_full++)
686 if (!usable[i_full])
continue;
689 for (
size_t j_full = 0; j_full < n_full; j_full++)
691 if (!usable[j_full])
continue;
692 eigvecs_full(i_full, j_full) = eigvecs_redu[i_redu][j_redu];
695 eigvals_full[i_full] = eigvals_redu[j_redu];
◆ evtStore() [1/2]
◆ evtStore() [2/2]
◆ execute()
StatusCode FPGATrackSimConstGenAlgo::execute |
( |
| ) |
|
|
override |
◆ extraDeps_update_handler()
Add StoreName to extra input/output deps as needed.
use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given
◆ extraOutputDeps()
const DataObjIDColl & AthAlgorithm::extraOutputDeps |
( |
| ) |
const |
|
overridevirtualinherited |
Return the list of extra output dependencies.
This list is extended to include symlinks implied by inheritance relations.
Definition at line 50 of file AthAlgorithm.cxx.
57 return Algorithm::extraOutputDeps();
◆ failedConstants()
◆ fillConstTree()
Definition at line 367 of file FPGATrackSimConstGenAlgo.cxx.
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);
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);
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());
386 m_ctree->SetBranchAddress(
"kaverages",
geo.kaverages.data());
387 m_ctree->SetBranchAddress(
"kernel",
geo.kernel.data());
393 const std::string
prefix{
"/TRIGFPGATrackSimTREEGOODOUT/"};
394 auto getHistogram = [&](
const std::string &
suffix)->TH1*{
397 return (
sc == StatusCode::SUCCESS) ?
ptr:
nullptr;
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");
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]);
◆ finalize()
StatusCode FPGATrackSimConstGenAlgo::finalize |
( |
| ) |
|
|
override |
◆ generate_constants()
void FPGATrackSimConstGenAlgo::generate_constants |
( |
| ) |
|
|
private |
◆ GetConstants() [1/2]
◆ GetConstants() [2/2]
Definition at line 338 of file FPGATrackSimConstGenAlgo.cxx.
347 std::vector<double> inv_covariance =
invert(
m_nCoords, mtx_reduced, coordsToUse);
350 std::vector<double> eigvals;
353 eigen(nusable,
m_nCoords, mtx_reduced, coordsToUse, eigvals, eigvecs);
356 geo =
makeConsts(acc_norm, coordsToUse, inv_covariance, eigvals, eigvecs);
◆ getReducedMatrix()
TMatrixD FPGATrackSimConstGenAlgo::getReducedMatrix |
( |
size_t |
n, |
|
|
std::vector< double > const & |
mtx_v, |
|
|
std::vector< bool > const & |
usable, |
|
|
size_t |
nDimToUse |
|
) |
| |
|
private |
Removes the rows/columns specified by !usable.
- Parameters
-
n | - Initial size of matrix |
mtx_v | - Matrix to be reduced (size n*n) |
usable | - Which rows/columns are to be kept (size n) |
nDimToUse | - Must be count(usable), size of output matrix |
Definition at line 598 of file FPGATrackSimConstGenAlgo.cxx.
600 TMatrixD mtx(
n,
n, mtx_v.data());
601 TMatrixD newmtx(nDimToUse, nDimToUse);
604 for (
size_t i = 0;
i <
n;
i++)
606 if (!usable[
i])
continue;
609 for (
size_t j = 0; j <
n; j++)
611 if (!usable[j])
continue;
612 newmtx[counteri][counterj] = mtx[
i][j];
615 assert(counterj == nDimToUse);
618 assert(counteri == nDimToUse);
◆ initialize()
StatusCode FPGATrackSimConstGenAlgo::initialize |
( |
| ) |
|
|
override |
◆ inputHandles()
Return this algorithm's input handles.
We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.
◆ invert()
std::vector< double > FPGATrackSimConstGenAlgo::invert |
( |
size_t |
n_full, |
|
|
TMatrixD |
mtx, |
|
|
std::vector< bool > const & |
usable |
|
) |
| |
|
private |
Inverts a reduced matrix, then pads with zeros to recover a full-sized matrix.
- Parameters
-
n_full | - Size of full (output) system |
mtx | - A reduced matrix to be inverted (size n_redu * n_redu) |
usable | - Which rows/columns were kept (size n_full, count(usable == n_redu)) |
Definition at line 631 of file FPGATrackSimConstGenAlgo.cxx.
634 std::vector<double> inv(n_full * n_full);
639 for (
size_t i = 0;
i < n_full;
i++)
641 if (!usable[
i])
continue;
644 for (
size_t j = 0; j < n_full; j++)
646 if (!usable[j])
continue;
647 inv[
i*n_full + j] = mtx[counteri][counterj];
◆ isNAN()
bool FPGATrackSimConstGenAlgo::isNAN |
( |
double |
value, |
|
|
const char * |
name |
|
) |
| |
|
private |
◆ isSingular()
bool FPGATrackSimConstGenAlgo::isSingular |
( |
TMatrixD |
mtx | ) |
|
|
private |
◆ makeConsts()
Definition at line 521 of file FPGATrackSimConstGenAlgo.cxx.
525 size_t nCoords =
acc.hit_coords.size();
536 if (!usable[
i])
continue;
537 for (
size_t j = 0; j < nCoords; j++)
539 if (!usable[j])
continue;
541 geo.kernel(
i, j) = eigvecs(
i, j) / sqrt(eigvals[
i]);
543 geo.kaverages[
i] += -
geo.kernel(
i, j) *
acc.hit_coords[j];
548 for (
size_t i = 0;
i < nCoords;
i++)
551 geo.pars.qOverPt += -
geo.Vcurvature[
i] *
acc.hit_coords[
i];
557 geo.real =
static_cast<int>(
acc.track_bins.size());
◆ matrix_multiply()
std::vector< double > FPGATrackSimConstGenAlgo::matrix_multiply |
( |
std::vector< double > const & |
A, |
|
|
std::vector< double > const & |
b |
|
) |
| |
|
private |
◆ msg() [1/2]
◆ msg() [2/2]
◆ msgLvl()
◆ normalize()
Definition at line 484 of file FPGATrackSimConstGenAlgo.cxx.
487 double coverage =
static_cast<double>(
acc.track_bins.size());
488 size_t nCoords =
acc.hit_coords.size();
491 acc.pars[
i] /= coverage;
493 for (
unsigned i = 0;
i < nCoords;
i++)
495 acc.hit_coords[
i] /= coverage;
497 else acc.coords_usable[
i] =
true;
501 for (
unsigned i = 0;
i < nCoords;
i++)
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);
510 for (
unsigned j =
i ; j < nCoords; ++j)
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);
◆ outputHandles()
Return this algorithm's output handles.
We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.
◆ prepareOutputTree()
StatusCode FPGATrackSimConstGenAlgo::prepareOutputTree |
( |
| ) |
|
|
private |
Definition at line 191 of file FPGATrackSimConstGenAlgo.cxx.
199 std::string tree_title =
"Ambank " +
std::to_string(0) +
" constants";
200 m_ctree =
new TTree(tree_name.c_str(), tree_title.c_str());
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");
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");
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");
224 m_ctree->Branch(
"kernel", &aDouble,
"kernel[nkernel]/D");
225 m_ctree->Branch(
"kaverages", &aDouble,
"kaverages[nkaverages]/D");
228 return StatusCode::SUCCESS;
◆ readSkipList()
void FPGATrackSimConstGenAlgo::readSkipList |
( |
size_t |
nEntries | ) |
|
|
private |
◆ renounce()
◆ renounceArray()
◆ sysInitialize()
StatusCode AthAlgorithm::sysInitialize |
( |
| ) |
|
|
overridevirtualinherited |
◆ sysStart()
Handle START transition.
We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.
◆ updateVHKA()
◆ writeSectors()
void FPGATrackSimConstGenAlgo::writeSectors |
( |
| ) |
|
|
private |
Definition at line 773 of file FPGATrackSimConstGenAlgo.cxx.
783 FILE *sector_file = fopen(sector_filename.c_str(),
"w");
784 FILE *sectorHW_file = fopen(sectorHW_filename.c_str(),
"w");
791 while (
reader.nextEntry())
794 size_t sector =
reader.getEntry();
796 fprintf(sector_file,
"%zu ", sector);
797 fprintf(sectorHW_file,
"%zu ", sector);
800 fprintf(sector_file,
"%d ",
acc.FTK_modules[
i]);
801 fprintf(sectorHW_file,
"%d ",
reader.getModules()[
i]);
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");
813 fclose(sectorHW_file);
815 slice.saveSlices(slice_filename);
◆ m_cfpath
Gaudi::Property<std::string> FPGATrackSimConstGenAlgo::m_cfpath {this, "merged_file_path", "", "merged file"} |
|
private |
◆ m_CheckGood2ndStage
Gaudi::Property<bool> FPGATrackSimConstGenAlgo::m_CheckGood2ndStage {this,"CheckGood2ndStage",true,"Check goodness of 2nd stage fit constants?"} |
|
private |
◆ m_ctree
TTree* FPGATrackSimConstGenAlgo::m_ctree = nullptr |
|
private |
◆ m_detStore
◆ m_dumpMissingHitsConstants
Gaudi::Property<bool> FPGATrackSimConstGenAlgo::m_dumpMissingHitsConstants {this, "missHitsConsts", false, "if this is true we dump constants assuming a missing hit in each layer, too"} |
|
private |
◆ m_EvtSel
◆ m_evtStore
◆ m_extendedExtraObjects
DataObjIDColl AthAlgorithm::m_extendedExtraObjects |
|
privateinherited |
◆ m_FPGATrackSimMapping
◆ m_geo_consts
std::vector<geo_constants> FPGATrackSimConstGenAlgo::m_geo_consts |
|
private |
◆ m_geo_consts_with_missinghit
std::vector<std::vector<geo_constants> > FPGATrackSimConstGenAlgo::m_geo_consts_with_missinghit |
|
private |
◆ m_good_tree
TTree* FPGATrackSimConstGenAlgo::m_good_tree = nullptr |
|
private |
◆ m_isSecondStage
Gaudi::Property<bool> FPGATrackSimConstGenAlgo::m_isSecondStage {this,"IsSecondStage",false,"If false, we're doing a 1st stage fit, otherwise 2nd stage"} |
|
private |
◆ m_mafile
TFile* FPGATrackSimConstGenAlgo::m_mafile = nullptr |
|
private |
◆ m_matrix_tree
TTree* FPGATrackSimConstGenAlgo::m_matrix_tree = nullptr |
|
private |
◆ m_Monitor
Gaudi::Property<bool> FPGATrackSimConstGenAlgo::m_Monitor {this,"Monitor",false,"flag to enable the monitor"} |
|
private |
◆ m_nCoords
int FPGATrackSimConstGenAlgo::m_nCoords = 0 |
|
private |
◆ m_nCoords_2
int FPGATrackSimConstGenAlgo::m_nCoords_2 = 0 |
|
private |
◆ m_nKAverages
int FPGATrackSimConstGenAlgo::m_nKAverages = 0 |
|
private |
◆ m_nKernel
int FPGATrackSimConstGenAlgo::m_nKernel = 0 |
|
private |
◆ m_nLayers
int FPGATrackSimConstGenAlgo::m_nLayers = 0 |
|
private |
◆ m_pmap
◆ m_region
Gaudi::Property<int> FPGATrackSimConstGenAlgo::m_region {this, "region",0,"region to run"} |
|
private |
◆ m_skipFile
Gaudi::Property<std::string> FPGATrackSimConstGenAlgo::m_skipFile {this, "skip_sectors", "File with list of sectors to skip"} |
|
private |
◆ m_skipList
std::vector<bool> FPGATrackSimConstGenAlgo::m_skipList |
|
private |
◆ m_sliceMax
◆ m_sliceMin
◆ m_sliceNBins
◆ m_tHistSvc
ServiceHandle<ITHistSvc> FPGATrackSimConstGenAlgo::m_tHistSvc {this, "THistSvc","THistSvc"} |
|
private |
◆ m_useHitScaleFactor
Gaudi::Property<bool> FPGATrackSimConstGenAlgo::m_useHitScaleFactor {this,"UseHitScaleFactor",false,"Scale factor for hits"} |
|
private |
◆ m_varHandleArraysDeclared
◆ m_vhka
The documentation for this class was generated from the following files:
void generate_constants()
std::vector< D3PDTest::MyVec2 > vec2
Gaudi::Property< bool > m_CheckGood2ndStage
geo_constants calculate_gcorth(geo_constants geo, int nCoords, std::vector< bool > const &usable)
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)
Gaudi::Property< std::string > m_skipFile
double dot(const double *vec1, const double *vec2, size_t size)
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Gaudi::Property< bool > m_Monitor
void DumpConstants(std::vector< geo_constants > &geo_consts, std::string &filename)
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
FPGATrackSimTrackPars m_sliceMax
ServiceHandle< ITHistSvc > m_tHistSvc
Gaudi::Property< int > m_region
bool GetConstants(FPGATrackSimMatrixAccumulator const &acc_norm, geo_constants &geo, int entryNumber)
std::vector< bool > m_skipList
const FPGATrackSimPlaneMap * m_pmap
Gaudi::Property< bool > m_isSecondStage
std::vector< double > matrix_multiply(std::vector< double > const &A, std::vector< double > const &b)
virtual void setOwner(IDataHandleHolder *o)=0
uint32_t getDim(size_t logiLayer) const
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.
uint32_t getCoordOffset(size_t logiLayer) const
FPGATrackSimMatrixAccumulator normalize(FPGATrackSimMatrixAccumulator const &acc_raw)
ServiceHandle< IFPGATrackSimEventSelectionSvc > m_EvtSel
virtual StatusCode sysInitialize() override
Override sysInitialize.
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
FPGATrackSimTrackParsI m_sliceNBins
::StatusCode StatusCode
StatusCode definition for legacy code.
std::vector< double > Vcurvature
std::vector< std::vector< geo_constants > > m_geo_consts_with_missinghit
std::vector< double > Vd0
std::vector< geo_constants > m_geo_consts
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
FPGATrackSimTrackPars pars
bool failedConstants(geo_constants const &geo, std::vector< bool > const &usable)
virtual void renounce()=0
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
FPGATrackSimTrackPars m_sliceMin
bool isSingular(TMatrixD mtx)
std::string to_string(const DetectorType &type)
std::vector< double > Vz0
void createMissingHitsConstants(FPGATrackSimMatrixAccumulator const &acc_norm, size_t entry)
T_ResultType project(ParameterMapping::type< N > parameter_map, const T_Matrix &matrix)
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)
DataObjIDColl m_extendedExtraObjects
std::vector< double > Veta
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.
StatusCode bookHistograms()
ServiceHandle< IFPGATrackSimMappingSvc > m_FPGATrackSimMapping
#define ATH_MSG_WARNING(x)
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
AthAlgorithm()
Default constructor:
reader
read the goodrunslist xml file(s)
void readSkipList(size_t nEntries)
writer
show summary of content
Gaudi::Property< bool > m_dumpMissingHitsConstants
std::vector< double > Vphi
StatusCode prepareOutputTree()
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
StatusCode copySliceTree(TFile *file)
Gaudi::Property< std::string > m_cfpath
void fillConstTree(std::vector< module_t > &modules, FPGATrackSimMatrixAccumulator &acc, geo_constants &geo)