ATLAS Offline Software
CaloComputeSWcellWeights.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /********************************************************************
6 
7 NAME: CaloComputeSWcellWeights.cxx
8 PACKAGE: offline/Calorimeter/CaloClusterCorrection
9 
10 AUTHORS: D. Lelas
11 CREATED: Dec. 02, 2005
12 
13 PURPOSE: - Compute simple cell weights for Sliding Window
14  clusters, to solve double-counting of cells' energies
15  for cells shared by two or more clusters.
16 
17  This tool does not update the cluster kinematics,
18  only the cell weights. It should be followed by
19  a pass of CaloFillRectangularCluster with fill_cluster
20  set to False.
21 
22 *********************************************************************/
23 
24 // include header files
26 #include "CaloEvent/CaloCell.h"
27 #include "CaloEvent/CaloClusterContainer.h"
28 //#include "CaloDetDescr/CaloDetDescrElement.h"
29 //#include "CaloDetDescr/CaloDetDescrManager.h"
30 //#include "CaloIdentifier/CaloCell_ID.h"
32 
33 // -------------------------------------------------------------
34 // Constructor
35 // -------------------------------------------------------------
36 
38  const std::string& name,
39  const IInterface* parent)
41 {
42 }
43 
44 // Make Corrections for SW cell weights
46 CaloComputeSWcellWeights::execute(const EventContext& /*ctx*/,
47  xAOD::CaloClusterContainer* clusColl) const
48 {
49 
50 
51  ATH_MSG_DEBUG( "Executing CaloComputeSWcellWeights" << endmsg) ;
52 
53  std::map<IdentifierHash,double> WeightMap; //FIXME: use a vector!
54 
55  for (const xAOD::CaloCluster* cluster : *clusColl) {
56  for (const CaloCell* cell : *cluster) {
57  IdentifierHash myHashId = cell->caloDDE()->calo_hash();
58  WeightMap[myHashId] += cell->e();
59  }
60  }
61 
62  for (xAOD::CaloCluster* cluster : *clusColl) {
63  xAOD::CaloCluster::cell_iterator cellIter = cluster->cell_begin();
64  xAOD::CaloCluster::cell_iterator cellIterEnd = cluster->cell_end();
65  for( ;cellIter!=cellIterEnd;cellIter++) {
66  const CaloCell* cell = *cellIter;
67  IdentifierHash myHashId = cell->caloDDE()->calo_hash();
68  double WEIGHT=(cell->e())/WeightMap[myHashId];
69  cellIter.reweight(WEIGHT);
70  }
71  CaloClusterKineHelper::calculateKine(cluster); //FIXME .. maybe unnecessary
72  }
73 
74  return StatusCode::SUCCESS;
75 }
76 
77 
78 
79 
80 
CaloClusterKineHelper.h
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
CaloCell.h
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CaloComputeSWcellWeights::execute
StatusCode execute(const EventContext &ctx, xAOD::CaloClusterContainer *clusColl) const override
Execute on an entire collection of clusters.
Definition: CaloComputeSWcellWeights.cxx:46
test_pyathena.parent
parent
Definition: test_pyathena.py:15
CaloComputeSWcellWeights::CaloComputeSWcellWeights
CaloComputeSWcellWeights()
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
CaloComputeSWcellWeights.h
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
CaloClusterKineHelper::calculateKine
static void calculateKine(xAOD::CaloCluster *clu, const bool useweight=true, const bool updateLayers=true, const bool useGPUCriteria=false)
Helper class to calculate cluster kinematics based on cells.
Definition: CaloClusterKineHelper.cxx:223
AthAlgTool
Definition: AthAlgTool.h:26
IdentifierHash
Definition: IdentifierHash.h:38