ATLAS Offline Software
CaloCellD3PDObject.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 from D3PDMakerCoreComps.D3PDObject import D3PDObject
4 from CaloIdentifier import SUBCALO
5 from AthenaConfiguration.ComponentFactory import CompFactory
6 
7 D3PD = CompFactory.D3PD
8 
9 
10 prefix_to_det = {}
11 prefix_to_det["cc_sel_"] = [SUBCALO.LAREM,SUBCALO.LARHEC,SUBCALO.LARFCAL,SUBCALO.TILE]
12 prefix_to_det["cc_em_"] = [SUBCALO.LAREM]
13 prefix_to_det["cc_hec_"] = [SUBCALO.LARHEC]
14 prefix_to_det["cc_fcal_"] = [SUBCALO.LARFCAL]
15 prefix_to_det["cc_tile_"] = [SUBCALO.TILE]
16 
17 def makeCellD3PDObject (name, prefix, object_name, getter = None,
18  sgkey = None,
19  label = None):
20  if sgkey is None: sgkey = 'AllCalo'
21  if label is None: label = prefix
22 
23  if prefix in prefix_to_det.keys():
24  sgkey = prefix
25  #print " makeCellD3PDObject: sgkey = ", sgkey
26 
27  if not getter:
29  (name + '_Getter',
30  TypeName = 'CaloCellContainer',
31  SGKey = sgkey,
32  Label = label)
33 
34  # create the selected cells
35  from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags
36  return D3PD.VectorFillerTool (name,
37  Prefix = prefix,
38  Getter = getter,
39  ObjectName = object_name,
40  SaveMetadata = \
41  D3PDMakerFlags.SaveObjectMetadata)
42 
43 
44 # function to create the CaloCellContainer for selected
45 def hookForCaloCellFilterAlg(c, flags, acc, prefix, *args, **kw) :
46  cellSigmaCut=-1.
47 
48  if prefix in prefix_to_det.keys():
49  sgkey = prefix
50  subCalo = prefix_to_det[prefix]
51 
52  if sgkey == "cc_sel_":
53  cellSigmaCut=4
54 
55  #print " in makeCellD3PDObject, subCalo, sgkey, cellSigmaCut = ", subCalo, sgkey, cellSigmaCut
56 
57  from .CaloCellFilterAlgConfig import CaloCellFilterAlgCfg
58  filter = CaloCellFilterAlgCfg( flags, CaloNums=subCalo, OutputCellsName=sgkey, CellSigmaCut=cellSigmaCut )
59 
60  acc.addEventAlgo (filter)
61 
62  return
63 
64 def hookForCaloNoiseCondAlg(c, flags, acc, prefix, *args, **kw):
65  from CaloTools.CaloNoiseCondAlgConfig import CaloNoiseCondAlgCfg
66  acc.merge (CaloNoiseCondAlgCfg (flags, noisetype='totalNoise'))
67  return
68 
69 
70 def hookForCaloBadChanTool(c, flags, acc, *args, **kw):
71  from CaloBadChannelTool.CaloBadChanToolConfig import CaloBadChanToolCfg
72  c.BadChannelTool = acc.popToolsAndMerge (CaloBadChanToolCfg (flags))
73  return
74 
75 
76 def hookForCaloGM(c, flags, acc, prefix, *args, **kw):
77  from LArGeoAlgsNV.LArGMConfig import LArGMCfg
78  acc.merge (LArGMCfg (flags))
79  return
80 
81 
82 def makeCaloCellD3PDObject (maker, prefix, object_name) :
83 
84  cellD3PDObject = D3PDObject (makeCellD3PDObject, prefix, object_name)
85 
86  if prefix in prefix_to_det.keys() :
87  #print " in makeCaloCellD3PDMaker, prefix =" , prefix
88  cellD3PDObject.defineHook ( hookForCaloCellFilterAlg )
89 
90  cellD3PDObject.defineHook ( hookForCaloGM )
91 
92  cellD3PDObject.defineBlock (0, 'Kinematics',
94  WriteE = True, WriteM = False)
95 
96 
97  cellD3PDObject.defineBlock (1, 'Detail1',
99  SaveCellQuality=True,
100  SaveTimeInfo=True,
101  SaveDetInfo=True,
102  SaveCellGain=True,
103  SaveBadCellStatus=False,
104  SaveId =False,
105  SavePositionInfo=False,
106  )
107 
108 
109  detail2 = cellD3PDObject.defineBlock (2, 'Detail2',
111  SaveCellQuality=False,
112  SaveTimeInfo=False,
113  SaveDetInfo=False,
114  SaveCellGain=False,
115  SaveBadCellStatus=True,
116  SaveId =True,
117  SavePositionInfo=True,
118  )
119  detail2.defineHook ( hookForCaloBadChanTool )
120 
121  cellD3PDObject.defineHook ( hookForCaloNoiseCondAlg )
122  noiseType = "totalNoise"
123 
124  cellD3PDObject.defineBlock (3, 'Detail3',
126  SaveCellQuality=False,
127  SaveTimeInfo=False,
128  SaveDetInfo=False,
129  SaveCellGain=False,
130  SaveBadCellStatus=False,
131  SaveId =False,
132  SavePositionInfo=False,
133  SaveSigma = True,
134  CaloNoise = noiseType
135  )
136 
137  # Raw eta/phi --- off by default.
138  cellD3PDObject.defineBlock (99, 'RawPosition',
140 
141  return cellD3PDObject
142 
143 """
144 level of details: 0: only kinematics
145  1: time, quality, gain, cell_id
146  2: xyz position, bad channel status, offline id.
147  3: cell noise
148 """
149 
150 # all CaloCells
151 AllCaloCellD3PDObject = makeCaloCellD3PDObject(makeCellD3PDObject, 'cc_', 'AllCaloCellD3PDObject')
152 # Selected Cells with 4 sigma noise cut
153 SelCaloCellD3PDObject = makeCaloCellD3PDObject(makeCellD3PDObject, 'cc_sel_', 'SelCaloCellD3PDObject')
154 # All EM cells
155 EMCellD3PDObject = makeCaloCellD3PDObject(makeCellD3PDObject, 'cc_em_', 'EMCellD3PDObject')
156 # All HEC cells
157 HECCellD3PDObject = makeCaloCellD3PDObject(makeCellD3PDObject, 'cc_hec_', 'HECCellD3PDObject')
158 # All FCAL cells
159 FCALCellD3PDObject = makeCaloCellD3PDObject(makeCellD3PDObject, 'cc_fcal_', 'FCALCellD3PDObject')
160 # All Tile cels
161 TileCellD3PDObject = makeCaloCellD3PDObject(makeCellD3PDObject, 'cc_tile_', 'TileCellD3PDObject')
162 
163 
164 # slimmed version of the CaloCellObject
165 def makeCaloCellSlimmedD3PDObject (maker, prefix, object_name) :
166 
167  cellD3PDObject = D3PDObject (makeCellD3PDObject, prefix, object_name)
168 
169  if prefix in prefix_to_det.keys() :
170  #print " in makeCaloCellD3PDMaker, prefix =" , prefix
171  cellD3PDObject.defineHook ( hookForCaloCellFilterAlg )
172 
173  cellD3PDObject.defineBlock (0, 'Kinematics',
175  WriteE = True, WriteM = False, WritePt = False)
176 
177 
178  cellD3PDObject.defineHook ( hookForCaloNoiseCondAlg )
179  noiseType = "totalNoise"
180 
181  cellD3PDObject.defineBlock (1, 'Detail1',
183  SaveCellQuality=True,
184  SaveBadCellStatus=True,
185  SaveSigma = True,
186  SaveId = True,
187  SaveDetInfo=True,
188  CaloNoise = noiseType
189  )
190 
191  return cellD3PDObject
192 
193 SelCaloCellSlimmedD3PDObject = makeCaloCellSlimmedD3PDObject(makeCellD3PDObject, 'cc_sel_', 'SelCaloCellSlimmedD3PDObject')
python.CaloCellD3PDObject.makeCaloCellSlimmedD3PDObject
def makeCaloCellSlimmedD3PDObject(maker, prefix, object_name)
Definition: CaloCellD3PDObject.py:165
D3PD::CaloCellDetailsFillerTool
Block filler tool for EM samplings from a CaloCluster.
Definition: CaloCellDetailsFillerTool.h:34
python.CaloCellD3PDObject.hookForCaloBadChanTool
def hookForCaloBadChanTool(c, flags, acc, *args, **kw)
Definition: CaloCellD3PDObject.py:70
python.CaloCellD3PDObject.hookForCaloCellFilterAlg
def hookForCaloCellFilterAlg(c, flags, acc, prefix, *args, **kw)
Definition: CaloCellD3PDObject.py:45
D3PD::SGDataVectorGetterTool
Getter tool to retrieve DataVector/List collections from StoreGate.
Definition: SGDataVectorGetterTool.h:55
python.CaloCellD3PDObject.hookForCaloGM
def hookForCaloGM(c, flags, acc, prefix, *args, **kw)
Definition: CaloCellD3PDObject.py:76
D3PD::FourMomFillerTool
Block filler tool for a four-momentum.
Definition: FourMomFillerTool.h:56
python.CaloCellFilterAlgConfig.CaloCellFilterAlgCfg
def CaloCellFilterAlgCfg(flags, CellsName="AllCalo", OutputCellsName="SelectedCells", MaxNCells=200000, CellSigmaCut=4, CaloNums=[SUBCALO.LAREM, SUBCALO.LARHEC, SUBCALO.LARFCAL, SUBCALO.TILE], CaloSamplings=[], CellEnergyThreshold=0.)
Definition: CaloCellFilterAlgConfig.py:7
python.CaloCellD3PDObject.hookForCaloNoiseCondAlg
def hookForCaloNoiseCondAlg(c, flags, acc, prefix, *args, **kw)
Definition: CaloCellD3PDObject.py:64
D3PD::CaloCellRawFillerTool
Block filler tool for calo cell raw eta/phi.
Definition: CaloCellRawFillerTool.h:29
python.CaloCellD3PDObject.makeCellD3PDObject
def makeCellD3PDObject(name, prefix, object_name, getter=None, sgkey=None, label=None)
Definition: CaloCellD3PDObject.py:17
D3PD::VectorFillerTool
Object filler tool for a collection of objects, saved as vectors.
Definition: VectorFillerTool.h:70
python.CaloCellD3PDObject.makeCaloCellD3PDObject
def makeCaloCellD3PDObject(maker, prefix, object_name)
Definition: CaloCellD3PDObject.py:82