-
Notifications
You must be signed in to change notification settings - Fork 32
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
base: main
Are you sure you want to change the base?
Changes from all commits
0a558ae
79ff346
93febe8
581c4b4
1d70ff4
ee01baf
3096e5e
3c04b82
668fdf4
e0e7b92
10bd338
1b7f3b7
32d7d30
f6ee7de
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 | ||||||||
|
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.
Suggested change
|
||||||||
| {"EcalEndcapPRawHits", "EcalEndcapPRawHitAssociations"}, | ||||||||
| {"EcalEndcapPRawHits", "EcalEndcapPRawHitAssociations"}, | ||||||||
| #else | ||||||||
| {"EcalEndcapPRawHits"}, | ||||||||
| {"EcalEndcapPRawHits"}, | ||||||||
| #endif | ||||||||
|
Comment on lines
77
to
79
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. Remove these 3 lines. |
||||||||
| { | ||||||||
| .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 | ||||||||
|
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.
Suggested change
|
||||||||
| {"EcalEndcapPRawHits", "EcalEndcapPRawHitAssociations"}, | ||||||||
| #else | ||||||||
| {"EcalEndcapPRawHits"}, | ||||||||
| #endif | ||||||||
|
Comment on lines
+104
to
+106
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.
Suggested change
|
||||||||
| { | ||||||||
| //.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 | ||||||||
|
|
||||||||
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 ?
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.
Done. Once #1064 is in, I can switch to using that.
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.
#1064 is merged.