Skip to content
Open
Changes from 40 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
0a558ae
Update FEMC for new geometry:
akioogawa May 1, 2025
79ff346
Merge branch 'main' into FEMCupdate20250501
akioogawa May 2, 2025
93febe8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 2, 2025
581c4b4
typo
akioogawa May 2, 2025
1d70ff4
Merge branch 'main' into FEMCupdate20250501
akioogawa May 5, 2025
ee01baf
Merge branch 'main' into FEMCupdate20250501
akioogawa May 8, 2025
3096e5e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 8, 2025
3c04b82
Merge branch 'main' into FEMCupdate20250501
akioogawa May 8, 2025
668fdf4
Merge branch 'main' into FEMCupdate20250501
akioogawa May 12, 2025
e0e7b92
Merge branch 'main' into FEMCupdate20250501
akioogawa May 13, 2025
10bd338
- Update ScFi model's Sampling Faction from 3% to 2.9% based on ratio…
akioogawa May 13, 2025
1b7f3b7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 13, 2025
32d7d30
Merge branch 'main' into FEMCupdate20250501
akioogawa Jun 3, 2025
f6ee7de
Merge branch 'main' into FEMCupdate20250501
akioogawa Jun 17, 2025
6965701
Update src/detectors/FEMC/FEMC.cc
akioogawa Oct 27, 2025
83e634a
Update src/detectors/FEMC/FEMC.cc
akioogawa Oct 27, 2025
d186248
Update src/detectors/FEMC/FEMC.cc
akioogawa Oct 27, 2025
02979bc
Remove 3 lines for old code compatibility
akioogawa Oct 27, 2025
7b5e952
Revert back
akioogawa Oct 27, 2025
cb4265d
add back empty line
akioogawa Oct 27, 2025
5aaa220
Merge branch 'main' into FEMCupdate20250501
akioogawa Oct 27, 2025
6d65460
Changed to use #1064
akioogawa Oct 27, 2025
c8645a8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 27, 2025
50fffe9
add copyright, use fmt::format, remove commented code
veprbl Oct 28, 2025
399e6ee
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 28, 2025
b0d7e64
Replace fmt/base.h with fmt/core.h
veprbl Oct 28, 2025
036a3c0
fix EcaslEndcapP typo, add consistent prefixes
veprbl Oct 28, 2025
320cf88
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 28, 2025
80d23d2
Change totalPixel type to unsigned long long
veprbl Oct 28, 2025
956453f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 28, 2025
37fe322
Fix field initialization in FEMC.cc
veprbl Oct 28, 2025
01f50e6
reorder again
veprbl Oct 28, 2025
3b8fd8b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 28, 2025
4568907
fields go last
veprbl Oct 28, 2025
d71d25f
Merge branch 'main' into FEMCupdate20250501
veprbl Oct 28, 2025
b0d3d12
Update FEMC for new geometry: (fix: iwyu) (#2156)
wdconinc Oct 28, 2025
0e7b743
address clang-tidy comments
veprbl Oct 28, 2025
062f231
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 28, 2025
1e93ae3
Update src/detectors/FEMC/FEMC.cc
veprbl Oct 28, 2025
7aecce9
Update FEMC for new geometry: (fix: iwyu) (#2157)
wdconinc Oct 28, 2025
2511b2f
Rename FEMCHomoScFi to EcalEndcapP_homogeniousFlag
veprbl Oct 28, 2025
efef380
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 28, 2025
3c15a25
Update EcalEndcapPRawHits parameters in FEMC.cc
veprbl Oct 28, 2025
3249c9d
Fix typo in homogeneousFlag variable name
veprbl Oct 28, 2025
0fafb40
Merge branch 'main' into FEMCupdate20250501
akioogawa Oct 28, 2025
74dbeb0
Merge branch 'main' into FEMCupdate20250501
akioogawa Oct 29, 2025
c3e641a
"fiberx -> fiber_x (consistency with the other scfi implementations)
veprbl Oct 31, 2025
b0444c6
adjust some comments
veprbl Oct 31, 2025
5568d72
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 31, 2025
6ab3799
remove empty line
veprbl Oct 31, 2025
087ad94
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 31, 2025
3fc4c41
Update light collection efficiency with better number
akioogawa Nov 6, 2025
82bfaec
Remove summing over x and y for ScFi case (recent changes applied to …
veprbl Nov 14, 2025
8d5aa2e
naming
veprbl Nov 14, 2025
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
113 changes: 89 additions & 24 deletions src/detectors/FEMC/FEMC.cc
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright (C) 2021 - 2025, Chao Peng, Sylvester Joosten, Whitney Armstrong, David Lawrence, Friederike Bock, Wouter Deconinck, Kolja Kauder, Sebouh Paul
// Copyright (C) 2021 - 2025, Chao Peng, Sylvester Joosten, Whitney Armstrong, David Lawrence, Friederike Bock, Wouter Deconinck, Kolja Kauder, Sebouh Paul, Akio Ogawa

#include <DD4hep/Detector.h>
#include <Evaluator/DD4hepUnits.h>
#include <JANA/JApplication.h>
#include <JANA/JApplicationFwd.h>
#include <JANA/Utils/JTypeInfo.h>
#include <fmt/core.h>
#include <spdlog/logger.h>
#include <cmath>
#include <gsl/pointers>
#include <memory>
#include <string>
#include <variant>
#include <vector>
Expand All @@ -18,41 +24,99 @@
#include "factories/calorimetry/CalorimeterIslandCluster_factory.h"
#include "factories/calorimetry/CalorimeterTruthClustering_factory.h"
#include "factories/calorimetry/TrackClusterMergeSplitter_factory.h"
#include "services/geometry/dd4hep/DD4hep_service.h"
#include "services/log/Log_service.h"

extern "C" {
void InitPlugin(JApplication* app) {

using namespace eicrecon;

InitJANAPlugin(app);

auto log_service = app->GetService<Log_service>();
auto mLog = log_service->logger("FEMC");

// Make sure digi and reco use the same value
decltype(CalorimeterHitDigiConfig::capADC) EcalEndcapP_capADC =
16384; //16384, assuming 14 bits. For approximate HGCROC resolution use 65536
decltype(CalorimeterHitDigiConfig::dyRangeADC) EcalEndcapP_dyRangeADC = 3 * dd4hep::GeV;
decltype(CalorimeterHitDigiConfig::dyRangeADC) EcalEndcapP_dyRangeADC = 100 * dd4hep::GeV;
decltype(CalorimeterHitDigiConfig::pedMeanADC) EcalEndcapP_pedMeanADC = 200;
decltype(CalorimeterHitDigiConfig::pedSigmaADC) EcalEndcapP_pedSigmaADC = 2.4576;
decltype(CalorimeterHitDigiConfig::resolutionTDC) EcalEndcapP_resolutionTDC =
10 * dd4hep::picosecond;
app->Add(new JOmniFactoryGeneratorT<CalorimeterHitDigi_factory>(
"EcalEndcapPRawHits", {"EventHeader", "EcalEndcapPHits"},
{"EcalEndcapPRawHits", "EcalEndcapPRawHitAssociations"},
{
.eRes = {0.11333 * sqrt(dd4hep::GeV), 0.03,
0.0 * dd4hep::GeV}, // (11.333% / sqrt(E)) \oplus 3%
.tRes = 0.0,
.threshold = 0.0,
// .threshold = 15 * dd4hep::MeV for a single tower, applied on ADC level
.capADC = EcalEndcapP_capADC,
.capTime = 100, // given in ns, 4 samples in HGCROC
.dyRangeADC = EcalEndcapP_dyRangeADC,
.pedMeanADC = EcalEndcapP_pedMeanADC,
.pedSigmaADC = EcalEndcapP_pedSigmaADC,
.resolutionTDC = EcalEndcapP_resolutionTDC,
.corrMeanScale = "0.03",
.readout = "EcalEndcapPHits",
},
app // TODO: Remove me once fixed
));
const double EcalEndcapP_sampFrac = 0.029043; // updated with ratio to ScFi model
decltype(CalorimeterHitDigiConfig::corrMeanScale) EcalEndcapP_corrMeanScale =
fmt::format("{}", 1.0 / EcalEndcapP_sampFrac);
const double EcalEndcapP_nPhotonPerGeV = 1500;
const double EcalEndcapP_PhotonCollectionEff = 0.5;
const unsigned long long EcalEndcapP_totalPixel = 4 * 159565ULL;

int FEMCHomoScFi = 0;
try {
auto detector = app->GetService<DD4hep_service>()->detector();
FEMCHomoScFi = detector->constant<int>("ForwardEcal_Homogeneous_Scfi");
if (FEMCHomoScFi <= 1) {
mLog->info("Homogeneous geometry loaded");
} else {
mLog->info("ScFi geometry loaded");
}
} catch (...) {
FEMCHomoScFi = 0;
};

if (FEMCHomoScFi <= 1) {
app->Add(new JOmniFactoryGeneratorT<CalorimeterHitDigi_factory>(
"EcalEndcapPRawHits", {"EcalEndcapPHits"},
{"EcalEndcapPRawHits", "EcalEndcapPRawHitAssociations"},
{
.eRes = {0.11333 * sqrt(dd4hep::GeV), 0.03,
0.0 * dd4hep::GeV}, // (11.333% / sqrt(E)) \oplus 3%
.tRes = 0.0,
.threshold =
0.0, // 15MeV threshold for a single tower will be applied on ADC at Reco below
.readoutType = "sipm",
.lightYield = EcalEndcapP_nPhotonPerGeV / EcalEndcapP_PhotonCollectionEff,
.photonDetectionEfficiency = EcalEndcapP_PhotonCollectionEff,
.numEffectiveSipmPixels = EcalEndcapP_totalPixel,
.capADC = EcalEndcapP_capADC,
.capTime = 100, // given in ns, 4 samples in HGCROC
.dyRangeADC = EcalEndcapP_dyRangeADC,
.pedMeanADC = EcalEndcapP_pedMeanADC,
.pedSigmaADC = EcalEndcapP_pedSigmaADC,
.resolutionTDC = EcalEndcapP_resolutionTDC,
.corrMeanScale = "1.0",
.readout = "EcalEndcapPHits",
},
app // TODO: Remove me once fixed
));
} else if (FEMCHomoScFi == 2) {
app->Add(new JOmniFactoryGeneratorT<CalorimeterHitDigi_factory>(
"EcalEndcapPRawHits", {"EcalEndcapPHits"},
{"EcalEndcapPRawHits", "EcalEndcapPRawHitAssociations"},
{
.eRes = {0.0, 0.022, 0.0}, // just constant term 2.2% based on MC data comparison
.tRes = 0.0,
.threshold =
0.0, // 15MeV threshold for a single tower will be applied on ADC at Reco below
.readoutType = "sipm",
.lightYield = EcalEndcapP_nPhotonPerGeV / EcalEndcapP_PhotonCollectionEff,
.photonDetectionEfficiency = EcalEndcapP_PhotonCollectionEff,
.numEffectiveSipmPixels = EcalEndcapP_totalPixel,
.capADC = EcalEndcapP_capADC,
.capTime = 100, // given in ns, 4 samples in HGCROC
.dyRangeADC = EcalEndcapP_dyRangeADC,
.pedMeanADC = EcalEndcapP_pedMeanADC,
.pedSigmaADC = EcalEndcapP_pedSigmaADC,
.resolutionTDC = EcalEndcapP_resolutionTDC,
.corrMeanScale = EcalEndcapP_corrMeanScale,
.readout = "EcalEndcapPHits",
.fields = {"fiberx", "fibery", "x", "y"},
},
app // TODO: Remove me once fixed
));
}

app->Add(new JOmniFactoryGeneratorT<CalorimeterHitReco_factory>(
"EcalEndcapPRecHits", {"EcalEndcapPRawHits"}, {"EcalEndcapPRecHits"},
{
Expand All @@ -63,8 +127,9 @@ void InitPlugin(JApplication* app) {
.resolutionTDC = EcalEndcapP_resolutionTDC,
.thresholdFactor = 0.0,
.thresholdValue =
2, // The ADC of a 15 MeV particle is adc = 200 + 15 * 0.03 * ( 1.0 + 0) / 3000 * 16384 = 200 + 2.4576
.sampFrac = "0.03",
// 2, // The ADC of a 15 MeV particle is adc = 200 + 15 * 0.03 * ( 1.0 + 0) / 3000 * 16384 = 200 + 2.4576
3, // 15 MeV = 2.4576, but adc=llround(dE) and cut off is "<". So 3 here = 15.25MeV
.sampFrac = "1.00", // already taken care in DIGI code above
.readout = "EcalEndcapPHits",
},
app // TODO: Remove me once fixed
Expand Down
Loading