ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
LArHVGainsPredictor.GainPredictor Class Reference
Collaboration diagram for LArHVGainsPredictor.GainPredictor:

Public Member Functions

def __init__ (self, mapping)
 
def GetGain (self, receiver, orig_gain, layer_corr_ref, layer_corr_new, layer_names)
 

Public Attributes

 geometry_convertor
 
 layer_weights_em
 
 layer_weights_had
 

Detailed Description

Definition at line 75 of file LArHVGainsPredictor.py.

Constructor & Destructor Documentation

◆ __init__()

def LArHVGainsPredictor.GainPredictor.__init__ (   self,
  mapping 
)

Definition at line 77 of file LArHVGainsPredictor.py.

77  def __init__(self, mapping):
78 
79  self.geometry_convertor = mapping
80 
81  self.layer_weights_em = {} # per eta bin
82  self.layer_weights_had = {} # per eta bin
83 
84  file_name= ROOT.PathResolver.find_calib_file("TrigT1Calo/HVcorrPhysicsWeights_v1.txt")
85 
86 
87 
88  try:
89 
90  file = open(file_name)
91 
92  except IOError:
93 
94  print ("\ncould not find file: %s ....exiting\n" % file_name)
95 
96  sys.exit()
97 
98  for line in file.readlines():
99 
100  parts = line.split()
101 
102  self.layer_weights_em [int(parts[0])] = [float(parts[1]),float(parts[2]),float(parts[3]),float(parts[4]),float(parts[5])]
103  self.layer_weights_had[int(parts[0])] = [float(parts[6]),float(parts[7]),float(parts[8]),float(parts[9])]
104 
105  file.close()
106 
107 

Member Function Documentation

◆ GetGain()

def LArHVGainsPredictor.GainPredictor.GetGain (   self,
  receiver,
  orig_gain,
  layer_corr_ref,
  layer_corr_new,
  layer_names 
)

Definition at line 108 of file LArHVGainsPredictor.py.

108  def GetGain(self, receiver, orig_gain, layer_corr_ref, layer_corr_new, layer_names):
109 
110  coolid = self.geometry_convertor.getPPMfromReceiver(receiver)
111 
112  eta_bin = self.geometry_convertor.getEtaBin(coolid)
113 
114  hv_coef_ref = 0. # ref hv coefficient
115  hv_coef_new = 0. # new hv coefficient
116 
117 
118 
119  if self.geometry_convertor.isCoolEm (coolid):
120 
121  is_overlap = self.geometry_convertor.isPPMOverlap(coolid)
122 
123 
124 
125  for n in range(len(layer_names)):
126 
127  layer = layer_names[n]
128 
130 
131  hv_coef_ref += layer_corr_ref[n] * self.layer_weights_em [eta_bin][0]
132  hv_coef_new += layer_corr_new[n] * self.layer_weights_em [eta_bin][0]
133 
134  if PlotCalibrationHV.isEmFront(layer,is_overlap):
135 
136  hv_coef_ref += layer_corr_ref[n] * self.layer_weights_em [eta_bin][1]
137  hv_coef_new += layer_corr_new[n] * self.layer_weights_em [eta_bin][1]
138 
139  if PlotCalibrationHV.isEmMiddle(layer,is_overlap):
140 
141  hv_coef_ref += layer_corr_ref[n] * self.layer_weights_em [eta_bin][2]
142  hv_coef_new += layer_corr_new[n] * self.layer_weights_em [eta_bin][2]
143 
144  if PlotCalibrationHV.isEmBack(layer,is_overlap):
145 
146  hv_coef_ref += layer_corr_ref[n] * self.layer_weights_em [eta_bin][3]
147  hv_coef_new += layer_corr_new[n] * self.layer_weights_em [eta_bin][3]
148 
149  if PlotCalibrationHV.isEmOverlapBack(layer,is_overlap):
150 
151  hv_coef_ref += layer_corr_ref[n] * self.layer_weights_em [eta_bin][4]
152  hv_coef_new += layer_corr_new[n] * self.layer_weights_em [eta_bin][4]
153 
154 
155 
156  if self.geometry_convertor.isCoolHad(coolid):
157 
158  regions = "EmbFcalHighEta" # (?)
159 
160 
161 
162  for n in range(len(layer_names)):
163 
164  layer = layer_names[n]
165 
166  if PlotCalibrationHV.isHadFirstLayer(layer,regions):
167 
168  hv_coef_ref += layer_corr_ref[n] * self.layer_weights_had[eta_bin][0]
169  hv_coef_new += layer_corr_new[n] * self.layer_weights_had[eta_bin][0]
170 
171  if PlotCalibrationHV.isHadSecondLayer(layer,regions):
172 
173  hv_coef_ref += layer_corr_ref[n] * self.layer_weights_had[eta_bin][1]
174  hv_coef_new += layer_corr_new[n] * self.layer_weights_had[eta_bin][1]
175 
176  if PlotCalibrationHV.isHadThirdLayer(layer,regions):
177 
178  hv_coef_ref += layer_corr_ref[n] * self.layer_weights_had[eta_bin][2]
179  hv_coef_new += layer_corr_new[n] * self.layer_weights_had[eta_bin][2]
180 
181  if PlotCalibrationHV.isHadFourthLayer(layer,regions):
182 
183  hv_coef_ref += layer_corr_ref[n] * self.layer_weights_had[eta_bin][3]
184  hv_coef_new += layer_corr_new[n] * self.layer_weights_had[eta_bin][3]
185 
186  pred_gain = orig_gain * (hv_coef_new/hv_coef_ref) # predicted gain
187 
188  return pred_gain
189 
190 

Member Data Documentation

◆ geometry_convertor

LArHVGainsPredictor.GainPredictor.geometry_convertor

Definition at line 79 of file LArHVGainsPredictor.py.

◆ layer_weights_em

LArHVGainsPredictor.GainPredictor.layer_weights_em

Definition at line 81 of file LArHVGainsPredictor.py.

◆ layer_weights_had

LArHVGainsPredictor.GainPredictor.layer_weights_had

Definition at line 82 of file LArHVGainsPredictor.py.


The documentation for this class was generated from the following file:
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
PlotCalibrationHV.isEmPresampler
def isEmPresampler(layerName)
Definition: PlotCalibrationHV.py:17
PlotCalibrationHV.isHadFirstLayer
def isHadFirstLayer(layerName, TT_part)
Definition: PlotCalibrationHV.py:84
PlotCalibrationHV.isHadSecondLayer
def isHadSecondLayer(layerName, TT_part)
Definition: PlotCalibrationHV.py:93
PlotCalibrationHV.isEmMiddle
def isEmMiddle(layerName, isOverlap)
Definition: PlotCalibrationHV.py:43
PlotCalibrationHV.isEmFront
def isEmFront(layerName, isOverlap)
Definition: PlotCalibrationHV.py:27
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
PlotCalibrationHV.isEmOverlapBack
def isEmOverlapBack(layerName, isOverlap)
Definition: PlotCalibrationHV.py:73
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
Trk::open
@ open
Definition: BinningType.h:40
PlotCalibrationHV.isHadThirdLayer
def isHadThirdLayer(layerName, TT_part)
Definition: PlotCalibrationHV.py:102
PlotCalibrationHV.isEmBack
def isEmBack(layerName, isOverlap)
Definition: PlotCalibrationHV.py:58
readCCLHist.float
float
Definition: readCCLHist.py:83
PlotCalibrationHV.isHadFourthLayer
def isHadFourthLayer(layerName, TT_part)
Definition: PlotCalibrationHV.py:111