ATLAS Offline Software
Loading...
Searching...
No Matches
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
7NAME: CaloComputeSWcellWeights.cxx
8PACKAGE: offline/Calorimeter/CaloClusterCorrection
9
10AUTHORS: D. Lelas
11CREATED: Dec. 02, 2005
12
13PURPOSE: - 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)
40 : AthAlgTool(type, name, parent)
41{
42}
43
44// Make Corrections for SW cell weights
45StatusCode
46CaloComputeSWcellWeights::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
#define endmsg
#define ATH_MSG_DEBUG(x)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
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.
CaloComputeSWcellWeights(const std::string &type, const std::string &name, const IInterface *parent)
StatusCode execute(const EventContext &ctx, xAOD::CaloClusterContainer *clusColl) const override
Execute on an entire collection of clusters.
This is a "hash" representation of an Identifier.
CaloClusterCellLink::iterator cell_iterator
Iterator of the underlying CaloClusterCellLink (non-const version)
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.