8 #include <utl/ErrorLogger.h>
9 #include <utl/Reader.h>
10 #include <utl/TabulatedFunction.h>
11 #include <utl/MathConstants.h>
12 #include <utl/AugerUnits.h>
13 #include <utl/TimeStamp.h>
14 #include <utl/UTCDateTime.h>
15 #include <utl/Md5Sum.h>
17 #include <fwk/CentralConfig.h>
19 #include <evt/Event.h>
21 #include <fevt/FEvent.h>
23 #include <fevt/Telescope.h>
24 #include <fevt/TelescopeSimData.h>
25 #include <fevt/PixelSimData.h>
26 #include <fevt/Pixel.h>
27 #include <fevt/ChannelSimData.h>
28 #include <fevt/Channel.h>
30 #include <det/Detector.h>
32 #include <fdet/FDetector.h>
34 #include <fdet/Telescope.h>
35 #include <fdet/Channel.h>
36 #include <fdet/Pixel.h>
42 using namespace ThresholdCalculatorKG;
52 fRootFileName(
"out.root")
83 Detector::GetInstance().Update(
UTCDateTime(2012,1,1,0,0,0).GetTimeStamp());
84 const Camera& detCamera = Detector::GetInstance().GetFDetector().GetEye(
fEye).GetTelescope(
fTel).GetCamera();
99 for (
unsigned int i=0; i<
fNpe.size(); ++i){
100 ostringstream sampleName;
101 sampleName <<
"BinSum" << i+1;
108 fSamples.push_back(
new TH1D(sampleName.str().c_str(), sampleName.str().c_str(), NSamplesMax - NSamplesMin + 1, NSamplesMin-.5, NSamplesMax+.5));
137 FEvent& fEvent =
event.GetFEvent();
162 for (
unsigned int channelId=1; channelId<=detTel.
GetLastPixelId(); ++channelId) {
165 unsigned int pixelId = detChannel.
GetPixelId();
182 if (pixelEvent.
GetStatus() == ComponentSelector::eDeSelected) {
192 const double qEffAtNormWavelength = qEff.
Y(normWavelength);
198 for(
unsigned int i = 0; i <
fNpe.size(); ++i){
209 for (
unsigned int bin=0; bin<fadc_trace.
GetSize(); ++bin){
212 boxcar[i] = boxcar[i+1];
213 boxcar[fBoxcarSumLength-1] = fadc_trace [bin];
215 for (
int i=fBoxcarSumLength-1; i >= 0; --i){
228 msg <<
"BoxCarSum bigger than maximum of histogram. Calculation is wrong!! " << sum <<
" " <<
fSampleMaximum[meanPeBin];
245 const fdet::Camera & detCamera = Detector::GetInstance().GetFDetector().GetEye(
fEye).GetTelescope(
fTel).GetCamera();
248 for (
unsigned int i=0; i<
fSamples.size(); ++i){
259 ostringstream ThresholdSignature;
260 ThresholdSignature <<
"Threshold:"
270 ThresholdSignature <<
" Telescopetype = standard";
274 ThresholdSignature <<
" Telescopetype = HEAT";
279 ofstream thresholdXml(
"FSimulationThreshold.generated.xml.in");
280 thresholdXml <<
"<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n\n"
281 <<
"<FSimulationThreshold xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
282 <<
" xsi:noNamespaceSchemaLocation='@XMLSCHEMALOCATION@/FSimulationThreshold.xsd'>\n\n"
283 <<
" <Threshold signature=\"" <<
Md5Sum(ThresholdSignature.str()).GetHexDigest() <<
"\"> \n"
284 <<
" <!--" << ThresholdSignature.str() <<
"-->\n";
297 info <<
"Result of Threshold Calculation for"
298 <<
" meanPe = " <<
fNpe[i]
299 <<
" Threshold = " << threshold
300 <<
" Uncertainty = " << dummy
301 <<
" Binnumber = " << x;
305 xValues[i] =
fNpe[i];
306 yValues[i] = threshold;
310 thresholdXml <<
" <x>";
312 thresholdXml <<
" " << xValues[i];
313 thresholdXml <<
"</x>\n";
315 thresholdXml <<
" <y>";
317 thresholdXml <<
" " << yValues[i];
318 thresholdXml <<
"</y>\n";
320 thresholdXml <<
" </Threshold>\n\n"
321 <<
"</FSimulationThreshold>";
fwk::VModule::ResultFlag Init()
Initialize: invoked at beginning of run (NOT beginning of event)
fwk::VModule::ResultFlag Run(evt::Event &event)
Run: invoked once per event.
Class to compute MD5 checksum Based on the RSA C code, wrapped in an OO fashion.
ComponentSelector::Status GetStatus() const
double GetFADCBinSize() const
Description of the electronic channel for the 480 channels of the crate.
Report success to RunController.
std::vector< double > fNpe
Fluorescence Detector Eye Event.
double GetElectronicsGain() const
const Pixel & GetPixel(const fevt::Pixel &eventPixel) const
Get fdet::Pixel from fevt::Channel.
Class to hold collection (x,y) points and provide interpolation between them.
double GetCutoffFrequency() const
double GetMeanBgPhotonFlux() const
Get mean bg photon flux.
EyeIterator EyesEnd(const ComponentSelector::Status status)
double GetGainVariance() const
const Channel & GetChannel(const unsigned int channelId) const
Get Channel by id, throw utl::NonExistentComponentException if n.a.
#define INFO(message)
Macro for logging informational messages.
PixelSimData & GetSimData()
bool HasFADCTrace(const FdConstants::LightSource source) const
Check that source /par source is present.
boost::filter_iterator< ComponentSelector, AllEyeIterator > EyeIterator
selective Eye iterators
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
Fluorescence Detector Channel Simulated Data Event.
std::string GetVersionInfo(const VersionInfoType v) const
Retrieve different sorts of module version info.
std::vector< TH1 * > fSummedSamples
double GetFLTTriggerRate() const
ChannelSimData & GetSimData()
int GetFLTBoxcarSumLength() const
Detector description interface for FDetector-related data.
bool HasPixel(const unsigned int pixelId, const ComponentSelector::Status status=ComponentSelector::eHasData) const
Check if the pixel is in the event.
Class representing a document branch.
unsigned int GetLastPixelId() const
Channel & GetChannel(const unsigned int channelId)
Fluorescence Detector Pixel event.
const utl::TabulatedFunction & GetQEfficiency() const
Average quantum efficiency as a function of the wavelength.
std::vector< TH1D * > fSamples
TelescopeIterator TelescopesEnd()
first available tel of status eHasData (DEPRECATED)
double abs(const SVector< n, T > &v)
EyeIterator EyesBegin(const ComponentSelector::Status status)
utl::TraceI & GetFADCTrace(const FdConstants::LightSource source=FdConstants::eTotal)
boost::filter_iterator< ComponentSelector, AllTelescopeIterator > TelescopeIterator
selective Telescope iterators
#define WARNING(message)
Macro for logging warning messages.
Fluorescence Detector Channel 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 GetElectronicNoiseVariance() const
double GetReferenceLambda() const
fwk::VModule::ResultFlag Finish()
Finish: invoked at end of the run (NOT end of the event)
Pixel & GetPixel(const unsigned int pixelId, const ComponentSelector::Status status=ComponentSelector::eHasData)
Retrieve Pixel by Id, throw exception if not existent.
Detector description interface for Telescope-related data.
ResultFlag
Flag returned by module methods to the RunController.
bool HasChannel(const unsigned int channelId) const
const Telescope & GetTelescope(const fevt::Telescope &eventTel) const
Get fdet::Telescope from fevt::Telescope.
Main configuration utility.
Fluorescence Detector Telescope Event.
std::vector< double > fSampleMaximum
double Y(const double x) const
Get or interpolate the Y value that corresponds to parameter x.
unsigned int fBoxcarSumLength
int GetFADCTraceLength() const
utl::Branch GetTopBranch(const std::string &id)
Get top branch for moduleConfigLink with given id (XML files)
std::string fRootFileName
Fluorescence Detector Pixel Simulated Data.
std::vector< unsigned int > fNumberOfTraces
unsigned int GetPixelId() const