3 #include <fwk/CentralConfig.h>
5 #include <utl/ErrorLogger.h>
6 #include <utl/Reader.h>
7 #include <utl/config.h>
8 #include <utl/RadioGeometryUtilities.h>
10 #include <det/Detector.h>
11 #include <rdet/RDetector.h>
13 #include <evt/Event.h>
14 #include <evt/ShowerRecData.h>
15 #include <evt/ShowerRRecData.h>
16 #include <evt/ShowerSRecData.h>
17 #include <evt/ShowerFRecData.h>
19 #include <sevt/SEvent.h>
20 #include <revt/REvent.h>
21 #include <fevt/FEvent.h>
23 #include <fevt/EyeRecData.h>
46 fMinNumberOfStationsWithPulseFound);
47 topBranch.
GetChild(
"UseCoincidenceCheck").
GetData(fUseCoincidenceCheck);
48 topBranch.
GetChild(
"MaximumAngularDeviation").
GetData(fMaximumAngularDeviation);
49 topBranch.
GetChild(
"MaximumAxisToCoreDistance").
GetData(fMaximumAxisToCoreDistance);
50 topBranch.
GetChild(
"MaximumNumberOfRejectedStations").
GetData(fMaximumNumberOfRejectedStations);
53 string tmp = topBranch.
GetChild(
"UsedEye").
Get<
string>();
65 info <<
" \n No zenith cut apllied";
67 info <<
" \n Maximum zenith angle: " << fMaxZenith /
degree <<
" deg";
69 info <<
" \n Use only converged shower reconstructions";
70 if (fUseSuccessfulFits)
71 info <<
" \n Use only successfully fitted shower reconstructions";
72 if (fMinNumberOfStationsWithPulseFound > 0)
73 info <<
" \n Requiring " << fMinNumberOfStationsWithPulseFound <<
" stations with pulse found";
74 if (fUseCoincidenceCheck ==
"SD" || fUseCoincidenceCheck ==
"FD") {
75 info <<
" \n Checking for coincidences with SD/FD with the following parameter:";
76 info <<
" \n Maximum angular deviation: " << fMaximumAngularDeviation /
degree <<
" degree.";
77 info <<
" \n Maximum axis to core distance: " << fMaximumAxisToCoreDistance /
kilometer <<
" km.";
86 RdEventPostSelector::Run(
Event& event)
91 ++fNumberOfRejectedEvents;
94 const REvent& rEvent =
event.GetREvent();
97 if (!event.
HasSEvent() && fUseCoincidenceCheck ==
"SD") {
98 INFOFinal(
"No SD event found, but needed for coincidence check. Skipping event.");
99 ++fNumberOfRejectedEvents;
100 return eContinueLoop;
103 if (!event.
HasFEvent() && fUseCoincidenceCheck ==
"FD") {
104 INFOFinal(
"No FD event found, but needed for coincidence check. Skipping event.");
105 ++fNumberOfRejectedEvents;
106 return eContinueLoop;
111 ++fNumberOfRejectedEvents;
112 return eContinueLoop;
118 ++fNumberOfRejectedEvents;
119 return eContinueLoop;
125 if (fMaxZenith > 0) {
126 const double thisZenith = rRecShower.
GetZenith();
127 if (thisZenith > fMaxZenith) {
128 INFOFinal(
"Shower zenith is above cut value. Skipping event");
129 ++fNumberOfRejectedEvents;
130 ++fNumberOfRejectedEventsZenithCut;
131 return eContinueLoop;
135 if (fMaximumNumberOfRejectedStations != -1) {
137 const int nRejectedStations =
139 [&](
auto const& station){
return station.GetRejectedReason() > 1; });
141 if (nRejectedStations > fMaximumNumberOfRejectedStations) {
142 INFOFinal(
"Too many rejected stations. Skipping event.");
143 ++fNumberOfRejectedEvents;
144 return eContinueLoop;
148 if (fMinNumberOfStationsWithPulseFound != 0) {
151 if (numberOfStations < fMinNumberOfStationsWithPulseFound) {
152 INFOFinal(
"Event has not enough stations with pulse found. Skipping event.");
154 info <<
" Pulse found in " << numberOfStations <<
" stations, requested are "
155 << fMinNumberOfStationsWithPulseFound <<
" stations";
157 ++fNumberOfRejectedEvents;
158 ++fNumberOfRejectedEventsPulseFound;
159 return eContinueLoop;
165 if (!rRecShower.
GetParameter(eFitConvergence) && fUseConverged) {
166 INFOFinal(
"Reconstruction did not converge. Skipping event.");
167 ++fNumberOfRejectedEvents;
168 return eContinueLoop;
170 }
else if (!rRecShower.
HasParameter(eFitConvergence) && fUseConverged) {
171 INFOFinal(
"Parameter eFitConvergence not set. Skipping event.");
172 ++fNumberOfRejectedEvents;
173 return eContinueLoop;
178 if (!rRecShower.
GetParameter(eFitSuccess) && fUseSuccessfulFits) {
179 INFOFinal(
"Reconstruction fit was not successful. Skipping event.");
180 ++fNumberOfRejectedEvents;
181 return eContinueLoop;
183 }
else if (!rRecShower.
HasParameter(eFitSuccess) && fUseSuccessfulFits) {
184 INFOFinal(
"Parameter eFitSuccess not set. Skipping event.");
185 ++fNumberOfRejectedEvents;
186 return eContinueLoop;
191 const ShowerSRecData& sRecShower =
event.GetRecShower().GetSRecShower();
196 INFOFinal(
"no radio core reconstructed. Event is skipped.");
197 ++fNumberOfRejectedEvents;
198 return eContinueLoop;
204 const bool passes = passesCoincidenceCheck(rCore, rShowerAxis, sCore, sShowerAxis);
206 ++fNumberOfRejectedEvents;
207 return eContinueLoop;
211 if (fUseCoincidenceCheck ==
"FD") {
212 FEvent& fdEvent =
event.GetFEvent();
214 for (
auto eyeIter = fdEvent.
EyesBegin(ComponentSelector::eHasData);
215 eyeIter != fdEvent.
EyesEnd(ComponentSelector::eHasData); ++eyeIter) {
216 if (eyeIter->GetId() != fWhichEye)
219 const Eye& eye = *eyeIter;
221 ERROR(
"Eye has no RecData or FRecShower but FDCore specified in the settings!");
222 ++fNumberOfRejectedEvents;
223 return eContinueLoop;
231 INFOFinal(
"no radio core reconstructed. Event is skipped");
232 ++fNumberOfRejectedEvents;
233 return eContinueLoop;
239 const bool passes = passesCoincidenceCheck(rCore, rShowerAxis, fCore, fShowerAxis);
241 ++fNumberOfRejectedEvents;
242 return eContinueLoop;
248 double minDistance = 100 *
km;
249 const rdet::RDetector& rDetector = det::Detector::GetInstance().GetRDetector();
250 for (
const auto& station : rEvent.SignalStationsRange()) {
251 if(station.GetId() > 124) {
257 if(distance < minDistance) {
258 minDistance = distance;
262 if (minDistance > fAERA24Distance) {
263 INFOFinal(
"Core position too far away from AERA24 sub array. Skipping event.");
264 ++fNumberOfRejectedEvents;
265 return eContinueLoop;
274 RdEventPostSelector::Finish()
277 sstr <<
"\n\t" << fNumberOfRejectedEventsZenithCut
278 <<
" events rejected because of zenith angle cut (zenith was larger than "
279 << fMaxZenith /
degree <<
" deg)"
280 <<
"\n\t" << fNumberOfRejectedEventsPulseFound
281 <<
" events rejected because of not enough stations with pulse found"
282 " (number of stations with pulse found was smaller than "
283 << fMinNumberOfStationsWithPulseFound <<
")"
284 <<
"\n\t" << fNumberOfRejectedEventsAngularDeviation
285 <<
" events rejected because of angular deviation cut"
286 " (angular deviation SD/RD or FD/RD was larger than "
287 << round(fMaximumAngularDeviation /
degree * 10.) / 10. <<
" deg)"
288 <<
"\n\t" << fNumberOfRejectedEventsAxisToCoreDistance
289 <<
" events rejected because of axis to core distance cut"
290 " (axis to core distance SD/RD or FD/RD was larger than "
291 << fMaximumAxisToCoreDistance <<
" m)"
292 <<
"\n\t" << fNumberOfRejectedEvents <<
" events rejected in total";
300 RdEventPostSelector::passesCoincidenceCheck(
const Point& rCore,
const Vector& rAxis,
305 if (fMaximumAngularDeviation >= 0) {
308 info <<
"Angular deviation of " << round((angleDiff /
degree) * 10.) / 10
309 <<
" degree between RD and other axis ";
311 if (angleDiff /
degree >= fMaximumAngularDeviation /
degree) {
312 info <<
"is larger than allowed difference of "
313 << round((fMaximumAngularDeviation /
degree) * 10.) / 10
314 <<
" degree. Skipping event.";
316 ++fNumberOfRejectedEventsAngularDeviation;
319 info <<
"is in allowed range of maximal "
320 << round((fMaximumAngularDeviation /
degree) * 10) / 10
321 <<
" degree. Event is coincident candidate";
326 if (fMaximumAxisToCoreDistance >= 0) {
327 const double axisToCoreDistance = RadioGeometryUtilities::GetDistanceToAxis(oAxis, oCore, rCore);
329 info <<
"Core distance of " << round((axisToCoreDistance /
kilometer) * 100.) / 100 <<
" km ";
332 info <<
"is larger than allowed difference of "
333 << round((fMaximumAxisToCoreDistance /
kilometer) * 100.) / 100
334 <<
" km. Skipping event.";
336 ++fNumberOfRejectedEventsAxisToCoreDistance;
339 info <<
"is in allowed range of "
340 << round((fMaximumAxisToCoreDistance /
kilometer) * 100) / 100
341 <<
" km. Event is coincident candidate.";
bool HasParameter(const Parameter i) const
utl::Vector GetAxis() const
Returns vector of the shower axis.
utl::Point GetReferenceCorePosition(const Event &event) const
Returning the reference core position depending on the corresponding flag.
Fluorescence Detector Eye Event.
Interface class to access to the SD Reconstruction of a Shower.
Interface class to access Shower Reconstructed parameters.
bool HasRecShower() const
Interface class to access to the Radio part of an event.
RejectedStationIterator RejectedStationsBegin(const int rejectionMask=~0)
ShowerRecData & GetRecShower()
Interface class to access to the RD Reconstruction of a Shower.
EyeIterator EyesEnd(const ComponentSelector::Status status)
bool HasCorePosition() const
Return true if all 3 core parameter are set.
#define INFO(message)
Macro for logging informational messages.
void Init()
Initialise the registry.
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
ShowerRRecData & GetRRecShower()
Detector description interface for RDetector-related data.
#define INFOIntermediate(y)
Class representing a document branch.
double GetZenith() const
returns the zenith angle (from the wave fit)
bool HasRRecShower() const
bool HasFRecShower() const
Check if reconstructed shower info has been allocated.
evt::ShowerFRecData & GetFRecShower()
Reconstructed shower info for this eye.
EyeIterator EyesBegin(const ComponentSelector::Status status)
const utl::Vector & GetAxis() const
void GetData(bool &b) const
Overloads of the GetData member template function.
Top of Fluorescence Detector event hierarchy.
AxialVector Normalized(const AxialVector &v)
int GetNumberOfSignalStations() const
Get number of signal stations in the event.
ResultFlag
Flag returned by module methods to the RunController.
static CentralConfig * GetInstance()
Use this the first time you get an instance of central configuration.
constexpr double kilometer
Interface class to access to Fluorescence reconstruction of a Shower.
const utl::Point & GetCorePosition() const
utl::Point GetCorePosition() const
returns pointer of the position vector of the core in the reference coor system
RejectedStationIterator RejectedStationsEnd(const int rejectionMask=~0)
double GetParameter(const Parameter i) 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.
const utl::Point & GetCorePosition() const
Shower core as reconstructed by the FD or FD eye.
bool HasSRecShower() const
utl::Branch GetTopBranch(const std::string &id)
Get top branch for moduleConfigLink with given id (XML files)
fevt::EyeRecData & GetRecData()
Reconstructed data for this eye.
const utl::Vector & GetAxis() const
Shower Axis as reconstructed by the FD or FD eye.