ATLAS Offline Software
CaloCellContainerFinalizerTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /********************************************************************
6 
7 NAME: CaloCellContainerFinalizerTool
8 PACKAGE: offline/Calorimeter/CaloRec
9 
10 AUTHORS: David Rousseau
11 CREATED: May 12,2004
12 
13 PURPOSE: Apply necessary finalising operation to CaloCellContainer
14 
15 ********************************************************************/
16 
18 
19 #include "GaudiKernel/Service.h"
20 #include "GaudiKernel/MsgStream.h"
21 #include "Gaudi/Property.h"
22 #include "GaudiKernel/ListItem.h"
23 
24 #include "StoreGate/StoreGateSvc.h"
25 
26 
30 
31 
33 // CONSTRUCTOR:
35 
37  const std::string& type,
38  const std::string& name,
39  const IInterface* parent)
40  :base_class (type, name, parent),
41  m_theCaloCCIDM (nullptr)
42 {
43 }
44 
45 
46 
48 // DESTRUCTOR:
50 //CaloCellContainerFinalizerTool::~CaloCellContainerFinalizerTool()
51 //{ }
52 
54 // INITIALIZE:
55 // The initialize method will create all the required algorithm objects
57 
59 {
60 
61  ATH_CHECK(detStore()->retrieve(m_theCaloCCIDM,"CaloCell_ID"));
62  return StatusCode::SUCCESS;
63 }
64 
65 template <class CONTAINER>
67 {
68 
69  const unsigned int hashMax=m_theCaloCCIDM->calo_cell_hash_max();
70  if (theCont->size()<hashMax) {
71  ATH_MSG_DEBUG("CaloCellContainer size " << theCont->size() << " smaller than hashMax: " << hashMax);
72  }
73  else if (theCont->size()==hashMax) {
74  ATH_MSG_DEBUG("CaloCellContainer size " << theCont->size() << " correspond to hashMax : " << hashMax);
75  theCont->setHasTotalSize(true);
76  }
77  else {
78  msg(MSG::WARNING) << "CaloCellContainer size " << theCont->size()
79  << " larger than hashMax ! Too many cells ! " << hashMax << endmsg ;
80 
81  }
82 
83 
84  // check whether in order
85  if (theCont->checkOrdered()){
86  ATH_MSG_DEBUG("CaloCellContainer ordered");
87  theCont->setIsOrdered(true);
88  } else {
89  ATH_MSG_DEBUG("CaloCellContainer not ordered");
90  theCont->setIsOrdered(false);
91  }
92 
93  /*
94  CaloCellContainer::const_iterator itrCell=theCont->begin();
95  unsigned int index=0;
96 
97  for (; itrCell!=theCont->end();++itrCell){
98  const CaloDetDescrElement * theDDE=(*itrCell)->caloDDE();
99  std::cout << " index " << index << " hash " << theDDE->calo_hash() << std::endl;
100 
101  ++index ;
102  }
103  */
104 
105 
106  // check whether in order and complete
107  if (theCont->checkOrderedAndComplete()){
108  ATH_MSG_DEBUG("CaloCellContainer ordered and complete");
109  theCont->setIsOrderedAndComplete(true);
110  } else {
111  ATH_MSG_DEBUG("CaloCellContainer not ordered or incomplete");
112  theCont->setIsOrderedAndComplete(false);
113  }
114 
115  if (!theCont->isOrdered()) {
116  ATH_MSG_DEBUG("Now ordering CaloCellContainer");
117  theCont->order();
118 
119  //FIXME check again whether in order
120  ATH_MSG_DEBUG("Now check CaloCellContainer ordered");
121  if (theCont->checkOrdered()){
122  ATH_MSG_DEBUG( "CaloCellContainer ordered");
123  theCont->setIsOrdered(true);
124  } else {
125  ATH_MSG_DEBUG( "CaloCellContainer not ordered");
126  theCont->setIsOrdered(false);
127  }
128 
129 
130  // check whether in order and complete
131  if (theCont->checkOrderedAndComplete()){
132  ATH_MSG_DEBUG( " CaloCellContainer ordered and complete");
133  theCont->setIsOrderedAndComplete(true);
134  } else {
135  ATH_MSG_DEBUG("CaloCellContainer not ordered or incomplete");
136  theCont->setIsOrderedAndComplete(false);
137  }
138  }
139 
140  theCont->updateCaloIterators();
141 
142  return StatusCode::SUCCESS;
143 }
144 
145 
148  const EventContext& /*ctx*/) const
149 {
150  CHECK( doProcess (theCont) );
151  return StatusCode::SUCCESS;
152 }
153 
154 
157  const EventContext& /*ctx*/) const
158 {
159  // Container will automatically be locked when recorded.
160  return doProcess (theCont);
161 }
162 
163 
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
CaloCellContainerFinalizerTool.h
CaloCellContainerFinalizerTool::process
virtual StatusCode process(CaloCellContainer *theCellContainer, const EventContext &ctx) const override
Definition: CaloCellContainerFinalizerTool.cxx:147
CaloCellContainerFinalizerTool::CaloCellContainerFinalizerTool
CaloCellContainerFinalizerTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: CaloCellContainerFinalizerTool.cxx:36
CaloCell_ID.h
CaloCellContainerFinalizerTool::m_theCaloCCIDM
const CaloCell_ID * m_theCaloCCIDM
Definition: CaloCellContainerFinalizerTool.h:39
CaloCellContainerFinalizerTool::initialize
virtual StatusCode initialize() override
Definition: CaloCellContainerFinalizerTool.cxx:58
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
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
CaloCellContainer.h
CaloCellContainer
Container class for CaloCell.
Definition: CaloCellContainer.h:55
CaloConstCellContainer
CaloCellContainer that can accept const cell pointers.
Definition: CaloConstCellContainer.h:45
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
CaloCellContainerFinalizerTool::doProcess
StatusCode doProcess(CONTAINER *theCellContainer) const
Definition: CaloCellContainerFinalizerTool.cxx:66
CaloConstCellContainer.h
CaloCellContainer that can accept const cell pointers.
StoreGateSvc.h
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
CaloCell_Base_ID::calo_cell_hash_max
size_type calo_cell_hash_max(void) const
cell 'global' hash table max size