10#include "GaudiKernel/SystemOfUnits.h"
32 ISvcLocator* pSvcLocator ) :
57 return StatusCode::SUCCESS;
68 ATH_CHECK( previousDecisionsHandle.isValid() );
70 ATH_MSG_DEBUG(
"Running with " << previousDecisionsHandle->size() <<
" previous decisions" );
71 if( previousDecisionsHandle->size()!=1 ) {
72 ATH_MSG_ERROR(
"Previous decision handle size is not 1. It is" << previousDecisionsHandle->size() );
73 return StatusCode::FAILURE;
75 const Decision * previousDecision = previousDecisionsHandle->at(0);
80 for(
auto decisionID: previousDecisionIDs) {
ATH_MSG_VERBOSE(
" " << decisionID ); }
85 auto outputDecisions = outputHandle.
ptr();
92 ATH_MSG_DEBUG(
"dEdxTrk handle size: " << dEdxTrkHandle->size() );
97 ATH_MSG_DEBUG(
"dEdxHit handle size: " << dEdxHitHandle->size() );
102 if( dEdxTrksContainer ==
nullptr ) {
104 return StatusCode::FAILURE;
106 if( dEdxHitsContainer ==
nullptr ) {
108 return StatusCode::FAILURE;
112 auto HPtdEdxTrkContainer = std::make_unique<xAOD::TrigCompositeContainer>();
113 auto HPtdEdxTrkContainerAux = std::make_unique<xAOD::TrigCompositeAuxContainer>();
114 HPtdEdxTrkContainer->setStore(HPtdEdxTrkContainerAux.get());
121 ATH_MSG_DEBUG(
"nr of cands by createCandidates = " << n_cands );
123 std::vector<TrigdEdxTrackHypoTool::dEdxTrkHypoInfo> dEdxTrkHypoInputs;
125 for (
auto dedx : *dedxContainer ) {
134 dEdxTrkHypoInputs.push_back( hypoInfo );
142 ATH_MSG_VERBOSE(
"+++++ Now computing decision for " << tool->name() );
143 ATH_CHECK( tool->decide( dEdxTrkHypoInputs ) );
147 while(it != outputDecisions->end()) {
151 it = outputDecisions->erase(it);
160 ATH_CHECK( HPtdEdxTrkHandle.
record( std::move( HPtdEdxTrkContainer ), std::move( HPtdEdxTrkContainerAux ) ) );
167 return StatusCode::SUCCESS;
180 auto monitorIt =
Monitored::Group(
m_monTool, monTrackdEdx, monTrackPtGeV, monTrackEta, monTracka0beam, monTrackNhighdEdxHits );
183 float trackPt = trk->getDetail<
float>(
"HPtdEdxTrk_pt");
184 float trackEta = trk->getDetail<
float>(
"HPtdEdxTrk_eta");
185 float tracka0beam = trk->getDetail<
float>(
"HPtdEdxTrk_a0beam");
186 float trackdEdx = trk->getDetail<
float>(
"HPtdEdxTrk_dedx");
187 int trackNhighdEdxHits = (int)trk->getDetail<int16_t>(
"HPtdEdxTrk_n_hdedx_hits_1p70");
188 monTrackPtGeV = trackPt / 1000.0;
189 monTrackEta = trackEta;
190 monTracka0beam = tracka0beam;
191 monTrackdEdx = trackdEdx;
192 monTrackNhighdEdxHits = trackNhighdEdxHits;
195 return StatusCode::SUCCESS;
210 float trackPt = trk->getDetail<
float>(
"dEdxTrk_pt");
211 float trackEta = trk->getDetail<
float>(
"dEdxTrk_eta");
212 float trackPhi = trk->getDetail<
float>(
"dEdxTrk_phi");
213 float tracka0beam = trk->getDetail<
float>(
"dEdxTrk_a0beam");
214 float trackdEdx = trk->getDetail<
float>(
"dEdxTrk_dedx");
215 int trackId = trk->getDetail<
int> (
"dEdxTrk_id");
216 ATH_MSG_VERBOSE(
"track pt / eta / a0beam / dEdx / Id = " << trackPt <<
" / " << trackEta <<
" / " << tracka0beam <<
" / " << trackdEdx <<
" / " << trackId );
218 std::vector<int16_t> n_hdedx_hits;
222 int id = hit->getDetail<
int>(
"dEdxHit_trkid");
223 if(
id != trackId )
continue;
224 float dedx = hit->getDetail<
float>(
"dEdxHit_dedx");
233 int16_t n_hits_innermost = (int16_t)trk->getDetail<
int>(
"dEdxTrk_n_hits_innermost");
234 int16_t n_hits_inner = (int16_t)trk->getDetail<
int>(
"dEdxTrk_n_hits_inner");
235 int16_t n_hits_pix = (int16_t)trk->getDetail<
int>(
"dEdxTrk_n_hits_pix");
236 int16_t n_hits_sct = (int16_t)trk->getDetail<
int>(
"dEdxTrk_n_hits_sct");
244 dedx->
setDetail<
float>(
"HPtdEdxTrk_pt", trackPt);
245 dedx->
setDetail<
float>(
"HPtdEdxTrk_eta", trackEta);
246 dedx->
setDetail<
float>(
"HPtdEdxTrk_phi", trackPhi);
247 dedx->
setDetail<
float>(
"HPtdEdxTrk_a0beam",tracka0beam);
248 dedx->
setDetail<
float>(
"HPtdEdxTrk_dedx", trackdEdx);
251 dedx->
setDetail<int16_t>(name, n_hdedx_hits[idef]);
253 dedx->
setDetail<int16_t>(
"HPtdEdxTrk_n_hits_innermost", n_hits_innermost);
254 dedx->
setDetail<int16_t>(
"HPtdEdxTrk_n_hits_inner", n_hits_inner);
255 dedx->
setDetail<int16_t>(
"HPtdEdxTrk_n_hits_pix", n_hits_pix);
256 dedx->
setDetail<int16_t>(
"HPtdEdxTrk_n_hits_sct", n_hits_sct);
260 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define CHECK(...)
Evaluate an expression and check for errors.
SG::WriteHandle< DecisionContainer > createAndStore(const SG::WriteHandleKey< DecisionContainer > &key, const EventContext &ctx)
Creates and right away records the DecisionContainer with the key.
Header file to be included by clients of the Monitored infrastructure.
bool allFailed(const Decision *d)
return true if there is no positive decision stored
value_type push_back(value_type pElem)
Add an element to the end of the collection.
DataModel_detail::iterator< DataVector > iterator
ElementLink implementation for ROOT usage.
bool isValid() const
Test to see if the link can be dereferenced.
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.
void makePrivateStore()
Create a new (empty) private store for this object.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
pointer_type ptr()
Dereference the pointer.
virtual StatusCode execute(const EventContext &context) const override
StatusCode createCandidates(const xAOD::TrigCompositeContainer *, const xAOD::TrigCompositeContainer *, xAOD::TrigCompositeContainer *, int &) const
SG::ReadHandleKey< xAOD::TrigCompositeContainer > m_dEdxTrkKey
virtual StatusCode initialize() override
std::vector< float > m_highdEdxHitDefThres
TrigdEdxTrackHypoAlg(const std::string &name, ISvcLocator *pSvcLocator)
std::vector< std::string > m_highdEdxHitDefNames
ToolHandleArray< TrigdEdxTrackHypoTool > m_hypoTools
ToolHandle< GenericMonitoringTool > m_monTool
SG::WriteHandleKey< xAOD::TrigCompositeContainer > m_HPtdEdxTrkKey
StatusCode doMonitor(const xAOD::TrigCompositeContainer *) const
SG::ReadHandleKey< xAOD::TrigCompositeContainer > m_dEdxHitKey
bool setObjectLink(const std::string &name, const ElementLink< CONTAINER > &link)
Set the link to an object.
bool setDetail(const std::string &name, const TYPE &value)
Set an TYPE detail on the object.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
const std::string & viewString()
xAOD::TrigComposite Decision
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.
bool allFailed(const Decision *d)
return true if there is no positive decision stored
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.
TrigCompositeContainer_v1 TrigCompositeContainer
Declare the latest version of the container.
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...