3 #include <fwk/CentralConfig.h>
4 #include <utl/Branch.h>
5 #include <utl/RadioGeometryUtilities.h>
7 #include <det/Detector.h>
8 #include <rdet/RDetector.h>
10 #include <evt/Event.h>
11 #include <evt/ShowerRecData.h>
12 #include <evt/ShowerRRecData.h>
14 #include <revt/REvent.h>
15 #include <revt/StationRecData.h>
32 return (x.first > y.first);
41 topBranch.
GetChild(
"MaximumDiscontinuity").
GetData(fMaximumDiscontinuity);
42 topBranch.
GetChild(
"RejectLonelyStations").
GetData(fRejectLonelyStations);
43 topBranch.
GetChild(
"LonelyIfNoneInDistance").
GetData(fLonelyIfNoneInDistance);
44 topBranch.
GetChild(
"LonelyIfOneInDistance").
GetData(fLonelyIfOneInDistance);
45 topBranch.
GetChild(
"LonelyIfNoneInDistancePhase3").
GetData(fLonelyIfNoneInDistancePhase3);
46 topBranch.
GetChild(
"LonelyIfOneInDistancePhase3").
GetData(fLonelyIfOneInDistancePhase3);
47 topBranch.
GetChild(
"IgnoreRejectedStations").
GetData(fIgnoreRejectedStations);
48 topBranch.
GetChild(
"IgnoreExcludedStations").
GetData(fIgnoreExcludedStations);
50 if (fIgnoreRejectedStations > 2)
51 ERROR(
"Wrong config. IgnoreRejectedStations must be 0, 1 or 2.");
58 RdClusterFinder::Run(
Event& event)
62 WARNING(
"eContinueLoop, No radio event found!");
66 REvent& rEvent =
event.GetREvent();
74 const rdet::RDetector& rDetector = det::Detector::GetInstance().GetRDetector();
75 vector<int> selectedCluster;
76 vector<int> deselectedStations;
78 const Point& showerCore =
event.GetRecShower().GetRRecShower().GetReferenceCorePosition(event);
79 const utl::Vector& showerAxis =
event.GetRecShower().GetRRecShower().GetReferenceAxis(event);
82 vector<pair<double, int> > distanceToSdAxis;
83 for (
const auto& station : rEvent.StationsRange()) {
85 if (!UseStation(station))
91 distanceToSdAxis.emplace_back(distance, station.GetId());
97 for (
auto itCurrent = distanceToSdAxis.begin(); itCurrent != prev(distanceToSdAxis.end()); ++itCurrent) {
98 selectedCluster.push_back(itCurrent->second);
100 auto itNext =
next(itCurrent);
101 const double deltaR = itCurrent->first - itNext->first;
102 if (deltaR > fMaximumDiscontinuity) {
103 copy(selectedCluster.begin(), selectedCluster.end(), std::back_inserter(deselectedStations));
104 selectedCluster.clear();
109 for (
const auto& deselectedStation : deselectedStations) {
115 info <<
"Deselected station ID : " << deselectedStation;
122 det::Detector::GetInstance().GetReferenceCoordinateSystem();
129 if (fRejectLonelyStations) {
130 for (
auto& iStation : rEvent.SignalStationsRange()) {
131 unsigned int closeNeighbors = 0;
132 unsigned int remoteNeighbors = 0;
134 double closeDist = 0;
135 double remoteDist = 0;
140 if (rDetector.
GetStation(iStation.GetId()).GetPosition().GetY(referenceCS) < 14.6 *
km) {
141 closeDist = fLonelyIfNoneInDistancePhase3;
142 remoteDist = fLonelyIfOneInDistancePhase3;
144 closeDist = fLonelyIfNoneInDistance;
145 remoteDist = fLonelyIfOneInDistance;
148 for (
const auto& jStation : rEvent.AllStationsRange()) {
150 if (iStation.GetId() == jStation.GetId())
153 if (!UseStation(jStation))
157 info <<
"checking stations: " << iStation.GetId() <<
", " << jStation.GetId();
160 const double distij = (rDetector.
GetStation(iStation.GetId()).GetPosition() -
161 rDetector.
GetStation(jStation.GetId()).GetPosition()).GetMag();
163 if (distij < closeDist)
165 if (distij < remoteDist)
169 if (!closeNeighbors || remoteNeighbors <= 1) {
174 info <<
"Station with ID " << iStation.GetId()
175 <<
" rejected as lonely due to # of close neighbors = " << closeNeighbors;
176 else if (remoteNeighbors <= 1)
177 info <<
"Station with ID " << iStation.GetId()
178 <<
" rejected as lonely due to # of remote neighbors = " << remoteNeighbors;
189 RdClusterFinder::Finish()
198 if (station.
IsExcluded() && !fIgnoreExcludedStations)
201 if (!CheckRejection(station))
215 switch (fIgnoreRejectedStations)
Branch GetTopBranch() const
static double GetDistanceToAxis(const utl::Vector &ShowerAxis, const utl::Point &CorePosition, const utl::Point &AntennaPosition)
computes the distance from the antenna position to the shower "line" defined by the core position and...
StationRecData & GetRecData()
Get station level reconstructed data.
Interface class to access to the Radio part of an event.
Base class for exceptions arising because configuration data are not valid.
bool SortPairByDistance(const pair< double, int > x, const pair< double, int > y)
void Init()
Initialise the registry.
bool GetPulseFound() const
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
Station & GetStation(const int stationId)
retrieve station by id throw utl::NonExistentComponentException if n.a.
Detector description interface for RDetector-related data.
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
Iterator next(Iterator it)
Class representing a document branch.
class to hold data at the radio Station level.
#define WARNING(message)
Macro for logging warning messages.
void GetData(bool &b) const
Overloads of the GetData member template function.
void SetRejectedReason(const unsigned long long int reason)
int GetNumberOfSignalStations() const
Get number of signal stations in the event.
ResultFlag
Flag returned by module methods to the RunController.
unsigned long long int GetRejectedReason() const
utl::Point GetPosition() const
Tank position in Site Cartesian Coordinates.
#define ERROR(message)
Macro for logging error messages.
const Station & GetStation(const int stationId) const
Get station by Station Id.