5 #include <fwk/CentralConfig.h>
6 #include <det/VManager.h>
7 #include <mdet/MDetector.h>
8 #include <mevt/Counter.h>
10 #include <utl/ConsecutiveEnumFactory.h>
11 #include <utl/Trace.h>
12 #include <utl/AugerUnits.h>
13 #include <utl/Branch.h>
14 #include <utl/RandomEngine.h>
15 #include <utl/ConfigUtils.h>
16 #include <utl/TimeInterval.h>
17 #include <utl/TabularStream.h>
19 #include <utl/ErrorLogger.h>
20 #include <utl/Verbosity.h>
30 namespace MdPileUpCorrecterAG {
32 const char*
const MdPileUpCorrecter::kStrategyTags[] = {
"Inhibit" };
39 fUnits.SetTimeDefault(
utl::ns,
"ns");
40 fUnits.Configure(config);
41 fLog.Configure(config);
43 LoadConfig(config,
"strategy", tag, kStrategyTags[0]);
50 fLog(
"Strategy",1)(kStrategyTags[ fStrategy ])(
".");
62 WARNING(
"\n+++++++++\nEvent without MEvent: nothing to be done. Skipping to next event.\n++++++++++\n");
67 const mdet::MDetector& theMdDetector = det::Detector::GetInstance().GetMDetector();
69 std::ostringstream os;
73 const int counterId = counter.
GetId();
78 os <<
"Skipping the rejected counter " << counterId;
84 os <<
"Processing counter " << counterId;
90 const int moduleId = module.
GetId();
94 os <<
"Processing module " << moduleId;
100 os <<
"Module " << module.
GetId() <<
" of counter " << counterId;
106 double nSingleRealizationMuons = 0;
107 double nAverageMuons = 0;
109 boost::tie(nAverageMuons, nSingleRealizationMuons) = (*fCorrecter)(module,mdetModule);
114 mRecData.SetMeanMuons(nAverageMuons);
116 mRecData.SetNumberOfMuonsErrorHigh(0);
117 mRecData.SetNumberOfMuonsErrorLow(0);
119 mRecData.SetNumberOfMuonsLowLimit(0);
122 const double moduleArea = s.
GetArea() * im->GetRecData().GetSegmentation();
123 mRecData.SetActiveArea( moduleArea );
126 const utl::TraceUI& channelsOnTrace = mRecData.GetChannelsOn();
127 const utl::TraceUI& channelsInhiTrace = mRecData.GetChannelsInhibited();
129 const unsigned int numberOfSamples = mdetModule.
IsSiPM() ?
133 std::unique_ptr<utl::TabularStream> spanTable;
134 const unsigned int LogLevel = 15;
135 if (fLog.GetLevel() >= LogLevel) {
136 InitTable(spanTable, 5);
144 for (
size_t bin = 0; bin < numberOfSamples; ++bin ) {
145 if (channelsOnTrace.
At(bin)||channelsInhiTrace.
At(bin))
151 << fLog << channelsInhiTrace.
At(bin) << utl::endr
154 fLog(
"Channels On & Inhibited span:");
155 fLog(spanTable->Str());
158 fLog(
"Estimated muons in")(mRecData.IsSaturated()?
"SATURATED":
"")(
"Cter")(counterId)
159 (
"Mod")(moduleId)(
": Single realization")(nSingleRealizationMuons)(
"- Average")(nAverageMuons);
170 MdPileUpCorrecter::Finish()
176 MdPileUpCorrecter::InitTable(std::unique_ptr<utl::TabularStream>& pt,
unsigned int nCol)
179 std::stringstream fmt;
180 for(
unsigned int i = 0; i < nCol; ++i)
184 fLog.ApplyConfigurationOn(*pt);
Module level reconstruction data. This class contains all data required by the muon reconstruction...
T & At(const SizeType i)
trace entry with checked address
const Module & GetModule(const int mId) const
Retrieve by id a constant module.
CounterConstIterator CountersBegin() const
static EnumType Create(const int k)
int version of the overloaded creation method.
Counter level event data.
std::string GetRejectionReason() const
#define INFO(message)
Macro for logging informational messages.
ScintillatorConstIterator ScintillatorsBegin() const
Begin iterator over the contained scitillators.
void Init()
Initialise the registry.
bool IsRejected() const
Check if the counter is rejected.
Detector associated to muon detector hierarchy.
Actual muon-sensitive objects.
Class representing a document branch.
class to format data in tabular form
void SetNumberOfEstimatedMuons(const double m)
Number of estimated muons in a module.
#define WARNING(message)
Macro for logging warning messages.
double GetArea() const
Compute Scintillator's total area in square metres.
unsigned int GetBufferLength() const
Number of bins of the buffer.
const FrontEnd & GetFrontEnd() const
InternalModuleCollection::ComponentIterator ModuleIterator
ModuleConstIterator ModulesBegin() const
Root detector of the muon detector hierarchy.
Functor implementing pile-up correction proposed in GAP 2022-001.
ResultFlag
Flag returned by module methods to the RunController.
int GetId() const
The id of the counter.
ModuleConstIterator ModulesEnd() const
InternalCounterCollection::ComponentIterator CounterIterator
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.
const FrontEndSiPM & GetFrontEndSiPM() const
void LoadConfig(const utl::Branch &b, const std::string &tag, T1 &var, const T2 &defaultValue)
Helper method to load a particular configuration parameter.
CounterConstIterator CountersEnd() const
const Counter & GetCounter(int id) const
Retrieve Counter by id.
Root of the Muon event hierarchy.
utl::Branch GetTopBranch(const std::string &id)
Get top branch for moduleConfigLink with given id (XML files)
unsigned int GetBufferLength() const
Number of bins of the buffer.