PixelSelector.cc
Go to the documentation of this file.
1 #include "PixelSelector.h"
2 #include <fwk/CentralConfig.h>
3 #include <evt/Event.h>
4 #include <fevt/FEvent.h>
5 #include <fevt/Eye.h>
6 #include <fevt/EyeRecData.h>
7 #include <fevt/Pixel.h>
8 #include <utl/Vector.h>
9 #include <utl/Reader.h>
10 #include <det/Detector.h>
11 #include <fdet/FDetector.h>
12 #include <fdet/Pixel.h>
13 #include <utl/MathConstants.h>
14 
15 #include <sstream>
16 
17 using namespace utl;
18 
19 
20 namespace PixelSelectorOG {
21 
24  {
25  auto topB = fwk::CentralConfig::GetInstance()->GetTopBranch("PixelSelector");
26 
27  if (!topB) {
28  ERROR("Configuration for module PixelSelector not found.");
29  return eFailure;
30  }
31 
32  topB.GetChild("minAngle").GetData(fMinAngle);
33 
34  // info output
35  std::ostringstream info;
36  info << "\n"
37  " Version: " << GetVersionInfo(VModule::eRevisionNumber) << "\n"
38  " Parameters:\n"
39  " minimum angle: " << fMinAngle/deg << "deg";
40  INFO(info);
41 
42  return eSuccess;
43  }
44 
45 
47  PixelSelector::CheckIsolated(evt::Event& event)
48  {
49  if (!event.HasFEvent())
50  return eSuccess;
51 
52  auto& fevent = event.GetFEvent();
53 
54  //unsigned int neyes = 0; // number of eyes with enough pixels
55 
56  for (auto eyeiter = fevent.EyesBegin(fevt::ComponentSelector::eHasData);
57  eyeiter != fevent.EyesEnd(fevt::ComponentSelector::eHasData); ++eyeiter) {
58 
59  // no rec data here, continue ...
60  if (!eyeiter->HasRecData())
61  continue;
62 
63  auto& eyerecdata = eyeiter->GetRecData();
64 
65  for (auto pix1 = eyerecdata.PulsedPixelsBegin();
66  pix1 != eyerecdata.PulsedPixelsEnd(); ) {
67 
68  const auto& dir1 = det::Detector::GetInstance().GetFDetector().GetPixel(*pix1).GetDirection();
69  bool isisolated = true;
70  for (auto pix2 = eyerecdata.PulsedPixelsBegin();
71  pix2 != eyerecdata.PulsedPixelsEnd(); ++pix2) {
72 
73  if (pix1 == pix2)
74  continue;
75 
76  const auto& dir2 = det::Detector::GetInstance().GetFDetector().GetPixel(*pix2).GetDirection();
77 
78  if (Angle(dir1, dir2) < fMinAngle) {
79  isisolated = false;
80  break;
81  }
82 
83  }
84  if (isisolated)
85  pix1 = eyerecdata.RemovePulsedPixel(pix1);
86  else
87  ++pix1;
88 
89  }
90 
91  }
92 
93  return eSuccess;
94  }
95 
96 }
bool HasFEvent() const
#define INFO(message)
Macro for logging informational messages.
Definition: ErrorLogger.h:161
void Init()
Initialise the registry.
constexpr double deg
Definition: AugerUnits.h:140
ResultFlag
Flag returned by module methods to the RunController.
Definition: VModule.h:60
static CentralConfig * GetInstance()
Use this the first time you get an instance of central configuration.
double Angle(const Vector &left, const Vector &right)
Definition: OperationsVV.h:82
#define ERROR(message)
Macro for logging error messages.
Definition: ErrorLogger.h:165
utl::Branch GetTopBranch(const std::string &id)
Get top branch for moduleConfigLink with given id (XML files)

, generated on Tue Sep 26 2023.