5 #include <fwk/CentralConfig.h>
6 #include <fwk/VModule.h>
7 #include <det/Detector.h>
8 #include <rdet/RDetector.h>
11 #include <utl/ErrorLogger.h>
12 #include <utl/Reader.h>
13 #include <utl/config.h>
15 #include <evt/Event.h>
16 #include <evt/ShowerRRecData.h>
17 #include <evt/ShowerSRecData.h>
18 #include <evt/ShowerRecData.h>
19 #include <revt/REvent.h>
20 #include <revt/Station.h>
21 #include <revt/Header.h>
22 #include <revt/StationRecData.h>
35 topB.GetChild(
"checkT1Crossings").GetData(fCheckT1Crossings);
36 topB.GetChild(
"checkT2Crossings").GetData(fCheckT2Crossings);
37 topB.GetChild(
"T1").GetData(fT1);
38 topB.GetChild(
"T2").GetData(fT2);
39 topB.GetChild(
"T1MinSNR").GetData(fT1MinSNR);
40 topB.GetChild(
"PulseRegion").GetData(fPulseRegion);
41 topB.GetChild(
"TPer").GetData(fTPer);
42 topB.GetChild(
"T2MinSNR").GetData(fT2MinSNR);
43 topB.GetChild(
"NCMax").GetData(fNCMax);
44 topB.GetChild(
"UseVerticalComponent").GetData(fUseVerticalComponent);
58 int traceMaxInt = FindTraceMaximum(station);
59 bool t1CrossingDeselected =
false;
61 if (fCheckT1Crossings) {
62 t1CrossingDeselected = !CheckT1Crossings(station, traceMaxInt);
64 sstr <<
"T1Crossing check returned " << t1CrossingDeselected;
66 if (t1CrossingDeselected) {
68 sstr <<
"Rejecting station " << station.
GetId();
76 if ((!t1CrossingDeselected) && fCheckT2Crossings) {
78 sstr <<
"Checking station " << station.
GetId();
80 CheckT2Crossings(station, traceMaxInt);
88 RdStationPulseShapeRejector::CheckT1Crossings(
revt::Station& station,
int peakInt)
92 sstr <<
"RdStationPulseShapeRejector::CheckT1Crossings";
100 const double peakMag = stationTrace[peakInt].GetMag();
102 double signalToNoise = 0;
105 const double noise = recStation.
GetParameter(revt::eNoise);
106 int start = recStation.
GetParameter(revt::eSignalSearchWindowStart) / binning;
109 for (
int i = start; i < stop; i++) {
110 signalToNoise = stationTrace[i].GetMag() / noise;
111 if ((stationTrace[i].GetMag() > fT1 * peakMag && signalToNoise >
sqrt(fT1MinSNR)) &&
112 (prevMag < fT1 * peakMag || prevSNR <
sqrt(fT1MinSNR))) {
114 sstr <<
"station rejected. peak located at " << peakInt
115 <<
" with magnitude " << peakMag <<
" . Crossed at " << i
116 <<
" with magnitude " << stationTrace[i].GetMag();
121 prevMag = stationTrace[i].GetMag();
122 prevSNR = signalToNoise;
128 stop = recStation.
GetParameter(revt::eSignalSearchWindowStop) / binning;
130 for (
int i = start; i < stop; i++) {
131 signalToNoise = stationTrace[i].GetMag() / noise;
132 if ((stationTrace[i].GetMag() > fT1 * peakMag && signalToNoise >
sqrt(fT1MinSNR)) &&
133 (prevMag < fT1 * peakMag || prevSNR <
sqrt(fT1MinSNR))) {
135 sstr <<
"station rejected. peak located at " << peakInt <<
" with magnitude "
136 << peakMag <<
" . Crossed at " << i
137 <<
" with magnitude " << stationTrace[i].GetMag();
142 prevSNR = signalToNoise;
143 prevMag = stationTrace[i].GetMag();
150 RdStationPulseShapeRejector::CheckT2Crossings(
revt::Station& station,
int peakInt)
154 sstr <<
"CheckT2Crossings";
159 const double binning = stationTrace.
GetBinning();
160 const double peakMag = stationTrace[peakInt].GetMag();
161 int start = peakInt - (fTPer / binning);
162 int stop = peakInt + (fTPer / binning);
163 int numberOfCrossings = 0;
164 double prevMag = stationTrace[start].GetMag();
167 if (fUseVerticalComponent) {
170 noise = recStation.
GetParameter(revt::eNoiseRmsNSEWPlane);
173 double signalToNoise = 0;
176 for (
int i = start; i < peakInt; i++) {
177 if (fUseVerticalComponent) {
178 mag = stationTrace[i].GetMag();
180 mag =
sqrt(stationTrace[i][0] * stationTrace[i][0] + stationTrace[i][1] * stationTrace[i][1]);
183 signalToNoise = mag / noise;
184 if ((mag > fT2 * peakMag && signalToNoise >
sqrt(fT2MinSNR)) && (prevMag <= fT2 * peakMag || prevSNR <
sqrt(fT2MinSNR))) {
186 sstr <<
"NC increased at index " << i <<
" and relative time " << (i - peakInt) * binning;
192 prevSNR = signalToNoise;
195 if (numberOfCrossings > fNCMax + 1) {
197 sstr <<
"Station rejected: " << station.
GetId();
205 sstr <<
"Station not rejected with NC=" << numberOfCrossings;
209 numberOfCrossings = 0;
210 for (
int i = peakInt; i < stop; i++) {
211 if (fUseVerticalComponent) {
212 mag = stationTrace[i].GetMag();
214 mag =
sqrt(stationTrace[i][0] * stationTrace[i][0] + stationTrace[i][1] * stationTrace[i][1]);
217 signalToNoise = mag / noise;
218 if ((mag > fT2 * peakMag && signalToNoise >
sqrt(fT2MinSNR)) && (prevMag <= fT2 * peakMag || prevSNR <
sqrt(fT2MinSNR))) {
220 sstr <<
"NC increased at index " << i <<
" and relative time " << (i - peakInt) * binning;
225 prevSNR = signalToNoise;
229 if (numberOfCrossings > fNCMax) {
231 sstr <<
"Station rejected: " << station.
GetId();
239 sstr <<
"Station not rejected with NC=" << numberOfCrossings;
250 const double binning = stationTrace.
GetBinning();
251 int peakInt = peakTime / binning;
252 double peakMag = stationTrace[peakInt].GetMag();
254 for (
int i = peakInt - fPulseRegion; i < peakInt + fPulseRegion; i++) {
255 if (stationTrace[i].GetMag() > peakMag) {
257 sstr <<
"Corrected peak from i=" << peakInt <<
" and P=" << peakMag
258 <<
" to i=" << i <<
" t=" << i * binning <<
" and P=" << stationTrace[i].GetMag();
261 peakMag = stationTrace[i].GetMag();
267 sstr <<
"Peak is at index " << peakInt <<
" and time "
275 RdStationPulseShapeRejector::Finish()
279 sstr <<
"Rejected " << fRejectedStations <<
" stations out of a total of " << fTotalStations <<
" stations.";
Class to access station level reconstructed data.
StationRecData & GetRecData()
Get station level reconstructed data.
Interface class to access to the Radio part of an event.
double GetBinning() const
size of one slot
void Init()
Initialise the registry.
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
class to hold data at the radio Station level.
constexpr double nanosecond
void GetData(bool &b) const
Overloads of the GetData member template function.
void SetRejectedReason(const unsigned long long int reason)
int GetId() const
Get the station Id.
double GetParameter(const Parameter i) const
Template class for a data container that offers and takes both time series and corresponding frequenc...
ResultFlag
Flag returned by module methods to the RunController.
const StationFFTDataContainer & GetFFTDataContainer() const
retrieve Station FFTDataContainer (read access)
static CentralConfig * GetInstance()
Use this the first time you get an instance of central configuration.
Template class for a FADC data or calibrated data container. Use the typedefs (TraceD, TraceI, etc.) defined in Trace-fwd.h.
SignalStationIterator SignalStationsEnd()
utl::Branch GetTopBranch(const std::string &id)
Get top branch for moduleConfigLink with given id (XML files)
boost::filter_iterator< SignalStationFilter, AllStationIterator > SignalStationIterator
Iterator over all signal stations.
SignalStationIterator SignalStationsBegin()