|
ATLAS Offline Software
|
Go to the documentation of this file.
37 ATH_MSG_ERROR(
"either track Key name or track count key name is undefined ");
38 return StatusCode::FAILURE;
45 return StatusCode::SUCCESS;
53 if (not previousDecisionsHandle.isValid())
56 return StatusCode::SUCCESS;
59 if (previousDecisionsHandle->size() == 0)
62 return StatusCode::SUCCESS;
64 else if (previousDecisionsHandle->size() > 1)
66 ATH_MSG_ERROR(
"Found " << previousDecisionsHandle->size() <<
" previous decisions.");
67 return StatusCode::FAILURE;
70 ATH_MSG_DEBUG(
"Running with " << previousDecisionsHandle->size() <<
" implicit ReadHandles for previous decisions");
72 const auto viewTrk = (previousDecisionsHandle->at(0))->objectLink<ViewContainer>(
viewString());
76 ATH_MSG_DEBUG(
"spacepoint handle size: " << tracksHandle->size() <<
"...");
80 auto linkToVertex = findLink<xAOD::TrigCompositeContainer>(previousDecisionsHandle->at(0),
featureString());
81 if ( linkToVertex.link.isValid() ) {
82 auto all_verties = linkToVertex.link.getDataPtr();
83 for (
auto vtxInfo: *all_verties) {
84 const float weight = vtxInfo->getDetail<
float>(
"zfinder_vtx_weight");
85 if (
weight > maxWeight ) {
87 vertexZ = vtxInfo->getDetail<
float>(
"zfinder_vtx_z");
90 ATH_MSG_DEBUG(
"Obtained vertex from ZFinder z:" << vertexZ <<
" weight " << maxWeight);
96 const int ntrks = tracksHandle->size();
97 ATH_MSG_DEBUG(
"Successfully retrieved track container of size" << ntrks);
98 auto trkPt =
Monitored::Collection(
"trkPt", *tracksHandle, [](
const auto& trk){
return trk->pt()*1.
e-3; } );
99 auto trkEta =
Monitored::Collection(
"trkEta", *tracksHandle, [](
const auto& trk){
return trk->eta(); } );
101 std::vector<int> counts(
m_minPt.size());
102 for (
const auto trackPtr : *tracksHandle)
104 const double pT = trackPtr->pt();
105 const double z0 = trackPtr->z0();
106 const double sinTheta =
std::sin(trackPtr->theta());
108 for (
long unsigned int i = 0;
i <
m_minPt.size();
i++)
116 for (
long unsigned int i = 0;
i <
m_minPt.size();
i++)
119 <<
"and z0 cut= " <<
m_maxZ0[
i] << counts[
i]);
123 auto trackCountContainer = std::make_unique<xAOD::TrigCompositeContainer>();
124 auto trackCountContainerAux = std::make_unique<xAOD::TrigCompositeAuxContainer>();
125 trackCountContainer->setStore(trackCountContainerAux.get());
128 trackCountContainer->push_back(trackCount);
137 for (
long unsigned int i = 0;
i < counts.size();
i++)
160 ATH_CHECK(trackCountHandle.
record(std::move(trackCountContainer), std::move(trackCountContainerAux)));
163 return StatusCode::SUCCESS;
bool setDetail(const std::string &name, const TYPE &value)
Set an TYPE detail on the object.
Group
Properties of a chain group.
xAOD::TrigCompositeContainer DecisionContainer
TrigComposite_v1 TrigComposite
Declare the latest version of the class.
Decision * newDecisionIn(DecisionContainer *dc, const std::string &name)
Helper method to create a Decision object, place it in the container and return a pointer to it.
const std::string & hypoAlgNodeName()
SG::ReadHandle< T > makeHandle(const SG::View *view, const SG::ReadHandleKey< T > &rhKey, const EventContext &context)
navigate from the TrigComposite to nearest view and fetch object from it
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)
ToolHandleArray< TrackCountHypoTool > m_hypoTools
const SG::ReadHandleKey< TrigCompositeUtils::DecisionContainer > & decisionInput() const
methods for derived classes to access handles of the base class input other read/write handles may be...
SG::WriteHandle< DecisionContainer > createAndStore(const SG::WriteHandleKey< DecisionContainer > &key, const EventContext &ctx)
Creates and right away records the DecisionContainer with the key.
const std::string & key() const
Return the StoreGate ID for the referenced object.
Gaudi::Property< std::vector< float > > m_minPt
const SG::WriteHandleKey< TrigCompositeUtils::DecisionContainer > & decisionOutput() const
methods for derived classes to access handles of the base class output other read/write handles may b...
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Gaudi::Property< std::vector< float > > m_maxZ0
virtual StatusCode initialize() override
StatusCode hypoBaseOutputProcessing(SG::WriteHandle< TrigCompositeUtils::DecisionContainer > &outputHandle, MSG::Level lvl=MSG::DEBUG) const
Base class function to be called once slice specific code has finished. Handles debug printing and va...
::StatusCode StatusCode
StatusCode definition for legacy code.
pointer_type ptr()
Dereference the pointer.
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_tracksKey
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Class used to describe composite objects in the HLT.
xAOD::TrigCompositeAuxContainer DecisionAuxContainer
ElementLink implementation for ROOT usage.
const std::string & featureString()
std::string to_string(const DetectorType &type)
Hypothesis algorithms take the output of reco algorithms and the decision from the preceeding InputMa...
TrackCountHypoAlg(const std::string &name, ISvcLocator *pSvcLocator)
ToolHandle< GenericMonitoringTool > m_monTool
void linkToPrevious(Decision *d, const std::string &previousCollectionKey, size_t previousIndex)
Links to the previous object, location of previous 'seed' decision supplied by hand.
Helper to keep a Decision object, ElementLink and ActiveState (with respect to some requested ChainGr...
std::set< DecisionID > DecisionIDContainer
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
LinkInfo< T > findLink(const Decision *start, const std::string &linkName, const bool suppressMultipleLinksWarning=false)
Perform a recursive search for ElementLinks of type T and name 'linkName', starting from Decision obj...
void decisionIDs(const Decision *d, DecisionIDContainer &destination)
Extracts DecisionIDs stored in the Decision object.
Gaudi::Property< std::vector< float > > m_vertexZ
Declare a monitored scalar variable.
virtual StatusCode execute(const EventContext &context) const override
const std::string & viewString()
SG::WriteHandleKey< xAOD::TrigCompositeContainer > m_trackCountKey