SimMuonCounter.cc
Go to the documentation of this file.
1 #include "SimMuonCounter.h"
2 
3 #include <evt/Event.h>
4 #include <evt/ShowerSimData.h>
5 
6 #include <utl/ErrorLogger.h>
7 #include <utl/ShowerParticleIterator.h>
8 #include <utl/Particle.h>
9 #include <utl/UTMPoint.h>
10 
11 
12 namespace SimMuonCounter {
13 
15  SimMuonCounter::Run(evt::Event& event)
16  {
17  if (!event.HasSimShower())
18  ERROR("Event has no sim shower");
19 
20  auto& simShower = event.GetSimShower();
21 
22  double totalWeight = 0;
23 
24  for (auto pIt = simShower.GroundParticlesBegin(), end = simShower.GroundParticlesEnd();
25  pIt != end; ++pIt) {
26 
27  const auto type = pIt->GetType();
28 
29  if (!(type == utl::Particle::eMuon || type == utl::Particle::eAntiMuon))
30  continue;
31 
32  totalWeight += pIt->GetWeight();
33  }
34 
35  std::ostringstream info;
36  info << "total weight of (anti)muons is " << totalWeight;
37  INFO(info);
38  simShower.SetMuonNumber(totalWeight);
39 
40  return eSuccess;
41  }
42 
43 }
Report success to RunController.
Definition: VModule.h:62
bool HasSimShower() const
#define INFO(message)
Macro for logging informational messages.
Definition: ErrorLogger.h:161
ResultFlag
Flag returned by module methods to the RunController.
Definition: VModule.h:60
#define ERROR(message)
Macro for logging error messages.
Definition: ErrorLogger.h:165

, generated on Tue Sep 26 2023.