Belle II Software  release-05-02-19
prepareAsicCrosstalkSimDB Namespace Reference

Functions

def getEff (var, cut, n=40, limits=(0., 2500.))
 

Variables

string InputFile = "cosmic.0008.03420_03427.root"
 Input root file, produced by AsicBackgroundLibraryCreator.
 
 df = read_root(InputFile, columns=["Channel", "ADC", "Board", "Nhit", "Asic"])
 Dataframe, containing relevant variables from the root file.
 
def u1 = getEff(df[(df.asic % 3 == 1)].ADC_ADC_Sig, df.Nhit > 1, 128, (0, 1024.))
 auxiliary variable, split ADC range in two < 1024 and above (u1: below)
 
def u2 = getEff(df[(df.asic % 3 == 1)].ADC_ADC_Sig, df.Nhit > 1, 16, (1024, 7800.))
 auxiliary variable, split ADC range in two < 1024 and above (u2: above)
 
 u = np.append(u1, u2, axis=1)
 merged u1 and u2
 
 x = np.nan_to_num(u[0])
 aux. More...
 
 e = np.nan_to_num(u[1])
 aux. More...
 
 ee = np.where(np.nan_to_num(u[2]) == 0, 1000., u[2])
 aux. More...
 
 f = UnivariateSpline(x, e, 1/ee)
 spline parameterisation of efficiency
 
 xp = np.arange(-0.5, 8197.5, 1)
 location of points for the plot
 
 fmt
 use dots
 
list names = ["Board", "Channel"]
 variables to write out
 
 index
 do not write index
 
 fi = TFile("t.root", "update")
 open root file to store x-talk probability histogram
 
 t = TH1F("ProbXTalk", "Prob xTalk", 8196, 0, 8196)
 histogram to store x-talk probability
 
 INPUT = FileSystem.findFile("t.root")
 prepared payload:
 
int expFirst = 0
 starting experiment for payload
 
int expLast = -1
 last experiment for payload
 
int runFirst = 0
 first run for payload
 
int runLast = -1
 last run for payload
 
 main = basf2.create_path()
 path
 
 eventinfosetter = basf2.register_module('EventInfoSetter')
 Event info setter - execute single event.
 
 dbImporter = CDCDatabaseImporter(expFirst, runFirst, expLast, runLast)
 get the importer module
 

Detailed Description

Prepare CDC x-talk simulation  DB object 

Function Documentation

◆ getEff()

def prepareAsicCrosstalkSimDB.getEff (   var,
  cut,
  n = 40,
  limits = (0., 2500.) 
)
Simple efficiency estimator
   var: pandas series/np array of variable to study
   cut: bool series/np array pass/fail
   n  : number of bins
   limits : histogram limits

Definition at line 15 of file prepareAsicCrosstalkSimDB.py.

15 def getEff(var, cut, n=40, limits=(0., 2500.)):
16  ''' Simple efficiency estimator
17  var: pandas series/np array of variable to study
18  cut: bool series/np array pass/fail
19  n : number of bins
20  limits : histogram limits
21  '''
22  a = np.histogram(var, n, limits)
23  b = np.histogram(var[cut], n, limits)
24 
25  eff = b[0]/a[0]
26  # simple binomial formula:
27  effErr = 1/a[0]*np.sqrt(a[0]*eff*(1-eff))
28  x = 0.5*(a[1][1:]+a[1][:-1])
29  return x, eff, effErr
30 
31 #
32 # Specify file name here:
33 #
34 

Variable Documentation

◆ e

e = np.nan_to_num(u[1])

aux.

x-talk prob. variable, remove NaNs

Definition at line 53 of file prepareAsicCrosstalkSimDB.py.

◆ ee

ee = np.where(np.nan_to_num(u[2]) == 0, 1000., u[2])

aux.

x-talk prob. error varlable, remove NaNs

Definition at line 55 of file prepareAsicCrosstalkSimDB.py.

◆ x

x = np.nan_to_num(u[0])

aux.

ADC variable, remove NaNs

Definition at line 51 of file prepareAsicCrosstalkSimDB.py.