Commit 263b0a02 authored by Sylvester Joosten's avatar Sylvester Joosten
Browse files

Update for improved cluster ID/relations

parent 3d74a493
......@@ -12,24 +12,29 @@
// Event Model related classes
#include "dd4pod/Geant4ParticleCollection.h"
#include "eicd/ReconstructedParticleCollection.h"
#include "eicd/ReconstructedParticleRelationsCollection.h"
namespace Jug {
namespace Base {
namespace Jug::Base {
class MC2DummyParticle : public GaudiAlgorithm, AlgorithmIDMixin<int32_t> {
public:
DataHandle<dd4pod::Geant4ParticleCollection> m_inputHitCollection{"mcparticles", Gaudi::DataHandle::Reader, this};
DataHandle<eic::ReconstructedParticleCollection> m_outputHitCollection{"DummyReconstructedParticles",
Gaudi::DataHandle::Writer, this};
DataHandle<eic::ReconstructedParticleRelationsCollection>
m_outputRelCollection{"DummyReconstructedParticleRelations", Gaudi::DataHandle::Writer, this};
Rndm::Numbers m_gaussDist;
Gaudi::Property<double> m_smearing{this, "smearing", 0.01 /* 1 percent*/};
const int32_t kMonteCarloSource{uniqueID<int32_t>("mcparticles")};
MC2DummyParticle(const std::string& name, ISvcLocator* svcLoc)
: GaudiAlgorithm(name, svcLoc)
, AlgorithmIDMixin(name, info())
{
declareProperty("inputCollection", m_inputHitCollection, "mcparticles");
declareProperty("outputCollection", m_outputHitCollection, "DummyReconstructedParticles");
declareProperty("outputRelations", m_outputRelCollection, "DummyReconstructedParticles");
}
StatusCode initialize() override
{
......@@ -49,6 +54,7 @@ namespace Jug {
const dd4pod::Geant4ParticleCollection* parts = m_inputHitCollection.get();
// output collection
auto out_parts = m_outputHitCollection.createAndPut();
auto relations = m_outputRelCollection.createAndPut();
int ID = 0;
for (const auto& p : *parts) {
if (p.genStatus() != 1) {
......@@ -72,14 +78,13 @@ namespace Jug {
eic::VectorXYZ psmear{px, py, pz};
eic::ReconstructedParticle rec_part{
ID++, // Unique index
{ID++, algorithmID()}, // Unique index
psmear, // 3-momentum [GeV]
{vx, vy, vz}, // Vertex [mm]
static_cast<float>(p.time()), // time [ns]
p.pdgID(), // PDG type
static_cast<int16_t>(p.status()), // Status
static_cast<int16_t>(p.charge()), // Charge
algorithmID(), // Algorithm type
1., // particle weight
{psmear.theta(), psmear.phi()}, // direction
momentum, // 3-momentum magnitude [GeV]
......@@ -87,6 +92,10 @@ namespace Jug {
static_cast<float>(p.mass())}; // mass [GeV]
out_parts->push_back(rec_part);
eic::ReconstructedParticleRelations rel;
rel.mcID({p.ID(), kMonteCarloSource});
relations->push_back(rel);
}
return StatusCode::SUCCESS;
}
......@@ -94,6 +103,5 @@ namespace Jug {
DECLARE_COMPONENT(MC2DummyParticle)
} // namespace Base
} // namespace Jug
} // namespace Jug::Base
......@@ -15,14 +15,15 @@
#include "Gaudi/Property.h"
#include "GaudiKernel/RndmGenerators.h"
// FCCSW
#include "JugBase/DataHandle.h"
#include "JugBase/UniqueID.h"
// Event Model related classes
#include "dd4pod/CalorimeterHitCollection.h"
#include "eicd/RawCalorimeterHitCollection.h"
#include "eicd/RawCalorimeterHitData.h"
using namespace Gaudi::Units;
namespace Jug::Digi {
......@@ -32,7 +33,7 @@ namespace Jug::Digi {
* \ingroup digi
* \ingroup calorimetry
*/
class CalorimeterHitDigi : public GaudiAlgorithm {
class CalorimeterHitDigi : public GaudiAlgorithm, AlgorithmIDMixin<> {
public:
// additional smearing resolutions
Gaudi::Property<std::vector<double>> u_eRes{this, "energyResolutions", {}}; // a/sqrt(E/GeV) + b + c/(E/GeV)
......@@ -53,7 +54,9 @@ namespace Jug::Digi {
double dyRangeADC, tRes, eRes[3] = {0., 0., 0.};
// ill-formed: using GaudiAlgorithm::GaudiAlgorithm;
CalorimeterHitDigi(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc)
CalorimeterHitDigi(const std::string& name, ISvcLocator* svcLoc)
: GaudiAlgorithm(name, svcLoc)
, AlgorithmIDMixin{name, info()}
{
declareProperty("inputHitCollection", m_inputHitCollection, "");
declareProperty("outputHitCollection", m_outputHitCollection, "");
......@@ -97,10 +100,11 @@ namespace Jug::Digi {
double ped = m_pedMeanADC + m_normDist() * m_pedSigmaADC;
long long adc = std::llround(ped + ahit.energyDeposit() * (1. + eResRel) / dyRangeADC * m_capADC);
eic::RawCalorimeterHit rawhit(
{nhits++, algorithmID()},
(long long)ahit.cellID(),
(adc > m_capADC.value() ? m_capADC.value() : adc),
static_cast<int64_t>(1e6*(double)ahit.truth().time + m_normDist() * tRes), // @FIXME: this shouldn't be hardcoded, but should still be stored as an integer type
nhits++);
static_cast<int64_t>(1e6*(double)ahit.truth().time + m_normDist() * tRes) // @FIXME: this shouldn't be hardcoded, but should still be stored as an integer type
);
rawhits->push_back(rawhit);
}
return StatusCode::SUCCESS;
......
......@@ -7,8 +7,8 @@
#include "Gaudi/Property.h"
#include "GaudiKernel/PhysicalConstants.h"
// FCCSW
#include "JugBase/DataHandle.h"
#include "JugBase/UniqueID.h"
// Event Model related classes
#include "eicd/RawCalorimeterHitCollection.h"
......@@ -22,7 +22,7 @@ namespace Jug {
*
* \ingroup digi
*/
class CrystalEndcapsDigi : public GaudiAlgorithm {
class CrystalEndcapsDigi : public GaudiAlgorithm, AlgorithmIDMixin<> {
public:
Gaudi::Property<double> m_energyResolution{this, "energyResolution", 0.02}; // 2%sqrt(E)
......@@ -32,7 +32,8 @@ namespace Jug {
// ill-formed: using GaudiAlgorithm::GaudiAlgorithm;
CrystalEndcapsDigi(const std::string& name, ISvcLocator* svcLoc)
: GaudiAlgorithm(name, svcLoc) {
: GaudiAlgorithm(name, svcLoc)
, AlgorithmIDMixin(name, info()) {
declareProperty("inputHitCollection", m_inputHitCollection,"");
declareProperty("outputHitCollection", m_outputHitCollection, "");
}
......@@ -61,9 +62,10 @@ namespace Jug {
for (const auto& ahit : *simhits) {
double res = m_gaussDist()/sqrt(ahit.energyDeposit());
eic::RawCalorimeterHit rawhit(
{nhits++, algorithmID()},
(long long) ahit.cellID(),
std::llround(ahit.energyDeposit() * (1. + res)*1.0e6), // convert to keV integer
(double) ahit.truth().time, nhits++);
(double) ahit.truth().time);
rawhits->push_back(rawhit);
}
return StatusCode::SUCCESS;
......
......@@ -7,8 +7,8 @@
#include "GaudiKernel/RndmGenerators.h"
#include "Gaudi/Property.h"
// FCCSW
#include "JugBase/DataHandle.h"
#include "JugBase/UniqueID.h"
// Event Model related classes
#include "eicd/RawCalorimeterHitCollection.h"
......@@ -22,7 +22,7 @@ namespace Jug {
*
* \ingroup digi
*/
class EMCalorimeterDigi : public GaudiAlgorithm {
class EMCalorimeterDigi : public GaudiAlgorithm, AlgorithmIDMixin<> {
public:
using SimHit = dd4pod::CalorimeterHitCollection;
using RawHit = eic::RawCalorimeterHitCollection;
......@@ -32,7 +32,9 @@ namespace Jug {
Gaudi::Property<double> m_energyResolution{this, "energyResolution", 0.05 /* 5 percent*/};
Rndm::Numbers m_gaussDist;
EMCalorimeterDigi(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc)
EMCalorimeterDigi(const std::string& name, ISvcLocator* svcLoc)
: GaudiAlgorithm(name, svcLoc)
, AlgorithmIDMixin(name, info())
{
declareProperty("inputHitCollection", m_inputHitCollection, "");
declareProperty("outputHitCollection", m_outputHitCollection, "");
......@@ -62,9 +64,10 @@ namespace Jug {
// std::cout << ahit << "\n";
double sqrtE = std::sqrt(ahit.energyDeposit()) ;
double aterm = m_gaussDist()*sqrtE;
eic::RawCalorimeterHit rawhit((long long)ahit.cellID(),
eic::RawCalorimeterHit rawhit({nhits++, algorithmID()},
(long long)ahit.cellID(),
std::llround((ahit.energyDeposit() + aterm) * 1e6),
ahit.truth().time * 1e6, nhits++);
ahit.truth().time * 1e6);
rawhits->push_back(rawhit);
}
return StatusCode::SUCCESS;
......
......@@ -8,8 +8,8 @@
#include "Gaudi/Property.h"
#include "GaudiKernel/RndmGenerators.h"
// FCCSW
#include "JugBase/DataHandle.h"
#include "JugBase/UniqueID.h"
// Event Model related classes
#include "dd4pod/CalorimeterHitCollection.h"
......@@ -25,7 +25,7 @@ namespace Jug {
*
* \ingroup digi
*/
class EcalTungstenSamplingDigi : public GaudiAlgorithm {
class EcalTungstenSamplingDigi : public GaudiAlgorithm, AlgorithmIDMixin<> {
public:
Gaudi::Property<double> m_eRes{this, "energyResolution", 0.11}; // a%/sqrt(E/GeV)
Gaudi::Property<std::vector<double>> u_eRes{this, "energyResolutions", {}}; // a%/sqrt(E/GeV) + b% + c%/E
......@@ -44,7 +44,9 @@ namespace Jug {
double res[3] = {0., 0., 0.};
// ill-formed: using GaudiAlgorithm::GaudiAlgorithm;
EcalTungstenSamplingDigi(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc)
EcalTungstenSamplingDigi(const std::string& name, ISvcLocator* svcLoc)
: GaudiAlgorithm(name, svcLoc)
, AlgorithmIDMixin(name, info())
{
declareProperty("inputHitCollection", m_inputHitCollection, "");
declareProperty("outputHitCollection", m_outputHitCollection, "");
......@@ -86,10 +88,10 @@ namespace Jug {
double ped = m_pedMeanADC + m_normDist()*m_pedSigmaADC;
long long adc = std::llround(ped + ahit.energyDeposit()*(1. + resval) * m_eUnit/m_dyRangeADC*m_capADC);
eic::RawCalorimeterHit rawhit(
{nhits++, algorithmID()},
(long long)ahit.cellID(),
(adc > m_capADC ? m_capADC.value() : adc),
(double)ahit.truth().time*m_tUnit/ns + m_normDist()*m_tRes/ns,
nhits++);
(double)ahit.truth().time*m_tUnit/ns + m_normDist()*m_tRes/ns);
rawhits->push_back(rawhit);
}
return StatusCode::SUCCESS;
......
......@@ -5,8 +5,8 @@
#include "GaudiAlg/Producer.h"
#include "GaudiAlg/GaudiTool.h"
// FCCSW
#include "JugBase/DataHandle.h"
#include "JugBase/UniqueID.h"
// Event Model related classes
//#include "GaudiExamples/MyTrack.h"
......@@ -17,85 +17,11 @@
namespace Jug {
namespace Digi {
//using BaseClass_t = Gaudi::Functional::Traits::BaseClass_t<Gaudi::Algorithm>;
///** Do not use this as an example!!!
// * This is for testing purposes only.
// */
//struct ExampleCaloDigiFunc final
// : Gaudi::Functional::Producer<std::vector<eic::RawCalorimeterHitData>(const dd4pod::CalorimeterHitCollection&),
// BaseClass_t> {
// ExampleCaloDigiFunc(const std::string& name, ISvcLocator* pSvc)
// : Transformer(name, pSvc, KeyValue("InputData", {"FAEC_ShHits"})},
// KeyValue("OutputData", {"ForwardPreshowerHits"})) {
// declareProperty("InputData", m_inputHitCollection, "FAEC_ShHits");
// }
// StatusCode initialize() override {
// if (Gaudi::Functional::Transformer<std::vector<eic::RawCalorimeterHitData>(const dd4pod::CalorimeterHitCollection&),
// BaseClass_t>::initialize()
// .isFailure())
// return StatusCode::FAILURE;
// // f_counter = m_starting_value.value();
// return StatusCode::SUCCESS;
// }
// std::vector<eic::RawCalorimeterHitData> operator()(const dd4pod::CalorimeterHitCollection& in_hits) const override {
// //const dd4pod::CalorimeterHitCollection* in_hits =
// // m_inputHitCollection.get();
// std::vector<eic::RawCalorimeterHitData> out_hits;
// for (auto i = in_hits.begin(), end = in_hits.end(); i != end; ++i) {
// out_hits.push_back(eic::RawCalorimeterHitData{
// (long long)i->cellID(), (long long)i->cellID(),
// (long long)i->energyDeposit() * 100, 0});
// }
// return out_hits;
// }
//};
//DECLARE_COMPONENT(ExampleCaloDigiFunc)
///** Do not use this as an example!!!
// * This is for testing purposes only.
// */
//struct ExampleCaloDigiFunc2 final
// : Gaudi::Functional::Producer<std::vector<eic::RawCalorimeterHitData>(),
// BaseClass_t> {
// ExampleCaloDigiFunc2(const std::string& name, ISvcLocator* pSvc)
// : Producer(name, pSvc, //,//KeyValue("InputData", {"FAEC_ShHits"})},
// KeyValue("OutputData", {"ForwardPreshowerHits"})) {
// declareProperty("InputData", m_inputHitCollection, "FAEC_ShHits");
// }
// StatusCode initialize() override {
// if (Gaudi::Functional::Producer<std::vector<eic::RawCalorimeterHitData>(),
// BaseClass_t>::initialize()
// .isFailure())
// return StatusCode::FAILURE;
// // f_counter = m_starting_value.value();
// return StatusCode::SUCCESS;
// }
// std::vector<eic::RawCalorimeterHitData> operator()() const override {
// const dd4pod::CalorimeterHitCollection* in_hits =
// m_inputHitCollection.get();
// std::vector<eic::RawCalorimeterHitData> out_hits;
// for (auto i = in_hits->begin(), end = in_hits->end(); i != end; ++i) {
// out_hits.push_back(eic::RawCalorimeterHitData{
// (long long)i->cellID(), (long long)i->cellID(),
// (long long)i->energyDeposit() * 100, 0});
// }
// return out_hits;
// }
// mutable DataHandle<dd4pod::CalorimeterHitCollection> m_inputHitCollection{
// "inputHitCollection", Gaudi::DataHandle::Reader, this};
//};
//DECLARE_COMPONENT(ExampleCaloDigiFunc2)
class ExampleCaloDigi : public GaudiAlgorithm {
class ExampleCaloDigi : public GaudiAlgorithm, AlgorithmIDMixin<> {
public:
// ill-formed: using GaudiAlgorithm::GaudiAlgorithm;
ExampleCaloDigi(const std::string& name, ISvcLocator* svcLoc)
: GaudiAlgorithm(name, svcLoc) {
: GaudiAlgorithm(name, svcLoc), AlgorithmIDMixin(name, info()) {
declareProperty("inputHitCollection", m_inputHitCollection,"");
declareProperty("outputHitCollection", m_outputHitCollection, "");
}
......@@ -113,7 +39,7 @@ namespace Jug {
int nhits = 0;
for(const auto& ahit : *simhits) {
//std::cout << ahit << "\n";
eic::RawCalorimeterHit rawhit((long long)ahit.cellID(), std::llround(ahit.energyDeposit() * 100), 0, nhits++);
eic::RawCalorimeterHit rawhit({nhits++, algorithmID()}, (long long)ahit.cellID(), std::llround(ahit.energyDeposit() * 100), 0);
rawhits->push_back(rawhit);
}
return StatusCode::SUCCESS;
......
......@@ -7,8 +7,8 @@
#include "GaudiKernel/RndmGenerators.h"
#include "Gaudi/Property.h"
// FCCSW
#include "JugBase/DataHandle.h"
#include "JugBase/UniqueID.h"
// Event Model related classes
#include "eicd/RawCalorimeterHitCollection.h"
......@@ -30,7 +30,7 @@ namespace Jug {
*
* \ingroup digi
*/
class HadronicCalDigi : public GaudiAlgorithm {
class HadronicCalDigi : public GaudiAlgorithm, AlgorithmIDMixin<> {
public:
Gaudi::Property<double> m_energyResolution_a{this, "energyResolution_a", 0.5 /*50 percent*/};
Gaudi::Property<double> m_energyResolution_b{this, "energyResolution_b", 0.05 /* 5 percent*/};
......@@ -42,7 +42,8 @@ namespace Jug {
Gaudi::DataHandle::Writer, this};
public:
HadronicCalDigi(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) {
HadronicCalDigi(const std::string& name, ISvcLocator* svcLoc)
: GaudiAlgorithm(name, svcLoc), AlgorithmIDMixin(name, info()) {
declareProperty("inputHitCollection", m_inputHitCollection, "");
declareProperty("outputHitCollection", m_outputHitCollection, "");
}
......@@ -78,8 +79,9 @@ namespace Jug {
double aterm = m_gaussDist_a()*sqrtE;
double bterm = ahit.energyDeposit()*m_gaussDist_b();
// here 1000 is arbitrary scale factor
eic::RawCalorimeterHit rawhit((long long)ahit.cellID(),
std::llround(ahit.energyDeposit() +aterm + bterm * 1000), 0, nhits++);
eic::RawCalorimeterHit rawhit({nhits++, algorithmID()},
(long long)ahit.cellID(),
std::llround(ahit.energyDeposit() +aterm + bterm * 1000), 0);
rawhits->push_back(rawhit);
}
return StatusCode::SUCCESS;
......
......@@ -18,6 +18,7 @@
#include "GaudiKernel/PhysicalConstants.h"
#include "JugBase/DataHandle.h"
#include "JugBase/UniqueID.h"
// Event Model related classes
#include "eicd/RawPMTHitCollection.h"
......@@ -32,7 +33,7 @@ namespace Jug::Digi {
*
* \ingroup digi
*/
class PhotoMultiplierDigi : public GaudiAlgorithm
class PhotoMultiplierDigi : public GaudiAlgorithm, AlgorithmIDMixin<>
{
public:
DataHandle<dd4pod::PhotoMultiplierHitCollection>
......@@ -52,6 +53,7 @@ public:
// constructor
PhotoMultiplierDigi(const std::string& name, ISvcLocator* svcLoc)
: GaudiAlgorithm(name, svcLoc)
, AlgorithmIDMixin(name, info())
{
declareProperty("inputHitCollection", m_inputHitCollection,"");
declareProperty("outputHitCollection", m_outputHitCollection, "");
......@@ -122,8 +124,8 @@ public:
for (auto &it : hit_groups) {
for (auto &data : it.second) {
eic::RawPMTHit hit{
{ID++, algorithmID()},
it.first,
ID++,
static_cast<uint32_t>(data.signal),
static_cast<uint32_t>(data.time/(m_timeStep/ns))};
raw.push_back(hit);
......
......@@ -6,8 +6,8 @@
#include "GaudiKernel/RndmGenerators.h"
#include "Gaudi/Property.h"
// FCCSW
#include "JugBase/DataHandle.h"
#include "JugBase/UniqueID.h"
// Event Model related classes
//#include "GaudiExamples/MyTrack.h"
......@@ -21,7 +21,7 @@ namespace Jug {
*
* \ingroup digi
*/
class SOIPIXTrackerDigi : public GaudiAlgorithm {
class SOIPIXTrackerDigi : public GaudiAlgorithm, AlgorithmIDMixin<> {
public:
Gaudi::Property<double> m_timeResolution{this, "timeResolution", 1e3}; // ns -- todo add units
Rndm::Numbers m_gaussDist;
......@@ -30,11 +30,11 @@ namespace Jug {
public:
// ill-formed: using GaudiAlgorithm::GaudiAlgorithm;
SOIPIXTrackerDigi(const std::string& name, ISvcLocator* svcLoc)
: GaudiAlgorithm(name, svcLoc) {
declareProperty("inputHitCollection", m_inputHitCollection,"");
declareProperty("outputHitCollection", m_outputHitCollection, "");
}
SOIPIXTrackerDigi(const std::string& name, ISvcLocator* svcLoc)
: GaudiAlgorithm(name, svcLoc), AlgorithmIDMixin(name, info()) {
declareProperty("inputHitCollection", m_inputHitCollection, "");
declareProperty("outputHitCollection", m_outputHitCollection, "");
}
StatusCode initialize() override {
if (GaudiAlgorithm::initialize().isFailure())
return StatusCode::FAILURE;
......@@ -56,9 +56,9 @@ namespace Jug {
// std::cout << ahit << "\n";
if (cell_hit_map.count(ahit.cellID()) == 0) {
cell_hit_map[ahit.cellID()] = rawhits->size();
eic::RawTrackerHit rawhit((long long)ahit.cellID(),
ID++,
ahit.truth().time * 1e6 + m_gaussDist() * 1e6, // ns->fs
eic::RawTrackerHit rawhit({ID++, algorithmID()}, (long long)ahit.cellID(),
ahit.truth().time * 1e6 +
m_gaussDist() * 1e6, // ns->fs
std::llround(ahit.energyDeposit() * 1e6));
rawhits->push_back(rawhit);
} else {
......
......@@ -6,12 +6,10 @@
#include "GaudiKernel/RndmGenerators.h"
#include "Gaudi/Property.h"
// FCCSW
#include "JugBase/DataHandle.h"
#include "JugBase/UniqueID.h"
// Event Model related classes
//#include "GaudiExamples/MyTrack.h"
//
// dd4pod's tracker hit is the input collectiopn
#include "dd4pod/TrackerHitCollection.h"
// eicd's RawTrackerHit is the output
......@@ -23,7 +21,7 @@ namespace Jug::Digi {
*
* \ingroup digi
*/
class SiliconTrackerDigi : public GaudiAlgorithm {
class SiliconTrackerDigi : public GaudiAlgorithm, AlgorithmIDMixin<> {
public:
Gaudi::Property<double> m_timeResolution{this, "timeResolution", 10}; // todo : add units
Rndm::Numbers m_gaussDist;
......@@ -34,7 +32,9 @@ namespace Jug::Digi {
public:
// ill-formed: using GaudiAlgorithm::GaudiAlgorithm;
SiliconTrackerDigi(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc)
SiliconTrackerDigi(const std::string& name, ISvcLocator* svcLoc)
: GaudiAlgorithm(name, svcLoc)
, AlgorithmIDMixin(name, info())
{
declareProperty("inputHitCollection", m_inputHitCollection, "");
declareProperty("outputHitCollection", m_outputHitCollection, "");
......@@ -68,8 +68,8 @@ namespace Jug::Digi {
// std::cout << ahit << "\n";
if (cell_hit_map.count(ahit.cellID()) == 0) {
cell_hit_map[ahit.cellID()] = rawhits->size();
eic::RawTrackerHit rawhit((int64_t)ahit.cellID(),
ID++,
eic::RawTrackerHit rawhit({ID++, algorithmID()},
(int64_t)ahit.cellID(),
ahit.truth().time * 1e6 + m_gaussDist() * 1e3, // ns->fs
std::llround(ahit.energyDeposit() * 1e6));
rawhits->push_back(rawhit);
......
......@@ -6,8 +6,8 @@
#include "GaudiKernel/RndmGenerators.h"
#include "Gaudi/Property.h"
// FCCSW
#include "JugBase/DataHandle.h"
#include "JugBase/UniqueID.h"
// Event Model related classes
//#include "GaudiExamples/MyTrack.h"
......@@ -23,7 +23,7 @@ namespace Jug::Digi {
*
* \ingroup digi
*/
class UFSDTrackerDigi : public GaudiAlgorithm {
class UFSDTrackerDigi : public GaudiAlgorithm, AlgorithmIDMixin<> {
public:
Gaudi::Property<double> m_timeResolution{this, "timeResolution", 10}; // todo : add units
Rndm::Numbers m_gaussDist;
......@@ -34,7 +34,9 @@ namespace Jug::Digi {
public:
// ill-formed: using GaudiAlgorithm::GaudiAlgorithm;
UFSDTrackerDigi(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc)
UFSDTrackerDigi(const std::string& name, ISvcLocator* svcLoc)
: GaudiAlgorithm(name, svcLoc)
, AlgorithmIDMixin(name, info())
{
declareProperty("inputHitCollection", m_inputHitCollection, "");
declareProperty("outputHitCollection", m_outputHitCollection, "");
......@@ -68,8 +70,8 @@ namespace Jug::Digi {
// std::cout << ahit << "\n";
if (cell_hit_map.count(ahit.cellID()) == 0) {
cell_hit_map[ahit.cellID()] = rawhits->size();
eic::RawTrackerHit rawhit((int64_t)ahit.cellID(),
ID++,
eic::RawTrackerHit rawhit({ID++, algorithmID()},
(int64_t)ahit.cellID(),
ahit.truth().time * 1e6 + m_gaussDist() * 1e3, // ns->fs
std::llround(ahit.energyDeposit() * 1e6));
rawhits->push_back(rawhit);
......
......@@ -211,11 +211,10 @@ namespace Jug::Reco {
// m_geoSvc->cellIDPositionConverter()->findContext(id)->volumePlacement().volIDs().str()
// << endmsg;
hits.push_back({
{rh.ID(), algorithmID()}, // ID
rh.cellID(), // cellID
rh.ID(), // ID
lid, // layer
sid, // sector
algorithmID(), // hit source (a hash of the algorithm name)
energy, // energy
0, // @TODO: energy error
time, // time
......
......@@ -108,6 +108,7 @@ namespace Jug::Reco {
for (const auto &[bins, hits] : merged_hits) {
const auto ref = hits.front();
eic::CalorimeterHit hit;
hit.ID({ref.ID(), algorithmID()});
hit.cellID(ref.cellID());
hit.sector(ref.sector());
hit.layer(ref.layer());
......@@ -125,7 +126,6 @@ namespace Jug::Reco {
for (const auto &h : hits) {
hit.energy(hit.energy() + h.energy());
}
hit.source(algorithmID());
mhits.push_back(hit);
}
......
......@@ -133,7 +133,6 @@ namespace Jug::Reco {
auto poscon = m_geoSvc->cellIDPositionConverter();