ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
CalibHitToCaloCellTool Class Reference

#include <CalibHitToCaloCellTool.h>

Inheritance diagram for CalibHitToCaloCellTool:
Collaboration diagram for CalibHitToCaloCellTool:

Public Member Functions

 CalibHitToCaloCellTool (const std::string &t, const std::string &n, const IInterface *p)
 
 ~CalibHitToCaloCellTool ()
 
StatusCode initialize () override
 
StatusCode processCalibHitsFromParticle () const
 
StatusCode finalize () override
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Static Public Member Functions

static const InterfaceID & interfaceID ()
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
 
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

int m_caloGain
 
std::vector< std::string > m_calibHitContainerNames
 
std::string m_tileActiveHitCnt
 
std::string m_tileInactiveHitCnt
 
std::string m_tileDMHitCnt
 
std::string m_larInactHitCnt
 
std::string m_larActHitCnt
 
std::string m_larDMHitCnt
 
bool m_doTile
 
std::string m_caloCell_Tot
 
std::string m_caloCell_Vis
 
std::string m_caloCell_Em
 
std::string m_caloCell_NonEm
 
const CaloCell_IDm_caloCell_ID {nullptr}
 
const CaloDM_IDm_caloDM_ID {nullptr}
 
SG::ReadCondHandleKey< CaloDetDescrManagerm_caloMgrKey
 
std::string m_outputCellContainerName
 
std::string m_outputClusterContainerName
 
SG::WriteHandleKeyArray< CaloCellContainerm_cellContKeys
 
SG::WriteHandleKeyArray< xAOD::CaloClusterContainerm_clusterContKeys
 
SG::WriteHandleKeyArray< CaloClusterCellLinkContainerm_cellLinkKeys
 
const std::array< std::string, 3 > m_energyTypeToStr {"Eem","Evis","Etot"}
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

Definition at line 38 of file CalibHitToCaloCellTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ CalibHitToCaloCellTool()

CalibHitToCaloCellTool::CalibHitToCaloCellTool ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

Definition at line 26 of file CalibHitToCaloCellTool.cxx.

27  : AthAlgTool(t,n,p),
29  m_caloCell_Tot("TotalCalibCell"), m_caloCell_Vis("VisCalibCell"),
31 {
32  declareInterface<CalibHitToCaloCellTool>(this);
33 
34  declareProperty("CaloGain", m_caloGain);
35  declareProperty("CalibHitContainers", m_calibHitContainerNames);
36 
37  declareProperty("CellTotEne", m_caloCell_Tot);
38  declareProperty("CellVisEne", m_caloCell_Vis);
39  declareProperty("CellEmEne", m_caloCell_Em);
40  declareProperty("CellNonEmEne", m_caloCell_NonEm);
41  declareProperty("DoTile", m_doTile=false);
42 
43  declareProperty("OutputCellContainerName", m_outputCellContainerName = "TruthCells");
44  declareProperty("OutputClusterContainerName", m_outputClusterContainerName = "TruthClusters");
45 
46  m_tileActiveHitCnt = "TileCalibHitActiveCell";
47  m_tileInactiveHitCnt = "TileCalibHitInactiveCell";
48  m_tileDMHitCnt = "TileCalibHitDeadMaterial";
49  m_larActHitCnt = "LArCalibrationHitActive";
50  m_larInactHitCnt = "LArCalibrationHitInactive";
51  m_larDMHitCnt = "LArCalibrationHitDeadMaterial";
52 
53 }

◆ ~CalibHitToCaloCellTool()

CalibHitToCaloCellTool::~CalibHitToCaloCellTool ( )
default

Member Function Documentation

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKeyArray>

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleBase>

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ detStore()

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ evtStore() [1/2]

ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( ) const
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase &  ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ finalize()

StatusCode CalibHitToCaloCellTool::finalize ( )
override

Definition at line 298 of file CalibHitToCaloCellTool.cxx.

299 {
300  ATH_MSG_INFO("finalize() successfully" );
301  return StatusCode::SUCCESS;
302 }

◆ initialize()

StatusCode CalibHitToCaloCellTool::initialize ( )
override

Definition at line 60 of file CalibHitToCaloCellTool.cxx.

61 {
62  // retrieve ID helpers from det store
63  ATH_MSG_INFO("initialisation ID helpers" );
64 
68 
69 
70  for (unsigned int i=0; i<CalibHitUtils::nEnergyTypes; i++) {
74  }
75 
76  ATH_CHECK(m_cellContKeys.initialize());
77  ATH_CHECK(m_clusterContKeys.initialize());
78  ATH_CHECK(m_cellLinkKeys.initialize());
79 
80  ATH_MSG_INFO("initialisation completed" );
81  return StatusCode::SUCCESS;
82 }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

static const InterfaceID& CalibHitToCaloCellTool::interfaceID ( )
inlinestatic

Definition at line 47 of file CalibHitToCaloCellTool.h.

47 { return IID_CalibHitToCaloCellTool;}

◆ msg() [1/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ outputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ processCalibHitsFromParticle()

StatusCode CalibHitToCaloCellTool::processCalibHitsFromParticle ( ) const

..........................................................

Definition at line 86 of file CalibHitToCaloCellTool.cxx.

87 {
88  ATH_MSG_DEBUG("in calibHitToCaloCellTool");
89 
91  ATH_CHECK(caloMgrHandle.isValid());
92  const CaloDetDescrManager* caloDDMgr = *caloMgrHandle;
93 
94  //CaloCellContainer* truthCells[3];
95  //xAOD::CaloClusterContainer* truthClusters[3];
96 
97  std::vector<SG::WriteHandle<CaloCellContainer> > truthCells;
98  std::vector<SG::WriteHandle<xAOD::CaloClusterContainer> > truthClusters;
99  std::vector<SG::WriteHandle<CaloClusterCellLinkContainer> > truthLinks;
100 
101 
102  // register containers for cells and clusters
103  for (unsigned int i=0; i<CalibHitUtils::nEnergyTypes; i++) {
104 
105  truthCells.emplace_back(m_cellContKeys[i]);
106  ATH_CHECK(truthCells.back().record(std::make_unique<CaloCellContainer>()));
107 
108  truthClusters.emplace_back(m_clusterContKeys[i]);
110 
111  truthLinks.emplace_back(m_cellLinkKeys[i]);
112  ATH_CHECK(truthLinks.back().record(std::make_unique<CaloClusterCellLinkContainer>()));
113  }
114 
115  // retrieve calibration hit containers
116  const unsigned int nCont = m_calibHitContainerNames.size();
117  std::vector<const CaloCalibrationHitContainer*> calibHitContainers(nCont,nullptr);
118  for (unsigned int i=0; i<nCont; i++) {
119  ATH_MSG_DEBUG("Retrieving " << m_calibHitContainerNames[i]);
120  ATH_CHECK( evtStore()->retrieve(calibHitContainers[i], m_calibHitContainerNames[i].c_str()) );
121  ATH_MSG_DEBUG(" Retrieved container " << calibHitContainers[i]->Name() << " with size " << calibHitContainers[i]->Size() );
122  if( calibHitContainers[i]->Size() == 0 ) {
123  ATH_MSG_DEBUG("Container " << calibHitContainers[i]->Name() << " is empty");
124  }
125  }
126  ATH_MSG_DEBUG("CaloCalibrationHitContainers retrieved successfuly" );
127 
128  //count
129  int nchan=0;
130  int em_nchan=0;
131  int hec_nchan=0;
132  int fcal_nchan=0;
133  int tile_nchan=0;
134  int unknown_nchan = 0 ;
135 
136  std::vector<Identifier> ID;
137 
138 
139  std::vector<CaloCell*> CellsEtot;
140  std::vector<CaloCell*> CellsEvis;
141  std::vector<CaloCell*> CellsEem;
142 
143  int nhitsInactive = 0;
144 
145  for (unsigned int i=0; i<calibHitContainers.size(); i++) {
146  for( const auto *const calibhit: *(calibHitContainers[i])) {
147  //care only for deposits of the given truth particle
148  if (!MC::isSingleParticle((int)calibhit->particleID())) continue;
149 
150  double Etot = calibhit->energyTotal();
151  double Eem = calibhit->energy(0);
152  double Enonem = calibhit->energy(1);
153  double Evis = Eem + Enonem;
154 
155  Identifier id=calibhit->cellID();
156 
157  //merge inactive and active hits from the same cell together
158  if (i>0) {
159  //find if have already created cell..
160  bool isNewId = true;
161  for (int n=0; n<nhitsInactive; n++) {
162  if( id == ID[n] ) { //found
163  CellsEtot[n]->addEnergy(Etot);
164  CellsEvis[n]->addEnergy(Evis);
165  CellsEem[n]->addEnergy(Eem);
166  isNewId = false;
167  break;
168  }
169  }
170  if(!isNewId) continue; //go to next hit, else create new cell for this hit
171  }
172 
173  //check if this ID is LAr or Tile
174  if(m_caloCell_ID->is_lar(id)) {
175  ATH_MSG_VERBOSE( "Found LAr cell" );
176  const CaloDetDescrElement* caloDDE = caloDDMgr->get_element(id);
177  CellsEtot.push_back(new LArCell(caloDDE, id, Etot, 0., 0, 0, (CaloGain::CaloGain)m_caloGain)) ;
178  CellsEvis.push_back(new LArCell(caloDDE, id, Evis, 0., 0, 0, (CaloGain::CaloGain)m_caloGain));
179  CellsEem.push_back(new LArCell(caloDDE, id, Eem, 0., 0, 0, (CaloGain::CaloGain)m_caloGain));
180  ID.push_back(id);
181  ++nchan;
182  }
183  else if(m_caloCell_ID->is_tile(id)) {
184  ATH_MSG_VERBOSE( "Found Tile cell" );
185  const CaloDetDescrElement* caloDDE = caloDDMgr->get_element(id);
186  CellsEtot.push_back(new TileCell(caloDDE, id, Etot, 0., 0, 0, (CaloGain::CaloGain)m_caloGain)) ;
187  CellsEvis.push_back(new TileCell(caloDDE, id, Evis, 0., 0, 0, (CaloGain::CaloGain)m_caloGain));
188  CellsEem.push_back(new TileCell(caloDDE, id, Eem, 0., 0, 0, (CaloGain::CaloGain)m_caloGain));
189  ID.push_back(id);
190  ++nchan;
191  }
192  else { //other, DeadMaterial
194  ATH_MSG_VERBOSE( "Found unknown cell" );
195  continue;
196  }
197  }
198  if (i==0) nhitsInactive = (int)ID.size();
199  }
200 
201  //Now, put cells in the containers keeping the order. First goes EM, then HEC and so on
202  // if(CellsEtot.size()==0) {
203  // ID.clear();
204  // return StatusCode::SUCCESS;
205  // }
206 
207  ATH_MSG_DEBUG("N cells : " << nchan );
208 
209  for(int itr=0; itr!=nchan; itr++) {
210  if(m_caloCell_ID->is_em(CellsEtot[itr]->ID())) {
211  truthCells[CalibHitUtils::EnergyTotal]->push_back(CellsEtot[itr]);
212  truthCells[CalibHitUtils::EnergyVisible]->push_back(CellsEvis[itr]);
213  truthCells[CalibHitUtils::EnergyEM]->push_back(CellsEem[itr]);
214  ++em_nchan;
215  }
216  }
217  if(em_nchan) {
218  for (int i=0;i<CalibHitUtils::nEnergyTypes;i++) truthCells[i]->setHasCalo(CaloCell_ID::LAREM);
219  }
220 
221  for(int itr=0; itr!=nchan; itr++) {
222  if(m_caloCell_ID->is_hec(CellsEtot[itr]->ID())) {
223  truthCells[CalibHitUtils::EnergyTotal]->push_back(CellsEtot[itr]);
224  truthCells[CalibHitUtils::EnergyVisible]->push_back(CellsEvis[itr]);
225  truthCells[CalibHitUtils::EnergyEM]->push_back(CellsEem[itr]);
226  ++hec_nchan;
227  }
228  }
229  if(hec_nchan){
230  for (int i=0;i<CalibHitUtils::nEnergyTypes;i++) truthCells[i]->setHasCalo(CaloCell_ID::LARHEC);
231  }
232 
233  for(int itr=0; itr!=nchan; itr++) {
234  if(m_caloCell_ID->is_fcal(CellsEtot[itr]->ID())) {
235  truthCells[CalibHitUtils::EnergyTotal]->push_back(CellsEtot[itr]);
236  truthCells[CalibHitUtils::EnergyVisible]->push_back(CellsEvis[itr]);
237  truthCells[CalibHitUtils::EnergyEM]->push_back(CellsEem[itr]);
238  ++fcal_nchan;
239  }
240  }
241  if(fcal_nchan) {
242  for (int i=0;i<CalibHitUtils::nEnergyTypes;i++) truthCells[i]->setHasCalo(CaloCell_ID::LARFCAL);
243  }
244 
245  for(int itr=0; itr!=nchan; itr++) {
246  if((m_caloCell_ID->is_tile(CellsEtot[itr]->ID()))) {
247  truthCells[CalibHitUtils::EnergyTotal]->push_back(CellsEtot[itr]);
248  truthCells[CalibHitUtils::EnergyVisible]->push_back(CellsEvis[itr]);
249  truthCells[CalibHitUtils::EnergyEM]->push_back(CellsEem[itr]);
250  ++tile_nchan;
251  }
252  }
253  if(tile_nchan) {
254  for (int i=0;i<CalibHitUtils::nEnergyTypes;i++) truthCells[i]->setHasCalo(CaloCell_ID::TILE);
255  }
256  if(unknown_nchan) {
257  for (int i=0;i<CalibHitUtils::nEnergyTypes;i++) truthCells[i]->setHasCalo(CaloCell_ID::NOT_VALID);
258  }
259  ATH_MSG_DEBUG("--- LAr INFO --- "<<nchan );
260  ATH_MSG_DEBUG("LArCells = "<<nchan );
261  ATH_MSG_DEBUG("EMCells = "<<em_nchan );
262  ATH_MSG_DEBUG("HECCells = "<<hec_nchan );
263  ATH_MSG_DEBUG("FCALCells = "<<fcal_nchan );
264  ATH_MSG_DEBUG("TileCells = "<<tile_nchan );
265  ATH_MSG_DEBUG("NOT_VALID = "<<unknown_nchan );
266 
267  ID.clear();
268 
270 
271  ATH_MSG_DEBUG("making truth cluster");
272  xAOD::CaloCluster* truthCluster[3] = {nullptr,nullptr,nullptr};
273  for (int i=0;i<CalibHitUtils::nEnergyTypes;i++) {
274  truthCluster[i] = CaloClusterStoreHelper::makeCluster(truthClusters[i].ptr(),truthCells[i].ptr());
275  if (!truthCluster[i]) {
276  ATH_MSG_FATAL("makeCluster failed");
277  return StatusCode::FAILURE;
278  }
279  for (const auto cell: *truthCells[i]) {
280  if(m_caloCell_ID->is_lar(cell->ID()) || m_caloCell_ID->is_tile(cell->ID()))
281  truthCluster[i]->addCell( truthCells[i]->findIndex(cell->caloDDE()->calo_hash()) , 1.);
282  }
283 
285  CaloClusterKineHelper::calculateKine(truthCluster[i], true, true);
287  truthClusters[i].ptr()));
288 
289  ATH_MSG_INFO("Created truth cluster with " << m_energyTypeToStr[i] <<" " << truthCluster[i]->e());
290  }
291 
292  ATH_MSG_DEBUG("execute() completed successfully" );
293  return StatusCode::SUCCESS;
294 }

◆ renounce()

std::enable_if_t<std::is_void_v<std::result_of_t<decltype(&T::renounce)(T)> > && !std::is_base_of_v<SG::VarHandleKeyArray, T> && std::is_base_of_v<Gaudi::DataHandle, T>, void> AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T &  h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381  {
382  h.renounce();
383  PBASE::renounce (h);
384  }

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase &  )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308  {
309  // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310  // << " size: " << m_vhka.size() << endmsg;
311  for (auto &a : m_vhka) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_calibHitContainerNames

std::vector<std::string> CalibHitToCaloCellTool::m_calibHitContainerNames
private

Definition at line 51 of file CalibHitToCaloCellTool.h.

◆ m_caloCell_Em

std::string CalibHitToCaloCellTool::m_caloCell_Em
private

Definition at line 64 of file CalibHitToCaloCellTool.h.

◆ m_caloCell_ID

const CaloCell_ID* CalibHitToCaloCellTool::m_caloCell_ID {nullptr}
private

Definition at line 67 of file CalibHitToCaloCellTool.h.

◆ m_caloCell_NonEm

std::string CalibHitToCaloCellTool::m_caloCell_NonEm
private

Definition at line 65 of file CalibHitToCaloCellTool.h.

◆ m_caloCell_Tot

std::string CalibHitToCaloCellTool::m_caloCell_Tot
private

Definition at line 62 of file CalibHitToCaloCellTool.h.

◆ m_caloCell_Vis

std::string CalibHitToCaloCellTool::m_caloCell_Vis
private

Definition at line 63 of file CalibHitToCaloCellTool.h.

◆ m_caloDM_ID

const CaloDM_ID* CalibHitToCaloCellTool::m_caloDM_ID {nullptr}
private

Definition at line 68 of file CalibHitToCaloCellTool.h.

◆ m_caloGain

int CalibHitToCaloCellTool::m_caloGain
private

Definition at line 50 of file CalibHitToCaloCellTool.h.

◆ m_caloMgrKey

SG::ReadCondHandleKey<CaloDetDescrManager> CalibHitToCaloCellTool::m_caloMgrKey
private
Initial value:
{ this
, "CaloDetDescrManager"
, "CaloDetDescrManager"
, "SG Key for CaloDetDescrManager in the Condition Store" }

Definition at line 70 of file CalibHitToCaloCellTool.h.

◆ m_cellContKeys

SG::WriteHandleKeyArray<CaloCellContainer> CalibHitToCaloCellTool::m_cellContKeys
private

Definition at line 78 of file CalibHitToCaloCellTool.h.

◆ m_cellLinkKeys

SG::WriteHandleKeyArray<CaloClusterCellLinkContainer> CalibHitToCaloCellTool::m_cellLinkKeys
private

Definition at line 80 of file CalibHitToCaloCellTool.h.

◆ m_clusterContKeys

SG::WriteHandleKeyArray<xAOD::CaloClusterContainer> CalibHitToCaloCellTool::m_clusterContKeys
private

Definition at line 79 of file CalibHitToCaloCellTool.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_doTile

bool CalibHitToCaloCellTool::m_doTile
private

Definition at line 60 of file CalibHitToCaloCellTool.h.

◆ m_energyTypeToStr

const std::array<std::string, 3> CalibHitToCaloCellTool::m_energyTypeToStr {"Eem","Evis","Etot"}
private

Definition at line 82 of file CalibHitToCaloCellTool.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_larActHitCnt

std::string CalibHitToCaloCellTool::m_larActHitCnt
private

Definition at line 57 of file CalibHitToCaloCellTool.h.

◆ m_larDMHitCnt

std::string CalibHitToCaloCellTool::m_larDMHitCnt
private

Definition at line 58 of file CalibHitToCaloCellTool.h.

◆ m_larInactHitCnt

std::string CalibHitToCaloCellTool::m_larInactHitCnt
private

Definition at line 56 of file CalibHitToCaloCellTool.h.

◆ m_outputCellContainerName

std::string CalibHitToCaloCellTool::m_outputCellContainerName
private

Definition at line 75 of file CalibHitToCaloCellTool.h.

◆ m_outputClusterContainerName

std::string CalibHitToCaloCellTool::m_outputClusterContainerName
private

Definition at line 76 of file CalibHitToCaloCellTool.h.

◆ m_tileActiveHitCnt

std::string CalibHitToCaloCellTool::m_tileActiveHitCnt
private

Definition at line 53 of file CalibHitToCaloCellTool.h.

◆ m_tileDMHitCnt

std::string CalibHitToCaloCellTool::m_tileDMHitCnt
private

Definition at line 55 of file CalibHitToCaloCellTool.h.

◆ m_tileInactiveHitCnt

std::string CalibHitToCaloCellTool::m_tileInactiveHitCnt
private

Definition at line 54 of file CalibHitToCaloCellTool.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
CaloClusterStoreHelper::makeCluster
static std::unique_ptr< xAOD::CaloCluster > makeCluster(const CaloCellContainer *cellCont)
Creates a valid CaloCluster with a private Aux-Store and CellLink container.
Definition: CaloClusterStoreHelper.cxx:13
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
TileCell
Definition: TileCell.h:57
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
xAOD::CaloCluster_v1::CSize_Unknown
@ CSize_Unknown
Definition: CaloCluster_v1.h:112
CaloCell_Base_ID::LARFCAL
@ LARFCAL
Definition: CaloCell_Base_ID.h:46
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
CaloClusterStoreHelper::finalizeClusters
static StatusCode finalizeClusters(SG::WriteHandle< CaloClusterCellLinkContainer > &h, xAOD::CaloClusterContainer *pClusterColl)
Finalize clusters (move CaloClusterCellLink to a separate container).
Definition: CaloClusterStoreHelper.cxx:64
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
ID
std::vector< Identifier > ID
Definition: CalibHitIDCheck.h:24
CaloClusterStoreHelper::AddContainerWriteHandle
static StatusCode AddContainerWriteHandle(SG::WriteHandle< xAOD::CaloClusterContainer > &clusColl)
Creates a new xAOD::CaloClusterContainer in the given WriteHandle + CaloClusterAuxContainer and recor...
Definition: CaloClusterStoreHelper.cxx:53
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
AtlasDetectorID::is_lar
bool is_lar(Identifier id) const
Definition: AtlasDetectorID.h:689
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
TrigConf::JetWindowSize::Size
Size
Definition: TriggerThresholdValue.h:17
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
CaloDetDescrManager_Base::get_element
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
Definition: CaloDetDescrManager.cxx:159
CalibHitToCaloCellTool::m_tileInactiveHitCnt
std::string m_tileInactiveHitCnt
Definition: CalibHitToCaloCellTool.h:54
CalibHitToCaloCellTool::m_caloCell_ID
const CaloCell_ID * m_caloCell_ID
Definition: CalibHitToCaloCellTool.h:67
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
PlotCalibFromCool.nchan
nchan
Definition: PlotCalibFromCool.py:564
CalibHitUtils::EnergyEM
@ EnergyEM
Definition: CalibHitToCaloCellTool.h:35
CaloCell_Base_ID::LARHEC
@ LARHEC
Definition: CaloCell_Base_ID.h:46
CalibHitToCaloCellTool::m_larDMHitCnt
std::string m_larDMHitCnt
Definition: CalibHitToCaloCellTool.h:58
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
CaloCell_Base_ID::is_tile
bool is_tile(const Identifier id) const
test if the id belongs to the Tiles
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
CalibHitToCaloCellTool::m_cellLinkKeys
SG::WriteHandleKeyArray< CaloClusterCellLinkContainer > m_cellLinkKeys
Definition: CalibHitToCaloCellTool.h:80
CaloCell_Base_ID::is_hec
bool is_hec(const Identifier id) const
test if the id belongs to the HEC
CalibHitToCaloCellTool::m_caloCell_Em
std::string m_caloCell_Em
Definition: CalibHitToCaloCellTool.h:64
AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:27
CalibHitToCaloCellTool::m_outputCellContainerName
std::string m_outputCellContainerName
Definition: CalibHitToCaloCellTool.h:75
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
CaloCell_Base_ID::is_em
bool is_em(const Identifier id) const
test if the id belongs to LArEM
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
CalibHitToCaloCellTool::m_caloDM_ID
const CaloDM_ID * m_caloDM_ID
Definition: CalibHitToCaloCellTool.h:68
CalibHitToCaloCellTool::m_tileActiveHitCnt
std::string m_tileActiveHitCnt
Definition: CalibHitToCaloCellTool.h:53
lumiFormat.i
int i
Definition: lumiFormat.py:85
CaloCell_Base_ID::is_fcal
bool is_fcal(const Identifier id) const
test if the id belongs to the FCAL - true also for MiniFCAL
beamspotman.n
n
Definition: beamspotman.py:731
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CalibHitToCaloCellTool::m_caloCell_NonEm
std::string m_caloCell_NonEm
Definition: CalibHitToCaloCellTool.h:65
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CaloCell_Base_ID::TILE
@ TILE
Definition: CaloCell_Base_ID.h:46
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
CalibHitToCaloCellTool::m_caloCell_Vis
std::string m_caloCell_Vis
Definition: CalibHitToCaloCellTool.h:63
CalibHitUtils::EnergyTotal
@ EnergyTotal
Definition: CalibHitToCaloCellTool.h:35
MC::isSingleParticle
bool isSingleParticle(const T &p)
Identify a particlegun particle.
Definition: HepMCHelpers.h:74
CalibHitToCaloCellTool::m_caloGain
int m_caloGain
Definition: CalibHitToCaloCellTool.h:50
CalibHitToCaloCellTool::m_energyTypeToStr
const std::array< std::string, 3 > m_energyTypeToStr
Definition: CalibHitToCaloCellTool.h:82
CalibHitToCaloCellTool::m_caloMgrKey
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Definition: CalibHitToCaloCellTool.h:70
CalibHitToCaloCellTool::m_outputClusterContainerName
std::string m_outputClusterContainerName
Definition: CalibHitToCaloCellTool.h:76
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
CalibHitUtils::EnergyVisible
@ EnergyVisible
Definition: CalibHitToCaloCellTool.h:35
CalibHitToCaloCellTool::m_doTile
bool m_doTile
Definition: CalibHitToCaloCellTool.h:60
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
CalibHitToCaloCellTool::m_tileDMHitCnt
std::string m_tileDMHitCnt
Definition: CalibHitToCaloCellTool.h:55
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
LArCell
Data object for LAr calorimeter readout cell.
Definition: LArCell.h:53
CalibHitToCaloCellTool::m_larInactHitCnt
std::string m_larInactHitCnt
Definition: CalibHitToCaloCellTool.h:56
CaloGain::CaloGain
CaloGain
Definition: CaloGain.h:11
Name
JetDumper::Name Name
Definition: JetDumper.cxx:19
a
TList * a
Definition: liststreamerinfos.cxx:10
h
CaloDetDescrManager
This class provides the client interface for accessing the detector description information common to...
Definition: CaloDetDescrManager.h:473
xAOD::CaloCluster_v1::setClusterSize
void setClusterSize(const ClusterSize)
Get cluster size.
Definition: CaloCluster_v1.cxx:369
CalibHitUtils::nEnergyTypes
@ nEnergyTypes
Definition: CalibHitToCaloCellTool.h:35
xAOD::CaloCluster_v1::addCell
bool addCell(const unsigned index, const double weight)
Method to add a cell to the cluster (Beware: Kinematics not updated!)
Definition: CaloCluster_v1.h:771
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
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
CalibHitToCaloCellTool::m_caloCell_Tot
std::string m_caloCell_Tot
Definition: CalibHitToCaloCellTool.h:62
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
CalibHitToCaloCellTool::m_larActHitCnt
std::string m_larActHitCnt
Definition: CalibHitToCaloCellTool.h:57
CaloGain::LARLOWGAIN
@ LARLOWGAIN
Definition: CaloGain.h:18
CaloCell_Base_ID::LAREM
@ LAREM
Definition: CaloCell_Base_ID.h:46
CaloCell_Base_ID::NOT_VALID
@ NOT_VALID
Definition: CaloCell_Base_ID.h:46
CalibHitToCaloCellTool::m_clusterContKeys
SG::WriteHandleKeyArray< xAOD::CaloClusterContainer > m_clusterContKeys
Definition: CalibHitToCaloCellTool.h:79
CalibHitToCaloCellTool::m_calibHitContainerNames
std::vector< std::string > m_calibHitContainerNames
Definition: CalibHitToCaloCellTool.h:51
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
fitman.k
k
Definition: fitman.py:528
CalibHitToCaloCellTool::m_cellContKeys
SG::WriteHandleKeyArray< CaloCellContainer > m_cellContKeys
Definition: CalibHitToCaloCellTool.h:78
Identifier
Definition: IdentifierFieldParser.cxx:14