11 #include <utl/Trace.h>
12 #include <utl/TabulatedFunctionErrors.h>
13 #include <utl/ErrorLogger.h>
14 #include <evt/Event.h>
15 #include <fevt/FEvent.h>
17 #include <fevt/EyeRecData.h>
18 #include <fevt/Telescope.h>
19 #include <fevt/Channel.h>
20 #include <fevt/ChannelSimData.h>
21 #include <fevt/Pixel.h>
22 #include <fevt/PixelRecData.h>
23 #include <fevt/PixelSimData.h>
24 #include <fevt/FdComponentSelector.h>
25 #include <fdet/FDetector.h>
27 #include <fdet/Telescope.h>
28 #include <fwk/CentralConfig.h>
29 #include <det/Detector.h>
30 #include <utl/TimeStamp.h>
31 #include <utl/UTCDateTime.h>
32 #include <utl/ErrorLogger.h>
34 #include <tst/Verify.h>
35 #include <cppunit/extensions/HelperMacros.h>
48 fIsOwnerOfEvent(true),
90 det::Detector::GetInstance().Update(time);
98 const fdet::FDetector& detFD = det::Detector::GetInstance().GetFDetector();
100 iEye != detFD.
EyesEnd(); ++iEye) {
102 unsigned int eye_id = iEye->GetId();
108 iTel != iEye->TelescopesEnd(); ++iTel) {
110 unsigned int tel_id = iTel->GetId();
113 for (
unsigned int id = iTel->GetFirstPixelId();
id < 10; ++id) {
119 for (
unsigned int id = iTel->GetFirstChannelId();
id < 10; ++id) {
137 eye !=
event.EyesEnd(ComponentSelector::eHasData); ++eye)
140 tel != eye->TelescopesEnd(ComponentSelector::eHasData); ++tel)
143 pix != tel->PixelsEnd(ComponentSelector::eHasData); ++pix) {
147 pr.
SetT_i(1234.0f,5678.0);
158 double binning = 10.*
ns;
163 for (
int i = 0; i < 10; ++i)
167 for (
int i = 20; i < 30; ++i)
178 eye !=
event.EyesEnd(ComponentSelector::eHasData); ++eye)
181 tel != eye->TelescopesEnd(ComponentSelector::eHasData); ++tel)
184 pix != tel->PixelsEnd(ComponentSelector::eHasData); ++pix) {
190 CPPUNIT_ASSERT(pr.
GetChi_i() == 4567.);
193 CPPUNIT_ASSERT(pr.
GetRMS() == 456.);
202 for (
int i = 0; i < 10; ++i)
203 CPPUNIT_ASSERT(Verify<CloseTo>(trace[i],
double(i)));
207 for (
int i = 20; i < 30; ++i)
208 CPPUNIT_ASSERT(Verify<CloseTo>(trace2[i],
double(i)));
215 const TraceD& trace = trIt->GetTrace();
217 if (static_cast<FdConstants::LightSource>(trIt->GetLabel()) ==
219 for (
int i = 0; i < 10; ++i)
220 CPPUNIT_ASSERT(Verify<CloseTo>(trace[i],
double(i)));
222 if (static_cast<FdConstants::LightSource>(trIt->GetLabel()) ==
224 for (
int i = 20; i < 30; ++i)
225 CPPUNIT_ASSERT(Verify<CloseTo>(trace[i],
double(i)));
246 eye !=
event.EyesEnd(ComponentSelector::eHasData); ++eye)
249 tel != eye->TelescopesEnd(ComponentSelector::eHasData); ++tel)
252 pix != tel->PixelsEnd(ComponentSelector::eHasData); ++pix) {
259 double binning = 10.*
ns;
264 for (
int i = 0; i < 10; ++i)
268 for (
int i = 20; i < 30; ++i)
279 eye !=
event.EyesEnd(ComponentSelector::eHasData); ++eye)
282 tel != eye->TelescopesEnd(ComponentSelector::eHasData); ++tel)
285 pix != tel->PixelsEnd(ComponentSelector::eHasData); ++pix) {
293 for (
int i = 0; i < 10; ++i)
294 CPPUNIT_ASSERT(Verify<CloseTo>(trace[i],
double(i)));
298 for (
int i = 20; i < 30; ++i)
299 CPPUNIT_ASSERT(Verify<CloseTo>(trace2[i],
double(i)));
306 const TraceD& trace = trIt->GetTrace();
308 if (static_cast<FdConstants::LightSource>(trIt->GetLabel()) ==
310 for (
int i = 0; i < 10; ++i)
311 CPPUNIT_ASSERT(Verify<CloseTo>(trace[i],
double(i)));
313 if (static_cast<FdConstants::LightSource>(trIt->GetLabel()) ==
315 for (
int i = 20; i < 30; ++i)
316 CPPUNIT_ASSERT(Verify<CloseTo>(trace[i],
double(i)));
337 eye !=
event.EyesEnd(ComponentSelector::eHasData); ++eye)
340 tel != eye->TelescopesEnd(ComponentSelector::eHasData); ++tel)
343 ch != tel->ChannelsEnd(); ++ch) {
348 double binning = 10.*
ns;
353 for (
int i = 0; i < 10; ++i)
357 for (
int i = 20; i < 30; ++i)
368 eye !=
event.EyesEnd(ComponentSelector::eHasData); ++eye)
371 tel != eye->TelescopesEnd(ComponentSelector::eHasData); ++tel)
374 ch != tel->ChannelsEnd(); ++ch) {
380 for (
int i = 0; i < 10; ++i)
381 CPPUNIT_ASSERT(trace[i] == i);
385 for (
int i = 20; i < 30; ++i)
386 CPPUNIT_ASSERT(trace2[i] == i);
393 const TraceI& trace = trIt->GetTrace();
395 if (static_cast<FdConstants::LightSource>(trIt->GetLabel()) ==
397 for (
int i = 0; i < 10; ++i)
398 CPPUNIT_ASSERT(trace[i] == i);
400 if (static_cast<FdConstants::LightSource>(trIt->GetLabel()) ==
402 for (
int i = 20; i < 30; ++i)
403 CPPUNIT_ASSERT(trace[i] == i);
424 eye !=
event.EyesEnd(ComponentSelector::eHasData); ++eye) {
429 det::Detector::GetInstance().GetSiteCoordinateSystem()));
437 eyer.
SetRp(910,1112);
444 for (
int i = 0; i < 10; ++i)
445 flux1.
PushBack(i, i+100, i+20, i+1000);
448 for (
int i = 0; i < 10; ++i)
449 flux2.
PushBack(i, i+200, i+10, i+2000);
461 eye !=
event.EyesEnd(ComponentSelector::eHasData); ++eye) {
465 CPPUNIT_ASSERT(Verify<CloseTo>(
466 eyer.
GetSDP().
GetX(det::Detector::GetInstance().GetSiteCoordinateSystem()), 1.));
468 CPPUNIT_ASSERT(Verify<CloseTo>(
469 eyer.
GetSDP().
GetY(det::Detector::GetInstance().GetSiteCoordinateSystem()), 2.));
471 CPPUNIT_ASSERT(Verify<CloseTo>(
472 eyer.
GetSDP().
GetZ(det::Detector::GetInstance().GetSiteCoordinateSystem()), 3.));
478 CPPUNIT_ASSERT(eyer.
GetTZero() == 12);
487 for (
int i = 0; i < 10; ++i) {
488 CPPUNIT_ASSERT(Verify<CloseTo>(tf[i].X(),
double(i)));
489 CPPUNIT_ASSERT(Verify<CloseTo>(tf[i].XErr(),
double(i+100)));
490 CPPUNIT_ASSERT(Verify<CloseTo>(tf[i].Y(),
double(i+20)));
491 CPPUNIT_ASSERT(Verify<CloseTo>(tf[i].YErr(),
double(i+1000)));
496 for (
int i = 0; i < 10; ++i) {
497 CPPUNIT_ASSERT(Verify<CloseTo>(tf2[i].X(),
double(i)));
498 CPPUNIT_ASSERT(Verify<CloseTo>(tf2[i].XErr(),
double(i+200)));
499 CPPUNIT_ASSERT(Verify<CloseTo>(tf2[i].Y(),
double(i+10)));
500 CPPUNIT_ASSERT(Verify<CloseTo>(tf2[i].YErr(),
double(i+2000)));
531 unsigned int neyes_evt = fevent.
GetNEyes();
533 CPPUNIT_ASSERT(neyes_evt ==
fNEyes);
Telescope & GetTelescope(const unsigned int telescopeId, const ComponentSelector::Status status=ComponentSelector::eHasData)
Retrieve Telescope by Id, throw exception if not existent.
void MakeFADCTrace(unsigned int size, double binning, const FdConstants::LightSource source=FdConstants::eTotal)
void SetChiZero(const double chiZero, const double error)
bool HasLightFlux(const FdConstants::LightSource source=FdConstants::eTotal) const
Check that light profile for source /par source is present.
void SetSDPPhiError(const double sdpPhiError)
int GetPulseStop() const
pulse stop (to be defined)
void SetPulseStart(const int start)
void SetSDPFitChiSquare(const double sdpChi2, const unsigned int ndof)
double GetRMS() const
Get the baseline RMS of the trace.
PhotonTraceIterator PhotonTracesEnd()
Last std::pair<int source, TraceD * trace>
FADCTraceIterator FADCTracesEnd()
Last std::pair<int source, TraceD* trace>
boost::filter_iterator< ComponentSelector, ConstAllEyeIterator > ConstEyeIterator
void setPixelRecDataValues(fevt::FEvent &event)
unsigned int GetNEyes() const
double GetBaseline() const
int GetThreshold() const
Get the simulated trigger threshold of the pixel.
double GetChiZero() const
double GetSDPFitChiSquare() const
PhotonTraceIterator PhotonTracesBegin()
First std::pair<int source, TraceD * trace>
int GetPulseStart() const
pulse start (to be defined)
double GetCentroidError() const
utl::MultiTraceI::ConstIterator ConstFADCTraceIterator
unsigned int GetSDPFitNDof() const
void checkEyeRecDataValues(const fevt::FEvent &event)
unsigned int GetTimeFitNDof() const
void SetT_i(const double t_i, const double error)
void SetPulseFound(bool flag=true)
bool HasFADCTrace(const FdConstants::LightSource source) const
Check that source /par source is present.
void MakeEye(const unsigned int eyeId, const ComponentSelector::Status status=ComponentSelector::eHasData)
void SetTotalCharge(const double charge)
void SetRp(const double rp, const double error)
EyeIterator EyesBegin(const FDetComponentSelector::Type type=FDetComponentSelector::ePhysical) const
iterator pointing to first eye of given type (ePhysical, eVirtual, eAll)
boost::filter_iterator< ComponentSelector, AllEyeIterator > EyeIterator
selective Eye iterators
void checkPixelRecDataValues(const fevt::FEvent &event)
bool HasPhotonTrace(const FdConstants::LightSource source) const
Check that trace for source /par source is present.
Fluorescence Detector Channel Simulated Data Event.
void MakeTelescope(const unsigned int telescopeId, const ComponentSelector::Status status=ComponentSelector::eHasData)
Make Telescope telescopeId.
bool PulseIsFound() const
double GetSDPPhiError() const
double GetTZeroError() const
Detector description interface for FDetector-related data.
double GetChiZeroError() const
A TimeStamp holds GPS second and nanosecond for some event.
void MakePixel(const unsigned int pixelId, const ComponentSelector::Status status=ComponentSelector::eHasData)
Make Pixel telescopeId.
utl::TraceD & GetPhotonTrace(const FdConstants::LightSource source=FdConstants::eTotal)
Channel & GetChannel(const unsigned int channelId)
void testChannelSimData()
void SetCentroid(const double centroid, const double err)
void SetPhotonsStartTime(const utl::TimeStamp &ts)
boost::filter_iterator< FDetComponentSelector, AllEyeIterator > EyeIterator
void checkAll(fevt::FEvent &fevent)
double GetX(const CoordinateSystemPtr &coordinateSystem) const
utl::TimeInterval GetT_i() const
void checkChannelSimDataValues(const fevt::FEvent &event)
EyeIterator EyesBegin(const ComponentSelector::Status status)
bool HasPhotonTrace(const FdConstants::LightSource source=FdConstants::eTotal) const
Check that trace for source /par source is present.
void SetTimeFitChiSquare(const double tfitChi2, const unsigned int ndof)
boost::filter_iterator< ComponentSelector, ConstAllPixelIterator > ConstPixelIterator
void setPixelSimDataValues(fevt::FEvent &event)
utl::TraceI & GetFADCTrace(const FdConstants::LightSource source=FdConstants::eTotal)
boost::filter_iterator< ComponentSelector, AllTelescopeIterator > TelescopeIterator
selective Telescope iterators
void PushBack(const double x, const double xErr, const double y, const double yErr)
Top of Fluorescence Detector event hierarchy.
void SetPulseStop(const int stop)
Eye-specific shower reconstruction data.
Eye & GetEye(const unsigned int eyeId, const ComponentSelector::Status status=ComponentSelector::eHasData)
return Eye by id
void MakeChannel(const unsigned int channelId)
void MakePhotonTrace(unsigned int size, double binning, const FdConstants::LightSource source=FdConstants::eTotal)
const utl::AxialVector & GetSDP() const
double GetTimeFitChiSquare() const
boost::filter_iterator< TelIsCommissioned, InternalConstTelescopeIterator > TelescopeIterator
An iterator over telescopes.
void SetThreshold(const int thr)
Set the simulated trigger threshold of the pixel.
fevt::FEvent & GetFEvent()
Pixel & GetPixel(const unsigned int pixelId, const ComponentSelector::Status status=ComponentSelector::eHasData)
Retrieve Pixel by Id, throw exception if not existent.
double GetY(const CoordinateSystemPtr &coordinateSystem) const
boost::filter_iterator< ComponentSelector, AllPixelIterator > PixelIterator
selective Pixel iterators
A TimeInterval is used to represent time elapsed between two events.
PhotonTraceIterator PhotonTracesEnd()
Last std::pair<int source, TraceD * trace>
void setAll(fevt::FEvent &fevent)
PhotonTraceIterator PhotonTracesBegin()
First std::pair<int source, TraceD * trace>
static CentralConfig * GetInstance()
Use this the first time you get an instance of central configuration.
void checkPixelSimDataValues(const fevt::FEvent &event)
double GetTotalCharge() const
integrated pulse charge
boost::indirect_iterator< InternalConstChannelIterator, const Channel & > ConstChannelIterator
An iterator over available channles for read.
utl::TraceD & GetPhotonTrace(const FdConstants::LightSource source=FdConstants::eTotal)
Simulated Photon Trace.
total (shower and background)
void SetSDPThetaError(const double sdpThetaError)
utl::TimeInterval GetT_iError() const
boost::indirect_iterator< InternalChannelIterator, Channel & > ChannelIterator
An iterator over available channels for r/w.
void SetSDP(const utl::AxialVector &vec)
void SetTZero(const double tzero, const double error)
void SetRMS(const double rms)
utl::TabulatedFunctionErrors & GetLightFlux(const FdConstants::LightSource source=fevt::FdConstants::eTotal)
Light flux at diaphragm, photons/m^2 versus time in ns.
void SetBaseline(const double bl)
double GetZ(const CoordinateSystemPtr &coordinateSystem) const
double GetCentroid() const
Fluorescence Detector Pixel Reconstructed Data.
utl::MultiTraceD::ConstIterator ConstPhotonTraceIterator
TimeStamp GetTimeStamp() const
boost::filter_iterator< ComponentSelector, ConstAllTelescopeIterator > ConstTelescopeIterator
void MakeLightFlux(const FdConstants::LightSource source=FdConstants::eTotal)
void setEyeRecDataValues(fevt::FEvent &event)
void SetChi_i(const double chi_i)
Fluorescence Detector Pixel Simulated Data.
FADCTraceIterator FADCTracesBegin()
First std::pair<int source, TraceD* trace>
void MakePhotonTrace(unsigned int size, double binning, const FdConstants::LightSource source=FdConstants::eTotal)
EyeIterator EyesEnd(const FDetComponentSelector::Type type=FDetComponentSelector::ePhysical) const
iterator pointing to end of available eyes of given type (ePhysical, eVirtual, eAll) ...
void setChannelSimDataValues(fevt::FEvent &event)
double GetSDPThetaError() const