Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Functions
PixelDefectsEmulatorPostInclude Namespace Reference

Functions

def emulateITkPixelDefects (flags, cfg, ModulePatterns=[[-2, 2, 0, 99,-99, 99,-99, 99, 0, 9999, 0, 1, 0]], DefectProbabilities=[[0., 1e-2, 1e-1, 0.]], NDefectFractionsPerPattern=[[1.,-1, 1.]], NoiseProbability=[], NoiseShape=[], CornerDefectParamsPerPattern=[], NCornerDefectFractionsPerPattern=[], FillHistogramsPerPattern=False, FillEtaPhiHistogramsPerPattern=False, int MaxRandomPositionAttempts=10, str HistogramGroupName="ITkPixelDefects", str HistogramFileName="itk_pixel_defects_opt1.root", PropagateDefectsToStatus=True)
 
def emulatePixelDefects (flags, cfg, ModulePatterns=None, DefectProbabilities=None, NDefectFractionsPerPattern=None, FillHistogramsPerPattern=False, FillEtaPhiHistogramsPerPattern=False, str HistogramGroupName="PixelDefects", str HistogramFileName="pixel_defects.root")
 
def poissonFractions (cc_defect_prob=1e-1, max_n=5)
 
def quadProb (circuit_prob)
 
def fractionsForExactlyNCoreColumnDefects (ExactlyNCoreColumnDefects=1)
 
def makeITkDefectsParams (quad_cc_defect_prob, quad_fractions, circuit_cc_defect_prob, circuit_fractions, pixel_defect_prob=1e-2, module_defect_prob=0., cornerDefectProb=0., noiseProbability=None, noiseShape=[])
 
def makeITkPixelNoise (noiseProb=0.)
 
def emulateITkPixelDefectsOneCC (flags, cfg, FrontEndCCDefectProb=0.1, PixelDefectProb=1e-2, NumberOfCCDefects=1, ModuleDefectProb=0., CornerDefectProb=0., NoiseProb=0., PropagateDefectsToStatus=True, HistogramFileName=None)
 
def emulateITkPixelDefectsPoisson (flags, cfg, FrontEndCCDefectProb=0.1, PixelDefectProb=1e-2, ModuleDefectProb=0., CornerDefectProb=0., NoiseProb=0., PropagateDefectsToStatus=True, HistogramFileName=None)
 
def emulateITkPixelDefectsDefault (flags, cfg, FrontEndCCDefectProb=0.1, PixelDefectProb=1e-2, ModuleDefectProb=1e-2, CornerDefectProb=15e-2, NoiseProb=0., PropagateDefectsToStatus=True, HistogramFileName=None)
 

Function Documentation

◆ emulateITkPixelDefects()

def PixelDefectsEmulatorPostInclude.emulateITkPixelDefects (   flags,
  cfg,
  ModulePatterns = [[-2,2,0,99,-99,99,-99,99,0,9999,0,1,0]],
  DefectProbabilities = [[0.,1e-2,1e-1,0.]],
  NDefectFractionsPerPattern = [[1.,-1, 1.]],
  NoiseProbability = [],
  NoiseShape = [],
  CornerDefectParamsPerPattern = [],
  NCornerDefectFractionsPerPattern = [],
  FillHistogramsPerPattern = False,
  FillEtaPhiHistogramsPerPattern = False,
int  MaxRandomPositionAttempts = 10,
str  HistogramGroupName = "ITkPixelDefects",
str  HistogramFileName = "itk_pixel_defects_opt1.root",
  PropagateDefectsToStatus = True 
)
Schedule conditions algorithm for emulated ITk pixel defects, and algorithms to drop RDOs overlapping with the emulated defects.
ModulePattern: criteria to match modules, which are lists of n-tuples where every two numbers of each n-tuple define a range
               to match parts of module identifiers (barrel/ec, layer/disk, eta., phi, columns, side) plus a flag (last
               element of each n-tuple), which is unused for pixel.
DefectProbabilities: list of n-tuples per criterion containing 4 probabilities: module, pixel to be defect, a module
                     to have at least one core column defect, circuit defect.
NDefectFractionsPerPattern: Fractions of exactly n-group defects (core-column, circuit) under condition that there is at least one
                            such group defect. There must be one n-tuple with fractions per criterion, and each fraction
                            n-tuple must contain for each group defect probability a non empty set of fractions of exactly 1, ... n defects.
                            Fractions for different group defects are separated by -1. There should be two sequences of
                            positive fractions separated by -1.
NoiseProbability: Empty or probabilities of a pixel to produce a spurious hit.
NoiseShape: binned PDF (i.e. list of fractions) to create tot values for spurious hits.
CornerDefectParamsPerPattern: parameters for corner defects per pattern can be created with e.g. makeCornerDefectParam
NCornerDefectFractionsPerPattern: fractions of 1,..4 corner defects
FillHistogramsPerPattern: if True histograms are filled per module pattern
FillEtaPhiHistogramsPerPattern: if True also fill xy, and rz histograms of defects per module.
HistogramGroupName: None (disables histogramming) or the histogram group name must be unique
HistogramFileName: None (disables histogramming) or a file name for writing the histograms.

Definition at line 16 of file PixelDefectsEmulatorPostInclude.py.

16 def emulateITkPixelDefects(flags,
17  cfg,
18  ModulePatterns=[[-2,2,0,99,-99,99,-99,99,0,9999,0,1,0]],
19  DefectProbabilities=[[0.,1e-2,1e-1,0.]],
20  NDefectFractionsPerPattern=[[1.,-1, 1.]],
21  NoiseProbability=[],
22  NoiseShape=[],
23  CornerDefectParamsPerPattern=[],
24  NCornerDefectFractionsPerPattern=[],
25  FillHistogramsPerPattern=False,
26  FillEtaPhiHistogramsPerPattern=False,
27  MaxRandomPositionAttempts: int=10,
28  HistogramGroupName: str="ITkPixelDefects",
29  HistogramFileName: str="itk_pixel_defects_opt1.root",
30  PropagateDefectsToStatus=True) :
31  """
32  Schedule conditions algorithm for emulated ITk pixel defects, and algorithms to drop RDOs overlapping with the emulated defects.
33  ModulePattern: criteria to match modules, which are lists of n-tuples where every two numbers of each n-tuple define a range
34  to match parts of module identifiers (barrel/ec, layer/disk, eta., phi, columns, side) plus a flag (last
35  element of each n-tuple), which is unused for pixel.
36  DefectProbabilities: list of n-tuples per criterion containing 4 probabilities: module, pixel to be defect, a module
37  to have at least one core column defect, circuit defect.
38  NDefectFractionsPerPattern: Fractions of exactly n-group defects (core-column, circuit) under condition that there is at least one
39  such group defect. There must be one n-tuple with fractions per criterion, and each fraction
40  n-tuple must contain for each group defect probability a non empty set of fractions of exactly 1, ... n defects.
41  Fractions for different group defects are separated by -1. There should be two sequences of
42  positive fractions separated by -1.
43  NoiseProbability: Empty or probabilities of a pixel to produce a spurious hit.
44  NoiseShape: binned PDF (i.e. list of fractions) to create tot values for spurious hits.
45  CornerDefectParamsPerPattern: parameters for corner defects per pattern can be created with e.g. makeCornerDefectParam
46  NCornerDefectFractionsPerPattern: fractions of 1,..4 corner defects
47  FillHistogramsPerPattern: if True histograms are filled per module pattern
48  FillEtaPhiHistogramsPerPattern: if True also fill xy, and rz histograms of defects per module.
49  HistogramGroupName: None (disables histogramming) or the histogram group name must be unique
50  HistogramFileName: None (disables histogramming) or a file name for writing the histograms.
51  """
52 
53  from InDetDefectsEmulation.PixelDefectsEmulatorConfig import (
54  ITkPixelDefectsEmulatorCondAlgCfg,
55  ITkPixelDefectsEmulatorAlgCfg,
56  ITkPixelDefectsEmulatorToDetectorElementStatusCondAlgCfg,
57  DefectsHistSvcCfg
58  )
59  from AthenaCommon.Constants import INFO
60 
61  if HistogramFileName is None or len(HistogramFileName) ==0 :
62  HistogramGroupName = None
63  if HistogramGroupName is not None :
64  cfg.merge( DefectsHistSvcCfg(flags, HistogramGroup=HistogramGroupName, FileName=HistogramFileName))
65 
66  # schedule custom defects generating conditions alg
67  cfg.merge( ITkPixelDefectsEmulatorCondAlgCfg(flags,
68  # to enable histogramming:
69  HistogramGroupName=f"/{HistogramGroupName}/EmulatedDefects/" if HistogramGroupName is not None else "",
70  ModulePatterns = ModulePatterns,
71  DefectProbabilities = DefectProbabilities,
72  NDefectFractionsPerPattern = NDefectFractionsPerPattern,
73  MaxRandomPositionAttempts=MaxRandomPositionAttempts,
74  CornerDefectParamsPerPattern=CornerDefectParamsPerPattern,
75  NCornerDefectFractionsPerPattern=NCornerDefectFractionsPerPattern,
76  FillHistogramsPerPattern=FillHistogramsPerPattern,
77  FillEtaPhiHistogramsPerPattern=FillEtaPhiHistogramsPerPattern,
78  CheckerBoardDefects=False,
79  OddColToggle=False,
80  OddRowToggle=False,
81  WriteKey="ITkPixelEmulatedDefects", # the default should match the key below
82  ))
83 
84  # schedule the algorithm which drops elements from the ITk Pixel RDO collection
85  cfg.merge( ITkPixelDefectsEmulatorAlgCfg(flags,
86  # prevent default cond alg from being scheduled :
87  EmulatedDefectsKey="ITkPixelEmulatedDefects",
88  ModulePatterns = ModulePatterns,
89  NoiseProbability = NoiseProbability,
90  NoiseShape = NoiseShape,
91  # to enable histogramming:
92  HistogramGroupName=f"/{HistogramGroupName}/RejectedRDOs/" if HistogramGroupName is not None else "",
93  OutputLevel=INFO))
94 
95  if PropagateDefectsToStatus :
96  # propagate defects to detector element status
98  name="ITkPixelDefectsEmulatorToDetectorElementStatusCondAlg",
99  EmulatedDefectsKey="ITkPixelEmulatedDefects",
100  WriteKey="ITkPixelDetectorElementStatusFromEmulatedDefects"))
101  pixel_det_el_status_cond_alg=cfg.getCondAlgo("ITkPixelDetectorElementStatusCondAlgNoByteStreamErrors")
102  pixel_det_el_status_cond_alg.ConditionsSummaryTool.PixelDetElStatusCondDataBaseKey="ITkPixelDetectorElementStatusFromEmulatedDefects"
103 

◆ emulateITkPixelDefectsDefault()

def PixelDefectsEmulatorPostInclude.emulateITkPixelDefectsDefault (   flags,
  cfg,
  FrontEndCCDefectProb = 0.1,
  PixelDefectProb = 1e-2,
  ModuleDefectProb = 1e-2,
  CornerDefectProb = 15e-2,
  NoiseProb = 0.,
  PropagateDefectsToStatus = True,
  HistogramFileName = None 
)
Enables all defects according to the current expectation.

Definition at line 378 of file PixelDefectsEmulatorPostInclude.py.

379  cfg,
380  FrontEndCCDefectProb=0.1,
381  PixelDefectProb=1e-2,
382  ModuleDefectProb=1e-2,
383  CornerDefectProb=15e-2,
384  NoiseProb=0.,
385  PropagateDefectsToStatus=True,
386  HistogramFileName=None) :
387  """
388  Enables all defects according to the current expectation.
389  """
391  FrontEndCCDefectProb,
392  PixelDefectProb,
393  ModuleDefectProb,
394  CornerDefectProb,
395  NoiseProb,
396  PropagateDefectsToStatus,
397  HistogramFileName)

◆ emulateITkPixelDefectsOneCC()

def PixelDefectsEmulatorPostInclude.emulateITkPixelDefectsOneCC (   flags,
  cfg,
  FrontEndCCDefectProb = 0.1,
  PixelDefectProb = 1e-2,
  NumberOfCCDefects = 1,
  ModuleDefectProb = 0.,
  CornerDefectProb = 0.,
  NoiseProb = 0.,
  PropagateDefectsToStatus = True,
  HistogramFileName = None 
)
Create exactly one core column defect per module where the probability is given
by module_prob, and create single pixel defects according to pixel_defect_prob

Definition at line 295 of file PixelDefectsEmulatorPostInclude.py.

296  cfg,
297  FrontEndCCDefectProb=0.1,
298  PixelDefectProb=1e-2,
299  NumberOfCCDefects=1,
300  ModuleDefectProb=0.,
301  CornerDefectProb=0.,
302  NoiseProb=0.,
303  PropagateDefectsToStatus=True,
304  HistogramFileName=None) :
305  """
306  Create exactly one core column defect per module where the probability is given
307  by module_prob, and create single pixel defects according to pixel_defect_prob
308  """
309  noiseProbabilitySingle,noiseShapeSingle = makeITkPixelNoise(NoiseProb)
310  fractions=fractionsForExactlyNCoreColumnDefects(NumberOfCCDefects)
311  ModulePatterns, DefectProbabilities, NDefectFractionsPerPattern, NoiseProbability, NoiseShape,cornerDefectParam,cornerDefectFractions = makeITkDefectsParams(
312  quad_cc_defect_prob=quadProb(FrontEndCCDefectProb),
313  quad_fractions=fractions, # same fractions for quads and other modules
314  circuit_cc_defect_prob=FrontEndCCDefectProb,
315  circuit_fractions=fractions,
316  pixel_defect_prob=PixelDefectProb,
317  module_defect_prob=ModuleDefectProb,
318  cornerDefectProb=CornerDefectProb,
319  noiseProbability=noiseProbabilitySingle,
320  noiseShape=noiseShapeSingle)
321 
322  return emulateITkPixelDefects(flags,
323  cfg,
324  ModulePatterns=ModulePatterns,
325  DefectProbabilities=DefectProbabilities,
326  NDefectFractionsPerPattern=NDefectFractionsPerPattern,
327  NoiseProbability=NoiseProbability,
328  NoiseShape=NoiseShape,
329  CornerDefectParamsPerPattern=cornerDefectParam,
330  NCornerDefectFractionsPerPattern=cornerDefectFractions,
331  FillHistogramsPerPattern=True,
332  FillEtaPhiHistogramsPerPattern=True,
333  PropagateDefectsToStatus=PropagateDefectsToStatus,
334  HistogramFileName=HistogramFileName)
335 
336 

◆ emulateITkPixelDefectsPoisson()

def PixelDefectsEmulatorPostInclude.emulateITkPixelDefectsPoisson (   flags,
  cfg,
  FrontEndCCDefectProb = 0.1,
  PixelDefectProb = 1e-2,
  ModuleDefectProb = 0.,
  CornerDefectProb = 0.,
  NoiseProb = 0.,
  PropagateDefectsToStatus = True,
  HistogramFileName = None 
)
Create Poisson distributed  core column defects per module where the probability for at least one
core column defect is given by front_end_cc_defect_prob for single chip modules and larger for
quads, respectively. Single pixel defects are controlled by pixel_defect_prob

Definition at line 337 of file PixelDefectsEmulatorPostInclude.py.

338  cfg,
339  FrontEndCCDefectProb=0.1,
340  PixelDefectProb=1e-2,
341  ModuleDefectProb=0.,
342  CornerDefectProb=0.,
343  NoiseProb=0.,
344  PropagateDefectsToStatus=True,
345  HistogramFileName=None) :
346  """
347  Create Poisson distributed core column defects per module where the probability for at least one
348  core column defect is given by front_end_cc_defect_prob for single chip modules and larger for
349  quads, respectively. Single pixel defects are controlled by pixel_defect_prob
350  """
351  noiseProbabilitySingle,noiseShapeSingle = makeITkPixelNoise(NoiseProb)
352  quad_prob=quadProb(FrontEndCCDefectProb)
353  ModulePatterns, DefectProbabilities, NDefectFractionsPerPattern, NoiseProbability, NoiseShape,cornerDefectParam,cornerDefectFractions = makeITkDefectsParams(
354  quad_cc_defect_prob=quad_prob,
355  quad_fractions=poissonFractions(quad_prob),
356  circuit_cc_defect_prob=FrontEndCCDefectProb,
357  circuit_fractions=poissonFractions(FrontEndCCDefectProb),
358  pixel_defect_prob=PixelDefectProb,
359  module_defect_prob=ModuleDefectProb,
360  cornerDefectProb=CornerDefectProb,
361  noiseProbability=noiseProbabilitySingle,
362  noiseShape=noiseShapeSingle)
363 
364  return emulateITkPixelDefects(flags,
365  cfg,
366  ModulePatterns=ModulePatterns,
367  DefectProbabilities=DefectProbabilities,
368  NDefectFractionsPerPattern=NDefectFractionsPerPattern,
369  NoiseProbability=NoiseProbability,
370  NoiseShape=NoiseShape,
371  CornerDefectParamsPerPattern=cornerDefectParam,
372  NCornerDefectFractionsPerPattern=cornerDefectFractions,
373  FillHistogramsPerPattern=True,
374  FillEtaPhiHistogramsPerPattern=True,
375  PropagateDefectsToStatus=PropagateDefectsToStatus,
376  HistogramFileName=HistogramFileName)
377 

◆ emulatePixelDefects()

def PixelDefectsEmulatorPostInclude.emulatePixelDefects (   flags,
  cfg,
  ModulePatterns = None,
  DefectProbabilities = None,
  NDefectFractionsPerPattern = None,
  FillHistogramsPerPattern = False,
  FillEtaPhiHistogramsPerPattern = False,
str  HistogramGroupName = "PixelDefects",
str  HistogramFileName = "pixel_defects.root" 
)
Schedule algorithms to emulate run3 pixel defects, and algorithm to drop RDOs which overlap with these defects

Definition at line 104 of file PixelDefectsEmulatorPostInclude.py.

104 def emulatePixelDefects(flags,
105  cfg,
106  ModulePatterns=None,
107  DefectProbabilities=None,
108  NDefectFractionsPerPattern=None,
109  FillHistogramsPerPattern=False,
110  FillEtaPhiHistogramsPerPattern=False,
111  HistogramGroupName: str="PixelDefects",
112  HistogramFileName: str="pixel_defects.root") :
113  """
114  Schedule algorithms to emulate run3 pixel defects, and algorithm to drop RDOs which overlap with these defects
115  """
116  from InDetDefectsEmulation.PixelDefectsEmulatorConfig import (
117  PixelDefectsEmulatorCondAlgCfg,
118  PixelDefectsEmulatorAlgCfg,
119  DefectsHistSvcCfg
120  )
121  from AthenaCommon.Constants import INFO
122 
123  if HistogramFileName is None or len(HistogramFileName) ==0 :
124  HistogramGroupName = None
125  if HistogramGroupName is not None :
126  cfg.merge( DefectsHistSvcCfg(flags, HistogramGroup=HistogramGroupName, FileName=HistogramFileName))
127 
128  if ModulePatterns is None and DefectProbabilities is None and NDefectFractionsPerPattern is None:
129  a_module_pattern_list, a_prob_list,fractions,ignore_NoiseProbability,ignore_NoiseShape, cornerDefectParam, cornerDefectFractions = combineModuleDefects([
130  moduleDefect(bec=[-2,-2],layer=[0,99], phi_range=[-99,99],eta_range=[-99,99], # select all modules
131  columns_or_strips=[0,9999], # sensors with all kind of numbers of columns
132  side_range=[0,0], # there is only a single side
133  all_rows=False, # there is no connection between modules
134  probability=[1e-2, # probability of a module to be defect
135  1e-2, # probability of a pixel to be defect
136  0., # probability of a module to have at least one core-column defect
137  0. # probability of a module to have at least one defect circuit
138  ])
139  ])
140  ModulePatterns = a_module_pattern_list
141  DefectProbabilities = a_prob_list
142  NDefectFractionsPerPattern = fractions
143 
144  # schedule custom defects generating conditions alg
145  cfg.merge( PixelDefectsEmulatorCondAlgCfg(flags,
146  ModulePatterns = ModulePatterns,
147  DefectProbabilities = DefectProbabilities,
148  NDefectFractionsPerPattern = NDefectFractionsPerPattern,
149  CornerDefectParamsPerPattern=cornerDefectParam,
150  NCornerDefectFractionsPerPattern=cornerDefectFractions,
151  FillHistogramsPerPattern=FillHistogramsPerPattern,
152  FillEtaPhiHistogramsPerPattern=FillEtaPhiHistogramsPerPattern,
153  # to enable histogramming:
154  HistogramGroupName=f"/{HistogramGroupName}/EmulatedDefects/" if HistogramGroupName is not None else "",
155  WriteKey="PixelEmulatedDefects", # the default should match the key below
156  ))
157 
158  # schedule the algorithm which drops elements from the ITk Pixel RDO collection
159  cfg.merge( PixelDefectsEmulatorAlgCfg(flags,
160  # prevent default cond alg from being scheduled :
161  EmulatedDefectsKey="PixelEmulatedDefects",
162  # to enable histogramming:
163  HistogramGroupName=f"/{HistogramGroupName}/RejectedRDOs/" if HistogramGroupName is not None else "",
164  # (prefix "/PixelDefects/" is assumed by THistSvc config)
165  OutputLevel=INFO))
166 
167 

◆ fractionsForExactlyNCoreColumnDefects()

def PixelDefectsEmulatorPostInclude.fractionsForExactlyNCoreColumnDefects (   ExactlyNCoreColumnDefects = 1)
Create fraction n-tuple, containing zero except for the element corresponding
to exactly n defects, which is set to 1.

Definition at line 193 of file PixelDefectsEmulatorPostInclude.py.

193 def fractionsForExactlyNCoreColumnDefects(ExactlyNCoreColumnDefects=1) :
194  """
195  Create fraction n-tuple, containing zero except for the element corresponding
196  to exactly n defects, which is set to 1.
197  """
198  return [ 0. if idx != ExactlyNCoreColumnDefects else 1. for idx in range(1,ExactlyNCoreColumnDefects+1) ]
199 

◆ makeITkDefectsParams()

def PixelDefectsEmulatorPostInclude.makeITkDefectsParams (   quad_cc_defect_prob,
  quad_fractions,
  circuit_cc_defect_prob,
  circuit_fractions,
  pixel_defect_prob = 1e-2,
  module_defect_prob = 0.,
  cornerDefectProb = 0.,
  noiseProbability = None,
  noiseShape = [] 
)
Create different defects for quads and single chip modules, where the corresponding modules are selected by
the number of offline columns

Definition at line 200 of file PixelDefectsEmulatorPostInclude.py.

200 def makeITkDefectsParams( quad_cc_defect_prob,
201  quad_fractions,
202  circuit_cc_defect_prob,
203  circuit_fractions,
204  pixel_defect_prob=1e-2,
205  module_defect_prob=0.,
206  cornerDefectProb=0.,
207  noiseProbability=None,
208  noiseShape=[]) :
209  """
210  Create different defects for quads and single chip modules, where the corresponding modules are selected by
211  the number of offline columns
212  """
213  # corner defects:
214  # - 50% of ~30% of the 3D modules have disconnected corners area 2-4mm x 2-2.5mm,
215  # - roughly circular shape with a sagitta (defined by circle crossing sensor edges) of ~0-2mm,
216  # - impact on all 3D sensors which are all single chip modules i.e. modules with 384 or 400 columns
217  corner_defects=makeCornerDefectParam(probability=cornerDefectProb,
218  min_rx=2.,max_rx=8.4,
219  min_ry=2.,max_ry=4.5,
220  min_sagitta=0.,max_sagitta=2.2)
221  # assume each corner has equal probability to suffer corner defects
222  # Assume number of corners with defects Poisson distributed
223  corner_defect_n_defect_corners=poissonFractions(cc_defect_prob=15e-2, max_n=4)
224 
225  return combineModuleDefects([
226  moduleDefect(bec=[-2,2],layer=[0,99], phi_range=[-99,99],eta_range=[-99,99], # select all modules
227  columns_or_strips=[800,800], # but only quads
228  side_range=[0,0], # there is only a single side
229  all_rows=False, # there is no connection between modules
230  probability=[module_defect_prob, # probability of a module to be defect
231  pixel_defect_prob, # probability of a pixel to be defect
232  quad_cc_defect_prob, # probability of a module to have at least one core-column defect
233  0. # probability of a module to have at least one defect circuit
234  ],
235  fractionsOfNDefects=[quad_fractions,[1.]], # dummy fractions for circuit defects
236  noiseProbability=noiseProbability,
237  noiseShape=noiseShape,
238  cornerDefectParam=[], # need empty lists here
239  cornerDefectNCornerFractions=[] # and here, otherwise resulting property will be non-conform,
240  ),
241  moduleDefect(bec=[-2,2],layer=[0,1], phi_range=[-99,99],eta_range=[-99,99], # select all modules
242  columns_or_strips=[384,384], # but only ring triplet modules
243  side_range=[0,0], # there is only a single side
244  all_rows=False, # there is no connection between modules
245  probability=[module_defect_prob, # probability of a module to be defect
246  pixel_defect_prob, # probability of a pixel to be defect
247  circuit_cc_defect_prob, # probability of a module to have at least one core-column defect
248  0. # probability of a module to have at least one defect circuit
249  ],
250  fractionsOfNDefects=[circuit_fractions,[1.]], # dummy fractions for circuit defects
251  noiseProbability=noiseProbability,
252  noiseShape=noiseShape,
253  cornerDefectParam=corner_defects,
254  cornerDefectNCornerFractions=corner_defect_n_defect_corners,
255  ),
256  moduleDefect(bec=[-2,2],layer=[0,1], phi_range=[-99,99],eta_range=[-99,99], # select all modules
257  columns_or_strips=[200,200], # but only barrel triplet modules
258  side_range=[0,0], # there is only a single side
259  all_rows=False, # there is no connection between modules
260  probability=[module_defect_prob, # probability of a module to be defect
261  pixel_defect_prob, # probability of a pixel to be defect
262  circuit_cc_defect_prob, # probability of a module to have at least one core-column defect
263  0. # probability of a module to have at least one defect circuit
264  ],
265  fractionsOfNDefects=[circuit_fractions,[1.]], # dummy fractions for circuit defects
266  noiseProbability=noiseProbability,
267  noiseShape=noiseShape,
268  cornerDefectParam=corner_defects,
269  cornerDefectNCornerFractions=corner_defect_n_defect_corners,
270  )
271  ])
272 

◆ makeITkPixelNoise()

def PixelDefectsEmulatorPostInclude.makeITkPixelNoise (   noiseProb = 0.)
For NoiseProb>0. create phantasie noise tot shape, with mean at zero width of 0.7
truncated below a tot of 1.

Definition at line 273 of file PixelDefectsEmulatorPostInclude.py.

273 def makeITkPixelNoise(noiseProb=0.) :
274  """
275  For NoiseProb>0. create phantasie noise tot shape, with mean at zero width of 0.7
276  truncated below a tot of 1.
277  """
278  if noiseProb > 0. :
279  import math
280  def norm(dist) :
281  scale = sum(dist)
282  return [elm/scale if scale > 0. else 0. for elm in dist]
283  def gaussDist(mean, width, n) :
284  scale = -1./(2*width)
285  return norm([ math.exp( scale *math.pow(i - mean,2.) ) for i in range(0,n) ])
286 
287  # Guassian tot distribution with mean of 0 but tot >=1
288  noiseShape=[ 0. ] + gaussDist(-1,0.7,4)
289  else :
290  noiseProb=None
291  noiseShape=[]
292  return noiseProb,noiseShape
293 
294 

◆ poissonFractions()

def PixelDefectsEmulatorPostInclude.poissonFractions (   cc_defect_prob = 1e-1,
  max_n = 5 
)
Create fractions for exactly 1..max_n defects, under the condition that
the probability for at least one such defects is cc_defect_prob, and
assuming that the fractions are Poisson distributed.

Definition at line 168 of file PixelDefectsEmulatorPostInclude.py.

168 def poissonFractions(cc_defect_prob=1e-1, max_n=5) :
169  """
170  Create fractions for exactly 1..max_n defects, under the condition that
171  the probability for at least one such defects is cc_defect_prob, and
172  assuming that the fractions are Poisson distributed.
173  """
174  if cc_defect_prob > 0. :
175  def PoissonProb(expected, n) :
176  return math.pow(expected,n)*math.exp(-expected)/math.gamma(n+1)
177  def norm(fractions) :
178  Norm = 1./sum (fractions)
179  return [Norm*elm for elm in fractions ]
180  expectation=-math.log(1-cc_defect_prob)
181  return norm([ PoissonProb(expectation,i) for i in range(1,max_n+1) ])
182  else :
183  return [1.]
184 

◆ quadProb()

def PixelDefectsEmulatorPostInclude.quadProb (   circuit_prob)
Compute the defect probability for a quad module from the probabilities
of a single chip module, assuming that the defect is a "feature" of the
chip.

Definition at line 185 of file PixelDefectsEmulatorPostInclude.py.

185 def quadProb(circuit_prob) :
186  """
187  Compute the defect probability for a quad module from the probabilities
188  of a single chip module, assuming that the defect is a "feature" of the
189  chip.
190  """
191  return 1-math.pow(1-circuit_prob,4) # not (no defect core column on none of the sensors)
192 
PixelDefectsEmulatorConfig.ITkPixelDefectsEmulatorToDetectorElementStatusCondAlgCfg
ComponentAccumulator ITkPixelDefectsEmulatorToDetectorElementStatusCondAlgCfg(flags, str name="ITkPixelDefectsEmulatorToDetectorElementStatusCondAlgCfg", **dict kwargs)
Definition: PixelDefectsEmulatorConfig.py:103
PixelDefectsEmulatorConfig.DefectsHistSvcCfg
ComponentAccumulator DefectsHistSvcCfg(flags, str HistogramGroup="PixelDefects", str FileName='pixel_defects.root')
Definition: PixelDefectsEmulatorConfig.py:23
StripDefectsEmulatorConfig.moduleDefect
def moduleDefect(bec=[-2, 2], layer=[0, 8], eta_range=[-99, 99], phi_range=[-99, 99], columns_or_strips=[0, 2000], column_or_strip_length=[0, 1000000], side_range=[0, 1], all_rows=True, probability=[1e-2], fractionsOfNDefects=[], noiseProbability=None, noiseShape=[], cornerDefectParam=None, cornerDefectNCornerFractions=None)
Definition: StripDefectsEmulatorConfig.py:50
PlotCalibFromCool.norm
norm
Definition: PlotCalibFromCool.py:100
PixelDefectsEmulatorConfig.PixelDefectsEmulatorCondAlgCfg
ComponentAccumulator PixelDefectsEmulatorCondAlgCfg(flags, str name="PixelDefectsEmulatorCondAlg", **dict kwargs)
Definition: PixelDefectsEmulatorConfig.py:34
PixelDefectsEmulatorPostInclude.fractionsForExactlyNCoreColumnDefects
def fractionsForExactlyNCoreColumnDefects(ExactlyNCoreColumnDefects=1)
Definition: PixelDefectsEmulatorPostInclude.py:193
PixelDefectsEmulatorConfig.ITkPixelDefectsEmulatorCondAlgCfg
ComponentAccumulator ITkPixelDefectsEmulatorCondAlgCfg(flags, str name="ITkPixelDefectsEmulatorCondAlg", **dict kwargs)
Definition: PixelDefectsEmulatorConfig.py:49
PixelDefectsEmulatorPostInclude.emulateITkPixelDefects
def emulateITkPixelDefects(flags, cfg, ModulePatterns=[[-2, 2, 0, 99,-99, 99,-99, 99, 0, 9999, 0, 1, 0]], DefectProbabilities=[[0., 1e-2, 1e-1, 0.]], NDefectFractionsPerPattern=[[1.,-1, 1.]], NoiseProbability=[], NoiseShape=[], CornerDefectParamsPerPattern=[], NCornerDefectFractionsPerPattern=[], FillHistogramsPerPattern=False, FillEtaPhiHistogramsPerPattern=False, int MaxRandomPositionAttempts=10, str HistogramGroupName="ITkPixelDefects", str HistogramFileName="itk_pixel_defects_opt1.root", PropagateDefectsToStatus=True)
Definition: PixelDefectsEmulatorPostInclude.py:16
StripDefectsEmulatorConfig.makeCornerDefectParam
def makeCornerDefectParam(probability=1e-1, min_rx=0., max_rx=4e-3, min_ry=0., max_ry=4e-3, min_sagitta=0., max_sagitta=2e-3)
Definition: StripDefectsEmulatorConfig.py:22
PixelDefectsEmulatorPostInclude.makeITkDefectsParams
def makeITkDefectsParams(quad_cc_defect_prob, quad_fractions, circuit_cc_defect_prob, circuit_fractions, pixel_defect_prob=1e-2, module_defect_prob=0., cornerDefectProb=0., noiseProbability=None, noiseShape=[])
Definition: PixelDefectsEmulatorPostInclude.py:200
PixelDefectsEmulatorConfig.PixelDefectsEmulatorAlgCfg
ComponentAccumulator PixelDefectsEmulatorAlgCfg(flags, str name="PixelDefectsEmulatorAlg", **dict kwargs)
Definition: PixelDefectsEmulatorConfig.py:63
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
StripDefectsEmulatorConfig.combineModuleDefects
def combineModuleDefects(defects)
Definition: StripDefectsEmulatorConfig.py:138
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
PixelDefectsEmulatorConfig.ITkPixelDefectsEmulatorAlgCfg
ComponentAccumulator ITkPixelDefectsEmulatorAlgCfg(flags, str name="ITkPixelDefectsEmulatorAlg", **dict kwargs)
Definition: PixelDefectsEmulatorConfig.py:83
Constants
some useful constants -------------------------------------------------—
PixelDefectsEmulatorPostInclude.emulatePixelDefects
def emulatePixelDefects(flags, cfg, ModulePatterns=None, DefectProbabilities=None, NDefectFractionsPerPattern=None, FillHistogramsPerPattern=False, FillEtaPhiHistogramsPerPattern=False, str HistogramGroupName="PixelDefects", str HistogramFileName="pixel_defects.root")
Definition: PixelDefectsEmulatorPostInclude.py:104
PixelDefectsEmulatorPostInclude.quadProb
def quadProb(circuit_prob)
Definition: PixelDefectsEmulatorPostInclude.py:185
PixelDefectsEmulatorPostInclude.emulateITkPixelDefectsPoisson
def emulateITkPixelDefectsPoisson(flags, cfg, FrontEndCCDefectProb=0.1, PixelDefectProb=1e-2, ModuleDefectProb=0., CornerDefectProb=0., NoiseProb=0., PropagateDefectsToStatus=True, HistogramFileName=None)
Definition: PixelDefectsEmulatorPostInclude.py:337
PixelDefectsEmulatorPostInclude.emulateITkPixelDefectsOneCC
def emulateITkPixelDefectsOneCC(flags, cfg, FrontEndCCDefectProb=0.1, PixelDefectProb=1e-2, NumberOfCCDefects=1, ModuleDefectProb=0., CornerDefectProb=0., NoiseProb=0., PropagateDefectsToStatus=True, HistogramFileName=None)
Definition: PixelDefectsEmulatorPostInclude.py:295
PixelDefectsEmulatorPostInclude.makeITkPixelNoise
def makeITkPixelNoise(noiseProb=0.)
Definition: PixelDefectsEmulatorPostInclude.py:273
PixelDefectsEmulatorPostInclude.emulateITkPixelDefectsDefault
def emulateITkPixelDefectsDefault(flags, cfg, FrontEndCCDefectProb=0.1, PixelDefectProb=1e-2, ModuleDefectProb=1e-2, CornerDefectProb=15e-2, NoiseProb=0., PropagateDefectsToStatus=True, HistogramFileName=None)
Definition: PixelDefectsEmulatorPostInclude.py:378
PixelDefectsEmulatorPostInclude.poissonFractions
def poissonFractions(cc_defect_prob=1e-1, max_n=5)
Definition: PixelDefectsEmulatorPostInclude.py:168