 |
ATLAS Offline Software
|
Go to the documentation of this file.
7 #ifndef INDET_DEFECTSEMULATORCONDALGBASE_H
8 #define INDET_DEFECTSEMULATORCONDALGBASE_H
15 #include "GaudiKernel/ServiceHandle.h"
20 #include "GaudiKernel/ITHistSvc.h"
27 class HepRandomEngine;
50 {
this,
"ModulePatterns", {},
51 "Integer ranges to select: (0-1) barrel/end-cap range, (2-3) layer, (4-5) eta index range, (6-7) phi index range, "
52 "(8-9) module number of columns or strips, (10) both sides (0,1), (11) all rows (0,1)" };
54 {
this,
"DefectProbabilities", {},
55 "Defect probabilities per module pattern: defect module, defect strip." };
57 {
this,
"NDefectFractionsPerPattern", {},
58 "List of fractions per pattern for exactly 1 to n defects under the codition that there is a defect, where -1. marks the"
59 "end of this lists, before the fractions for the next mask start." };
61 {
this,
"CornerDefectParamsPerPattern", {},
62 "Set of corner defect parameters (probability, x-intersection pos min, max, y-intersection pos min, max, sagitta minm max). "
63 "per module pattern. " };
65 {
this,
"NCornerDefectFractionsPerPattern", {},
66 "List of fractions per pattern for exactly 1 to 4 corner defects under the codition that there is a defect." };
72 {
this,
"RngPerDefectType",
false,
"One RNG per defect type to decorrelate randomness of defects."};
77 {
this,
"OddRowToggle",
false};
79 {
this,
"OddColToggle",
false};
81 {
this,
"CheckerBoardDefects",
false};
83 {
this,
"MaxRandomPositionAttempts", 10};
87 {
this,
"HistogramGroupName",
"",
"Histogram group name or empty to disable histogramming"};
89 {
this,
"FillHistogramsPerPattern",
false,
"If true, histogram per module defects etc. separately per pattern."};
91 {
this,
"FillEtaPhiHistogramsPerPattern",
false,
"If true, histogram per eta, phi amd z, R are filled separately per pattern."};
94 {
this,
"DefectsOutputFile",
"",
"Empty or file name to write out conditions data (.json or .root)."};
96 {
this,
"DefectsInputFiles",{},
"Empty or file name to write out conditions data (.json or .root)."};
132 double totalProbability(
const std::vector<unsigned int> &module_pattern_idx,
unsigned int prob_idx)
const {
134 for (
unsigned int pattern_i : module_pattern_idx) {
148 unsigned int prob_idx,
149 std::vector<double> &cumulative_prob)
const {
150 cumulative_prob.clear();
151 double total_prob=0.f;
152 for (
unsigned int pattern_i : module_pattern_idx) {
155 cumulative_prob.push_back(total_prob);
179 const std::vector<unsigned int> &module_pattern_idx,
180 unsigned int n_masks,
181 unsigned int n_cells,
182 std::vector<unsigned int> &n_mask_defects)
const;
190 unsigned int n_error,
191 unsigned int n_defects_total,
192 const std::vector<std::array<unsigned int,kNCounts> > &
counts)
const;
203 std::pair<unsigned int, unsigned int>
findHist(
unsigned int pattern_i,
unsigned int n_rows,
unsigned int n_cols)
const;
216 unsigned int pattern_hist_i,
217 unsigned int matrix_histogram_index,
218 unsigned int matrix_index,
219 unsigned int module_i,
220 unsigned int n_masks,
221 const std::vector<unsigned int> &n_mask_defects,
Conditions algorithms for emulating ITK pixel defects.
Gaudi::Property< bool > m_oddRowToggle
ServiceHandle< IAthRNGSvc > m_rndmSvc
Gaudi::Property< std::vector< std::vector< double > > > m_nDefectFractionsPerPattern
Gaudi::Property< bool > m_checkerBoardToggle
std::pair< unsigned int, unsigned int > findHist(unsigned int pattern_i, unsigned int n_rows, unsigned int n_cols) const
std::array< std::vector< TH2 * >, kNPosHists > m_defectModuleEtaPhiHist ATLAS_THREAD_SAFE
StatusCode initializeCornerDefects()
Gaudi::Property< bool > m_oddColToggle
double totalProbability(const std::vector< unsigned int > &module_pattern_idx, unsigned int prob_idx) const
Compute the total probability using the probabilities associated to the given list of patterns.
virtual ~DefectsEmulatorCondAlgBase() override=default
DefectsEmulatorCondAlgBase(const std::string &name, ISvcLocator *pSvcLocator)
Gaudi::Property< std::string > m_histogramGroupName
Gaudi::Property< std::string > m_outputFile
std::vector< std::vector< std::vector< float > > > m_perPatternAndMaskFractions
ServiceHandle< ITHistSvc > m_histSvc
Gaudi::Property< bool > m_fillEtaPhiHistogramsPerPattern
std::vector< std::vector< TH2 * > > m_hist ATLAS_THREAD_SAFE
An algorithm that can be simultaneously executed in multiple threads.
std::vector< std::vector< float > > m_perPatternCornerDefectNCornerCummulativeProb
Gaudi::Property< bool > m_rngPerDefectType
Gaudi::Property< std::vector< std::vector< double > > > m_defectProbability
std::vector< std::vector< unsigned int > > m_dimPerHist ATLAS_THREAD_SAFE
std::vector< std::vector< TH2 * > > m_moduleHist ATLAS_THREAD_SAFE
void printSummaryOfDefectGeneration(unsigned int n_masks, unsigned int n_error, unsigned int n_defects_total, const std::vector< std::array< unsigned int, kNCounts > > &counts) const
::StatusCode StatusCode
StatusCode definition for legacy code.
void histogramDefectModule(unsigned int module_pattern_i, unsigned int hist_pattern_i, unsigned int id_hash, const Amg::Vector3D ¢er) const
StatusCode initializeProbabilities(unsigned int n_masks)
virtual StatusCode finalize() override
@ kCornerDefectkWidthRowDirectionOffset
Gaudi::Property< std::vector< std::vector< int > > > m_modulePattern
std::array< std::vector< TH2 * >, kNPosHists > m_defectModuleEtaLayerHist ATLAS_THREAD_SAFE
@ kCornerDefectWidthColumnDirection
Gaudi::Property< std::vector< std::vector< double > > > m_cornerDefectNCornerFractionsPerPattern
Property holding a SG store/key/clid from which a WriteHandle is made.
Gaudi::Property< std::vector< std::string > > m_inputFiles
Gaudi::Property< bool > m_fillHistogramsPerPattern
Eigen::Matrix< double, 3, 1 > Vector3D
StatusCode checkProbabilities(unsigned int n_probabilities) const
Consistency check of module patterns, probabilities.
StatusCode initializeBase(unsigned int n_masks, unsigned int wafer_hash_max)
@ kCornerDefectkWidthRowDirection
@ kCornerDefectWidthColumnDirectionOffset
bool m_histogrammingEnabled
std::vector< std::string > m_rngName
@ kCornerDefectkSagittaOffset
std::vector< unsigned int > m_maxNGroupDefects
Gaudi::Property< unsigned int > m_maxAttempts
void makeCumulativeProbabilityDist(std::vector< unsigned int > &module_pattern_idx, unsigned int prob_idx, std::vector< double > &cumulative_prob) const
Create a cumulative distribution from the referenced set of probabilities.
unsigned int throwNumberOfDefects(std::span< CLHEP::HepRandomEngine * > rndmEngine, const std::vector< unsigned int > &module_pattern_idx, unsigned int n_masks, unsigned int n_cells, std::vector< unsigned int > &n_mask_defects) const
std::atomic< unsigned int > m_modulesWithoutDefectParameters
Gaudi::Property< std::vector< std::vector< double > > > m_cornerDefectParamsPerPattern
std::vector< std::string > m_groupDefectHistNames
std::vector< unsigned int > m_matrixTypeId ATLAS_THREAD_SAFE
std::vector< std::vector< std::vector< TH1 * > > > m_groupDefectHists ATLAS_THREAD_SAFE
void fillPerModuleHistograms(unsigned int module_pattern_i, unsigned int pattern_hist_i, unsigned int matrix_histogram_index, unsigned int matrix_index, unsigned int module_i, unsigned int n_masks, const std::vector< unsigned int > &n_mask_defects, const Amg::Vector3D ¢er) const