Functions | Variables
PandAna.weight.cv_weights Namespace Reference

Functions

def kRescaleMAQE (tables, weight)
 
def kFixNonres1Pi (tables, weight)
 
def kRescaleHighWDIS (tables, weight)
 
def kRPAWeightCCQE (tables, weight)
 
def kRPAWeightRES (tables, weight)
 
def kEmpiricalMECWgt (tables, weight)
 
def kPPFXFluxCVWgt (tables, weight)
 

Variables

list kXSecCVWgt2018
 
list kFluxCVWgt2018 = [kPPFXFluxCVWgt]
 
 kCVWgt2018 = kXSecCVWgt2018+kFluxCVWgt2018
 

Function Documentation

def PandAna.weight.cv_weights.kEmpiricalMECWgt (   tables,
  weight 
)

Definition at line 76 of file cv_weights.py.

References cet.pow().

76 def kEmpiricalMECWgt(tables, weight):
77  rwgtCalc = EmpiricalMECWgt2018()
78  df = tables['rec.mc.nu']
79  sel = (df['mode'] == mode.kMEC)
80 
81  q0 = (df['E']*df['y'])[sel]
82  qmag = ((df['q2'] + (q0*q0)).pow(0.5))[sel]
83  isAntiNu = (df['pdg'] < 0)[sel]
84  params = pd.concat([q0, qmag, isAntiNu], axis=1)
85  params.columns = ['q0', 'qmag', 'IsAntiNu']
86 
87  if not params.empty:
88  weight[sel] *= params.apply(lambda x: rwgtCalc.GetWeight(x), axis=1)
89  return weight
90 
def kEmpiricalMECWgt(tables, weight)
Definition: cv_weights.py:76
constexpr T pow(T x)
Definition: pow.h:75
def PandAna.weight.cv_weights.kFixNonres1Pi (   tables,
  weight 
)

Definition at line 24 of file cv_weights.py.

References sum.

24 def kFixNonres1Pi(tables, weight):
25  df = tables['rec.mc.nu']
26  sel = (df['mode'] == mode.kDIS) & \
27  (df['W2'] <= 1.7*1.7) & \
28  (df['pdg'] >= 0) & \
29  (df[['npiplus', 'npiminus', 'npizero']].sum(axis=1) == 1)
30 
31  # keeping typo in 2018 version for now. It should actually be 0.43
32  weight[sel] *= 0.41
33  return weight
34 
def kFixNonres1Pi(tables, weight)
Definition: cv_weights.py:24
Double_t sum
Definition: plot.C:31
def PandAna.weight.cv_weights.kPPFXFluxCVWgt (   tables,
  weight 
)

Definition at line 91 of file cv_weights.py.

91 def kPPFXFluxCVWgt(tables, weight):
92  sel = (tables['rec.mc']['nnu'] == 1)
93  weight[sel] *= tables['rec.mc.nu.rwgt.ppfx']['cv']
94  return weight
95 
def kPPFXFluxCVWgt(tables, weight)
Definition: cv_weights.py:91
def PandAna.weight.cv_weights.kRescaleHighWDIS (   tables,
  weight 
)

Definition at line 35 of file cv_weights.py.

35 def kRescaleHighWDIS(tables, weight):
36  df = tables['rec.mc.nu']
37  sel = (df['mode'] == mode.kDIS) & \
38  (df['W2'] >= 1.7*1.7) & \
39  (df['pdg'] >= 0)
40 
41  weight[sel] *= 1.1
42  return weight
43 
def kRescaleHighWDIS(tables, weight)
Definition: cv_weights.py:35
def PandAna.weight.cv_weights.kRescaleMAQE (   tables,
  weight 
)

Definition at line 9 of file cv_weights.py.

9 def kRescaleMAQE(tables, weight):
10  correctionInSigma = (1.04 - 0.99) / 0.25
11 
12  df = tables['rec.mc.nu']
13 
14  genie_df = tables['rec.mc.nu.rwgt.genie']
15  genie_plus1 = tables['rec.mc.nu.rwgt.genie']['plus1sigma']
16  sel = (df['mode'] == mode.kQE) & \
17  (df['iscc'] == 1) & \
18  (genie_plus1.groupby(KL).agg('count') > genie.fReweightMaCCQE)
19  genie_plus1 = genie_plus1[genie_df['rec.mc.nu.rwgt.genie_idx'] == genie.fReweightMaCCQE][sel]
20 
21  weight[sel] *= (1. + correctionInSigma*(genie_plus1 - 1.))
22  return weight
23 
def kRescaleMAQE(tables, weight)
Definition: cv_weights.py:9
def PandAna.weight.cv_weights.kRPAWeightCCQE (   tables,
  weight 
)

Definition at line 44 of file cv_weights.py.

References cet.pow().

Referenced by fnex::CompareFNEXCAFEventListFiles.ReadCAFDataTextFile(), and fnex::CompareFNEXCAFEventListFiles.ReadCAFMCTextFile().

44 def kRPAWeightCCQE(tables, weight):
45  rwgtCalc = RPAWeightCCQE_2017()
46  df = tables['rec.mc.nu']
47  sel = (df['mode'] == mode.kQE) & \
48  (df['iscc'] == 1)
49 
50  q0 = (df['E']*df['y'])[sel]
51  qmag = ((df['q2'] + (q0*q0)).pow(0.5))[sel]
52  isAntiNu = (df['pdg'] < 0)[sel]
53  params = pd.concat([q0, qmag, isAntiNu], axis=1)
54  params.columns = ['q0', 'qmag', 'IsAntiNu']
55 
56  if not params.empty:
57  weight[sel] *= params.apply(lambda x: rwgtCalc.GetWeight(x), axis=1)
58  return weight
59 
constexpr T pow(T x)
Definition: pow.h:75
def kRPAWeightCCQE(tables, weight)
Definition: cv_weights.py:44
def PandAna.weight.cv_weights.kRPAWeightRES (   tables,
  weight 
)

Definition at line 60 of file cv_weights.py.

60 def kRPAWeightRES(tables, weight):
61  rwgtCalc = RPAWeightQ2_2017()
62  df = tables['rec.mc.nu']
63  sel = (df['mode'] == mode.kRes) & \
64  (df['iscc'] == 1)
65 
66  q2 = df['q2'][sel]
67  isAntiNu = (df['pdg'] < 0)[sel]
68  params = pd.concat([q2, isAntiNu], axis=1)
69  params.columns = ['q2', 'IsAntiNu']
70 
71  if not params.empty:
72  weight[sel] *= params.apply(lambda x: rwgtCalc.GetWeight(x), axis=1)
73  return weight
74 
75 
def kRPAWeightRES(tables, weight)
Definition: cv_weights.py:60

Variable Documentation

PandAna.weight.cv_weights.kCVWgt2018 = kXSecCVWgt2018+kFluxCVWgt2018

Definition at line 101 of file cv_weights.py.

list PandAna.weight.cv_weights.kFluxCVWgt2018 = [kPPFXFluxCVWgt]

Definition at line 99 of file cv_weights.py.

list PandAna.weight.cv_weights.kXSecCVWgt2018
Initial value:
1 = [kRescaleMAQE, kRPAWeightCCQE, kRPAWeightRES,
2  kFixNonres1Pi, kRescaleHighWDIS, kEmpiricalMECWgt]

Definition at line 96 of file cv_weights.py.