13 #include <utl/Reader.h>
14 #include <utl/ErrorLogger.h>
15 #include <utl/AugerUnits.h>
16 #include <utl/MathConstants.h>
17 #include <utl/PhysicalConstants.h>
18 #include <utl/TabulatedFunction.h>
19 #include <utl/TabulatedFunctionErrors.h>
20 #include <utl/Trace.h>
21 #include <utl/MultiTabulatedFunction.h>
22 #include <utl/ReferenceEllipsoid.h>
23 #include <utl/Vector.h>
25 #include <fwk/CentralConfig.h>
27 #include <det/Detector.h>
28 #include <fdet/FDetector.h>
29 #include <fdet/Telescope.h>
30 #include <fdet/Pixel.h>
31 #include <fdet/Camera.h>
32 #include <fdet/Mirror.h>
33 #include <fdet/Corrector.h>
34 #include <fdet/Filter.h>
38 #include <evt/Event.h>
39 #include <fevt/FEvent.h>
41 #include <fevt/Telescope.h>
42 #include <fevt/TelescopeSimData.h>
43 #include <fevt/PixelSimData.h>
44 #include <fevt/Pixel.h>
48 using namespace FdBackgroundSimulatorOG;
71 }
else if (tmp==
"parametric") {
73 }
else if (tmp==
"bgLoop") {
77 err <<
"unknown mode for bg model: " << tmp;
84 if (fBackgroundFlux.size()!=440) {
85 ERROR(
"Dimensions of the the vector with the photon background is different from 440. ");
92 << GetVersionInfo(VModule::eRevisionNumber) <<
"\n"
96 case eTable: info <<
"XML datacard tables \n";
break;
97 case eBGLoop: info <<
"bgLoop database \n";
break;
98 case eParametric: info <<
"sky-variance parametrisation \n";
break;
99 default: info <<
"UNKNOWN \n";
break;
111 ERROR (
"Event has no FEvent.");
115 FEvent& fEvent =
event.GetFEvent();
118 iEye != fEvent.
EyesEnd(ComponentSelector::eInDAQ);
134 iPixel != telEvent.
PixelsEnd(ComponentSelector::eInDAQ);
137 if (iPixel->HasSimData()) {
139 AddBackground(telEvent, event);
141 AddBackgroundFromVariance(telEvent, event);
166 const fdet::FDetector& detFD = det::Detector::GetInstance().GetFDetector();
169 unsigned int telId = telEvent.
GetId();
170 unsigned int eyeId = telEvent.
GetEyeId();
172 if (fVerbosity > 0) {
174 info <<
"Loading photon background to eye=" << eyeId
175 <<
" mirror=" << telId;
192 const double pixelAperture =
202 warn <<
"The pixel: " << pixelId <<
" already has a background trace.";
211 const double diaPhotonToPE =
213 const double opticalEfficiency =
216 const double flux = fBackgroundFlux[pixelId-1];
217 const double bgPhotons = flux * pixelAperture * timeBinSize * opticalEfficiency;
221 if (fVerbosity > 0) {
223 info <<
"bg-TABLE: Eye n." << eyeId <<
" mirror n." << telId
224 <<
" pixel n." << pixelId <<
" bgPhotons " << bgPhotons
225 <<
" OpticalFactor -> " << opticalEfficiency;
238 const fdet::FDetector& detFD = det::Detector::GetInstance().GetFDetector();
253 const double noiseEqBdw = 0.5*cutoffFrequency*
sqrt(
kPi/log(2.0));
254 const double samplingFrequency = 1./timeBinSize;
255 const double analogElectronicsFactor = 2. * noiseEqBdw / samplingFrequency;
260 const unsigned int telId = telEvent.
GetId();
261 const unsigned int eyeId = telEvent.
GetEyeId();
263 if (fVerbosity > 0) {
265 info <<
"Loading photon background to eye=" << eyeId
266 <<
" mirror=" << telId;
288 warn <<
"The pixel: " << pixelId <<
" already has a background trace.";
302 const double VARskyStandardASTel = GetParametricSkyVariance(theta);
303 VARsky = VARskyStandardASTel * timeBinSize / (100*
ns);
305 VARsky /= analogElectronicsFactor;
309 pixel.
SetStatus(ComponentSelector::eDeSelected);
310 cout <<
" pixel de-selected: " << pixelId << endl;
322 const double VARskyPE = VARsky / (absGain*absGain);
323 const double nPE = VARskyPE / (1+Vg);
325 const double bgPhotons = nPE / qEff.
Y(normWavelength);
327 if (fVerbosity > 0) {
330 if (fMode==eBGLoop) info <<
" bg-BGLoop: " ;
331 else info <<
" bg-Prmtrc: ";
332 info <<
" Eye n." << eyeId <<
" mirror n." << telId
333 <<
" pixel n." << pixelId <<
" pixel zenith "
334 << theta/
deg <<
" var_sky " << VARsky <<
" bgPhotons " << bgPhotons;
353 const double f = 0.501;
354 const double k = 0.3862;
355 const double bl = 14.27;
357 double V = 1 /
sqrt (1 - 0.96*sin(theta)*sin(theta) );
358 double expon = -.4*k*(V-1);
359 double var = bl * ( 1 - f + f *
V ) *
pow(10., expon);
const utl::Vector & GetDirection() const
pointing direction of this pixel
double GetFADCBinSize() const
Description of the electronic channel for the 480 channels of the crate.
Fluorescence Detector Eye Event.
unsigned int GetFirstPixelId() const
const Pixel & GetPixel(const fevt::Pixel &eventPixel) const
Get fdet::Pixel from fevt::Channel.
double GetTheta(const CoordinateSystemPtr &coordinateSystem) const
zenith (theta) angle in spherical coordinates
fwk::VModule::ResultFlag Finish()
Finish: invoked at end of the run (NOT end of the event)
Class to hold collection (x,y) points and provide interpolation between them.
unsigned int GetParentPhysicalEyeId() const
double GetElectronicNoiseVariance() const
double GetCutoffFrequency() const
EyeIterator EyesEnd(const ComponentSelector::Status status)
unsigned int GetEyeId() const
#define INFO(message)
Macro for logging informational messages.
PixelSimData & GetSimData()
const Eye & GetEye(const unsigned int eyeId) const
Find eye by numerical Id.
Detector description interface for Eye-related data.
boost::filter_iterator< ComponentSelector, AllEyeIterator > EyeIterator
selective Eye iterators
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
bool HasPhotonTrace(const FdConstants::LightSource source) const
Check that trace for source /par source is present.
double pow(const double x, const unsigned int i)
double GetElectronicsGain() const
const Camera & GetCamera() const
Get the Camera object that belongs to the telescope.
bool AddBackgroundFromVariance(fevt::Telescope &tel, evt::Event &event)
double GetParametricSkyVariance(double theta) const
PixelIterator PixelsEnd()
iterator pointing to end of available pixels of status eHasData (DEPRECATED)
Detector description interface for FDetector-related data.
const Pixel & GetPixel(const unsigned int pixelId) const
Get Pixel by id, throw utl::NonExistentComponentException if n.a.
void SetMeanBgPhotonFlux(const double mean)
Set mean bg photon flux.
double GetSolidAngle() const
The solid angle viewed by this pixel.
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
void MakePixel(const unsigned int pixelId, const ComponentSelector::Status status=ComponentSelector::eHasData)
Make Pixel telescopeId.
bool HasPixel(const unsigned int pixelId, const ComponentSelector::Status status=ComponentSelector::eHasData) const
Check if the pixel is in the event.
fevt::TelescopeSimData & GetSimData()
Class representing a document branch.
unsigned int GetLastPixelId() const
Fluorescence Detector Pixel event.
const utl::TabulatedFunction & GetQEfficiency() const
Average quantum efficiency as a function of the wavelength.
utl::CoordinateSystemPtr GetEyeCoordinateSystem() const
Returns the Eye Coordinate system.
TelescopeIterator TelescopesEnd()
first available tel of status eHasData (DEPRECATED)
bool AddBackground(fevt::Telescope &tel, evt::Event &event)
EyeIterator EyesBegin(const ComponentSelector::Status status)
const Channel & GetChannel(const fevt::Channel &eventChannel) const
Get fdet::Channel from fevt::Channel.
const std::string & GetConfigSignature() const
boost::filter_iterator< ComponentSelector, AllTelescopeIterator > TelescopeIterator
selective Telescope iterators
fwk::VModule::ResultFlag Init()
Initialize: invoked at beginning of run (NOT beginning of event)
void GetData(bool &b) const
Overloads of the GetData member template function.
Top of Fluorescence Detector event hierarchy.
TelescopeIterator TelescopesBegin()
first available tel of status eHasData (DEPRECATED)
double GetGainVariance() const
double GetReferenceLambda() const
void SetStatus(ComponentSelector::Status status)
Pixel & GetPixel(const unsigned int pixelId, const ComponentSelector::Status status=ComponentSelector::eHasData)
Retrieve Pixel by Id, throw exception if not existent.
boost::filter_iterator< ComponentSelector, AllPixelIterator > PixelIterator
selective Pixel iterators
Detector description interface for Telescope-related data.
ResultFlag
Flag returned by module methods to the RunController.
const Telescope & GetTelescope(const fevt::Telescope &eventTel) const
Get fdet::Telescope from fevt::Telescope.
unsigned int GetId() const
double GetDiaphragmArea() const
fwk::VModule::ResultFlag Run(evt::Event &event)
Run: invoked once per event.
Main configuration utility.
double GetADCVariance() const
Fluorescence Detector Telescope Event.
PixelIterator PixelsBegin()
iterator pointing to first available pixel of status eHasData (DEPRECATED)
double Y(const double x) const
Get or interpolate the Y value that corresponds to parameter x.
double GetDiaPhoton2PEFactor(const double wavelength, const std::string &configSignature="") const
#define ERROR(message)
Macro for logging error messages.
utl::Branch GetTopBranch(const std::string &id)
Get top branch for moduleConfigLink with given id (XML files)
Fluorescence Detector Pixel Simulated Data.