-
Notifications
You must be signed in to change notification settings - Fork 31
Update FEMC for new geometry: #1848
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
Open
akioogawa
wants to merge
13
commits into
main
Choose a base branch
from
FEMCupdate20250501
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
0a558ae
Update FEMC for new geometry:
akioogawa 79ff346
Merge branch 'main' into FEMCupdate20250501
akioogawa 93febe8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 581c4b4
typo
akioogawa 1d70ff4
Merge branch 'main' into FEMCupdate20250501
akioogawa ee01baf
Merge branch 'main' into FEMCupdate20250501
akioogawa 3096e5e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 3c04b82
Merge branch 'main' into FEMCupdate20250501
akioogawa 668fdf4
Merge branch 'main' into FEMCupdate20250501
akioogawa e0e7b92
Merge branch 'main' into FEMCupdate20250501
akioogawa 10bd338
- Update ScFi model's Sampling Faction from 3% to 2.9% based on ratio…
akioogawa 1b7f3b7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 32d7d30
Merge branch 'main' into FEMCupdate20250501
akioogawa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
|
||
// 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 | ||
|
||
|
@@ -8,6 +9,7 @@ | |
#include <string> | ||
|
||
#include "algorithms/calorimetry/CalorimeterHitDigiConfig.h" | ||
#include "algorithms/calorimetry/CalorimeterHitRecoConfig.h" | ||
#include "extensions/jana/JOmniFactoryGeneratorT.h" | ||
#include "factories/calorimetry/CalorimeterClusterRecoCoG_factory.h" | ||
#include "factories/calorimetry/CalorimeterHitDigi_factory.h" | ||
|
@@ -23,38 +25,107 @@ void InitPlugin(JApplication* app) { | |
using namespace eicrecon; | ||
|
||
InitJANAPlugin(app); | ||
|
||
auto log_service = app->GetService<Log_service>(); | ||
auto mLog = log_service->logger("FEMC"); | ||
|
||
int SiPMSaturation = 1; | ||
std::string opt("ON"); | ||
app->SetDefaultParameter("FEMC:SiPMSaturation", opt, "Turn ON(default) or OFF SiPM Saturation"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should avoid adding options inside plugins, when algorithm option would apply to different detectors. See how its made into algorithm parameter in #1064 . |
||
if (opt.find("OFF") != std::string::npos || opt.find("off") != std::string::npos || | ||
opt.find("Off") != std::string::npos) { | ||
mLog->info("SiPM Saturation OFF"); | ||
SiPMSaturation = 0; | ||
} else { | ||
mLog->info("SiPM Saturation ON"); | ||
} | ||
|
||
// 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", {"EcalEndcapPHits"}, | ||
//const double sampFrac = 0.03; | ||
const double sampFrac = 0.029043; //updated with ratio to ScFi model | ||
decltype(CalorimeterHitDigiConfig::corrMeanScale) EcalEndcapP_corrMeanScale = | ||
Form("%f", 1.0 / sampFrac); | ||
decltype(CalorimeterHitRecoConfig::sampFrac) EcalEndcapP_sampFrac = Form("%f", sampFrac); | ||
decltype(CalorimeterHitDigiConfig::nPhotonPerGeV) EcalEndcapP_nPhotonPerGeV = 1500; | ||
decltype(CalorimeterHitDigiConfig::totalPixel) EcalEndcapP_totalPixel = 4 * 159565; | ||
if (SiPMSaturation == 0) | ||
EcalEndcapP_totalPixel = 0; | ||
|
||
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 (...) { | ||
}; | ||
|
||
if (FEMCHomoScfi <= 1) { | ||
app->Add(new JOmniFactoryGeneratorT<CalorimeterHitDigi_factory>( | ||
"EcalEndcapPRawHits", {"EcalEndcapPHits"}, | ||
#if EDM4EIC_VERSION_MAJOR >= 7 | ||
{"EcalEndcapPRawHits", "EcalEndcapPRawHitAssociations"}, | ||
{"EcalEndcapPRawHits", "EcalEndcapPRawHitAssociations"}, | ||
#else | ||
{"EcalEndcapPRawHits"}, | ||
{"EcalEndcapPRawHits"}, | ||
#endif | ||
{ | ||
.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 | ||
)); | ||
{ | ||
.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 | ||
.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", | ||
.totalPixel = EcalEndcapP_totalPixel, | ||
.nPhotonPerGeV = EcalEndcapP_nPhotonPerGeV, | ||
}, | ||
app // TODO: Remove me once fixed | ||
)); | ||
} else if (FEMCHomoScfi == 2) { | ||
app->Add(new JOmniFactoryGeneratorT<CalorimeterHitDigi_factory>( | ||
"EcalEndcapPRawHits", {"EcalEndcapPHits"}, | ||
#if EDM4EIC_VERSION_MAJOR >= 7 | ||
{"EcalEndcapPRawHits", "EcalEndcapPRawHitAssociations"}, | ||
#else | ||
{"EcalEndcapPRawHits"}, | ||
#endif | ||
{ | ||
//.eRes = {0.0, 0.0, 0.0}, // No smearing for ScFi | ||
.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 | ||
.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"}, | ||
.totalPixel = EcalEndcapP_totalPixel, | ||
.nPhotonPerGeV = EcalEndcapP_nPhotonPerGeV, | ||
}, | ||
app // TODO: Remove me once fixed | ||
)); | ||
} | ||
|
||
app->Add(new JOmniFactoryGeneratorT<CalorimeterHitReco_factory>( | ||
"EcalEndcapPRecHits", {"EcalEndcapPRawHits"}, {"EcalEndcapPRecHits"}, | ||
{ | ||
|
@@ -65,8 +136,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 | ||
|
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you consider reviewing #1064 ?