ATLAS Offline Software
CaloSwTime.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: CaloSwTime.cxx
8 PACKAGE: offline/Calorimeter/CaloSwTime
9 
10 AUTHORS: G.Unal
11 CREATED: December 2008
12 
13 PURPOSE: Refined time estimate from SW EM clusters
14 
15 ********************************************************************/
16 
17 #include "CaloSwTime.h"
18 #include "CaloEvent/CaloCell.h"
19 
20 
21 void CaloSwTime::makeCorrection (const Context& /*myctx*/,
22  xAOD::CaloCluster* cluster) const
23 {
24 
25 
26  double emax=-9999.;
27  double time=0.;
28 
29  xAOD::CaloCluster::cell_iterator cellIter = cluster->cell_begin();
30  xAOD::CaloCluster::cell_iterator cellIterEnd = cluster->cell_end();
31  for (;cellIter!=cellIterEnd;cellIter++) {
32  const CaloCell* cell = (*cellIter);
33  CaloCell_ID::CaloSample sampling = cell->caloDDE()->getSampling();
34  if (sampling== CaloCell_ID::EMB2 || sampling== CaloCell_ID::EME2) {
35  if ( (cell->provenance() & 0x2000) ) {
36  if (cell->e() > emax) {
37  emax=cell->e();
38  time = cell->time();
39  }
40  }
41  }
42  }
43 
44  ATH_MSG_DEBUG( " Cluster: emax,time " << emax << " " << time << endmsg);
45 
46  if (emax>0.) cluster->setTime(time);
47 
48 }
49 
xAOD::CaloCluster_v1::cell_begin
const_cell_iterator cell_begin() const
Iterator of the underlying CaloClusterCellLink (const version)
Definition: CaloCluster_v1.h:812
CaloSwTime.h
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
CaloCell.h
xAOD::CaloCluster_v1::setTime
void setTime(flt_t)
Set cluster time.
CaloSwTime::makeCorrection
virtual void makeCorrection(const Context &myctx, xAOD::CaloCluster *cluster) const override
Definition: CaloSwTime.cxx:21
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
constants.EMB2
int EMB2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:54
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
xAOD::CaloCluster_v1::cell_end
const_cell_iterator cell_end() const
Definition: CaloCluster_v1.h:813
CaloUtils::ToolConstantsContext
Context object for retrieving ToolConstant values.
Definition: ToolWithConstants.h:61
constants.EME2
int EME2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:56