9 #include <fwk/CentralConfig.h>
10 #include <fwk/CoordinateSystemRegistry.h>
11 #include <fwk/LocalCoordinateSystem.h>
13 #include <utl/Reader.h>
14 #include <utl/ErrorLogger.h>
15 #include <utl/MathConstants.h>
16 #include <utl/PhysicalConstants.h>
17 #include <utl/Transformation.h>
18 #include <utl/Vector.h>
19 #include <utl/Point.h>
21 #include <evt/Event.h>
23 #include <sevt/SEvent.h>
25 #include <fevt/Telescope.h>
27 #include <fevt/EyeHeader.h>
28 #include <fevt/FEvent.h>
29 #include <fevt/Pixel.h>
30 #include <fevt/PixelRecData.h>
31 #include <fevt/EyeRecData.h>
32 #include <fevt/TelescopeRecData.h>
34 #include <evt/ShowerSimData.h>
35 #include <evt/ShowerRecData.h>
36 #include <evt/ShowerFRecData.h>
37 #include <evt/ShowerSRecData.h>
39 #include <det/Detector.h>
41 #include <fdet/FDetector.h>
42 #include <fdet/Telescope.h>
44 #include <fdet/Channel.h>
45 #include <fdet/Pixel.h>
55 using namespace UseMcGeometryOG;
64 CentralConfig::GetInstance()->
GetTopBranch(
"UseMcGeometry");
74 << GetVersionInfo(VModule::eRevisionNumber) <<
"\n"
76 info <<
" set SDP: " << fSetSDP <<
"\n"
77 " set time fit: " << fSetTimeFit <<
"\n"
78 " set SD geometry: " << fSetSdGeometry <<
"\n";
91 ERROR(
"No sim info. Cannot use MC geometry!");
97 ERROR(
"Sim info has no direction");
102 ERROR(
"Sim info has no position");
113 SetSdGeometry(event);
128 det::Detector::GetInstance().GetSiteCoordinateSystem();
130 FEvent& fevent =
event.GetFEvent();
133 const fdet::FDetector& detFD = det::Detector::GetInstance().GetFDetector();
139 showerAxisReal *= -1.0;
146 eyeiter != fevent.
EyesEnd(ComponentSelector::eHasData);
183 telIt != eye.
TelescopesEnd(ComponentSelector::eHasData); ++telIt)
195 if (!telIt->HasRecData())
196 telIt->MakeRecData();
199 const Vector telToCore = showerCore - telPos;
224 det::Detector::GetInstance().GetFDetector().GetPixel(*pixeliter);
227 const double angle = fabs(
kPi/2 - fabs(
Angle(dir, sdp)));
236 info3 <<
" sdp pixels: " << nPix;
254 FEvent& fevent =
event.GetFEvent();
263 info <<
" sim Axis (Theta,Phi) (siteCS) : "
265 << showerAxisReal.
GetPhi(siteCS)/
deg <<
" [deg]"
268 info <<
" sim Core (x,y,z) (siteCS) : " << showerCore.
GetX(siteCS)/
m
269 <<
", " << showerCore.
GetY(siteCS)/
m
270 <<
", " << showerCore.
GetZ(siteCS)/
m <<
" [m]"
274 const double zenith = (-simShower.
GetDirection()).GetTheta(localCS);
275 const double azimuth = (-simShower.
GetDirection()).GetPhi(localCS);
277 info <<
" simulated theta : " << zenith/
deg
278 <<
" phi : " << azimuth/
deg <<
" [deg]";
283 eyeiter != fevent.
EyesEnd(ComponentSelector::eHasData);
297 const fdet::FDetector& detFD = det::Detector::GetInstance().GetFDetector();
300 const Vector eyeToCore = showerCore-eyePos;
310 INFO(
" upward: YES");
316 const Vector vertical(0, 0, 1, eyeCS);
319 if (horizontalWithinSDP.
GetPhi(eyeCS) < 0 ||
320 horizontalWithinSDP.
GetPhi(eyeCS) >
kPi) {
322 horizontalWithinSDP *= -1;
326 Vector eyeToCoreInEye = eyeToCore-eyeToCore.
GetZ(eyeCS)/showerAxis.
GetZ(eyeCS)*showerAxis;
327 if (eyeToCoreInEye.
GetPhi(eyeCS) < 0 ||
329 horizontalWithinSDP *= -1;
332 const double chi0 =
Angle(horizontalWithinSDP, showerAxis) -
333 (upward ? 180.*
deg : 0.*
deg);
335 const double Rp =
cross(showerAxis, eyeToCore).
GetMag() /
336 showerAxis.
GetMag() * (upward ? -1 : 1);
350 const double distCoreEye = eyeToCore.
GetMag();
351 const double beta =
Angle(-showerAxisReal, eyeToCore);
353 - eyeTriggerTime).GetInterval();
357 eyerecdata.
SetRp(Rp, 1.e-5*Rp);
360 info <<
" chi0: " << chi0/
deg <<
" deg "
361 <<
" Rp: " << Rp/
m <<
" m"
362 <<
" T0: " << T0 <<
" ns";
368 telIt != eye.
TelescopesEnd(ComponentSelector::eHasData); ++telIt)
380 if (!telIt->HasRecData())
381 telIt->MakeRecData();
384 const Vector telToCore = showerCore - telPos;
385 const double distCoreTel = telToCore.
GetMag();
386 const double beta =
Angle(-showerAxisReal, telToCore);
388 - eyeTriggerTime).GetInterval();
400 const Vector vertical(0, 0, 1, localTelCS);
406 CoordinateSystem::RotationZ(detTel.
GetAxis().
GetPhi(localTelCS), localTelCS);
407 const utl::Vector horizontalProjOptAxis(1, 0, 0, auxCS);
412 const double angle =
Angle(horizontalProjOptAxis, horizontalWithinSDP);
414 horizontalWithinSDP *= -1;
417 Vector telToCoreInEye = telToCore-telToCore.
GetZ(auxCS)/showerAxis.
GetZ(auxCS)*showerAxis;
418 const double angle2 =
Angle(horizontalProjOptAxis, telToCoreInEye);
420 horizontalWithinSDP *= -1;
422 const double chi0 =
Angle(horizontalWithinSDP, showerAxis)
423 - (upward ? 180.*
deg : 0.*
deg);
425 const double Rp =
cross(showerAxis, telToCore).
GetMag()
431 telRecData.
SetRp(Rp, 1.e-5*Rp);
441 recshower.
SetAxis(showerAxis*(upward?-1:1));
444 const Vector core_eye_vec = Rp / sin(
kPi - chi0) * horizontalWithinSDP;
445 const Point coreInEye = eyePos + core_eye_vec;
449 const Vector coreToCoreInEye = coreInEye-showerCore;
452 timeCorrection *= -1;
454 timeCorrection *= -1;
455 const TimeStamp& timeAtCoreInEye = timeAtCore + timeCorrection;
472 const double t_i = pixeliter->GetRecData().GetCentroid()
476 const double t_i_Err = pixeliter->GetRecData().GetCentroidError()
501 const Vector telToCore = showerCore - telPos;
504 const Vector vertical(0, 0, 1, localTelCS);
509 CoordinateSystem::RotationZ(detTel.
GetAxis().
GetPhi(localTelCS), localTelCS);
510 const utl::Vector horizontalProjOptAxis(1, 0, 0, auxCS);
515 const double angle =
Angle(horizontalProjOptAxis, horizontalWithinSDP);
517 horizontalWithinSDP *= -1;
520 Vector telToCoreInEye = telToCore-telToCore.
GetZ(auxCS)/showerAxis.
GetZ(auxCS)*showerAxis;
521 const double angle2 =
Angle(horizontalProjOptAxis, telToCoreInEye);
523 horizontalWithinSDP *= -1;
526 Vector chi_i_vector = pixeldir - (sdp * pixeldir) * sdp;
530 const double chi_i =
Angle(chi_i_vector, horizontalWithinSDP);
532 pixeliter->GetRecData().SetChi_i(chi_i);
533 pixeliter->GetRecData().SetT_i(t_i,t_i_Err);
539 const double t_expected =
543 info <<
" chi_i=" << chi_i/
deg
548 <<
" t_exp=" << t_expected;
552 if (fabs(t_i - t_expected) > 400)
555 if (this->IsBadPixel(*pixeliter,eye))
572 info3 <<
" ndof: " << ndof;
588 det::Detector::GetInstance().GetSiteCoordinateSystem();
595 showerAxisReal *= -1.0;
603 ShowerSRecData& showersrec =
event.GetRecShower().GetSRecShower();
605 showersrec.
SetAxis(showerAxisReal);
630 UseMcGeometry::Finish()
641 const fdet::FDetector& detFD = det::Detector::GetInstance().GetFDetector();
650 double nTim = (double) (i2-i1+1);
651 static const double kPhoton2Pe = 0.128;
652 double noise = nTim*rms*rms+signal/kPhoton2Pe;
653 double sigToNoise = signal/
sqrt(noise);
654 static double minSigNoise = 1;
655 if(sigToNoise<minSigNoise)
673 const double timediff =
675 iter->GetRecData().GetCentroid()) * fadcBinSize;
677 static double isolationLimit = 10000*
ns;
678 if (timediff < isolationLimit )
AxialVector cross(const Vector &l, const Vector &r)
vector cross product
Telescope & GetTelescope(const unsigned int telescopeId, const ComponentSelector::Status status=ComponentSelector::eHasData)
Retrieve Telescope by Id, throw exception if not existent.
bool HasDirection() const
Check initialization of shower geometry.
Branch GetTopBranch() const
utl::CoordinateSystemPtr GetLocalCoordinateSystem() const
Get the Auger coordinate system associated to the shower core position.
void SetCurvature(const double curvature, const double error)
gaussian curvature = 1 / Rc
const utl::Vector & GetDirection() const
pointing direction of this pixel
void SetChiZero(const double chiZero, const double error)
void SetSDPFitChiSquare(const double sdpChi2, const unsigned int ndof)
void SetSDPPhiError(const double sdpPhiError)
int GetPulseStop() const
pulse stop (to be defined)
void SetBarycenter(const utl::Point &bary)
double Angle(const double theta1, const double phi1, const double theta2, const double phi2)
const utl::TimeStamp & GetTimeStamp() const
Get the TimeStamp of the absolute shower core-time.
Description of the electronic channel for the 480 channels of the crate.
double GetPhi(const CoordinateSystemPtr &coordinateSystem) const
azimuth (phi) angle in spherical and cylindrical coordinates
void SetSDPFitChiSquare(const double sdpChi2, const unsigned int ndof)
double GetRMS() const
Get the baseline RMS of the trace.
fevt::EyeHeader & GetHeader()
Header for this Eye Event.
unsigned int GetTimeOffset() const
Time offset of this Telescope compared to fevt::Header::GetTime [ns].
Fluorescence Detector Eye Event.
Interface class to access to the SD Reconstruction of a Shower.
PixelIterator PulsedPixelsEnd()
bool HasRecShower() 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
int GetPulseStart() const
pulse start (to be defined)
ShowerRecData & GetRecShower()
double GetCentroidError() const
bool HasSimShower() const
void SetCorePosition(const utl::Point &core)
EyeIterator EyesEnd(const ComponentSelector::Status status)
utl::Vector GetAxis() const
#define INFO(message)
Macro for logging informational messages.
void SetAngleChi2(const double chi2, const double ndof)
void SetRp(const double rp, const double error)
void Init()
Initialise the registry.
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.
fevt::TelescopeRecData & GetRecData()
Reconstructed data for this telescope.
void AddSDPPixel(fevt::Pixel &pixel)
add a pixel to the list of SDP pixels
PixelIterator PulsedPixelsBegin()
Detector description interface for FDetector-related data.
A TimeStamp holds GPS second and nanosecond for some event.
boost::indirect_iterator< ConstInternalPixelIterator, const Pixel & > ConstPixelIterator
Const iterator over pixels used in reconstruction.
bool HasPosition() const
Check initialization of shower geometry.
Interface class to access Shower Simulated parameters.
void SetSDP(const utl::AxialVector &vec)
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
Class representing a document branch.
void MakeFRecShower()
Allocate reconstructed shower info.
utl::CoordinateSystemPtr GetTelescopeCoordinateSystem() const
PixelIterator SDPPixelsBegin()
const utl::Vector & GetDirection() const
Get the direction of the shower axis. This is the true direction of shower movement.
Fluorescence Detector Pixel event.
double GetX(const CoordinateSystemPtr &coordinateSystem) const
void SetCoreTime(const utl::TimeStamp &coreTime, const utl::TimeInterval &coreTimeErr)
utl::CoordinateSystemPtr GetEyeCoordinateSystem() const
Returns the Eye Coordinate system.
TelescopeIterator TelescopesEnd()
first available tel of status eHasData (DEPRECATED)
void SetAxis(const utl::Vector &axis)
void SetAxis(const utl::Vector &axis)
const Telescope & GetTelescope(const unsigned int telescopeId) const
Find Telescope by numerical Id.
bool HasFRecShower() const
Check if reconstructed shower info has been allocated.
evt::ShowerFRecData & GetFRecShower()
Reconstructed shower info for this eye.
unsigned int GetTelescopeId() const
EyeIterator EyesBegin(const ComponentSelector::Status status)
void SetSDPPhiError(const double sdpPhiError)
const Channel & GetChannel(const fevt::Channel &eventChannel) const
Get fdet::Channel from fevt::Channel.
void SetChiZero(const double chiZero, const double error)
void SetTimeFitChiSquare(const double tfitChi2, const unsigned int ndof)
constexpr double kPiOnTwo
Telescope-specific shower reconstruction data.
void SetSDPThetaError(const double sdpThetaError)
boost::filter_iterator< ComponentSelector, AllTelescopeIterator > TelescopeIterator
selective Telescope iterators
void GetData(bool &b) const
Overloads of the GetData member template function.
Top of Fluorescence Detector event hierarchy.
Eye-specific shower reconstruction data.
void SetCoreTime(const utl::TimeStamp &coreTime, const utl::TimeInterval &coreTimeErr)
TelescopeIterator TelescopesBegin()
first available tel of status eHasData (DEPRECATED)
const utl::AxialVector & GetSDP() const
boost::indirect_iterator< InternalPixelIterator, fevt::Pixel & > PixelIterator
Iterator over pixels used in reconstruction.
double GetY(const CoordinateSystemPtr &coordinateSystem) const
constexpr double kSpeedOfLight
Detector description interface for Telescope-related data.
A TimeInterval is used to represent time elapsed between two events.
ResultFlag
Flag returned by module methods to the RunController.
const Telescope & GetTelescope(const fevt::Telescope &eventTel) const
Get fdet::Telescope from fevt::Telescope.
double GetFADCBinSize() const
void SetTZero(const double tzero, const double error)
double GetTotalCharge() const
integrated pulse charge
utl::Point GetPosition() const
void SetTimeFitChiSquare(const double tfitChi2, const unsigned int ndof)
Interface class to access to Fluorescence reconstruction of a Shower.
void SetSDPThetaError(const double sdpThetaError)
void SetRp(const double rp, const double error)
void SetCorePosition(const utl::Point &core)
void SetSDP(const utl::AxialVector &vec)
void SetTZero(const double tzero, const double error)
PixelIterator SDPPixelsEnd()
void AddTimeFitPixel(fevt::Pixel &pixel)
add a pixel to the list of Time Fit pixels
void SetLDFRecStage(const double stage)
double GetZ(const CoordinateSystemPtr &coordinateSystem) const
double GetChiZero() const
double GetCentroid() const
static Policy::type Create(const utl::Point &theOrigin)
Create the standard local coordinate system for a Point.
const utl::AxialVector & GetSDP() const
#define ERROR(message)
Macro for logging error messages.
bool HasSRecShower() const
utl::Point GetPosition() const
Eye position.
PixelRecData & GetRecData()
utl::CoordinateSystemPtr GetShowerCoordinateSystem() const
fevt::EyeRecData & GetRecData()
Reconstructed data for this eye.