diff --git a/k4Reco/DDPlanarDigi/components/DDPlanarDigi.cpp b/k4Reco/DDPlanarDigi/components/DDPlanarDigi.cpp index f2ab57a..aaa4b52 100644 --- a/k4Reco/DDPlanarDigi/components/DDPlanarDigi.cpp +++ b/k4Reco/DDPlanarDigi/components/DDPlanarDigi.cpp @@ -23,18 +23,15 @@ #include "edm4hep/TrackerHitPlaneCollection.h" #include "Gaudi/Accumulators/RootHistogram.h" -#include "Gaudi/Histograming/Sink/Utils.h" -#include "DD4hep/BitFieldCoder.h" #include "DD4hep/DD4hepUnits.h" #include "DD4hep/Detector.h" +#include "DDSegmentation/BitFieldCoder.h" -#include "TFile.h" #include "TMath.h" #include #include -#include DDPlanarDigi::DDPlanarDigi(const std::string& name, ISvcLocator* svcLoc) : MultiTransformer(name, svcLoc, @@ -156,7 +153,7 @@ std::tuple 0) { + if (m_resTLayer.size() && m_resTLayer[0] > 0) { float resT = m_resTLayer.size() > 1 ? m_resTLayer[layer] : m_resTLayer[0]; double tSmear = resT > 0 ? m_engine.Gaus(0, resT) : 0; @@ -312,22 +309,3 @@ std::tuple names = {"hu", "hv", "hT", "hitE", "hitsAccepted", "diffu", "diffv", "diffT", "hSize"}; - auto it = names.begin(); - for (auto& h : m_histograms) { - std::string name = ""; - // Name that will appear in the stats table - std::string histName = *it; - nlohmann::json json = *h; - auto [histo, dir] = - Gaudi::Histograming::Sink::jsonToRootHistogram>( - name, histName, json); - histo.Write(*it); - ++it; - } - file->Close(); - return StatusCode::SUCCESS; -} diff --git a/k4Reco/DDPlanarDigi/components/DDPlanarDigi.h b/k4Reco/DDPlanarDigi/components/DDPlanarDigi.h index 31aca7f..2fc327e 100644 --- a/k4Reco/DDPlanarDigi/components/DDPlanarDigi.h +++ b/k4Reco/DDPlanarDigi/components/DDPlanarDigi.h @@ -35,7 +35,6 @@ #include "TRandom2.h" -#include #include #include @@ -78,7 +77,6 @@ struct DDPlanarDigi final DDPlanarDigi(const std::string& name, ISvcLocator* svcLoc); StatusCode initialize() override; - StatusCode finalize() override; std::tuple operator()( const edm4hep::SimTrackerHitCollection& simTrackerHits, @@ -94,7 +92,7 @@ struct DDPlanarDigi final Gaudi::Property> m_resTLayer{ this, "ResolutionT", - {0.004}, + {-1}, "Resolution in the direction of t; either one per layer or one for all layers. If the single entry is negative, " "disable time smearing. "}; Gaudi::Property m_forceHitsOntoSurface{this, "ForceHitsOntoSurface", false, diff --git a/k4Reco/DDPlanarDigi/options/runDDPlanarDigi.py b/k4Reco/DDPlanarDigi/options/runDDPlanarDigi.py index 75d58c6..2d2a3dd 100644 --- a/k4Reco/DDPlanarDigi/options/runDDPlanarDigi.py +++ b/k4Reco/DDPlanarDigi/options/runDDPlanarDigi.py @@ -22,6 +22,8 @@ from Configurables import DDPlanarDigi from Configurables import GeoSvc from Configurables import UniqueIDGenSvc +from Configurables import RootHistSvc +from Configurables import Gaudi__Histograming__Sink__Root as RootHistoSink import os id_service = UniqueIDGenSvc("UniqueIDGenSvc") @@ -50,9 +52,13 @@ # "EventHeader", # ] +hps = RootHistSvc("HistogramPersistencySvc") +root_hist_svc = RootHistoSink("RootHistoSink") +root_hist_svc.FileName = "ddplanardigi_hist.root" + ApplicationMgr(TopAlg=[digi], EvtSel="NONE", EvtMax=-1, - ExtSvc=[EventDataSvc("EventDataSvc")], + ExtSvc=[EventDataSvc("EventDataSvc"), root_hist_svc], OutputLevel=INFO, )