DummyCentralTrigger.cc
Go to the documentation of this file.
1 #include "DummyCentralTrigger.h"
2 #include <utl/ErrorLogger.h>
3 #include <utl/TabularStream.h>
4 #include <utl/TimeStamp.h>
5 
6 #include <evt/ShowerSimData.h>
7 #include <evt/Event.h>
8 #include <sevt/SEvent.h>
9 #include <sevt/T3.h>
10 
11 #include <det/Detector.h>
12 #include <sdet/SDetector.h>
13 #include <sdet/Station.h>
14 
15 using namespace sdet;
16 using namespace std;
17 using namespace sevt;
18 using namespace evt;
19 using namespace fwk;
20 using namespace utl;
21 
22 
23 namespace DummyCentralTriggerNS {
24 
27  {
28  INFO("DummyCentralTrigger::Init()");
29  fDefaultOffset = TimeInterval(0);
30  fDefaultWindow = TimeInterval(30*microsecond);
31  return eSuccess;
32  }
33 
34 
36  DummyCentralTrigger::Run(evt::Event& event)
37  {
38  INFO("DummyCentralTrigger::Run()");
39 
40  if (!event.HasSEvent())
41  return eSuccess;
42  auto& sEvent = event.GetSEvent();
43 
44  if (!event.HasSimShower())
45  return eContinueLoop;
46  const auto& simShower = event.GetSimShower();
47 
48  T3 simT3;
49  const auto& trigTime = simShower.GetTimeStamp();
50  simT3.SetTime(trigTime);
51  simT3.SetAlgorithm("Dummy");
52 
53  ostringstream info;
54  info << "Dummy T3 trigger, "
55  "reference time " << trigTime << " "
56  "(" << trigTime.GetGPSSecond() << " s, " << int(trigTime.GetGPSNanoSecond()/1e3) << " us)" << '\n';
57  INFO(info);
58  TabularStream tab("r|r|l");
59  tab << endc << "time" << endr
60  << "station" << endc << "offset" << endc << "energy" << endr
61  << hline;
62  const auto& sDetector = det::Detector::GetInstance().GetSDetector();
63  for (const auto& s : sDetector.StationsRange()) {
64  tab << s.GetId() << ' ' << endc
65  << ' ' << fDefaultOffset << ' ' << endc
66  << " !w" << fDefaultWindow << endr;
67  simT3.AddStation(s.GetId(), fDefaultOffset, fDefaultWindow);
68  }
69 
70  tab << delr;
71  DEBUGLOG(tab);
72 
73  if (!sEvent.HasSimData())
74  sEvent.MakeSimData();
75  sEvent.GetSimData().AddT3(simT3);
76 
77  return eSuccess;
78  }
79 
80 
82  DummyCentralTrigger::Finish()
83  {
84  INFO("DummyCentralTrigger::Finish()");
85  return eSuccess;
86  }
87 
88 }
void SetAlgorithm(const std::string &algo)
Set the trigger algorithm.
Definition: T3.h:69
This class contains the basic information to build a surface event.
Definition: T3.h:36
void SetTime(const utl::TimeStamp &stamp)
Set the trigger time stamp.
Definition: T3.h:63
bool HasSimShower() const
#define INFO(message)
Macro for logging informational messages.
Definition: ErrorLogger.h:161
void Init()
Initialise the registry.
constexpr double s
Definition: AugerUnits.h:163
#define DEBUGLOG(message)
Macro for logging debugging messages.
Definition: ErrorLogger.h:157
const EndRow endr
const int tab
Definition: SdInspector.cc:35
class to format data in tabular form
A TimeInterval is used to represent time elapsed between two events.
Definition: TimeInterval.h:43
ResultFlag
Flag returned by module methods to the RunController.
Definition: VModule.h:60
const DeleteRow delr
constexpr double microsecond
Definition: AugerUnits.h:147
const HLine hline('-')
const EndColumn endc
bool HasSEvent() const
void AddStation(const int id, const utl::TimeInterval &offset, const utl::TimeInterval &window)
Add a station to request data, specifying offset and window size.
Definition: T3.cc:13

, generated on Tue Sep 26 2023.