12 #include <fwk/CentralConfig.h>
14 #include <det/Detector.h>
16 #include <sdet/SDetector.h>
17 #include <sdet/Station.h>
19 #include <evt/Event.h>
20 #include <evt/ShowerRecData.h>
21 #include <evt/ShowerSRecData.h>
23 #include <sevt/SEvent.h>
24 #include <sevt/Station.h>
26 #include <utl/Vector.h>
27 #include <utl/ErrorLogger.h>
28 #include <utl/Branch.h>
35 using namespace SdHorizontalEventSelectorHOG;
60 std::pair<int, std::vector<int>>
61 SdHorizontalEventSelector::CalculateT5HASTrigger(
const Event& event)
64 const SEvent& sEvent =
event.GetSEvent();
68 return make_pair(0
U, vector<int>());
75 double closestDistance = 10000*
meter;
82 const double distanceToCore =
Distance(core, ds);
83 if (distanceToCore < closestDistance) {
84 closestDistance = distanceToCore;
91 ERROR(
"No station closest to core found");
92 return make_pair(0
U, vector<int>());
96 pair<unsigned int, vector<int>> ret;
97 ret.first = closestStation->GetId();
99 fSDetector->GetStation(*closestStation).GetPosition();
101 auto& functioningNeighbors = ret.second;
108 const double dist =
Distance(closestStationPos, ds);
109 if (dist > fFirstCrownDistanceRange[0] && dist < fFirstCrownDistanceRange[1])
110 functioningNeighbors.push_back(sIt->GetId());
113 if (
int(functioningNeighbors.size()) >= fMinNumberOfActiveStations)
116 return make_pair(0
U, vector<int>());;
129 topB.
GetChild(
"MinNumberOfActiveStations").
GetData(fMinNumberOfActiveStations);
131 topB.
GetChild(
"FirstCrownDistanceRange").
GetData(fFirstCrownDistanceRange);
133 fSDetector = &det::Detector::GetInstance().GetSDetector();
143 return eContinueLoop;
147 return eContinueLoop;
149 if (fEnableT5HasTrigger) {
151 const auto t5Stations = CalculateT5HASTrigger(event);
152 const unsigned int closestStation = t5Stations.first;
153 const int nActive = t5Stations.second.size();
154 const bool t5Has = (closestStation && nActive >= fMinNumberOfActiveStations);
156 bool closestIsUUB =
false;
158 closestIsUUB = fSDetector->GetStation(closestStation).IsUUB();
161 vector<int> t5NeighborsUUB;
162 for (
const auto sid : t5Stations.second) {
163 const bool isUUB = fSDetector->GetStation(sid).IsUUB();
165 t5NeighborsUUB.push_back(sid);
169 info <<
"T5Has = " << t5Has;
172 if (fRejectNonT5HasEvents && !t5Has)
173 return eContinueLoop;
189 SdHorizontalEventSelector::Finish()
StationIterator StationsEnd()
End of all stations.
Detector description interface for Station-related data.
void SetT5PosteriorActiveUUBNeighbors(const std::vector< int > &neigh)
Interface class to access to the SD Reconstruction of a Shower.
Interface class to access Shower Reconstructed parameters.
Interface class to access to the SD part of an event.
void SetT5PosteriorActiveNeighbors(const std::vector< int > &neigh)
#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.
void SetT5ClosestStation(const int id)
bool IsSilent() const
Check if the station is silent.
ShowerSRecData & GetSRecShower()
bool IsCandidate() const
Check if the station is a candidate.
utl::Point GetPosition() const
Tank position.
void SetT5ClosestStationIsUUB(const bool flag)
Class representing a document branch.
class to hold data at Station level
void GetData(bool &b) const
Overloads of the GetData member template function.
double Distance(const Point &p, const sdet::Station &s)
ResultFlag
Flag returned by module methods to the RunController.
int GetRejectionStatus() const
void SetT5Trigger(const int t5)
static CentralConfig * GetInstance()
Use this the first time you get an instance of central configuration.
StationIterator StationsBegin()
Beginning of all stations.
bool IsActive(const sevt::Station &s)
const utl::Point & GetCorePosition() const
boost::indirect_iterator< InternalConstStationIterator, const Station & > ConstStationIterator
#define ERROR(message)
Macro for logging error messages.
bool HasSRecShower() const
utl::Branch GetTopBranch(const std::string &id)
Get top branch for moduleConfigLink with given id (XML files)