ATLAS Offline Software
xAODSpacePointAuxContainerCnv.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // Local include(s):
7 
8 // EDM include(s):
11 
12 // Other includes
13 #include "AthLinks/ElementLink.h"
14 
17 {}
18 
20 {
21  ATH_MSG_DEBUG("Initializing xAODSpacePointAuxContainerCnv ...");
23 }
24 
26  const std::string& key )
27 {
28  ATH_MSG_DEBUG("Calling xAODSpacePointAuxContainerCnv::createPersistentWithKey for our xAOD space points");
29 
30  // Load the necessary ROOT class(es):
31  static char const* const NAME =
32  "std::vector<std::vector<ElementLink<xAOD::UncalibratedMeasurementContainer> > >";
33  static TClass const* const cls = TClass::GetClass( NAME );
34  if( ! cls ) {
35  ATH_MSG_ERROR( "Couldn't load dictionary for type: " << NAME );
36  }
37 
38  // This makes a copy of the container, with any thinning applied.
39  std::unique_ptr< xAOD::SpacePointAuxContainer > result
41 
42  // see if we can get the variable from trans
43  using measurement_collection_t = std::vector< const xAOD::UncalibratedMeasurement* >;
44  static const SG::ConstAccessor< measurement_collection_t > uncalibMeasurementAcc("measurements");
45  static const SG::auxid_t measurementAuxId = uncalibMeasurementAcc.auxid();
46 
47  // Create a helper object for the Element Links
49  for (std::size_t i(0); i<result->size(); ++i) {
50  helper.push_back( std::make_unique< xAOD::SpacePoint >() );
51  }
52  helper.setStore( result.get() );
53 
54  // Convert the bare pointer(s) to Element Link(s)
56 
57  for (xAOD::SpacePoint *sp : helper) {
58  std::vector< ElementLink<xAOD::UncalibratedMeasurementContainer> > els;
59  accesor(*sp) = els;
60 
61  // get values from the trans aux container directly
62  const void* ptrToSomething = trans->getData (measurementAuxId);
63  const measurement_collection_t& measurements = static_cast<const measurement_collection_t*>(ptrToSomething)[sp->index()];
64  accesor(*sp).reserve( measurements.size() );
65  for (std::size_t idx(0); idx<measurements.size(); ++idx) {
66  accesor(*sp).push_back( ElementLink< xAOD::UncalibratedMeasurementContainer >(*dynamic_cast<const xAOD::UncalibratedMeasurementContainer*>(measurements[idx]->container()), measurements[idx]->index()) );
67  }
68  }
69 
70  return result.release();
71 }
get_generator_info.result
result
Definition: get_generator_info.py:21
xAODSpacePointAuxContainerCnv.h
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:68
SG::ConstAccessor::auxid
SG::auxid_t auxid() const
Return the aux id for this variable.
xAOD::SpacePointAuxContainer_v1
Auxiliary store for space point.
Definition: SpacePointAuxContainer_v1.h:19
CaloClusterListBadChannel.cls
cls
Definition: CaloClusterListBadChannel.py:8
T_AthenaPoolAuxContainerCnv
Athena pool converter for aux store classes.
Definition: T_AthenaPoolAuxContainerCnv.h:39
xAOD::SpacePoint_v1
Definition: SpacePoint_v1.h:29
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
runBeamSpotCalibration.helper
helper
Definition: runBeamSpotCalibration.py:112
SG::auxid_t
size_t auxid_t
Identifier for a particular aux data item.
Definition: AuxTypes.h:27
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:85
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
xAODSpacePointAuxContainerCnv::initialize
virtual StatusCode initialize() override
Gaudi Service Interface method implementations:
Definition: xAODSpacePointAuxContainerCnv.cxx:19
xAODSpacePointAuxContainerCnv::xAODSpacePointAuxContainerCnv
xAODSpacePointAuxContainerCnv(ISvcLocator *svcLoc)
Definition: xAODSpacePointAuxContainerCnv.cxx:15
UncalibratedMeasurementContainer.h
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
T_AthenaPoolAuxContainerCnv::createPersistentWithKey
virtual AUXSTORE * createPersistentWithKey(AUXSTORE *trans, const std::string &key) override
Convert a transient object to persistent form.
xAOD::AuxContainerBase::getData
virtual const void * getData(auxid_t auxid) const override
Get a pointer to a given array.
Definition: AuxContainerBase.cxx:230
xAODSpacePointAuxContainerCnv::createPersistentWithKey
virtual xAOD::SpacePointAuxContainer * createPersistentWithKey(xAOD::SpacePointAuxContainer *trans, const std::string &key) override
Definition: xAODSpacePointAuxContainerCnv.cxx:25
SpacePointContainer.h
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
T_AthenaPoolCustCnv< AUXSTORE, AUXSTORE >::initialize
virtual StatusCode initialize()
Gaudi Service Interface method implementations:
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37