ClearParticleLists.cc
Go to the documentation of this file.
1 #include "ClearParticleLists.h"
2 #include <utl/Reader.h>
3 #include <fwk/CentralConfig.h>
4 #include <utl/ErrorLogger.h>
5 
6 #include <evt/Event.h>
7 #include <sevt/SEvent.h>
8 #include <mevt/MEvent.h>
9 
10 using namespace std;
11 using namespace utl;
12 using namespace fwk;
13 
14 
15 namespace ClearParticleLists {
16 
19  {
20  Branch topB = CentralConfig::GetInstance()->GetTopBranch("ClearParticleLists");
21  fClearSEvent = topB.GetChild("ClearSEvent").Get<bool>();
22  fClearMEvent = topB.GetChild("ClearMEvent").Get<bool>();
23  ostringstream info;
24  info << "ClearSEvent: " << fClearSEvent << ", ClearMEvent: " << fClearMEvent;
25  INFO(info);
26  return eSuccess;
27  }
28 
29 
31  ClearParticleLists::Run(evt::Event& event)
32  {
33  int nLists = 0;
34  if (fClearSEvent && event.HasSEvent()) {
35  auto& sEvent = event.GetSEvent();
36  for (auto& s : sEvent.StationsRange())
37  if (s.HasSimData()) {
38  s.GetSimData().ClearParticleList();
39  ++nLists;
40  }
41  }
42  if (fClearMEvent && event.HasMEvent()) {
43  auto& mEvent = event.GetMEvent();
44  for (auto& m : mEvent.CountersRange())
45  if (m.HasSimData()) {
46  auto& simData = m.GetSimData();
47  simData.ClearGrdParticleList();
48  simData.ClearUGrdParticleList();
49  ++nLists;
50  }
51  }
52  ostringstream info;
53  info << "Cleared " << nLists << " particle lists.";
54  INFO(info);
55  return eSuccess;
56  }
57 
58 }
Branch GetTopBranch() const
Definition: Branch.cc:63
bool HasMEvent() const
#define INFO(message)
Macro for logging informational messages.
Definition: ErrorLogger.h:161
void Init()
Initialise the registry.
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
Definition: Branch.cc:211
T Get() const
Definition: Branch.h:271
Class representing a document branch.
Definition: Branch.h:107
constexpr double s
Definition: AugerUnits.h:163
ResultFlag
Flag returned by module methods to the RunController.
Definition: VModule.h:60
constexpr double m
Definition: AugerUnits.h:121
bool HasSEvent() const

, generated on Tue Sep 26 2023.