Skip to content
Snippets Groups Projects
Commit 2d286ed0 authored by Marco Cattaneo's avatar Marco Cattaneo
Browse files

Merge branch 'sponce_useNewCounters' into 'master'

Use new counters

See merge request !284
parents 230e3b04 e00c687a
No related branches found
No related tags found
1 merge request!284Use new counters
......@@ -15,7 +15,7 @@ STClusterKiller::STClusterKiller( const std::string& name,
{
declareProperty("SelectorType", m_selectorType = "STSelectClustersByChannel");
declareSTConfigProperty("InputLocation",m_inputLocation, STClusterLocation::TTClusters);
declareSTConfigProperty("InputLocation",m_inputLocation, STClusterLocation::TTClusters);
declareSTConfigProperty("SelectorName", m_selectorName, detType()+"Killer");
}
......@@ -33,16 +33,16 @@ StatusCode STClusterKiller::initialize()
StatusCode STClusterKiller::execute()
{
STClusters* clusterCont = get<STClusters>(m_inputLocation);
// make list of clusters to remove
std::vector<STChannelID> chanList; chanList.reserve(100);
removedClusters(clusterCont,chanList);
// remove from the container
std::vector<STChannelID>::reverse_iterator iterVec = chanList.rbegin();
std::vector<STChannelID>::reverse_iterator iterVec = chanList.rbegin();
for (; iterVec != chanList.rend(); ++iterVec){
clusterCont->erase(*iterVec);
} // iterVec
......@@ -61,25 +61,23 @@ void STClusterKiller::removedClusters(const LHCb::STClusters* clusterCont,
const bool select = (*m_clusterSelector)(*iterC);
if (select == true){;
deadClusters.push_back((*iterC)->key());
++counter("Dead");
++m_deadCnt;
}
++counter("Processed");
++m_processedCnt;
} // iterC
}
StatusCode STClusterKiller::finalize() {
const double dead = counter("Dead").flag();
const double processed = counter("Processed").flag();
const double dead = m_deadCnt.nEntries();
const double processed = m_processedCnt.nEntries();
double killed = 0.0;
if (!LHCb::Math::Equal_To<double>()(processed, 0.0)){
killed = dead/processed;
double killed = 0.0;
if (!LHCb::Math::Equal_To<double>()(processed, 0.0)){
killed = dead/processed;
}
info() << "Fraction of clusters killed " << 100* killed << " %" << endmsg;
return ST::AlgBase::finalize();
}
......@@ -8,7 +8,7 @@
/** @class STClusterKiller STClusterKiller.h
*
* Class for killing clusters
* Class for killing clusters
*
* @author M.Needham
* @date 06/10/2007
......@@ -23,9 +23,9 @@ namespace LHCb{
class STClusterKiller :public ST::AlgBase {
public:
// Constructor
STClusterKiller( const std::string& name, ISvcLocator* pSvcLocator);
STClusterKiller( const std::string& name, ISvcLocator* pSvcLocator);
// IAlgorithm members
StatusCode initialize() override;
......@@ -33,7 +33,7 @@ public:
StatusCode finalize() override;
private:
void removedClusters(const LHCb::STClusters* clusterCont,
std::vector<LHCb::STChannelID>& deadClusters) const;
......@@ -45,6 +45,8 @@ private:
std::string m_inputLocation;
mutable Gaudi::Accumulators::Counter<> m_deadCnt{ this, "Dead" };
mutable Gaudi::Accumulators::Counter<> m_processedCnt{ this, "Processed" };
};
#endif // STCLUSTERKILLER_H
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