From ffc0e794c951b48772aa7949696e0f13955e12f3 Mon Sep 17 00:00:00 2001 From: Zhongling Ji Date: Wed, 26 Oct 2022 20:56:47 -0400 Subject: [PATCH] This is a combined bug fixing for EEMC and corresponding algorithms. (1) Corrected the scaleResponse of raw hits in digitization for pECal and pECal insert in reco_flags.py. (2) The digitization in signal_sum_digi was fixed similar to that in single_hits_digi in CalorimeterHitDigi.cc. (3) Added factories to produce truth clusters from proto-truth clusters. (4) Corrected the proto-cluster tag-name for pECal insert in reco_flags.py. (5) The nested clusters in CalorimeterClusterMerger.cc, which prevented merged clusters to be written out, was temporally commented out. This is a global issue with podio reference. (6) Added dummy factories to let cluster associations written out. (7) Renamed all tag-names that end with "ClusterAssociations" to "ClustersAssocitions". This makes the naming uniform by just adding "Associations" without removing "s" in "Clusters". (8) Fixed some typos of filenames for the pECal insert. The code has been tested by 100 events. (1) It did not produce any error related to EEMC. (2) The energy responses of truth, reco, and merged clusters were reasonable. (3) The cluster associations were successfully written out. --- .../calorimetry/CalorimeterClusterMerger.cc | 2 +- .../calorimetry/CalorimeterHitDigi.cc | 2 +- ...terHit_factory_EcalEndcapPInsertRecHits.h} | 0 .../Cluster_factory_EcalEndcapNClusters.h | 15 ++- ...luster_factory_EcalEndcapNMergedClusters.h | 15 ++- ...Cluster_factory_EcalEndcapNTruthClusters.h | 109 ++++++++++++++++++ .../Cluster_factory_EcalEndcapPClusters.h | 15 ++- ...luster_factory_EcalEndcapPInsertClusters.h | 15 ++- ..._factory_EcalEndcapPInsertMergedClusters.h | 15 ++- ...r_factory_EcalEndcapPInsertTruthClusters.h | 109 ++++++++++++++++++ ...luster_factory_EcalEndcapPMergedClusters.h | 15 ++- ...Cluster_factory_EcalEndcapPTruthClusters.h | 109 ++++++++++++++++++ src/detectors/EEMC/EEMC.cc | 33 +++++- ...terHit_factory_EcalEndcapPInsertRawHits.h} | 0 ...er_factory_EcalEndcapNTruthProtoClusters.h | 61 ---------- ...tory_EcalEndcapPInsertTruthProtoClusters.h | 60 ---------- ...er_factory_EcalEndcapPTruthProtoClusters.h | 60 ---------- src/services/io/podio/JEventProcessorPODIO.cc | 20 +++- src/tools/default_flags_table/reco_flags.py | 43 +++---- 19 files changed, 477 insertions(+), 221 deletions(-) rename src/detectors/EEMC/{CalorimeterHit_factory_EcalEndcapInsertRecHits.h => CalorimeterHit_factory_EcalEndcapPInsertRecHits.h} (100%) create mode 100644 src/detectors/EEMC/Cluster_factory_EcalEndcapNTruthClusters.h create mode 100644 src/detectors/EEMC/Cluster_factory_EcalEndcapPInsertTruthClusters.h create mode 100644 src/detectors/EEMC/Cluster_factory_EcalEndcapPTruthClusters.h rename src/detectors/EEMC/{RawCalorimeterHit_factor_EcalEndcapPInsertRawHits.h => RawCalorimeterHit_factory_EcalEndcapPInsertRawHits.h} (100%) delete mode 100644 src/detectors/EEMC/TruthCluster_factory_EcalEndcapNTruthProtoClusters.h delete mode 100644 src/detectors/EEMC/TruthCluster_factory_EcalEndcapPInsertTruthProtoClusters.h delete mode 100644 src/detectors/EEMC/TruthCluster_factory_EcalEndcapPTruthProtoClusters.h diff --git a/src/algorithms/calorimetry/CalorimeterClusterMerger.cc b/src/algorithms/calorimetry/CalorimeterClusterMerger.cc index ef0d21502a..d562d9216e 100644 --- a/src/algorithms/calorimetry/CalorimeterClusterMerger.cc +++ b/src/algorithms/calorimetry/CalorimeterClusterMerger.cc @@ -95,7 +95,7 @@ void CalorimeterClusterMerger::AlgorithmProcess() { time += clus->getTime() * clus->getEnergy(); nhits += clus->getNhits(); position = position + energy * clus->getPosition(); - new_clus.addToClusters(*clus); + //new_clus.addToClusters(*clus); // FIXME: global issue with podio reference for (auto& hit : clus->getHits()) { new_clus.addToHits(hit); } diff --git a/src/algorithms/calorimetry/CalorimeterHitDigi.cc b/src/algorithms/calorimetry/CalorimeterHitDigi.cc index 541c690aed..15bdf42646 100644 --- a/src/algorithms/calorimetry/CalorimeterHitDigi.cc +++ b/src/algorithms/calorimetry/CalorimeterHitDigi.cc @@ -227,7 +227,7 @@ void CalorimeterHitDigi::signal_sum_digi( void ){ // m_normDist(generator) * eRes[2] / edep; // } double ped = m_pedMeanADC + m_normDist(generator) * m_pedSigmaADC; - unsigned long long adc = std::llround(ped + edep * (1. + eResRel) / dyRangeADC * m_capADC); + unsigned long long adc = std::llround(ped + edep * (m_corrMeanScale + eResRel) / dyRangeADC * m_capADC); unsigned long long tdc = std::llround((time + m_normDist(generator) * tRes) * stepTDC); auto rawhit = new edm4hep::RawCalorimeterHit( diff --git a/src/detectors/EEMC/CalorimeterHit_factory_EcalEndcapInsertRecHits.h b/src/detectors/EEMC/CalorimeterHit_factory_EcalEndcapPInsertRecHits.h similarity index 100% rename from src/detectors/EEMC/CalorimeterHit_factory_EcalEndcapInsertRecHits.h rename to src/detectors/EEMC/CalorimeterHit_factory_EcalEndcapPInsertRecHits.h diff --git a/src/detectors/EEMC/Cluster_factory_EcalEndcapNClusters.h b/src/detectors/EEMC/Cluster_factory_EcalEndcapNClusters.h index 1dd8739360..d5667da5d6 100644 --- a/src/detectors/EEMC/Cluster_factory_EcalEndcapNClusters.h +++ b/src/detectors/EEMC/Cluster_factory_EcalEndcapNClusters.h @@ -15,6 +15,19 @@ +// Dummy factory for JFactoryGeneratorT +class Association_factory_EcalEndcapNClustersAssociations : public JFactoryT { + +public: + //------------------------------------------ + // Constructor + Association_factory_EcalEndcapNClustersAssociations(){ + SetTag("EcalEndcapNClustersAssociations"); + } +}; + + + class Cluster_factory_EcalEndcapNClusters : public JFactoryT, CalorimeterClusterRecoCoG { public: @@ -89,7 +102,7 @@ class Cluster_factory_EcalEndcapNClusters : public JFactoryT, // Hand owner of algorithm objects over to JANA Set(m_outputClusters); - event->Insert(m_outputAssociations, "EcalEndcapNClusterAssociations"); + event->Insert(m_outputAssociations, "EcalEndcapNClustersAssociations"); m_outputClusters.clear(); // not really needed, but better to not leave dangling pointers around m_outputAssociations.clear(); } diff --git a/src/detectors/EEMC/Cluster_factory_EcalEndcapNMergedClusters.h b/src/detectors/EEMC/Cluster_factory_EcalEndcapNMergedClusters.h index 37085cea5f..1f71e220e3 100644 --- a/src/detectors/EEMC/Cluster_factory_EcalEndcapNMergedClusters.h +++ b/src/detectors/EEMC/Cluster_factory_EcalEndcapNMergedClusters.h @@ -14,6 +14,19 @@ +// Dummy factory for JFactoryGeneratorT +class Association_factory_EcalEndcapNMergedClustersAssociations : public JFactoryT { + +public: + //------------------------------------------ + // Constructor + Association_factory_EcalEndcapNMergedClustersAssociations(){ + SetTag("EcalEndcapNMergedClustersAssociations"); + } +}; + + + class Cluster_factory_EcalEndcapNMergedClusters : public JFactoryT, CalorimeterClusterMerger { public: @@ -29,7 +42,7 @@ class Cluster_factory_EcalEndcapNMergedClusters : public JFactoryTGetTag(); std::shared_ptr m_log = app->GetService()->logger(tag); diff --git a/src/detectors/EEMC/Cluster_factory_EcalEndcapNTruthClusters.h b/src/detectors/EEMC/Cluster_factory_EcalEndcapNTruthClusters.h new file mode 100644 index 0000000000..c11920cdbf --- /dev/null +++ b/src/detectors/EEMC/Cluster_factory_EcalEndcapNTruthClusters.h @@ -0,0 +1,109 @@ +// Copyright 2022, Thomas Britton +// Subject to the terms in the LICENSE file found in the top-level directory. +// + +#pragma once + +#include + +#include +#include +#include +#include +#include + + + +// Dummy factory for JFactoryGeneratorT +class Association_factory_EcalEndcapNTruthClustersAssociations : public JFactoryT { + +public: + //------------------------------------------ + // Constructor + Association_factory_EcalEndcapNTruthClustersAssociations(){ + SetTag("EcalEndcapNTruthClustersAssociations"); + } +}; + + + +class Cluster_factory_EcalEndcapNTruthClusters : public JFactoryT, CalorimeterClusterRecoCoG { + +public: + //------------------------------------------ + // Constructor + Cluster_factory_EcalEndcapNTruthClusters(){ + SetTag("EcalEndcapNTruthClusters"); + } + + //------------------------------------------ + // Init + void Init() override{ + auto app = GetApplication(); + //-------- Configuration Parameters ------------ + m_input_simhit_tag="EcalEndcapNHits"; + m_input_protoclust_tag="EcalEndcapNTruthProtoClusters"; + + m_sampFrac=1.0;//{this, "samplingFraction", 1.0}; + m_logWeightBase=3.6;//{this, "logWeightBase", 3.6}; + m_depthCorrection=0.0;//{this, "depthCorrection", 0.0}; + m_energyWeight="log";//{this, "energyWeight", "log"}; + m_moduleDimZName="";//{this, "moduleDimZName", ""}; + // Constrain the cluster position eta to be within + // the eta of the contributing hits. This is useful to avoid edge effects + // for endcaps. + m_enableEtaBounds=false;//{this, "enableEtaBounds", false}; + + + app->SetDefaultParameter("EEMC:EcalEndcapNTruthClusters:input_protoclust_tag", m_input_protoclust_tag, "Name of input collection to use"); + app->SetDefaultParameter("EEMC:EcalEndcapNTruthClusters:samplingFraction", m_sampFrac); + app->SetDefaultParameter("EEMC:EcalEndcapNTruthClusters:logWeightBase", m_logWeightBase); + app->SetDefaultParameter("EEMC:EcalEndcapNTruthClusters:depthCorrection", m_depthCorrection); + app->SetDefaultParameter("EEMC:EcalEndcapNTruthClusters:energyWeight", m_energyWeight); + app->SetDefaultParameter("EEMC:EcalEndcapNTruthClusters:moduleDimZName", m_moduleDimZName); + app->SetDefaultParameter("EEMC:EcalEndcapNTruthClusters:enableEtaBounds", m_enableEtaBounds); + + m_geoSvc = app->template GetService(); + + std::string tag=this->GetTag(); + std::shared_ptr m_log = app->GetService()->logger(tag); + + // Get log level from user parameter or default + std::string log_level_str = "info"; + auto pm = app->GetJParameterManager(); + pm->SetDefaultParameter(tag + ":LogLevel", log_level_str, "verbosity: trace, debug, info, warn, err, critical, off"); + m_log->set_level(eicrecon::ParseLogLevel(log_level_str)); + + + AlgorithmInit(m_log); + } + + //------------------------------------------ + // ChangeRun + void ChangeRun(const std::shared_ptr &event) override{ + AlgorithmChangeRun(); + } + + //------------------------------------------ + // Process + void Process(const std::shared_ptr &event) override{ + + + // Prefill inputs + m_inputSimhits=event->Get(m_input_simhit_tag); + m_inputProto=event->Get(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, "EcalEndcapNTruthClustersAssociations"); + m_outputClusters.clear(); // not really needed, but better to not leave dangling pointers around + m_outputAssociations.clear(); + } +}; + diff --git a/src/detectors/EEMC/Cluster_factory_EcalEndcapPClusters.h b/src/detectors/EEMC/Cluster_factory_EcalEndcapPClusters.h index 5a172400a6..2a7bc5f6a9 100644 --- a/src/detectors/EEMC/Cluster_factory_EcalEndcapPClusters.h +++ b/src/detectors/EEMC/Cluster_factory_EcalEndcapPClusters.h @@ -14,6 +14,19 @@ +// Dummy factory for JFactoryGeneratorT +class Association_factory_EcalEndcapPClustersAssociations : public JFactoryT { + +public: + //------------------------------------------ + // Constructor + Association_factory_EcalEndcapPClustersAssociations(){ + SetTag("EcalEndcapPClustersAssociations"); + } +}; + + + class Cluster_factory_EcalEndcapPClusters : public JFactoryT, CalorimeterClusterRecoCoG { public: @@ -88,7 +101,7 @@ class Cluster_factory_EcalEndcapPClusters : public JFactoryT, // Hand owner of algorithm objects over to JANA Set(m_outputClusters); - event->Insert(m_outputAssociations, "EcalEndcapPClusterAssociations"); + event->Insert(m_outputAssociations, "EcalEndcapPClustersAssociations"); m_outputClusters.clear(); // not really needed, but better to not leave dangling pointers around m_outputAssociations.clear(); } diff --git a/src/detectors/EEMC/Cluster_factory_EcalEndcapPInsertClusters.h b/src/detectors/EEMC/Cluster_factory_EcalEndcapPInsertClusters.h index 3054b23282..8997ffb9ca 100644 --- a/src/detectors/EEMC/Cluster_factory_EcalEndcapPInsertClusters.h +++ b/src/detectors/EEMC/Cluster_factory_EcalEndcapPInsertClusters.h @@ -14,6 +14,19 @@ +// Dummy factory for JFactoryGeneratorT +class Association_factory_EcalEndcapPInsertClustersAssociations : public JFactoryT { + +public: + //------------------------------------------ + // Constructor + Association_factory_EcalEndcapPInsertClustersAssociations(){ + SetTag("EcalEndcapPInsertClustersAssociations"); + } +}; + + + class Cluster_factory_EcalEndcapPInsertClusters : public JFactoryT, CalorimeterClusterRecoCoG { public: @@ -88,7 +101,7 @@ class Cluster_factory_EcalEndcapPInsertClusters : public JFactoryTInsert(m_outputAssociations, "EcalEndcapPInsertClusterAssociations"); + event->Insert(m_outputAssociations, "EcalEndcapPInsertClustersAssociations"); m_outputClusters.clear(); // not really needed, but better to not leave dangling pointers around m_outputAssociations.clear(); } diff --git a/src/detectors/EEMC/Cluster_factory_EcalEndcapPInsertMergedClusters.h b/src/detectors/EEMC/Cluster_factory_EcalEndcapPInsertMergedClusters.h index 51f24bf40c..5b8b5f78ca 100644 --- a/src/detectors/EEMC/Cluster_factory_EcalEndcapPInsertMergedClusters.h +++ b/src/detectors/EEMC/Cluster_factory_EcalEndcapPInsertMergedClusters.h @@ -14,6 +14,19 @@ +// Dummy factory for JFactoryGeneratorT +class Association_factory_EcalEndcapPInsertMergedClustersAssociations : public JFactoryT { + +public: + //------------------------------------------ + // Constructor + Association_factory_EcalEndcapPInsertMergedClustersAssociations(){ + SetTag("EcalEndcapPInsertMergedClustersAssociations"); + } +}; + + + class Cluster_factory_EcalEndcapPInsertMergedClusters : public JFactoryT, CalorimeterClusterMerger { public: @@ -29,7 +42,7 @@ class Cluster_factory_EcalEndcapPInsertMergedClusters : public JFactoryTGetTag(); std::shared_ptr m_log = app->GetService()->logger(tag); diff --git a/src/detectors/EEMC/Cluster_factory_EcalEndcapPInsertTruthClusters.h b/src/detectors/EEMC/Cluster_factory_EcalEndcapPInsertTruthClusters.h new file mode 100644 index 0000000000..84cb0a59eb --- /dev/null +++ b/src/detectors/EEMC/Cluster_factory_EcalEndcapPInsertTruthClusters.h @@ -0,0 +1,109 @@ +// Copyright 2022, Thomas Britton +// Subject to the terms in the LICENSE file found in the top-level directory. +// + +#pragma once + +#include + +#include +#include +#include +#include +#include + + + +// Dummy factory for JFactoryGeneratorT +class Association_factory_EcalEndcapPInsertTruthClustersAssociations : public JFactoryT { + +public: + //------------------------------------------ + // Constructor + Association_factory_EcalEndcapPInsertTruthClustersAssociations(){ + SetTag("EcalEndcapPInsertTruthClustersAssociations"); + } +}; + + + +class Cluster_factory_EcalEndcapPInsertTruthClusters : public JFactoryT, CalorimeterClusterRecoCoG { + +public: + //------------------------------------------ + // Constructor + Cluster_factory_EcalEndcapPInsertTruthClusters(){ + SetTag("EcalEndcapPInsertTruthClusters"); + } + + //------------------------------------------ + // Init + void Init() override{ + auto app = GetApplication(); + //-------- Configuration Parameters ------------ + m_input_simhit_tag="EcalEndcapPInsertHits"; + m_input_protoclust_tag="EcalEndcapPInsertTruthProtoClusters"; + + m_sampFrac=1.0;//{this, "samplingFraction", 1.0}; + m_logWeightBase=3.6;//{this, "logWeightBase", 3.6}; + m_depthCorrection=0.0;//{this, "depthCorrection", 0.0}; + m_energyWeight="log";//{this, "energyWeight", "log"}; + m_moduleDimZName="";//{this, "moduleDimZName", ""}; + // Constrain the cluster position eta to be within + // the eta of the contributing hits. This is useful to avoid edge effects + // for endcaps. + m_enableEtaBounds=false;//{this, "enableEtaBounds", false}; + + + app->SetDefaultParameter("EEMC:EcalEndcapPInsertTruthClusters:input_protoclust_tag", m_input_protoclust_tag, "Name of input collection to use"); + app->SetDefaultParameter("EEMC:EcalEndcapPInsertTruthClusters:samplingFraction", m_sampFrac); + app->SetDefaultParameter("EEMC:EcalEndcapPInsertTruthClusters:logWeightBase", m_logWeightBase); + app->SetDefaultParameter("EEMC:EcalEndcapPInsertTruthClusters:depthCorrection", m_depthCorrection); + app->SetDefaultParameter("EEMC:EcalEndcapPInsertTruthClusters:energyWeight", m_energyWeight); + app->SetDefaultParameter("EEMC:EcalEndcapPInsertTruthClusters:moduleDimZName", m_moduleDimZName); + app->SetDefaultParameter("EEMC:EcalEndcapPInsertTruthClusters:enableEtaBounds", m_enableEtaBounds); + + m_geoSvc = app->template GetService(); + + std::string tag=this->GetTag(); + std::shared_ptr m_log = app->GetService()->logger(tag); + + // Get log level from user parameter or default + std::string log_level_str = "info"; + auto pm = app->GetJParameterManager(); + pm->SetDefaultParameter(tag + ":LogLevel", log_level_str, "verbosity: trace, debug, info, warn, err, critical, off"); + m_log->set_level(eicrecon::ParseLogLevel(log_level_str)); + + + AlgorithmInit(m_log); + } + + //------------------------------------------ + // ChangeRun + void ChangeRun(const std::shared_ptr &event) override{ + AlgorithmChangeRun(); + } + + //------------------------------------------ + // Process + void Process(const std::shared_ptr &event) override{ + + + // Prefill inputs + m_inputSimhits=event->Get(m_input_simhit_tag); + m_inputProto=event->Get(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, "EcalEndcapPInsertTruthClustersAssociations"); + m_outputClusters.clear(); // not really needed, but better to not leave dangling pointers around + m_outputAssociations.clear(); + } +}; + diff --git a/src/detectors/EEMC/Cluster_factory_EcalEndcapPMergedClusters.h b/src/detectors/EEMC/Cluster_factory_EcalEndcapPMergedClusters.h index 5252e67db2..c0a2d6892c 100644 --- a/src/detectors/EEMC/Cluster_factory_EcalEndcapPMergedClusters.h +++ b/src/detectors/EEMC/Cluster_factory_EcalEndcapPMergedClusters.h @@ -14,6 +14,19 @@ +// Dummy factory for JFactoryGeneratorT +class Association_factory_EcalEndcapPMergedClustersAssociations : public JFactoryT { + +public: + //------------------------------------------ + // Constructor + Association_factory_EcalEndcapPMergedClustersAssociations(){ + SetTag("EcalEndcapPMergedClustersAssociations"); + } +}; + + + class Cluster_factory_EcalEndcapPMergedClusters : public JFactoryT, CalorimeterClusterMerger { public: @@ -29,7 +42,7 @@ class Cluster_factory_EcalEndcapPMergedClusters : public JFactoryTGetTag(); std::shared_ptr m_log = app->GetService()->logger(tag); diff --git a/src/detectors/EEMC/Cluster_factory_EcalEndcapPTruthClusters.h b/src/detectors/EEMC/Cluster_factory_EcalEndcapPTruthClusters.h new file mode 100644 index 0000000000..7c8693b059 --- /dev/null +++ b/src/detectors/EEMC/Cluster_factory_EcalEndcapPTruthClusters.h @@ -0,0 +1,109 @@ +// Copyright 2022, Thomas Britton +// Subject to the terms in the LICENSE file found in the top-level directory. +// + +#pragma once + +#include + +#include +#include +#include +#include +#include + + + +// Dummy factory for JFactoryGeneratorT +class Association_factory_EcalEndcapPTruthClustersAssociations : public JFactoryT { + +public: + //------------------------------------------ + // Constructor + Association_factory_EcalEndcapPTruthClustersAssociations(){ + SetTag("EcalEndcapPTruthClustersAssociations"); + } +}; + + + +class Cluster_factory_EcalEndcapPTruthClusters : public JFactoryT, CalorimeterClusterRecoCoG { + +public: + //------------------------------------------ + // Constructor + Cluster_factory_EcalEndcapPTruthClusters(){ + SetTag("EcalEndcapPTruthClusters"); + } + + //------------------------------------------ + // Init + void Init() override{ + auto app = GetApplication(); + //-------- Configuration Parameters ------------ + m_input_simhit_tag="EcalEndcapPHits"; + m_input_protoclust_tag="EcalEndcapPTruthProtoClusters"; + + m_sampFrac=1.0;//{this, "samplingFraction", 1.0}; + m_logWeightBase=3.6;//{this, "logWeightBase", 3.6}; + m_depthCorrection=0.0;//{this, "depthCorrection", 0.0}; + m_energyWeight="log";//{this, "energyWeight", "log"}; + m_moduleDimZName="";//{this, "moduleDimZName", ""}; + // Constrain the cluster position eta to be within + // the eta of the contributing hits. This is useful to avoid edge effects + // for endcaps. + m_enableEtaBounds=false;//{this, "enableEtaBounds", false}; + + + app->SetDefaultParameter("EEMC:EcalEndcapPTruthClusters:input_protoclust_tag", m_input_protoclust_tag, "Name of input collection to use"); + app->SetDefaultParameter("EEMC:EcalEndcapPTruthClusters:samplingFraction", m_sampFrac); + app->SetDefaultParameter("EEMC:EcalEndcapPTruthClusters:logWeightBase", m_logWeightBase); + app->SetDefaultParameter("EEMC:EcalEndcapPTruthClusters:depthCorrection", m_depthCorrection); + app->SetDefaultParameter("EEMC:EcalEndcapPTruthClusters:energyWeight", m_energyWeight); + app->SetDefaultParameter("EEMC:EcalEndcapPTruthClusters:moduleDimZName", m_moduleDimZName); + app->SetDefaultParameter("EEMC:EcalEndcapPTruthClusters:enableEtaBounds", m_enableEtaBounds); + + m_geoSvc = app->template GetService(); + + std::string tag=this->GetTag(); + std::shared_ptr m_log = app->GetService()->logger(tag); + + // Get log level from user parameter or default + std::string log_level_str = "info"; + auto pm = app->GetJParameterManager(); + pm->SetDefaultParameter(tag + ":LogLevel", log_level_str, "verbosity: trace, debug, info, warn, err, critical, off"); + m_log->set_level(eicrecon::ParseLogLevel(log_level_str)); + + + AlgorithmInit(m_log); + } + + //------------------------------------------ + // ChangeRun + void ChangeRun(const std::shared_ptr &event) override{ + AlgorithmChangeRun(); + } + + //------------------------------------------ + // Process + void Process(const std::shared_ptr &event) override{ + + + // Prefill inputs + m_inputSimhits=event->Get(m_input_simhit_tag); + m_inputProto=event->Get(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, "EcalEndcapPTruthClustersAssociations"); + m_outputClusters.clear(); // not really needed, but better to not leave dangling pointers around + m_outputAssociations.clear(); + } +}; + diff --git a/src/detectors/EEMC/EEMC.cc b/src/detectors/EEMC/EEMC.cc index 0035533f1f..d301965150 100644 --- a/src/detectors/EEMC/EEMC.cc +++ b/src/detectors/EEMC/EEMC.cc @@ -11,17 +11,25 @@ #include "CalorimeterHit_factory_EcalEndcapNRecHits.h" #include "ProtoCluster_factory_EcalEndcapNTruthProtoClusters.h" #include "ProtoCluster_factory_EcalEndcapNIslandProtoClusters.h" +#include "Cluster_factory_EcalEndcapNTruthClusters.h" #include "Cluster_factory_EcalEndcapNClusters.h" #include "Cluster_factory_EcalEndcapNMergedClusters.h" -#include "TruthCluster_factory_EcalEndcapNTruthProtoClusters.h" #include "RawCalorimeterHit_factory_EcalEndcapPRawHits.h" #include "CalorimeterHit_factory_EcalEndcapPRecHits.h" #include "ProtoCluster_factory_EcalEndcapPTruthProtoClusters.h" #include "ProtoCluster_factory_EcalEndcapPIslandProtoClusters.h" +#include "Cluster_factory_EcalEndcapPTruthClusters.h" #include "Cluster_factory_EcalEndcapPClusters.h" #include "Cluster_factory_EcalEndcapPMergedClusters.h" -#include "TruthCluster_factory_EcalEndcapPTruthProtoClusters.h" + +#include "RawCalorimeterHit_factory_EcalEndcapPInsertRawHits.h" +#include "CalorimeterHit_factory_EcalEndcapPInsertRecHits.h" +#include "ProtoCluster_factory_EcalEndcapPInsertTruthProtoClusters.h" +#include "ProtoCluster_factory_EcalEndcapPInsertIslandProtoClusters.h" +#include "Cluster_factory_EcalEndcapPInsertTruthClusters.h" +#include "Cluster_factory_EcalEndcapPInsertClusters.h" +#include "Cluster_factory_EcalEndcapPInsertMergedClusters.h" extern "C" { void InitPlugin(JApplication *app) { @@ -30,17 +38,34 @@ extern "C" { app->Add(new JFactoryGeneratorT()); app->Add(new JFactoryGeneratorT()); app->Add(new JFactoryGeneratorT()); + app->Add(new JFactoryGeneratorT()); app->Add(new JFactoryGeneratorT()); app->Add(new JFactoryGeneratorT()); - app->Add(new JFactoryGeneratorT()); + app->Add(new JFactoryGeneratorT()); + app->Add(new JFactoryGeneratorT()); + app->Add(new JFactoryGeneratorT()); app->Add(new JFactoryGeneratorT()); app->Add(new JFactoryGeneratorT()); app->Add(new JFactoryGeneratorT()); app->Add(new JFactoryGeneratorT()); + app->Add(new JFactoryGeneratorT()); app->Add(new JFactoryGeneratorT()); app->Add(new JFactoryGeneratorT()); - app->Add(new JFactoryGeneratorT()); + app->Add(new JFactoryGeneratorT()); + app->Add(new JFactoryGeneratorT()); + app->Add(new JFactoryGeneratorT()); + + app->Add(new JFactoryGeneratorT()); + app->Add(new JFactoryGeneratorT()); + app->Add(new JFactoryGeneratorT()); + app->Add(new JFactoryGeneratorT()); + app->Add(new JFactoryGeneratorT()); + app->Add(new JFactoryGeneratorT()); + app->Add(new JFactoryGeneratorT()); + app->Add(new JFactoryGeneratorT()); + app->Add(new JFactoryGeneratorT()); + app->Add(new JFactoryGeneratorT()); } } diff --git a/src/detectors/EEMC/RawCalorimeterHit_factor_EcalEndcapPInsertRawHits.h b/src/detectors/EEMC/RawCalorimeterHit_factory_EcalEndcapPInsertRawHits.h similarity index 100% rename from src/detectors/EEMC/RawCalorimeterHit_factor_EcalEndcapPInsertRawHits.h rename to src/detectors/EEMC/RawCalorimeterHit_factory_EcalEndcapPInsertRawHits.h diff --git a/src/detectors/EEMC/TruthCluster_factory_EcalEndcapNTruthProtoClusters.h b/src/detectors/EEMC/TruthCluster_factory_EcalEndcapNTruthProtoClusters.h deleted file mode 100644 index 0d0e844896..0000000000 --- a/src/detectors/EEMC/TruthCluster_factory_EcalEndcapNTruthProtoClusters.h +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2022, David Lawrence -// Subject to the terms in the LICENSE file found in the top-level directory. -// - -#pragma once - -#include - -#include -#include -#include - -class TruthCluster_factory_EcalEndcapNTruthProtoClusters : public JFactoryT, CalorimeterTruthClustering { - -public: - //------------------------------------------ - // Constructor - TruthCluster_factory_EcalEndcapNTruthProtoClusters(){ - SetTag("EcalEndcapNTruthProtoClusters"); - } - - //------------------------------------------ - // Init - void Init() override{ - auto app = GetApplication(); - m_inputHit_tag = "EcalEndcapNTruthProtoClusters"; - m_inputMCHit_tag = "EcalEndcapNHits"; - - app->SetDefaultParameter("EEMC:EcalEndcapNTruthProtoClusters:inputHit_tag", m_inputHit_tag, "Name of input collection to use"); - - AlgorithmInit(); - } - - //------------------------------------------ - // ChangeRun - void ChangeRun(const std::shared_ptr &event) override{ - AlgorithmChangeRun(); - } - - //------------------------------------------ - // Process - void Process(const std::shared_ptr &event) override{ - // Prefill inputs - m_inputHits = event->Get(m_inputHit_tag); - m_mcHits = event->Get(m_inputMCHit_tag); - - // Call Process for generic algorithm - AlgorithmProcess(); - - // Hand owner of algorithm objects over to JANA - Set(m_outputProtoClusters); - m_outputProtoClusters.clear(); // not really needed, but better to not leave dangling pointers around - } - -private: - // Name of input data type (collection) - std::string m_inputHit_tag; - std::string m_inputMCHit_tag; - -}; - diff --git a/src/detectors/EEMC/TruthCluster_factory_EcalEndcapPInsertTruthProtoClusters.h b/src/detectors/EEMC/TruthCluster_factory_EcalEndcapPInsertTruthProtoClusters.h deleted file mode 100644 index a564945a7e..0000000000 --- a/src/detectors/EEMC/TruthCluster_factory_EcalEndcapPInsertTruthProtoClusters.h +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2022, David Lawrence -// Subject to the terms in the LICENSE file found in the top-level directory. -// - -#pragma once - -#include - -#include -#include -#include - -class TruthCluster_factory_EcalEndcapPInsertTruthProtoClusters : public JFactoryT, CalorimeterTruthClustering { - -public: - //------------------------------------------ - // Constructor - TruthCluster_factory_EcalEndcapPInsertTruthProtoClusters(){ - SetTag("EcalEndcapPInsertTruthProtoClusters"); - } - - //------------------------------------------ - // Init - void Init() override{ - auto app = GetApplication(); - m_inputHit_tag = "EcalEndcapPInsertTruthProtoClusters"; - m_inputMCHit_tag = "EcalEndcapPInsertHits"; - - app->SetDefaultParameter("EEMC:EcalEndcapPInsertTruthProtoClusters:inputHit_tag", m_inputHit_tag, "Name of input collection to use"); - - AlgorithmInit(); - } - - //------------------------------------------ - // ChangeRun - void ChangeRun(const std::shared_ptr &event) override{ - AlgorithmChangeRun(); - } - - //------------------------------------------ - // Process - void Process(const std::shared_ptr &event) override{ - // Prefill inputs - m_inputHits = event->Get(m_inputHit_tag); - m_mcHits = event->Get(m_inputMCHit_tag); - - // Call Process for generic algorithm - AlgorithmProcess(); - - // Hand owner of algorithm objects over to JANA - Set(m_outputProtoClusters); - m_outputProtoClusters.clear(); // not really needed, but better to not leave dangling pointers around - } - -private: - // Name of input data type (collection) - std::string m_inputHit_tag; - std::string m_inputMCHit_tag; -}; - diff --git a/src/detectors/EEMC/TruthCluster_factory_EcalEndcapPTruthProtoClusters.h b/src/detectors/EEMC/TruthCluster_factory_EcalEndcapPTruthProtoClusters.h deleted file mode 100644 index bcb0f484f0..0000000000 --- a/src/detectors/EEMC/TruthCluster_factory_EcalEndcapPTruthProtoClusters.h +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2022, David Lawrence -// Subject to the terms in the LICENSE file found in the top-level directory. -// - -#pragma once - -#include - -#include -#include -#include - -class TruthCluster_factory_EcalEndcapPTruthProtoClusters : public JFactoryT, CalorimeterTruthClustering { - -public: - //------------------------------------------ - // Constructor - TruthCluster_factory_EcalEndcapPTruthProtoClusters(){ - SetTag("EcalEndcapPTruthProtoClusters"); - } - - //------------------------------------------ - // Init - void Init() override{ - auto app = GetApplication(); - m_inputHit_tag = "EcalEndcapPTruthProtoClusters"; - m_inputMCHit_tag = "EcalEndcapPHits"; - - app->SetDefaultParameter("EEMC:EcalEndcapPTruthProtoClusters:inputHit_tag", m_inputHit_tag, "Name of input collection to use"); - - AlgorithmInit(); - } - - //------------------------------------------ - // ChangeRun - void ChangeRun(const std::shared_ptr &event) override{ - AlgorithmChangeRun(); - } - - //------------------------------------------ - // Process - void Process(const std::shared_ptr &event) override{ - // Prefill inputs - m_inputHits = event->Get(m_inputHit_tag); - m_mcHits = event->Get(m_inputMCHit_tag); - - // Call Process for generic algorithm - AlgorithmProcess(); - - // Hand owner of algorithm objects over to JANA - Set(m_outputProtoClusters); - m_outputProtoClusters.clear(); // not really needed, but better to not leave dangling pointers around - } - -private: - // Name of input data type (collection) - std::string m_inputHit_tag; - std::string m_inputMCHit_tag; -}; - diff --git a/src/services/io/podio/JEventProcessorPODIO.cc b/src/services/io/podio/JEventProcessorPODIO.cc index f2db787057..d861586b49 100644 --- a/src/services/io/podio/JEventProcessorPODIO.cc +++ b/src/services/io/podio/JEventProcessorPODIO.cc @@ -68,12 +68,28 @@ JEventProcessorPODIO::JEventProcessorPODIO() { "EndcapTrackerHit", "EcalEndcapNRawHits", "EcalEndcapNRecHits", + "EcalEndcapNTruthClusters", + "EcalEndcapNClusters", + "EcalEndcapNMergedClusters", + "EcalEndcapNTruthClustersAssociations", + "EcalEndcapNClustersAssociations", + "EcalEndcapNMergedClustersAssociations", "EcalEndcapPRawHits", "EcalEndcapPRecHits", - "EcalEndcapNClusters", + "EcalEndcapPTruthClusters", "EcalEndcapPClusters", - "EcalEndcapNMergedClusters", "EcalEndcapPMergedClusters", + "EcalEndcapPTruthClustersAssociations", + "EcalEndcapPClustersAssociations", + "EcalEndcapPMergedClustersAssociations", + "EcalEndcapPInsertRawHits", + "EcalEndcapPInsertRecHits", + "EcalEndcapPInsertTruthClusters", + "EcalEndcapPInsertClusters", + "EcalEndcapPInsertMergedClusters", + "EcalEndcapPInsertTruthClustersAssociations", + "EcalEndcapPInsertClustersAssociations", + "EcalEndcapPInsertMergedClustersAssociations", "EcalBarrelSciGlassRawHits", "EcalBarrelSciGlassRecHits", "EcalBarrelSciGlassClusters", diff --git a/src/tools/default_flags_table/reco_flags.py b/src/tools/default_flags_table/reco_flags.py index 7cdec35378..77722e05a8 100644 --- a/src/tools/default_flags_table/reco_flags.py +++ b/src/tools/default_flags_table/reco_flags.py @@ -238,7 +238,7 @@ ('EEMC:EcalEndcapPRawHits:pedestalSigma', '0.7', '*'), ('EEMC:EcalEndcapPRawHits:readoutClass', '', ''), ('EEMC:EcalEndcapPRawHits:resolutionTDC', '1e-11', ''), - ('EEMC:EcalEndcapPRawHits:scaleResponse', '1', ''), + ('EEMC:EcalEndcapPRawHits:scaleResponse', '0.03', ''), ('EEMC:EcalEndcapPRawHits:signalSumFields', '', ''), ('EEMC:EcalEndcapPRawHits:timeResolution', '0', ''), @@ -275,6 +275,14 @@ ('EEMC:EcalEndcapPTruthClusters:moduleDimZName', '', ''), ('EEMC:EcalEndcapPTruthClusters:samplingFraction', '1', ''), + ('EEMC:EcalEndcapPClusters:input_protoclust_tag', 'EcalEndcapPIslandProtoClusters', ''), + ('EEMC:EcalEndcapPClusters:samplingFraction', '1', ''), + ('EEMC:EcalEndcapPClusters:logWeightBase', '3.6', ''), + ('EEMC:EcalEndcapPClusters:depthCorrection', '0', ''), + ('EEMC:EcalEndcapPClusters:energyWeight', 'log', ''), + ('EEMC:EcalEndcapPClusters:moduleDimZName', '', ''), + ('EEMC:EcalEndcapPClusters:enableEtaBounds', '0', ''), + # Positive Endcap insert ('EEMC:EcalEndcapPInsertRawHits:capacityADC', 'capacityBitsADC=14', '*'), ('EEMC:EcalEndcapPInsertRawHits:dynamicRangeADC', '3*GeV', '*'), @@ -285,7 +293,7 @@ ('EEMC:EcalEndcapPInsertRawHits:pedestalSigma', '0.7', '*'), ('EEMC:EcalEndcapPInsertRawHits:readoutClass', '', ''), ('EEMC:EcalEndcapPInsertRawHits:resolutionTDC', '1e-11', ''), - ('EEMC:EcalEndcapPInsertRawHits:scaleResponse', '1', ''), + ('EEMC:EcalEndcapPInsertRawHits:scaleResponse', '0.03', ''), ('EEMC:EcalEndcapPInsertRawHits:signalSumFields', '', ''), ('EEMC:EcalEndcapPInsertRawHits:timeResolution', '0', ''), @@ -315,14 +323,14 @@ ('EEMC:EcalEndcapPInsertIslandProtoClusters:sectorDist', '5', ''), ('EEMC:EcalEndcapPInsertIslandProtoClusters:splitCluster', '0', ''), - ('EEMC:EcalEndcapPTruthClusters:depthCorrection', '0', ''), - ('EEMC:EcalEndcapPTruthClusters:enableEtaBounds', '1', '*'), - ('EEMC:EcalEndcapPTruthClusters:energyWeight', 'log', ''), - ('EEMC:EcalEndcapPTruthClusters:logWeightBase', '6.2', '*'), - ('EEMC:EcalEndcapPTruthClusters:moduleDimZName', '', ''), - ('EEMC:EcalEndcapPTruthClusters:samplingFraction', '1', ''), + ('EEMC:EcalEndcapPInsertTruthClusters:depthCorrection', '0', ''), + ('EEMC:EcalEndcapPInsertTruthClusters:enableEtaBounds', '1', '*'), + ('EEMC:EcalEndcapPInsertTruthClusters:energyWeight', 'log', ''), + ('EEMC:EcalEndcapPInsertTruthClusters:logWeightBase', '6.2', '*'), + ('EEMC:EcalEndcapPInsertTruthClusters:moduleDimZName', '', ''), + ('EEMC:EcalEndcapPInsertTruthClusters:samplingFraction', '1', ''), - ('EEMC:EcalEndcapPInsertClusters:input_protoclust_tag', 'EcalEndcapPHits', ''), + ('EEMC:EcalEndcapPInsertClusters:input_protoclust_tag', 'EcalEndcapPInsertIslandProtoClusters', ''), ('EEMC:EcalEndcapPInsertClusters:samplingFraction', '1', ''), ('EEMC:EcalEndcapPInsertClusters:logWeightBase', '3.6', ''), ('EEMC:EcalEndcapPInsertClusters:depthCorrection', '0', ''), @@ -330,23 +338,6 @@ ('EEMC:EcalEndcapPInsertClusters:moduleDimZName', '', ''), ('EEMC:EcalEndcapPInsertClusters:enableEtaBounds', '0', ''), - ('EEMC:EcalEndcapPInsertClusters:depthCorrection', '0', ''), - ('EEMC:EcalEndcapPInsertClusters:dimScaledLocalDistXY', '1.8,1.8', ''), - ('EEMC:EcalEndcapPInsertClusters:enableEtaBounds', '0', ''), - ('EEMC:EcalEndcapPInsertClusters:energyWeight', 'log', ''), - ('EEMC:EcalEndcapPInsertClusters:globalDistEtaPhi', '', ''), - ('EEMC:EcalEndcapPInsertClusters:globalDistRPhi', '', ''), - ('EEMC:EcalEndcapPInsertClusters:localDistXY', '', ''), - ('EEMC:EcalEndcapPInsertClusters:localDistXZ', '', ''), - ('EEMC:EcalEndcapPInsertClusters:localDistYZ', '', ''), - ('EEMC:EcalEndcapPInsertClusters:logWeightBase', '3.6', ''), - ('EEMC:EcalEndcapPInsertClusters:minClusterCenterEdep', '0.03', ''), - ('EEMC:EcalEndcapPInsertClusters:minClusterHitEdep', '0.001', ''), - ('EEMC:EcalEndcapPInsertClusters:moduleDimZName', '', ''), - ('EEMC:EcalEndcapPInsertClusters:samplingFraction', '1', ''), - ('EEMC:EcalEndcapPInsertClusters:sectorDist', '5', ''), - ('EEMC:EcalEndcapPInsertClusters:splitCluster', '0', '*'), - # B0ECAL - Far forward B0 Ecal # ----------------- ('B0ECAL:B0ECalRawHits:capacityADC', 'capacityBitsADC=14', '*'),