Skip to content

Commit

Permalink
Fix histograms after Gaudi v39
Browse files Browse the repository at this point in the history
RootHistogram has been renamed to StaticHistogram, see
key4hep/k4FWCore#239
  • Loading branch information
jmcarcell committed Sep 22, 2024
1 parent 80d612f commit 620e1d6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
16 changes: 8 additions & 8 deletions k4Reco/DDPlanarDigi/components/DDPlanarDigi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@ DDPlanarDigi::DDPlanarDigi(const std::string& name, ISvcLocator* svcLoc)
throw std::runtime_error("DDPlanarDigi: Inconsistent number of resolutions given for U and V coordinate");
}

m_histograms[hu].reset(new Gaudi::Accumulators::RootHistogram<1>{this, "hu", "smearing u", {50, -5., +5.}});
m_histograms[hv].reset(new Gaudi::Accumulators::RootHistogram<1>{this, "hv", "smearing v", {50, -5., +5.}});
m_histograms[hT].reset(new Gaudi::Accumulators::RootHistogram<1>{this, "hT", "smearing time", {50, -5., +5.}});
m_histograms[hu].reset(new Gaudi::Accumulators::StaticRootHistogram<1>{this, "hu", "smearing u", {50, -5., +5.}});
m_histograms[hv].reset(new Gaudi::Accumulators::StaticRootHistogram<1>{this, "hv", "smearing v", {50, -5., +5.}});
m_histograms[hT].reset(new Gaudi::Accumulators::StaticRootHistogram<1>{this, "hT", "smearing time", {50, -5., +5.}});

m_histograms[diffu].reset(new Gaudi::Accumulators::RootHistogram<1>{this, "diffu", "diff u", {1000, -.1, +.1}});
m_histograms[diffv].reset(new Gaudi::Accumulators::RootHistogram<1>{this, "diffv", "diff v", {1000, -.1, +.1}});
m_histograms[diffT].reset(new Gaudi::Accumulators::RootHistogram<1>{this, "diffT", "diff time", {1000, -5., +5.}});
m_histograms[diffu].reset(new Gaudi::Accumulators::StaticRootHistogram<1>{this, "diffu", "diff u", {1000, -.1, +.1}});
m_histograms[diffv].reset(new Gaudi::Accumulators::StaticRootHistogram<1>{this, "diffv", "diff v", {1000, -.1, +.1}});
m_histograms[diffT].reset(new Gaudi::Accumulators::StaticRootHistogram<1>{this, "diffT", "diff time", {1000, -5., +5.}});

m_histograms[hitE].reset(new Gaudi::Accumulators::RootHistogram<1>{this, "hitE", "hitEnergy in keV", {1000, 0, 200}});
m_histograms[hitsAccepted].reset(new Gaudi::Accumulators::RootHistogram<1>{
m_histograms[hitE].reset(new Gaudi::Accumulators::StaticRootHistogram<1>{this, "hitE", "hitEnergy in keV", {1000, 0, 200}});
m_histograms[hitsAccepted].reset(new Gaudi::Accumulators::StaticRootHistogram<1>{
this, "hitsAccepted", "Fraction of accepted hits [%]", {201, 0, 100.5}});

m_geoSvc = serviceLocator()->service(m_geoSvcName);
Expand Down
13 changes: 12 additions & 1 deletion k4Reco/DDPlanarDigi/components/DDPlanarDigi.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@
#include <string>
#include <vector>

#include "GAUDI_VERSION.h"

#if GAUDI_MAJOR_VERSION < 39
namespace Gaudi::Accumulators {
using StaticRootHistogram = Gaudi::Accumulators::RootHistogram;
}
#endif

/** ======= DDPlanarDigi ========== <br>
* Creates TrackerHits from SimTrackerHits, smearing them according to the input parameters.
* The positions of "digitized" TrackerHits are obtained by gaussian smearing positions
Expand Down Expand Up @@ -119,12 +127,15 @@ struct DDPlanarDigi final
"Output file name for the histograms"};

const dd4hep::rec::SurfaceMap* surfaceMap;
std::array<std::unique_ptr<Gaudi::Accumulators::RootHistogram<1>>, hSize> m_histograms;
std::array<std::unique_ptr<Gaudi::Accumulators::StaticRootHistogram<1>>, hSize> m_histograms;
std::string m_collName;

inline static thread_local TRandom2 m_engine;
SmartIF<IGeoSvc> m_geoSvc;
SmartIF<IUniqueIDGenSvc> m_uidSvc;

public:
void registerCallBack(Gaudi::StateMachine::Transition, std::function<void()>) {}
};

DECLARE_COMPONENT(DDPlanarDigi)
Expand Down

0 comments on commit 620e1d6

Please sign in to comment.