38 ATH_MSG_ERROR(
"either track Key name or track count key name is undefined ");
39 return StatusCode::FAILURE;
46 return StatusCode::SUCCESS;
54 if (not previousDecisionsHandle.isValid())
57 return StatusCode::SUCCESS;
60 if (previousDecisionsHandle->size() == 0)
63 return StatusCode::SUCCESS;
65 else if (previousDecisionsHandle->size() > 1)
67 ATH_MSG_ERROR(
"Found " << previousDecisionsHandle->size() <<
" previous decisions.");
68 return StatusCode::FAILURE;
71 ATH_MSG_DEBUG(
"Running with " << previousDecisionsHandle->size() <<
" implicit ReadHandles for previous decisions");
77 ATH_MSG_DEBUG(
"spacepoint handle size: " << tracksHandle->size() <<
"...");
82 if ( linkToVertex.link.isValid() ) {
83 auto all_vertices = linkToVertex.link.getDataPtr();
84 for (
auto vtxInfo: *all_vertices) {
85 const float weight = vtxInfo->getDetail<
float>(
"zfinder_vtx_weight");
86 if ( weight > maxWeight ) {
88 vertexZ = vtxInfo->getDetail<
float>(
"zfinder_vtx_z");
91 ATH_MSG_DEBUG(
"Obtained vertex from ZFinder z:" << vertexZ <<
" weight " << maxWeight);
97 const int ntrks = tracksHandle->size();
98 ATH_MSG_DEBUG(
"Successfully retrieved track container of size" << ntrks);
99 auto trkPt =
Monitored::Collection(
"trkPt", *tracksHandle, [](
const auto& trk){
return trk->pt()*1.e-3; } );
100 auto trkEta =
Monitored::Collection(
"trkEta", *tracksHandle, [](
const auto& trk){
return trk->eta(); } );
102 std::vector<int> counts(
m_minPt.size());
103 for (
const auto trackPtr : *tracksHandle)
105 const double pT = trackPtr->pt();
106 const double z0 = trackPtr->z0();
107 const double sinTheta = std::sin(trackPtr->theta());
109 for (
long unsigned int i = 0; i <
m_minPt.size(); i++)
113 && ( std::abs((z0-vertexZ)*sinTheta) <
m_vertexZ[i] ) )
117 for (
long unsigned int i = 0; i <
m_minPt.size(); i++)
120 <<
"and z0 cut= " <<
m_maxZ0[i] << counts[i]);
124 auto trackCountContainer = std::make_unique<xAOD::TrigCompositeContainer>();
125 auto trackCountContainerAux = std::make_unique<xAOD::TrigCompositeAuxContainer>();
126 trackCountContainer->setStore(trackCountContainerAux.get());
129 trackCountContainer->push_back(trackCount);
138 for (
long unsigned int i = 0; i < counts.size(); i++)
145 auto decisions = outputHandle.
ptr();
161 ATH_CHECK(trackCountHandle.
record(std::move(trackCountContainer), std::move(trackCountContainerAux)));
164 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
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.
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 & hypoAlgNodeName()
const std::string & featureString()
void linkToPrevious(Decision *d, const std::string &previousCollectionKey, size_t previousIndex)
Links to the previous object, location of previous 'seed' decision supplied by hand.
const std::string & viewString()
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...
DataVector< SG::View > ViewContainer
View container for recording in StoreGate.
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)
ElementLink implementation for ROOT usage.
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...
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...
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...
HypoBase(const std::string &name, ISvcLocator *pSvcLocator)
constructor, to be called by sub-class constructors
Group of local monitoring quantities and retain correlation when filling histograms
Declare a monitored scalar variable.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
pointer_type ptr()
Dereference the pointer.
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_tracksKey
ToolHandleArray< TrackCountHypoTool > m_hypoTools
TrackCountHypoAlg(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode initialize() override
Gaudi::Property< std::vector< float > > m_vertexZ
Gaudi::Property< std::vector< float > > m_maxZ0
Gaudi::Property< std::vector< float > > m_minPt
ToolHandle< GenericMonitoringTool > m_monTool
virtual StatusCode execute(const EventContext &context) const override
SG::WriteHandleKey< xAOD::TrigCompositeContainer > m_trackCountKey
bool setDetail(const std::string &name, const TYPE &value)
Set an TYPE detail on the object.
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())
const std::string & viewString()
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 & featureString()
xAOD::TrigCompositeAuxContainer DecisionAuxContainer
std::set< DecisionID > DecisionIDContainer
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 & hypoAlgNodeName()
void linkToPrevious(Decision *d, const std::string &previousCollectionKey, size_t previousIndex)
Links to the previous object, location of previous 'seed' decision supplied by hand.
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...
xAOD::TrigCompositeContainer DecisionContainer
void decisionIDs(const Decision *d, DecisionIDContainer &destination)
Extracts DecisionIDs stored in the Decision object.
auto makeHandle(const SG::View *view, const KEY &key, const EventContext &ctx)
Create a view handle from a handle key.
TrigComposite_v1 TrigComposite
Declare the latest version of the class.
Helper to keep a Decision object, ElementLink and ActiveState (with respect to some requested ChainGr...