Skip to content
Snippets Groups Projects
Commit a9b1d007 authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

Merge branch 'AddSpacePointReader' into 'main'

Add space point reader

See merge request !69009
parents 2dc60f82 dcbd147c
No related branches found
Tags release/25.2.0
52 merge requests!78751Including CTP Monitoring in GLobal Monitoring,!78241Draft: FPGATrackSim: GenScan code refactor,!78236Draft: Switching Streams https://its.cern.ch/jira/browse/ATR-27417,!78056AFP monitoring: new synchronization and cleaning,!78041AFP monitoring: new synchronization and cleaning,!77990Updating TRT chip masks for L1TRT trigger simulation - ATR-28372,!77733Draft: add new HLT NN JVT, augmented with additional tracking information,!77731Draft: Updates to ZDC reconstruction,!77728Draft: updates to ZDC reconstruction,!77522Draft: sTGC Pad Trigger Emulator,!76725ZdcNtuple: Fix cppcheck warning.,!76611L1CaloFEXByteStream: Fix out-of-bounds array accesses.,!76475Punchthrough AF3 implementation in FastG4,!76474Punchthrough AF3 implementation in FastG4,!76343Draft: MooTrackBuilder: Recalibrate NSW hits in refine method,!75729New implementation of ZDC nonlinear FADC correction.,!75703Draft: Update to HI han config for HLT jets,!75184Draft: Update file heavyions_run.config,!74430Draft: Fixing upper bound for Delayed Jet Triggers,!73963Changing the path of the histograms to "Expert" area,!73875updating ID ART reference plots,!73874AtlasCLHEP_RandomGenerators: Fix cppcheck warnings.,!73449Add muon detectors to DarkJetPEBTLA partial event building,!73343Draft: [TrigEgamma] Add photon ringer chains on bootstrap mechanism,!72972Update L1Calo Jet Trigger Efficiency Monitoring algorithm,!72336Fixed TRT calibration crash,!72176Draft: Improving L1TopoOnline chain that now gets no-empty plots. Activating it by default,!72012Draft: Separate JiveXMLConfig.py into Config files,!71876Fix MET trigger name in MissingETMonitoring,!71820Draft: Adding new TLA End-Of-Fill (EOF) chains and removing obsolete DIPZ chains,!71279Draft: ATR-29330: Move L1_4J15 and the HLT chains seeded by it in the MC Menu,!70990Updates to pulse analysis to support new 2016 p+Pb analysis and 2023 Pb+Pb analysis,!70948[TrigEGam] Adding egamma chains to be monitored,!70777Draft: sTGC offline raw monitoring: strip efficiency re-implementation,!70654Update JetMonitoringStandard.py,!70442Draft: Harmonize output folders+collections in ID Alignment monitoring and update DQM han config,!70269Draft: Initial Preparations for mc23e mu-distribution,!70047More test chains for delayed jets,!69944Draft: Avoid additional ONNX thread spawning for FastCaloSim,!69935Draft: New efficiency DQ criteria for HLTmuon hanconfig,!69795Some updates to the LArSuperCell Monitoring...,!69643Draft: added back ditau chain for commissioning,!69589Draft: Rely on callables to deffer createion of sequences in HLT menu generation,!69450Draft: Adding WP Scan GN2 vs GN1,!69449Draft: Adding the Working Point Scan chains,!69341Draft: Removing BKee Triggers from CPS Group (ATR-19501),!69292Draft:Make InDetTimeCollection recording optional,!69228Updating LAr EM NTuple creation to CA based configuration,!69154gFEX: fix bug in gTower class,!69149Fix bug in gTower class,!69128Delayed jets, additional chains, ATR-28836,!69009Add space point reader
......@@ -107,6 +107,11 @@ acc = MainServicesCfg(flags)
from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
acc.merge(PoolReadCfg(flags))
# Schedule ACTS data pool if requested
if flags.PhysVal.IDPVM.doActs:
from ActsConfig.ActsCollectionsConfig import ActsPoolReadCfg
acc.merge(ActsPoolReadCfg(flags))
if flags.PhysVal.IDPVM.doPRW:
acc.addService(CompFactory.CP.SystematicsSvc("SystematicsSvc"))
from AsgAnalysisAlgorithms.PileupReweightingAlgConfig import PileupReweightingAlgCfg
......
# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
# Declare the package name:
atlas_subdir( ActsCollectionAlgs )
# Component(s) in the package:
atlas_add_component( ActsCollectionAlgs
src/*.h src/*.cxx
src/components/*.cxx
LINK_LIBRARIES
AthenaBaseComps
AthLinks
GaudiKernel
StoreGateLib
xAODInDetMeasurement
xAODMeasurementBase
)
/*
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
#include "SpacePointReader.h"
#include "xAODMeasurementBase/UncalibratedMeasurementContainer.h"
#include "AthLinks/ElementLink.h"
#include "StoreGate/WriteDecorHandle.h"
namespace ActsTrk {
SpacePointReader::SpacePointReader(const std::string& name,
ISvcLocator* pSvcLocator)
: AthReentrantAlgorithm(name, pSvcLocator)
{}
StatusCode SpacePointReader::initialize()
{
ATH_MSG_DEBUG("Initializing " << name() << " ... ");
m_clusterDecoration = m_spacePointKey.key() + "." + m_clusterDecoration.key();
ATH_MSG_DEBUG("Properties:");
ATH_MSG_DEBUG(m_spacePointKey);
ATH_MSG_DEBUG(m_clusterDecoration);
ATH_CHECK(m_spacePointKey.initialize());
ATH_CHECK(m_clusterDecoration.initialize());
return StatusCode::SUCCESS;
}
StatusCode SpacePointReader::execute(const EventContext& ctx) const
{
ATH_MSG_DEBUG("Executing " << name() << " ...");
ATH_MSG_DEBUG("Retrieving input space point collection with key: " << m_spacePointKey.key());
SG::ReadHandle< xAOD::SpacePointContainer > spHandle = SG::makeHandle( m_spacePointKey, ctx );
ATH_CHECK(spHandle.isValid());
const xAOD::SpacePointContainer* spacePoints = spHandle.cptr();
ATH_MSG_DEBUG("Retrieved " << spacePoints->size() << " elements from space point container");
ATH_MSG_DEBUG("Adding decoration to space point collection: bare pointers to clusters");
ATH_MSG_DEBUG("Decoration name: " << m_clusterDecoration.key());
using decoration_type = std::vector<const xAOD::UncalibratedMeasurement*>;
SG::WriteDecorHandle< xAOD::SpacePointContainer,
decoration_type > barePointersToClusters( m_clusterDecoration, ctx );
ATH_MSG_DEBUG("Retrieving Element Links to Clusters from the Space Points and attaching the bare pointers to the object");
static const SG::AuxElement::Accessor< std::vector<ElementLink<xAOD::UncalibratedMeasurementContainer>> > accesor("measurementLink");
for (const xAOD::SpacePoint* sp : *spacePoints) {
if (not accesor.isAvailable(*sp)) {
ATH_MSG_ERROR("Space point does not possess element link to cluster. Decoration `measurementLink` is not available and this should not happen!");
return StatusCode::FAILURE;
}
const std::vector< ElementLink< xAOD::UncalibratedMeasurementContainer > >& els = accesor(*sp);
std::vector< const xAOD::UncalibratedMeasurement* > meas;
meas.reserve(els.size());
for (const ElementLink< xAOD::UncalibratedMeasurementContainer >& el : els) {
meas.push_back(*el);
}
barePointersToClusters(*sp) = meas;
}
return StatusCode::SUCCESS;
}
}
/*
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
#ifndef ACTS_COLLECTIONALGS_SPACEPOINTS_H
#define ACTS_COLLECTIONALGS_SPACEPOINTS_H
#include "AthenaBaseComps/AthReentrantAlgorithm.h"
#include "GaudiKernel/EventContext.h"
#include "StoreGate/ReadHandleKey.h"
#include "StoreGate/WriteDecorHandleKey.h"
// EDM
#include "xAODInDetMeasurement/SpacePointContainer.h"
namespace ActsTrk {
class SpacePointReader
: public AthReentrantAlgorithm {
public:
SpacePointReader(const std::string& name, ISvcLocator* pSvcLocator);
virtual ~SpacePointReader() override = default;
virtual StatusCode initialize() override;
virtual StatusCode execute(const EventContext&) const override;
private:
SG::ReadHandleKey< xAOD::SpacePointContainer > m_spacePointKey
{this, "SpacePointKey", "",
"Key for input space point container"};
SG::WriteDecorHandleKey< xAOD::SpacePointContainer > m_clusterDecoration
{this, "ClusterDecorationKey", "measurements",
"Decoration key for the cluster bare pointer"};
};
} // namespace ActsTrk
#endif
/*
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
#include "src/SpacePointReader.h"
DECLARE_COMPONENT( ActsTrk::SpacePointReader )
# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory
def SpacePointReaderCfg(flags,
name: str,
**kwargs) -> ComponentAccumulator:
acc = ComponentAccumulator()
acc.addEventAlgo(CompFactory.ActsTrk.SpacePointReader(name=name, **kwargs))
return acc
def ActsPoolReadCfg(flags) -> ComponentAccumulator:
acc = ComponentAccumulator()
import re
typedCollections = flags.Input.TypedCollections
for col in typedCollections:
match = re.findall(r"xAOD::SpacePointContainer#(\S+)", col)
if match:
spCol = match[0]
acc.merge(SpacePointReaderCfg(flags,
name=f"{spCol}Reader",
SpacePointKey=spCol))
return acc
......@@ -57,12 +57,14 @@ namespace ActsTrk {
[[maybe_unused]] const auto idHash = el->identifierHash();
}
} else if (sp->isAvailable< std::vector< ElementLink<xAOD::UncalibratedMeasurementContainer> > >("measurementLink")) {
// For now this is still allowed. Once we have a Space Point reader algorithm, thi will imply an error instead
static const SG::AuxElement::Accessor< std::vector< ElementLink<xAOD::UncalibratedMeasurementContainer> > > accCluster("measurementLink");
const auto& els = accCluster(*sp);
for (const auto& el : els) {
[[maybe_unused]] const auto idHash = (*el)->identifierHash();
}
// if we are here, that means the bare pointers are not available
// This should not happen
ATH_MSG_ERROR("Space point has Element links but not bare pointers to cluster. This should not happen!");
return StatusCode::FAILURE;
} else {
// This should never happen
ATH_MSG_ERROR("There are no decorations that link the space point to the original clusters");
return StatusCode::FAILURE;
}
}
......
......@@ -27,6 +27,9 @@ if __name__ == "__main__":
from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
acc.merge(PoolReadCfg(flags))
from ActsConfig.ActsCollectionsConfig import ActsPoolReadCfg
acc.merge(ActsPoolReadCfg(flags))
if flags.readClusters:
if flags.Detector.EnableITkPixel:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment