ATLAS Offline Software
Functions
TauShotVariableHelpers Namespace Reference

implementation of photon shot variable calculation More...

Functions

const CaloCellgetNeighbour (const CaloCell *cell, const CaloClusterCellLink &links, const CaloCell_ID *calo_id, const LArNeighbours::neighbourOption &option)
 Obtain the required neighbour cell. More...
 
std::vector< std::vector< const CaloCell * > > getCellBlock (const xAOD::PFO &shot, const CaloCell_ID *calo_id)
 Get cell block with (currently) 2 x 5 cells in correct order for variable calculations. More...
 
float ptWindow (const std::vector< std::vector< const CaloCell * >> &shotCells, int windowSize, const ToolHandle< IHadronicCalibrationTool > &caloWeightTool)
 pt in a window of (currently) 2 x windowSize cells More...
 

Detailed Description

implementation of photon shot variable calculation

Author
Will Davey will..nosp@m.dave.nosp@m.y@cer.nosp@m.n.ch
Benedict Winter bened.nosp@m.ict..nosp@m.tobia.nosp@m.s.wi.nosp@m.nter@.nosp@m.cern.nosp@m..ch
Stephanie Yuen steph.nosp@m.anie.nosp@m..yuen.nosp@m.@cer.nosp@m.n.ch

Function Documentation

◆ getCellBlock()

std::vector< std::vector< const CaloCell * > > TauShotVariableHelpers::getCellBlock ( const xAOD::PFO shot,
const CaloCell_ID calo_id 
)

Get cell block with (currently) 2 x 5 cells in correct order for variable calculations.

Definition at line 48 of file TauShotVariableHelpers.cxx.

48  {
49  using namespace TauShotVariableHelpers::msgTauShotVariableHelpers;
50 
51  std::vector<std::vector<const CaloCell*>> cellBlock;
52 
53  int etaSize = 0;
55  ANA_MSG_WARNING("Couldn't find nCellsInEta. Return empty cell block.");
56  return cellBlock;
57  }
58 
59  int seedHash = 0;
61  ANA_MSG_WARNING("Couldn't find seed hash. Return empty cell block.");
62  return cellBlock;
63  }
64 
65  // Initialize the cell block
66  std::vector<const CaloCell*> etaLayer;
67  for (int etaIndex = 0; etaIndex < etaSize; ++ etaIndex) {
68  etaLayer.push_back(nullptr);
69  }
70  int phiSize = 2;
71  for (int phiIndex = 0; phiIndex < phiSize; ++phiIndex) {
72  cellBlock.push_back(etaLayer);
73  }
74 
75  // Get seed cell from shot cluster
76  const xAOD::CaloCluster* cluster = shot.cluster(0);
77  const CaloClusterCellLink* cellLinks = cluster->getCellLinks();
78 
79  const CaloCell* seedCell = nullptr;
80  for (const auto cell : *cellLinks) {
81  if (cell->caloDDE()->calo_hash() != (unsigned) seedHash) continue;
82  seedCell = cell;
83  break;
84  }
85  if (seedCell==nullptr) {
86  ANA_MSG_WARNING("Couldn't find seed cell in shot cluster. Return empty cell block.");
87  return cellBlock;
88  }
89  int mediumEtaIndex = etaSize/2;
90  cellBlock.at(0).at(mediumEtaIndex) = seedCell;
91 
92  // Obtain the neighbour cells in the eta direction
93  // -- Next in eta
94  const CaloCell* lastCell = seedCell;
95  int maxDepth = etaSize - mediumEtaIndex - 1;
96  for (int depth = 1; depth < maxDepth + 1; ++depth) {
97  lastCell = getNeighbour(lastCell, *cellLinks, calo_id, LArNeighbours::nextInEta);
98  if (lastCell != nullptr) {
99  cellBlock.at(0).at(mediumEtaIndex + depth) = lastCell;
100  }
101  else {
102  break;
103  }
104  }
105 
106  // -- Previous in eta
107  lastCell = seedCell;
108  for (int depth = 1; depth < maxDepth + 1; ++depth) {
109  lastCell = getNeighbour(lastCell, *cellLinks, calo_id, LArNeighbours::prevInEta);
110  if (lastCell != nullptr) {
111  cellBlock.at(0).at(mediumEtaIndex - depth) = lastCell;
112  }
113  else {
114  break;
115  }
116  }
117 
118  // Merged cell
119  const CaloCell* mergedCell = getNeighbour(seedCell, *cellLinks, calo_id, LArNeighbours::nextInPhi);
120  if (mergedCell == nullptr) {
121  mergedCell = getNeighbour(seedCell, *cellLinks, calo_id, LArNeighbours::prevInPhi);
122  }
123 
124  if (mergedCell != nullptr) {
125  cellBlock.at(1).at(mediumEtaIndex) = mergedCell;
126 
127  // Obtain the neighbour cells in the eta direction
128  // -- Next in eta
129  lastCell = mergedCell;
130  for (int depth = 1; depth < maxDepth + 1; ++depth) {
131  lastCell = getNeighbour(lastCell, *cellLinks, calo_id, LArNeighbours::nextInEta);
132  if (lastCell != nullptr) {
133  cellBlock.at(1).at(mediumEtaIndex + depth) = lastCell;
134  }
135  else {
136  break;
137  }
138  }
139 
140  // -- Previous in eta
141  lastCell = mergedCell;
142  for (int depth = 1; depth < maxDepth + 1; ++depth) {
143  lastCell = getNeighbour(lastCell, *cellLinks, calo_id, LArNeighbours::prevInEta);
144  if (lastCell != nullptr) {
145  cellBlock.at(1).at(mediumEtaIndex - depth) = lastCell;
146  }
147  else {
148  break;
149  }
150  }
151  } // End of mergedCell != nullptr
152 
153  return cellBlock;
154 }

◆ getNeighbour()

const CaloCell * TauShotVariableHelpers::getNeighbour ( const CaloCell cell,
const CaloClusterCellLink links,
const CaloCell_ID calo_id,
const LArNeighbours::neighbourOption option 
)

Obtain the required neighbour cell.

Definition at line 22 of file TauShotVariableHelpers.cxx.

25  {
26  const CaloCell* neigCell = nullptr;
27 
28  std::vector<IdentifierHash> neighHashes;
29  calo_id->get_neighbours(cell->caloDDE()->calo_hash(), option, neighHashes);
30 
31  // Loop all the cells, and find the required neighbour cell
32  for (const auto cell : links) {
33  const IdentifierHash& cellHash = cell->caloDDE()->calo_hash();
34 
35  // Check whether the cell is a neighbour cell
36  for (const IdentifierHash& neighHash : neighHashes) {
37  if (cellHash == neighHash) {
38  neigCell = cell;
39  return neigCell;
40  }
41  }
42  }
43 
44  return neigCell;
45 }

◆ ptWindow()

float TauShotVariableHelpers::ptWindow ( const std::vector< std::vector< const CaloCell * >> &  shotCells,
int  windowSize,
const ToolHandle< IHadronicCalibrationTool > &  caloWeightTool 
)

pt in a window of (currently) 2 x windowSize cells

Definition at line 158 of file TauShotVariableHelpers.cxx.

160  {
161  // window size should be odd and smaller than eta window of shotCells
162  if (windowSize%2 != 1) return 0.;
163 
164  int etaSize = shotCells.at(0).size();
165  if (windowSize > etaSize) return 0.;
166 
167  int seedIndex = etaSize/2;
168  int phiSize = shotCells.size();
169 
170  float ptWindow = 0.;
171  for (int etaIndex = 0; etaIndex != etaSize; ++etaIndex) {
172  if (std::abs(etaIndex-seedIndex) > windowSize/2) continue;
173 
174  for (int phiIndex = 0; phiIndex != phiSize; ++phiIndex) {
175  const CaloCell* cell = shotCells.at(phiIndex).at(etaIndex);
176  if (cell != nullptr) {
177  ptWindow += cell->pt() * caloWeightTool->wtCell(cell);
178  }
179  }
180  }
181 
182  return ptWindow;
183 }
egammaParameters::depth
@ depth
pointing depth of the shower as calculated in egammaqgcld
Definition: egammaParamDefs.h:276
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
xAOD::PFO_v1::attribute
bool attribute(PFODetails::PFOAttributes AttributeType, T &anAttribute) const
get a PFO Variable via enum
LArNeighbours::prevInPhi
@ prevInPhi
Definition: LArNeighbours.h:12
LArNeighbours::nextInPhi
@ nextInPhi
Definition: LArNeighbours.h:13
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
DMTest::links
links
Definition: CLinks_v1.cxx:22
ANA_MSG_WARNING
#define ANA_MSG_WARNING(xmsg)
Macro printing warning messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:292
xAOD::PFODetails::tauShots_seedHash
@ tauShots_seedHash
Definition: Event/xAOD/xAODPFlow/xAODPFlow/PFODefs.h:163
WriteCellNoiseToCool.cellHash
cellHash
Definition: WriteCellNoiseToCool.py:433
TauShotVariableHelpers::ptWindow
float ptWindow(const std::vector< std::vector< const CaloCell * >> &shotCells, int windowSize, const ToolHandle< IHadronicCalibrationTool > &caloWeightTool)
pt in a window of (currently) 2 x windowSize cells
Definition: TauShotVariableHelpers.cxx:158
xAOD::CaloCluster_v1::getCellLinks
const CaloClusterCellLink * getCellLinks() const
Get a pointer to the CaloClusterCellLink object (const version)
Definition: CaloCluster_v1.cxx:905
CaloCell_Base_ID::get_neighbours
int get_neighbours(const IdentifierHash caloHash, const LArNeighbours::neighbourOption &option, std::vector< IdentifierHash > &neighbourList) const
access to hashes for neighbours return == 0 for neighbours found
Definition: CaloCell_Base_ID.cxx:190
eflowRec::phiIndex
unsigned int phiIndex(float phi, float binsize)
calculate phi index for a given phi
Definition: EtaPhiLUT.cxx:23
TauShotVariableHelpers::getNeighbour
const CaloCell * getNeighbour(const CaloCell *cell, const CaloClusterCellLink &links, const CaloCell_ID *calo_id, const LArNeighbours::neighbourOption &option)
Obtain the required neighbour cell.
Definition: TauShotVariableHelpers.cxx:22
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
xAOD::PFODetails::tauShots_nCellsInEta
@ tauShots_nCellsInEta
These are the variables describing Tau Shot objects, which are built from EM1 cells.
Definition: Event/xAOD/xAODPFlow/xAODPFlow/PFODefs.h:143
LArNeighbours::nextInEta
@ nextInEta
Definition: LArNeighbours.h:15
xAOD::PFO_v1::cluster
const CaloCluster * cluster(unsigned int index) const
Retrieve a const pointer to a CaloCluster.
Definition: PFO_v1.cxx:669
LArNeighbours::prevInEta
@ prevInEta
Definition: LArNeighbours.h:14
IdentifierHash
Definition: IdentifierHash.h:38