Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Calo clustering factories now use JMultifactory #636

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions src/detectors/B0ECAL/Cluster_factory_B0ECalClusters.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,30 @@

#include <random>

#include <services/io/podio/JFactoryPodioT.h>
#include <JANA/JMultifactory.h>
#include <services/geometry/dd4hep/JDD4hep_service.h>
#include <algorithms/calorimetry/CalorimeterClusterRecoCoG.h>
#include <services/log/Log_service.h>
#include <extensions/spdlog/SpdlogExtensions.h>



class Cluster_factory_B0ECalClusters : public eicrecon::JFactoryPodioT<edm4eic::Cluster>, CalorimeterClusterRecoCoG {
class Cluster_factory_B0ECalClusters : public JMultifactory, CalorimeterClusterRecoCoG {

public:
//------------------------------------------
// Constructor
Cluster_factory_B0ECalClusters(){
SetTag("B0ECalClusters");
m_log = japp->GetService<Log_service>()->logger(GetTag());
DeclarePodioOutput<edm4eic::Cluster>("B0ECalClusters");
DeclarePodioOutput<edm4eic::MCRecoClusterParticleAssociation>("B0ECalClusterAssociations");
}

//------------------------------------------
// Init
void Init() override{
auto app = GetApplication();
auto app = japp; // GetApplication(); // TODO: NWB: FIXME after JANA2 v2.1.1
m_log = app->GetService<Log_service>()->logger("B0ECalClusters");

//-------- Configuration Parameters ------------
m_input_simhit_tag="B0ECalHits";
m_input_protoclust_tag="B0ECalIslandProtoClusters";
Expand Down Expand Up @@ -59,28 +61,25 @@ class Cluster_factory_B0ECalClusters : public eicrecon::JFactoryPodioT<edm4eic::

//------------------------------------------
// ChangeRun
void ChangeRun(const std::shared_ptr<const JEvent> &event) override{
void BeginRun(const std::shared_ptr<const JEvent> &event) override{
AlgorithmChangeRun();
}

//------------------------------------------
// Process
void Process(const std::shared_ptr<const JEvent> &event) override{


// Prefill inputs
m_inputSimhits=event->Get<edm4hep::SimCalorimeterHit>(m_input_simhit_tag);
m_inputProto=event->Get<edm4eic::ProtoCluster>(m_input_protoclust_tag);

// Call Process for generic algorithm
AlgorithmProcess();


//outputs

// Hand owner of algorithm objects over to JANA
Set(m_outputClusters);
event->Insert(m_outputAssociations, "B0ECalClusterAssociations");
SetData("B0ECalClusters", m_outputClusters);
SetData("B0ECalClusterAssociations", m_outputAssociations);

m_outputClusters.clear(); // not really needed, but better to not leave dangling pointers around
m_outputAssociations.clear();
}
Expand Down
21 changes: 12 additions & 9 deletions src/detectors/BEMC/Cluster_factory_EcalBarrelImagingClusters.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

#include <random>

#include <services/io/podio/JFactoryPodioT.h>
#include <JANA/JMultifactory.h>
#include <services/geometry/dd4hep/JDD4hep_service.h>
#include <algorithms/calorimetry/ImagingClusterReco.h>
#include <services/log/Log_service.h>
#include <extensions/spdlog/SpdlogExtensions.h>



class Cluster_factory_EcalBarrelImagingClusters : public eicrecon::JFactoryPodioT<edm4eic::Cluster>, ImagingClusterReco {
class Cluster_factory_EcalBarrelImagingClusters : public JMultifactory, ImagingClusterReco {

public:

Expand All @@ -24,14 +24,17 @@ class Cluster_factory_EcalBarrelImagingClusters : public eicrecon::JFactoryPodio
//------------------------------------------
// Constructor
Cluster_factory_EcalBarrelImagingClusters(){
SetTag("EcalBarrelImagingClusters");
m_log = japp->GetService<Log_service>()->logger(GetTag());
DeclarePodioOutput<edm4eic::Cluster>("EcalBarrelImagingClusters");
DeclarePodioOutput<edm4eic::MCRecoClusterParticleAssociation>("EcalBarrelImagingClusterAssociations");
DeclarePodioOutput<edm4eic::Cluster>("EcalBarrelImagingLayers");
}

//------------------------------------------
// Init
void Init() override{
auto app = GetApplication();
auto app = japp; // GetApplication(); // TODO: NWB: FIXME after JANA2 v2.1.1
m_log = app->GetService<Log_service>()->logger("EcalBarrelImagingClusters");

//-------- Configuration Parameters ------------
m_input_simhit_tag="EcalBarrelImagingHits";
m_input_protoclust_tag="EcalBarrelImagingProtoClusters";
Expand All @@ -47,7 +50,6 @@ class Cluster_factory_EcalBarrelImagingClusters : public eicrecon::JFactoryPodio
// Process
void Process(const std::shared_ptr<const JEvent> &event) override{


// Prefill inputs
m_mcHits=event->Get<edm4hep::SimCalorimeterHit>(m_input_simhit_tag);
m_inputProtoClusters=event->Get<edm4eic::ProtoCluster>(m_input_protoclust_tag);
Expand All @@ -56,9 +58,10 @@ class Cluster_factory_EcalBarrelImagingClusters : public eicrecon::JFactoryPodio
execute();

// Hand owner of algorithm objects over to JANA
Set(m_outputClusters);
event->Insert(m_outputAssociations, "EcalBarrelImagingClusterAssociations");
event->Insert(m_outputLayers, "EcalBarrelImagingLayers");
SetData("EcalBarrelImagingClusters", m_outputClusters);
SetData("EcalBarrelImagingClusterAssociations", m_outputAssociations);
SetData("EcalBarrelImagingLayers", m_outputLayers);

m_outputClusters.clear(); // not really needed, but better to not leave dangling pointers around
m_outputAssociations.clear();
m_outputLayers.clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,29 @@

#include <random>

#include <services/io/podio/JFactoryPodioT.h>
#include <JANA/JMultifactory.h>
#include <services/geometry/dd4hep/JDD4hep_service.h>
#include <algorithms/calorimetry/TruthEnergyPositionClusterMerger.h>
#include <services/log/Log_service.h>
#include <extensions/spdlog/SpdlogExtensions.h>


class Cluster_factory_EcalBarrelImagingMergedClusters : public eicrecon::JFactoryPodioT<edm4eic::Cluster>, TruthEnergyPositionClusterMerger {
class Cluster_factory_EcalBarrelImagingMergedClusters : public JMultifactory, TruthEnergyPositionClusterMerger {

public:
//------------------------------------------
// Constructor
Cluster_factory_EcalBarrelImagingMergedClusters(){
SetTag("EcalBarrelImagingMergedClusters");
m_log = japp->GetService<Log_service>()->logger(GetTag());
DeclarePodioOutput<edm4eic::Cluster>("EcalBarrelImagingMergedClusters");
DeclarePodioOutput<edm4eic::MCRecoClusterParticleAssociation>("EcalBarrelImagingMergedClustersAssoc");
}

//------------------------------------------
// Init
void Init() override{
auto app = GetApplication();
auto app = japp; // GetApplication(); // TODO: NWB: FIXME after JANA2 v2.1.1
m_log = app->GetService<Log_service>()->logger("EcalBarrelImagingMergedClusters");

//-------- Configuration Parameters ------------
m_inputMCParticles_tag = "MCParticles";
m_energyClusters_tag = "EcalBarrelScFiClusters";
Expand Down Expand Up @@ -58,8 +60,9 @@ class Cluster_factory_EcalBarrelImagingMergedClusters : public eicrecon::JFactor
execute();

// Hand owner of algorithm objects over to JANA
Set(m_outputClusters);
event->Insert(m_outputAssociations, "EcalBarrelImagingMergedClustersAssoc");
SetData("EcalBarrelImagingMergedClusters", m_outputClusters);
SetData("EcalBarrelImagingMergedClustersAssoc", m_outputAssociations);

m_outputClusters.clear(); // not really needed, but better to not leave dangling pointers around
m_outputAssociations.clear();
}
Expand Down
19 changes: 11 additions & 8 deletions src/detectors/BEMC/Cluster_factory_EcalBarrelScFiClusters.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,30 @@

#include <random>

#include <services/io/podio/JFactoryPodioT.h>
#include <JANA/JMultifactory.h>
#include <services/geometry/dd4hep/JDD4hep_service.h>
#include <algorithms/calorimetry/CalorimeterClusterRecoCoG.h>
#include <services/log/Log_service.h>
#include <extensions/spdlog/SpdlogExtensions.h>



class Cluster_factory_EcalBarrelScFiClusters : public eicrecon::JFactoryPodioT<edm4eic::Cluster>, CalorimeterClusterRecoCoG {
class Cluster_factory_EcalBarrelScFiClusters : public JMultifactory, CalorimeterClusterRecoCoG {

public:
//------------------------------------------
// Constructor
Cluster_factory_EcalBarrelScFiClusters(){
SetTag("EcalBarrelScFiClusters");
m_log = japp->GetService<Log_service>()->logger(GetTag());
DeclarePodioOutput<edm4eic::Cluster>("EcalBarrelScFiClusters");
DeclarePodioOutput<edm4eic::MCRecoClusterParticleAssociation>("EcalBarrelScFiClusterAssociations");
}

//------------------------------------------
// Init
void Init() override{
auto app = GetApplication();
auto app = japp; // GetApplication(); // TODO: NWB: FIXME after JANA2 v2.1.1
m_log = app->GetService<Log_service>()->logger("EcalBarrelScFiClusters");

//-------- Configuration Parameters ------------
m_input_simhit_tag="EcalBarrelScFiHits";
m_input_protoclust_tag="EcalBarrelScFiProtoClusters";
Expand Down Expand Up @@ -58,7 +60,7 @@ class Cluster_factory_EcalBarrelScFiClusters : public eicrecon::JFactoryPodioT<e

//------------------------------------------
// ChangeRun
void ChangeRun(const std::shared_ptr<const JEvent> &event) override{
void BeginRun(const std::shared_ptr<const JEvent> &event) override{
AlgorithmChangeRun();
}

Expand All @@ -75,8 +77,9 @@ class Cluster_factory_EcalBarrelScFiClusters : public eicrecon::JFactoryPodioT<e
AlgorithmProcess();

// Hand owner of algorithm objects over to JANA
Set(m_outputClusters);
event->Insert(m_outputAssociations, "EcalBarrelScFiClusterAssociations");
SetData("EcalBarrelScFiClusters", m_outputClusters);
SetData("EcalBarrelScFiClusterAssociations", m_outputAssociations);

m_outputClusters.clear(); // not really needed, but better to not leave dangling pointers around
m_outputAssociations.clear();
}
Expand Down
24 changes: 12 additions & 12 deletions src/detectors/BEMC/Cluster_factory_EcalBarrelSciGlassClusters.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,31 @@

#include <random>

#include <services/io/podio/JFactoryPodioT.h>
#include <JANA/JMultifactory.h>
#include <services/geometry/dd4hep/JDD4hep_service.h>
#include <algorithms/calorimetry/CalorimeterClusterRecoCoG.h>
#include <services/log/Log_service.h>
#include <extensions/spdlog/SpdlogExtensions.h>



class Cluster_factory_EcalBarrelSciGlassClusters : public eicrecon::JFactoryPodioT<edm4eic::Cluster>, CalorimeterClusterRecoCoG {
class Cluster_factory_EcalBarrelSciGlassClusters : public JMultifactory, CalorimeterClusterRecoCoG {

public:
//------------------------------------------
// Constructor
Cluster_factory_EcalBarrelSciGlassClusters(){
SetTag("EcalBarrelSciGlassClusters");
m_log = japp->GetService<Log_service>()->logger(GetTag());
DeclarePodioOutput<edm4eic::Cluster>("EcalBarrelSciGlassClusters");
DeclarePodioOutput<edm4eic::MCRecoClusterParticleAssociation>("EcalBarrelClusterAssociations");
// TODO: NWB: Collection naming convention not followed here
}

//------------------------------------------
// Init
void Init() override{
auto app = GetApplication();
auto app = japp; // GetApplication(); // TODO: NWB: FIXME after JANA2 v2.1.1
m_log = app->GetService<Log_service>()->logger("EcalBarrelSciGlassClusters");

//-------- Configuration Parameters ------------
m_input_simhit_tag="EcalBarrelSciGlassHits";
m_input_protoclust_tag="EcalBarrelSciGlassProtoClusters";
Expand Down Expand Up @@ -60,28 +63,25 @@ class Cluster_factory_EcalBarrelSciGlassClusters : public eicrecon::JFactoryPodi

//------------------------------------------
// ChangeRun
void ChangeRun(const std::shared_ptr<const JEvent> &event) override{
void BeginRun(const std::shared_ptr<const JEvent> &event) override{
AlgorithmChangeRun();
}

//------------------------------------------
// Process
void Process(const std::shared_ptr<const JEvent> &event) override{


// Prefill inputs
m_inputSimhits=event->Get<edm4hep::SimCalorimeterHit>(m_input_simhit_tag);
m_inputProto=event->Get<edm4eic::ProtoCluster>(m_input_protoclust_tag);

// Call Process for generic algorithm
AlgorithmProcess();


//outputs

// Hand owner of algorithm objects over to JANA
Set(m_outputClusters);
event->Insert(m_outputAssociations, "EcalBarrelClusterAssociations");
SetData("EcalBarrelSciGlassClusters", m_outputClusters);
SetData("EcalBarrelClusterAssociations", m_outputAssociations);

m_outputClusters.clear(); // not really needed, but better to not leave dangling pointers around
m_outputAssociations.clear();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,35 @@

#include <random>

#include <services/io/podio/JFactoryPodioT.h>
#include <JANA/JMultifactory.h>
#include <services/geometry/dd4hep/JDD4hep_service.h>
#include <algorithms/calorimetry/CalorimeterClusterMerger.h>
#include <services/log/Log_service.h>
#include <extensions/spdlog/SpdlogExtensions.h>



class Cluster_factory_EcalBarrelSciGlassMergedTruthClusters : public eicrecon::JFactoryPodioT<edm4eic::Cluster>, CalorimeterClusterMerger {
class Cluster_factory_EcalBarrelSciGlassMergedTruthClusters : public JMultifactory, CalorimeterClusterMerger {

public:
//------------------------------------------
// Constructor
Cluster_factory_EcalBarrelSciGlassMergedTruthClusters(){
SetTag("EcalBarrelSciGlassMergedTruthClusters");
m_log = japp->GetService<Log_service>()->logger(GetTag());
DeclarePodioOutput<edm4eic::Cluster>("EcalBarrelSciGlassMergedTruthClusters");
DeclarePodioOutput<edm4eic::MCRecoClusterParticleAssociation>("EcalBarrelMergedClusterAssociations");
// TODO: NWB: Inconsistent collection naming
}

//------------------------------------------
// Init
void Init() override{
auto app = GetApplication();
auto app = japp; // GetApplication(); // TODO: NWB: FIXME after JANA2 v2.1.1
m_log = app->GetService<Log_service>()->logger("EcalBarrelSciGlassMergedTruthClusters");

//-------- Configuration Parameters ------------
m_input_tag="EcalBarrelSciGlassTruthClusters";
m_inputAssociations_tag="EcalBarrelSciGlassTruthClusterAssociations";

std::string tag=this->GetTag();
std::shared_ptr<spdlog::logger> m_log = app->GetService<Log_service>()->logger(tag);

app->SetDefaultParameter("BEMC:EcalBarrelMergedSciGlassTruthClusters:input_tag", m_input_tag, "Name of input collection to use");
app->SetDefaultParameter("BEMC:EcalBarrelMergedSciGlassTruthClusters:inputAssociations_tag", m_inputAssociations_tag);

Expand All @@ -42,26 +42,25 @@ class Cluster_factory_EcalBarrelSciGlassMergedTruthClusters : public eicrecon::J

//------------------------------------------
// ChangeRun
void ChangeRun(const std::shared_ptr<const JEvent> &event) override{
void BeginRun(const std::shared_ptr<const JEvent> &event) override{
AlgorithmChangeRun();
}

//------------------------------------------
// Process
void Process(const std::shared_ptr<const JEvent> &event) override{


// Prefill inputs
m_inputClusters=event->Get<edm4eic::Cluster>(m_input_tag);
m_inputAssociations=event->Get<edm4eic::MCRecoClusterParticleAssociation>(m_inputAssociations_tag);

// Call Process for generic algorithm
AlgorithmProcess();

//outputs
// Hand owner of algorithm objects over to JANA
Set(m_outputClusters);
event->Insert(m_outputAssociations, "EcalBarrelMergedClusterAssociations");
SetData("EcalBarrelSciGlassMergedTruthClusters", m_outputClusters);
SetData("EcalBarrelMergedClusterAssociations", m_outputAssociations);

m_outputClusters.clear(); // not really needed, but better to not leave dangling pointers around
m_outputAssociations.clear();
}
Expand Down
Loading