-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
1 parent
257b91f
commit ffc0e79
Showing
19 changed files
with
477 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
109 changes: 109 additions & 0 deletions
109
src/detectors/EEMC/Cluster_factory_EcalEndcapNTruthClusters.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <random> | ||
|
||
#include <JANA/JFactoryT.h> | ||
#include <services/geometry/dd4hep/JDD4hep_service.h> | ||
#include <algorithms/calorimetry/CalorimeterClusterRecoCoG.h> | ||
#include <services/log/Log_service.h> | ||
#include <extensions/spdlog/SpdlogExtensions.h> | ||
|
||
|
||
|
||
// Dummy factory for JFactoryGeneratorT | ||
class Association_factory_EcalEndcapNTruthClustersAssociations : public JFactoryT<edm4eic::MCRecoClusterParticleAssociation> { | ||
|
||
public: | ||
//------------------------------------------ | ||
// Constructor | ||
Association_factory_EcalEndcapNTruthClustersAssociations(){ | ||
SetTag("EcalEndcapNTruthClustersAssociations"); | ||
} | ||
}; | ||
|
||
|
||
|
||
class Cluster_factory_EcalEndcapNTruthClusters : public JFactoryT<edm4eic::Cluster>, 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<JDD4hep_service>(); | ||
|
||
std::string tag=this->GetTag(); | ||
std::shared_ptr<spdlog::logger> m_log = app->GetService<Log_service>()->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<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, "EcalEndcapNTruthClustersAssociations"); | ||
m_outputClusters.clear(); // not really needed, but better to not leave dangling pointers around | ||
m_outputAssociations.clear(); | ||
} | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
109 changes: 109 additions & 0 deletions
109
src/detectors/EEMC/Cluster_factory_EcalEndcapPInsertTruthClusters.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <random> | ||
|
||
#include <JANA/JFactoryT.h> | ||
#include <services/geometry/dd4hep/JDD4hep_service.h> | ||
#include <algorithms/calorimetry/CalorimeterClusterRecoCoG.h> | ||
#include <services/log/Log_service.h> | ||
#include <extensions/spdlog/SpdlogExtensions.h> | ||
|
||
|
||
|
||
// Dummy factory for JFactoryGeneratorT | ||
class Association_factory_EcalEndcapPInsertTruthClustersAssociations : public JFactoryT<edm4eic::MCRecoClusterParticleAssociation> { | ||
|
||
public: | ||
//------------------------------------------ | ||
// Constructor | ||
Association_factory_EcalEndcapPInsertTruthClustersAssociations(){ | ||
SetTag("EcalEndcapPInsertTruthClustersAssociations"); | ||
} | ||
}; | ||
|
||
|
||
|
||
class Cluster_factory_EcalEndcapPInsertTruthClusters : public JFactoryT<edm4eic::Cluster>, 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<JDD4hep_service>(); | ||
|
||
std::string tag=this->GetTag(); | ||
std::shared_ptr<spdlog::logger> m_log = app->GetService<Log_service>()->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<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, "EcalEndcapPInsertTruthClustersAssociations"); | ||
m_outputClusters.clear(); // not really needed, but better to not leave dangling pointers around | ||
m_outputAssociations.clear(); | ||
} | ||
}; | ||
|
Oops, something went wrong.