RdCheckFootprint.cc
Go to the documentation of this file.
1 #include "RdCheckFootprint.h"
2 
3 using namespace std;
4 using namespace revt;
5 using namespace evt;
6 using namespace fwk;
7 using namespace utl;
8 //using namespace sevt;
9 
10 #define OUT(x) if ((x) <= fInfoLevel) cerr << " "
11 
12 namespace RdCheckFootprint {
13 
15  fInfoLevel(eNone),
16  fCherenkovRadius(150.),
17  fCheckOutliers(0),
18  fSigmaMultiplier(1.),
19  fTolerance(1),
20  fLDFUncertainty(0.15)
21  {
22  }
23 
24  RdCheckFootprint::~RdCheckFootprint()
25  {
26  }
27 
29  {
30 
31  INFO("RdCheckFootprint::Init()");
32 
34  Branch topBranch = CentralConfig::GetInstance()->GetTopBranch("RdCheckFootprint");
35  topBranch.GetChild("InfoLevel").GetData(fInfoLevel);
36  topBranch.GetChild("CherenkovRadius").GetData(fCherenkovRadius);
37  topBranch.GetChild("Tolerance").GetData(fTolerance);
38  topBranch.GetChild("CheckOutliers").GetData(fCheckOutliers);
39  topBranch.GetChild("SigmaMultiplier").GetData(fSigmaMultiplier);
40  topBranch.GetChild("LDFUncertainty").GetData(fLDFUncertainty);
41  fLDF.clear();
42 
43  return eSuccess;
44  }
45 
46  VModule::ResultFlag RdCheckFootprint::Run(evt::Event& event)
47  {
49  REvent& rEvent = event.GetREvent();
50  evt::ShowerRRecData& showerrrec = event.GetRecShower().GetRRecShower();
51  const rdet::RDetector& rDetector = det::Detector::GetInstance().GetRDetector();
52 
54  utl::Vector showerAxis = showerrrec.GetAxis();
55  utl::Point coordinateOrigin = showerrrec.GetCoordinateOrigin();
56 
58  fLDF.clear();
59 
61  for(REvent::StationIterator sIt = rEvent.StationsBegin(); sIt != rEvent.StationsEnd(); ++sIt) {
62  Station& station = *sIt;
63  const utl::Point sPos = rDetector.GetStation(station).GetPosition();
64  const utl::Point core = showerrrec.GetCorePosition();
65  double distanceToShowerAxis = utl::RadioGeometryUtilities::GetDistanceToAxis(showerAxis, core, sPos);
66  fLDF.push_back(ldf(station.GetId(),distanceToShowerAxis));
67  }
68  std::sort(fLDF.begin(),fLDF.end(),sort_ldf);
69 
71  int empty_ant = 0;
72 
74  double ldfUpperLimit = 0.0;
75 
77  double currentSignal = 0.0;
78 
80  for(unsigned int i = 0; i < fLDF.size(); ++i) {
82  if(rEvent.GetStation(fLDF[i].id).GetRejectionStatus() & (revt::eCheckAntennaBackgroundLevel | revt::ePolarizationDeselected)) {
83  continue;
84  }
85  if(rEvent.GetStation(fLDF[i].id).GetRecData().GetPulseFound()) {
87  if(fLDF[i].distance < fCherenkovRadius) {
88  continue;
89  }
91  if(ldfUpperLimit == 0.0) {
92  ldfUpperLimit = (1. + fLDFUncertainty) * (rEvent.GetStation(fLDF[i].id).GetRecData().GetParameter(revt::eSignal)
93  + fSigmaMultiplier * rEvent.GetStation(fLDF[i].id).GetRecData().GetParameterError(revt::eSignal));
94  }
95  currentSignal = rEvent.GetStation(fLDF[i].id).GetRecData().GetParameter(revt::eSignal);
97  if(((currentSignal > ldfUpperLimit) && fCheckOutliers) || (empty_ant > fTolerance)) {
98  INFO("Applying footprint cut");
99  if(currentSignal > ldfUpperLimit)
100  rEvent.GetStation(fLDF[i].id).SetRejected(revt::eCheckFootprintDeselected);
101  if(empty_ant > fTolerance)
102  rEvent.GetStation(fLDF[i].id).SetRejected(revt::eLonelyStation);
103  rEvent.GetStation(fLDF[i].id).GetRecData().SetPulseFound(false);
104  showerrrec.SetParameter(revt::eNumberOfStationsWithPulseFound, showerrrec.GetParameter(revt::eNumberOfStationsWithPulseFound)-1);
105  } else {
107  empty_ant = 0;
108  if( (1. + fLDFUncertainty) * rEvent.GetStation(fLDF[i].id).GetRecData().GetParameter(revt::eSignal)
109  + fSigmaMultiplier * rEvent.GetStation(fLDF[i].id).GetRecData().GetParameterError(revt::eSignal) < ldfUpperLimit) {
110  ldfUpperLimit = (1. + fLDFUncertainty) * (rEvent.GetStation(fLDF[i].id).GetRecData().GetParameter(revt::eSignal)
111  + fSigmaMultiplier * rEvent.GetStation(fLDF[i].id).GetRecData().GetParameterError(revt::eSignal));
112  }
113  }
114  } else {
116  ++empty_ant;
117  }
118  }
119  return eSuccess;
120  }
121 
122  VModule::ResultFlag RdCheckFootprint::Finish()
123  {
124  return eSuccess;
125  }
126 
127 
128 }
Branch GetTopBranch() const
Definition: Branch.cc:63
void SetParameter(Parameter i, double value, bool lock=true)
utl::Vector GetAxis() const
Returns vector of the shower axis.
Point object.
Definition: Point.h:32
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 &quot;line&quot; defined by the core position and...
Report success to RunController.
Definition: VModule.h:62
void SetPulseFound(const bool pulsefound)
StationRecData & GetRecData()
Get station level reconstructed data.
Interface class to access to the Radio part of an event.
Definition: REvent.h:42
int fCheckOutliers
xml configs: Switches check for outliers on
Interface class to access to the RD Reconstruction of a Shower.
double GetParameterError(const Parameter i) const
#define INFO(message)
Macro for logging informational messages.
Definition: ErrorLogger.h:161
StationIterator StationsEnd()
Definition: REvent.h:130
StationIterator StationsBegin()
Definition: REvent.h:128
void Init()
Initialise the registry.
int fTolerance
xml configs: If number of antennas wthout signal exceeds this value, all antennas after regected as e...
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
Definition: Branch.cc:211
boost::filter_iterator< StationFilter, AllStationIterator > StationIterator
Iterator over all (non-exculded) stations.
Definition: REvent.h:125
Station & GetStation(const int stationId)
retrieve station by id throw utl::NonExistentComponentException if n.a.
Definition: REvent.h:190
Detector description interface for RDetector-related data.
Definition: RDetector.h:46
Class representing a document branch.
Definition: Branch.h:107
utl::Point GetCoordinateOrigin() const
class to hold data at the radio Station level.
double fSigmaMultiplier
xml configs: The maximum tolerated deviation from LDF
void GetData(bool &b) const
Overloads of the GetData member template function.
Definition: Branch.cc:644
int GetId() const
Get the station Id.
int fInfoLevel
xml configs: verbosity
double GetParameter(const Parameter i) const
ResultFlag
Flag returned by module methods to the RunController.
Definition: VModule.h:60
double fLDFUncertainty
xml configs: The uncertainty of LDF model (as fraction of amplitude)
std::vector< ldf > fLDF
sorted lateral distribution of amplitudes
Vector object.
Definition: Vector.h:30
utl::Point GetCorePosition() const
returns pointer of the position vector of the core in the reference coor system
double GetParameter(const Parameter i) const
utl::Point GetPosition() const
Tank position in Site Cartesian Coordinates.
const Station & GetStation(const int stationId) const
Get station by Station Id.
Definition: RDetector.cc:141
bool sort_ldf(ldf a, ldf b)
sorting function
structure for sorting
double fCherenkovRadius
xml configs: Radius of Cherenkov ring. Inside this radius the module is not applied ...

, generated on Tue Sep 26 2023.