SelectEvents.cc
Go to the documentation of this file.
1 #include "SelectEvents.h"
2 
3 #include <fwk/CentralConfig.h>
4 #include <det/VManager.h>
5 #include <utl/Branch.h>
6 
7 #include <evt/Event.h>
8 #include <sevt/SEvent.h>
9 #include <sevt/Station.h>
10 #include <sdet/PMTConstants.h>
11 #include <sdet/SDetector.h>
12 
13 #include <utl/ErrorLogger.h>
14 
15 using namespace std;
16 
17 using namespace fwk;
18 using namespace det;
19 using namespace utl;
20 using namespace evt;
21 using namespace sevt;
22 
23 namespace SelectEvents {
24 
27  {
28  const Branch topB = CentralConfig::GetInstance()->GetTopBranch("SelectEvents");
29  Branch SSDSelection = topB.GetChild("SSDSelection");
30  SSDSelection.GetChild("SSDPreProd").GetData(fSSDPreProd);
31  return eSuccess;
32  }
33 
35  SelectEvents::Run(Event& event)
36  {
37  if (!event.HasSEvent())
38  return eContinueLoop;
39 
40  SEvent& sEvent = event.GetSEvent();
41  int nStations = 0;
42 
43  for (SEvent::StationIterator sIt = sEvent.StationsBegin(), end = sEvent.StationsEnd(); sIt != end; ++sIt) {
44 
45  const sdet::Station& dStation = det::Detector::GetInstance().GetSDetector().GetStation(*sIt);
46 
47  const bool isUUB = dStation.IsUUB();
48  const bool hasScintillator = dStation.HasScintillator();
49 
50  // Count depending on criteria (SSDPreProd)
51  if (fSSDPreProd) { //Count UB SSD
52  if (hasScintillator && !isUUB)
53  ++nStations;
54  } else { //Count UUB
55  if (isUUB)
56  ++nStations;
57  }
58  }
59 
60  if (!nStations) {
61  if (fSSDPreProd)
62  INFO("Could not find any stations with scintillator in this event, skipping...");
63  else
64  INFO("Could not find any UUB stations in this event, skipping...");
65  return eContinueLoop;
66  }
67  if (fSSDPreProd)
68  INFO("Found at least 1 station with UB scintillator in this event!");
69  else
70  INFO("Found at least 1 station with UUB in this event!");
71  return eSuccess;
72  }
73 
75  SelectEvents::Finish()
76  {
77  return eSuccess;
78  }
79 
80 }
81 
Branch GetTopBranch() const
Definition: Branch.cc:63
StationIterator StationsEnd()
End of all stations.
Definition: SEvent.h:59
Detector description interface for Station-related data.
bool IsUUB() const
Interface class to access to the SD part of an event.
Definition: SEvent.h:39
#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
Class representing a document branch.
Definition: Branch.h:107
void GetData(bool &b) const
Overloads of the GetData member template function.
Definition: Branch.cc:644
ResultFlag
Flag returned by module methods to the RunController.
Definition: VModule.h:60
StationIterator StationsBegin()
Beginning of all stations.
Definition: SEvent.h:57
bool HasScintillator() const
boost::indirect_iterator< InternalStationIterator, Station & > StationIterator
Iterator over all stations.
Definition: SEvent.h:52
bool HasSEvent() const

, generated on Tue Sep 26 2023.