ATLAS Offline Software
Loading...
Searching...
No Matches
CaloCellContainerFinalizerTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5/********************************************************************
6
7NAME: CaloCellContainerFinalizerTool
8PACKAGE: offline/Calorimeter/CaloRec
9
10AUTHORS: David Rousseau
11CREATED: May 12,2004
12
13PURPOSE: Apply necessary finalising operation to CaloCellContainer
14
15********************************************************************/
16
18
22
23
25// INITIALIZE:
26// The initialize method will create all the required algorithm objects
28
30{
31
32 ATH_CHECK(detStore()->retrieve(m_theCaloCCIDM,"CaloCell_ID"));
33 return StatusCode::SUCCESS;
34}
35
36template <class CONTAINER>
37StatusCode CaloCellContainerFinalizerTool::doProcess(CONTAINER* theCont ) const
38{
39
40 const unsigned int hashMax=m_theCaloCCIDM->calo_cell_hash_max();
41 if (theCont->size()<hashMax) {
42 ATH_MSG_DEBUG("CaloCellContainer size " << theCont->size() << " smaller than hashMax: " << hashMax);
43 }
44 else if (theCont->size()==hashMax) {
45 ATH_MSG_DEBUG("CaloCellContainer size " << theCont->size() << " correspond to hashMax : " << hashMax);
46 theCont->setHasTotalSize(true);
47 }
48 else {
49 msg(MSG::WARNING) << "CaloCellContainer size " << theCont->size()
50 << " larger than hashMax ! Too many cells ! " << hashMax << endmsg ;
51
52 }
53
54
55 // check whether in order
56 if (theCont->checkOrdered()){
57 ATH_MSG_DEBUG("CaloCellContainer ordered");
58 theCont->setIsOrdered(true);
59 } else {
60 ATH_MSG_DEBUG("CaloCellContainer not ordered");
61 theCont->setIsOrdered(false);
62 }
63
64 /*
65 CaloCellContainer::const_iterator itrCell=theCont->begin();
66 unsigned int index=0;
67
68 for (; itrCell!=theCont->end();++itrCell){
69 const CaloDetDescrElement * theDDE=(*itrCell)->caloDDE();
70 std::cout << " index " << index << " hash " << theDDE->calo_hash() << std::endl;
71
72 ++index ;
73 }
74 */
75
76
77 // check whether in order and complete
78 if (theCont->checkOrderedAndComplete()){
79 ATH_MSG_DEBUG("CaloCellContainer ordered and complete");
80 theCont->setIsOrderedAndComplete(true);
81 } else {
82 ATH_MSG_DEBUG("CaloCellContainer not ordered or incomplete");
83 theCont->setIsOrderedAndComplete(false);
84 }
85
86 if (!theCont->isOrdered()) {
87 ATH_MSG_DEBUG("Now ordering CaloCellContainer");
88 theCont->order();
89
90 //FIXME check again whether in order
91 ATH_MSG_DEBUG("Now check CaloCellContainer ordered");
92 if (theCont->checkOrdered()){
93 ATH_MSG_DEBUG( "CaloCellContainer ordered");
94 theCont->setIsOrdered(true);
95 } else {
96 ATH_MSG_DEBUG( "CaloCellContainer not ordered");
97 theCont->setIsOrdered(false);
98 }
99
100
101 // check whether in order and complete
102 if (theCont->checkOrderedAndComplete()){
103 ATH_MSG_DEBUG( " CaloCellContainer ordered and complete");
104 theCont->setIsOrderedAndComplete(true);
105 } else {
106 ATH_MSG_DEBUG("CaloCellContainer not ordered or incomplete");
107 theCont->setIsOrderedAndComplete(false);
108 }
109 }
110
111 theCont->updateCaloIterators();
112
113 return StatusCode::SUCCESS;
114}
115
116
117StatusCode
119 const EventContext& /*ctx*/) const
120{
121 CHECK( doProcess (theCont) );
122 return StatusCode::SUCCESS;
123}
124
125
126StatusCode
128 const EventContext& /*ctx*/) const
129{
130 // Container will automatically be locked when recorded.
131 return doProcess (theCont);
132}
133
134
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
CaloCellContainer that can accept const cell pointers.
#define CHECK(...)
Evaluate an expression and check for errors.
virtual StatusCode process(CaloCellContainer *theCellContainer, const EventContext &ctx) const override
StatusCode doProcess(CONTAINER *theCellContainer) const
Container class for CaloCell.
CaloCellContainer that can accept const cell pointers.
MsgStream & msg
Definition testRead.cxx:32