1 #ifndef _FdLightCollectionEfficiency_FdLightCollectionEfficiency_h_
2 #define _FdLightCollectionEfficiency_FdLightCollectionEfficiency_h_
14 #include <fwk/VModule.h>
18 #include <utl/Trace.h>
19 #include <fevt/FdConstants.h>
20 #include <atm/Atmosphere.h>
30 class TabulatedFunctionErrors;
39 namespace FdLightCollectionEfficiencyKG {
40 class PixelToApertureLightConverter;
74 std::pair<fwk::VModule::ResultFlag, unsigned int>
76 unsigned int nRayTracingIterations,
94 const double targetRelUncertainty,
95 const double minRelevantEfficiency);
114 const double minRelevantEfficiency,
115 const double maxUncertaintyChangeFraction);
119 const int eyeId,
const unsigned int nRayTracingIterations,
124 const fevt::Eye& realEye,
const unsigned int nRayTracingIterations,
135 const double simTimeOffset,
136 const std::vector<std::vector<unsigned int> >& pixelsInZeta,
148 const double nRayTracingIterations);
161 const double maxBin = trace.
GetSize()-1;
163 const double relBinStart = start / binSize;
164 const double relBinEnd = end / binSize;
166 const unsigned int relBinStartInt = (
unsigned int)relBinStart;
167 const unsigned int relBinEndInt = (
unsigned int)relBinEnd;
169 if (relBinStartInt > maxBin)
172 if (relBinStartInt == relBinEndInt) {
174 const double traceBinFactor = relBinEnd-relBinStart;
175 return trace.
At(relBinStartInt) * traceBinFactor;
178 double binSignal = 0.;
180 const double startBinFactor = 1. - (relBinStart - relBinStartInt);
181 binSignal += trace.
At(relBinStartInt) * startBinFactor;
183 if (relBinEndInt > maxBin)
187 const double endBinFactor = relBinEnd - relBinEndInt;
188 binSignal += trace.
At(relBinEndInt) * endBinFactor;
191 if (relBinEndInt > maxBin) {
192 for (
unsigned int iBin = relBinStartInt+1; iBin < maxBin; ++iBin)
193 binSignal += trace.
At(iBin);
195 for (
unsigned int iBin = relBinStartInt+1; iBin < relBinEndInt; ++iBin)
196 binSignal += trace.
At(iBin);
202 void WriteDebugInfo(
const int eyeId,
const int simTelId,
const double simTimeOffset,
void WriteDebugInfo(const int eyeId, const int simTelId, const double simTimeOffset, const fevt::FdConstants::LightSource component, const utl::TabulatedFunctionErrors &totalPixelTrace, const utl::TraceD &totalWlTrace, const utl::TabulatedFunctionErrors &realApLightFlux, const utl::TabulatedFunctionErrors &telEff)
T & At(const SizeType i)
trace entry with checked address
std::vector< fevt::FdConstants::LightSource > fLightComponents
utl::TabulatedFunctionErrors CalcTraceDivision(const utl::TabulatedFunctionErrors &pixelTrace, const utl::TraceD &apertureTrace, const utl::TraceI &nRayTracedTrace, const double nRayTracingIterations)
Fluorescence Detector Eye Event.
EStopCondition fStopCondition
Condition for stopping the ray tracing loop: eFixed/eTargetUncertainty/eBootstrap.
double fTargetUncertainty
Maximum tolerable uncertainty.
REGISTER_MODULE("FdLightCollectionEfficiencyKG", FdLightCollectionEfficiency)
for easy iteration over the relevant light components
Utility class to do (cached!) conversion from photons at the pixel to photons at aperture.
double fTargetWorstCaseLAtApUncertaintyChange
Target worst-case change of light at aperture uncertainty.
double GetBinning() const
size of one slot
fwk::VModule::ResultFlag DoInitialReconstruction(evt::Event &event, std::map< int, evt::ShowerFRecData * > &dataSets)
Runs the FdProfileReconstructor before the efficiency calculation.
bool fUseZeta
Collect light within zeta only or in the whole camera?
std::map< unsigned int, utl::TraceD > * fTimeCorrectedApertureTraces
LightSource
Possible light sources.
unsigned int fMaxIterations
Hard limit for the number of iterations. Intended for a fallback, HIGH upper limit.
bool CalculateEfficiency(const evt::Event &simEvent, evt::Event &realEvent, const int eyeId, const unsigned int nRayTracingIterations, const fevt::FdConstants::LightSource lightSource)
Calculates the light collection efficiency of a sim shower.
fwk::VModule::ResultFlag Init()
Initialize: invoked at beginning of run (NOT beginning of event)
void FillSimEvent(evt::Event &event, const evt::ShowerFRecData &recData)
Fill the simulated shower with data from the initial reconstruction.
int fMinNRayTracePerBin
ShowerPhotonGeneratorOG overrides.
fwk::VModule::ResultFlag Finish()
Finish: invoked at end of the run (NOT end of the event)
utl::TabulatedFunctionErrors CalculatePixelTraceSum(const fevt::Telescope &tel, const fevt::FdConstants::LightSource component, const double simTimeOffset, const std::vector< std::vector< unsigned int > > &pixelsInZeta, const utl::TabulatedFunctionErrors &realApLight)
Calculate the sum of pixel traces (simTimeOffset in ns)
double CalcTraceBinContent(const utl::Trace< T > &trace, const double start, const double end)
std::map< std::string, SubModule > fSubModulesList
double fMinRelevantEfficiency
Minimum relevant efficiency value.
Top of Fluorescence Detector event hierarchy.
double CalculateAdditionalIterationsToMeetTarget(const fevt::FEvent &theRealFEvent, const fevt::FEvent &theSimFEvent, const fevt::FdConstants::LightSource &lightSource, const double targetRelUncertainty, const double minRelevantEfficiency)
std::pair< fwk::VModule::ResultFlag, unsigned int > RunPhotonGenerationRayTracingLoop(evt::Event &event, evt::Event &realEvent, unsigned int nRayTracingIterations, const fevt::FdConstants::LightSource lightSource)
Runs the ShowerPhotonGenerator and TelescopeSimulator nRayTracingIterations times.
double fExtraRayTraceFactor
ResultFlag
Flag returned by module methods to the RunController.
Light collection efficiency correction for profile reconstruction.
int fVerbosity
global verbosity flag
Interface class to access to Fluorescence reconstruction of a Shower.
fwk::VModule::ResultFlag ProcessEvent(evt::Event &realEvent)
Main entry point. Run() is just a proxy.
double fLightAtDiaBinning
Relative time binning factor for the light at diaphragm simulation (default: 10 => slowish) ...
int fNRayTracingIterations
Number of photon-gen/ray-trace loop iterations.
Fluorescence Detector Telescope Event.
fwk::VModule::ResultFlag Run(evt::Event &event)
Run: invoked once per event.
double CalculateTargetRelUncertainty(const fevt::FEvent &theRealFEvent, const fevt::FEvent &theSimFEvent, const fevt::FdConstants::LightSource &lightSource, const double minRelevantEfficiency, const double maxUncertaintyChangeFraction)
bool CalculateTelescopeEfficiency(const fevt::Telescope &simTel, fevt::Telescope &realTel, const fevt::Eye &realEye, const unsigned int nRayTracingIterations, const fevt::FdConstants::LightSource lightSource)
Calculates the light collection efficiency of a telescope.
double fLowerUncertaintyLimit
Lower limit of the required uncertainty in eSmallEnough mode.
PixelToApertureLightConverter * fLightConverter
double fProfileXBinning
Depth-binning of the GH => dEdX/Ne calculation.
utl::TraceD CalculateTelescopeTraceSum(const fevt::Telescope &tel, const fevt::FdConstants::LightSource component, const atm::Atmosphere::EmissionMode lightType)
Calculate the wavelength-efficiency weighted sum of light-at-aperture traces.