|
ATLAS Offline Software
|
Go to the documentation of this file.
12 #include "Acts/EventData/TrackContainer.hpp"
13 #include "Acts/EventData/TrackParameters.hpp"
15 #include "Gaudi/Property.h"
16 #include "GaudiKernel/Algorithm.h"
17 #include "GaudiKernel/MsgStream.h"
31 ISvcLocator *pSvcLocator)
69 ATH_MSG_WARNING(
"No extrapolator found. Will not be able to extrapolate tracks.");
71 ATH_MSG_INFO(
"Extrapolator found. Will be able to extrapolate tracks.");
77 return StatusCode::SUCCESS;
89 const Acts::BoundTrackParameters trackparams(
track.referenceSurface().getSharedPtr(),
91 auto trackPosition = trackparams.position(gctx);;
92 data[
"pos"].push_back(trackPosition.x());
93 data[
"pos"].push_back(trackPosition.y());
94 data[
"pos"].push_back(trackPosition.z());
96 unsigned int nTrackStates =
track.nTrackStates();
100 std::vector<ActsTrk::MultiTrajectory::ConstTrackStateProxy> trackStates;
101 trackStates.reserve(nTrackStates);
102 for (
auto trackstate :
track.trackStatesReversed()) {
103 trackStates.push_back(trackstate);
108 unsigned int count = 0;
109 for (
auto trackstate : trackStates) {
111 if (trackstate.hasSmoothed() && trackstate.hasReferenceSurface()) {
112 const Acts::BoundTrackParameters
params(trackstate.referenceSurface().getSharedPtr(),
113 trackstate.smoothed(),
114 trackstate.smoothedCovariance(),
119 data[
"pos"].push_back(
pos.x());
120 data[
"pos"].push_back(
pos.y());
121 data[
"pos"].push_back(
pos.z());
126 ATH_MSG_WARNING(
"TrackState "<<
count<<
" does not have smoothed state ["<<trackstate.hasSmoothed()<<
"] or reference surface ["<<trackstate.hasReferenceSurface()<<
"]. Skipping.");
139 return StatusCode::SUCCESS;
152 j[
"run number"] = eventInfo->
runNumber();
171 ATH_MSG_VERBOSE(
"TrackStateContainer has "<< tcHandle->size() <<
" elements");
173 ATH_MSG_VERBOSE(
"Trying to load " << tcHandle.key() <<
" with " << tcHandle->size() <<
" tracks");
175 for (
auto track : *tc) {
177 j[
"TrackContainers"][tcHandle.key()].push_back(
tmp);
200 return StatusCode::SUCCESS;
208 auto writeEtaPhiLabel = [](
float eta,
float phi) {
212 j[
"event number"] = 999;
213 j[
"run number"] = 999;
216 unsigned int maxSteps = 3;
220 phi =
static_cast<float>(
nPhi) /
static_cast<float>(maxSteps) *
223 eta =
static_cast<float>(
nEta) /
static_cast<float>(maxSteps) *
228 cluster[
"phi"] =
phi;
229 cluster[
"eta"] =
eta;
230 cluster[
"energy"] = 999.9;
231 cluster[
"label"] = writeEtaPhiLabel(
eta,
phi);
233 j[
"CaloClusters"][
"TestClusters"].push_back(cluster);
239 jet[
"energy"] = 99999.9;
240 jet[
"label"] = writeEtaPhiLabel(
eta,
phi);
241 j[
"Jets"][
"TestJets"].push_back(
jet);
251 for (
unsigned int i = 0;
i < 4; ++
i) {
253 track[
"pos"].push_back({trackPos.x(), trackPos.y(), trackPos.z()});
256 j[
"Tracks"][
"TestTracks"].push_back(
track);
262 template <
class TYPE>
265 const std::string &jsonType) {
271 for (
auto object : *handle) {
273 event[jsonType][handle.key()].push_back(
tmp);
276 return StatusCode::SUCCESS;
295 data[
"energy"] = clust.
e();
317 data[
"chi2"] =
tp.chiSquared();
318 data[
"dof"] =
tp.numberDoF();
319 data[
"dparams"] = {
tp.d0(),
tp.z0(),
tp.phi0(),
tp.theta(),
tp.qOverP()};
322 ATH_MSG_VERBOSE(
"Physlite mode enabled. Not adding track parameters.");
327 data[
"pos"] = {
tp.perigeeParameters().position().x(),
328 tp.perigeeParameters().position().y(),
329 tp.perigeeParameters().position().z()};
330 for (
unsigned int i = 0;
i <
tp.numberOfParameters(); ++
i) {
331 data[
"pos"].push_back(
tp.parameterX(
i));
332 data[
"pos"].push_back(
tp.parameterY(
i));
333 data[
"pos"].push_back(
tp.parameterZ(
i));
336 std::vector<Amg::Vector3D> positions;
338 positions.push_back(
Amg::Vector3D(peri.position().x(), peri.position().y(),
339 peri.position().z()));
356 positions.push_back(
pos);
363 for (
auto pos : positions) {
364 data[
"pos"].push_back(
pos.x());
365 data[
"pos"].push_back(
pos.y());
366 data[
"pos"].push_back(
pos.z());
371 "Failure in extrapolation for Track with start parameters "
400 track.trackParameters();
403 data[
"pos"].push_back(param->position().x());
404 data[
"pos"].push_back(param->position().y());
405 data[
"pos"].push_back(param->position().z());
409 track.measurementsOnTrack();
412 data[
"pos"].push_back(meas->globalPosition().x());
413 data[
"pos"].push_back(meas->globalPosition().y());
414 data[
"pos"].push_back(meas->globalPosition().z());
429 std::vector<std::string> quality = {
"Tight",
"Medium",
"Loose",
"VeryLoose"};
430 data[
"Quality"] = quality[
static_cast<unsigned int>(
muon.quality())];
431 std::vector<std::string>
type = {
"Combined",
"Standalone",
"SegmentTagged",
432 "CaloTagged",
"SiAssociatedForward"};
433 data[
"Type"] =
type[
static_cast<unsigned int>(
muon.muonType())];
437 addLink(
muon.muonSpectrometerTrackParticleLink(),
data[
"LinkedTracks"]);
438 addLink(
muon.extrapolatedMuonSpectrometerTrackParticleLink(),
439 data[
"LinkedTracks"]);
450 data[
"energy"] = tauJet.
e();
479 template <
class TYPE>
481 if (link.isValid()) {
490 return StatusCode::FAILURE;
493 return StatusCode::SUCCESS;
496 template <
class TYPE>
499 const std::string &jsonType) {
501 return StatusCode::SUCCESS;
508 <<
" collections: ");
511 if (!
tmp.is_null()) {
513 <<
tmp.size() <<
" elements:");
514 event[jsonType][handle.
key()] =
tmp;
516 return StatusCode::SUCCESS;
520 template <
class TYPE>
524 for (
const auto &coll : container) {
525 for (
const auto &prd : *coll) {
527 data[
"pos"] = {prd->globalPosition().x(), prd->globalPosition().y(),
528 prd->globalPosition().z()};
530 data[
"id"] =
id.get_compact();
531 colldata.push_back(
data);
virtual double phi() const
The azimuthal angle ( ) of the particle.
virtual StatusCode initialize() override
inherited from Algorithm
char data[hepevt_bytes_allocation_ATLAS]
SG::ReadHandleKey< ActsGeometryContext > m_geometryContextKey
Scalar phi() const
phi method
uint64_t eventNumber() const
The current event's event number.
virtual double eta() const
The pseudorapidity ( ) of the particle.
ToolHandle< Trk::IExtrapolationEngine > m_extrapolator
Scalar eta() const
pseudorapidity method
const Amg::Vector3D & position() const
Access method for the position.
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
SG::ReadHandleKey< Muon::sTgcPrepDataContainer > m_stgcPrepRawDataKey
Scalar theta() const
theta method
SG::ReadHandleKeyArray< TrackCollection > m_trackCollectionKeys
SG::ReadHandleKey< InDet::PixelClusterContainer > m_pixelPrepRawDataKey
StatusCode getAndFillArrayOfContainers(nlohmann::json &event, const SG::ReadHandleKeyArray< TYPE > &keys, const std::string &jsonType)
SG::ReadHandleKey< Muon::RpcPrepDataContainer > m_rpcPrepRawDataKey
SG::ReadHandleKey< InDet::TRT_DriftCircleContainer > m_trtPrepRawDataKey
#define ATH_MSG_VERBOSE(x)
Property holding a SG store/key/clid from which a ReadHandle is made.
bool empty() const
Test if the key is blank.
void prependTestEvent()
Dumps a dummy event with some objects at specific eta/phi coordinates for calibration.
virtual double e() const
The total energy of the particle.
virtual StatusCode finalize() override
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
constexpr int nPhi
Default bin number of phi for vertex map.
uint32_t runNumber() const
The current event's run number.
SG::ReadHandleKeyArray< ActsTrk::TrackContainer > m_trackContainerKeys
SG::ReadHandleKey< Muon::TgcPrepDataContainer > m_tgcPrepRawDataKey
Acts::GeometryContext context() const
virtual double phi() const
The azimuthal angle ( ) of the particle.
SG::ReadHandleKey< Muon::MMPrepDataContainer > m_mmPrepRawDataKey
SG::ReadHandleKeyArray< xAOD::TauJetContainer > m_tauJetKeys
Description of a calorimeter cluster.
Gaudi::Property< bool > m_dumpTestEvent
POOL::TEvent event(POOL::TEvent::kClassAccess)
virtual double eta() const
The pseudorapidity ( ) of the particle.
SG::ReadHandleKeyArray< xAOD::JetContainer > m_jetKeys
::StatusCode StatusCode
StatusCode definition for legacy code.
Class describing a tau jet.
Gaudi::Property< std::string > m_outputJSON_Name
SG::ReadHandleKey< InDet::SCT_ClusterContainer > m_sctPrepRawDataKey
Class to represent and store fit qualities from track reconstruction in terms of and number of degre...
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
SG::ReadHandleKey< Muon::MdtPrepDataContainer > m_mdtPrepRawDataKey
nlohmann::json m_eventData
virtual bool isValid() override final
Can the handle be successfully dereferenced?
#define TYPE(CODE, TYP, IOTYP)
StatusCode getAndFillContainer(nlohmann::json &event, const SG::ReadHandleKey< TYPE > &key, const std::string &jsonType)
virtual StatusCode execute() override
void addLink(const TYPE &link, nlohmann::json &data)
std::string to_string(const DetectorType &type)
SG::ReadHandleKeyArray< xAOD::CaloClusterContainer > m_caloClustersKeys
nlohmann::json getData(const TYPE &object)
SG::ReadHandleKey< Muon::CscPrepDataContainer > m_cscPrepRawDataKey
Gaudi::Property< bool > m_physlite
DumpEventDataToJsonAlg(const std::string &name, ISvcLocator *pService)
Algorithm constructor.
Eigen::Matrix< double, 3, 1 > Vector3D
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
SG::ReadHandleKeyArray< xAOD::ElectronContainer > m_electronKeys
nlohmann::json getActsData(const Acts::TrackProxy< ActsTrk::TrackSummaryContainer, ActsTrk::MultiTrajectory, ActsTrk::DataLinkHolder, true > &track, const Acts::GeometryContext &gctx)
SG::ReadHandleKeyArray< xAOD::PhotonContainer > m_photonKeys
Data object for each calorimeter readout cell.
#define ATH_MSG_WARNING(x)
void setRThetaPhi(Amg::Vector3D &v, double r, double theta, double phi)
sets radius, the theta and phi angle of a vector.
SG::ReadHandleKeyArray< CaloCellContainer > m_caloCellKey
double chiSquared() const
returns the of the overall track fit
Class describing a TrackParticle.
constexpr int nEta
Default bin number of eta for vertex map.
virtual double e() const
The total energy of the particle.
SG::ReadHandleKeyArray< xAOD::TrackParticleContainer > m_trackParticleKeys
double doubleNumberDoF() const
returns the number of degrees of freedom of the overall track or vertex fit as double
SG::ReadHandleKeyArray< xAOD::MuonContainer > m_muonKeys