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/ConfigUtils.h>
16 #include <utl/ErrorLogger.h>
17 #include <utl/Verbosity.h>
27 namespace MdPatternFinderAG {
29 const char*
const MdPatternFinder::kStrategyTags[] = {
"Consecutive" };
36 fUnits.SetTimeDefault(
utl::ns,
"ns");
37 fUnits.Configure(config);
38 fLog.Configure(config);
40 LoadConfig(config,
"strategy", tag, kStrategyTags[0]);
46 LoadConfig(config,
"windowSize", fWindowSize, 18);
49 fLog(
"#Window size", 1)
51 (
"Number of ones")(fNOnes)(
"-")
52 (
"Strategy")(kStrategyTags[ fStrategy ])(
".");
64 WARNING(
"\n+++++++++\nEvent without MEvent: nothing to be done. Skipping to next event.\n++++++++++\n");
69 const mdet::MDetector& theMdDetector = det::Detector::GetInstance().GetMDetector();
71 std::ostringstream os;
75 const int counterId = counter.
GetId();
80 os <<
"Skipping the rejected counter " << counterId;
86 os <<
"Processing counter " << counterId;
92 const int moduleId = module.
GetId();
96 os <<
"Processing module " << moduleId;
103 os <<
"Module " << module.
GetId() <<
" of counter " << counterId;
109 unsigned int nTotalChannelsOn = 0;
114 const unsigned int nRecPatternMatches = FillChannelRecData(channel, mdetModule);
117 os <<
"counter " << counterId <<
": "
118 <<
"module " << module.
GetId() <<
" "
119 <<
"channel " << channel.
GetId() <<
" "
120 << nRecPatternMatches <<
" pattern(s) match(es) was(were) found ";
121 os << PrintPatternMatchBins(channel);
123 if ( nRecPatternMatches ) {
125 nTotalChannelsOn +=1;
137 assert(nTotalChannelsOn <= 64);
149 MdPatternFinder::Finish()
169 (
"preexisting muons for channel=")(channel.
GetId())(
':')
178 const unsigned int nRecPatternMatches = (*fFinder)(trace, rData);
185 const unsigned int numberOfSamples = mdetModule.
IsSiPM() ?
195 for (
size_t bin = 0; bin < numberOfSamples; ++bin )
200 traceRec.
At(*pIt) = 1;
201 for (
size_t bin = 1; bin < fWindowSize && *pIt+bin<numberOfSamples; ++bin )
202 traceRec.
At(*pIt+bin) = 2;
206 const unsigned int debugLevel = 30;
207 if (nRecPatternMatches && fLog.GetLevel() >= debugLevel ) {
208 fLog(
"Channel", debugLevel,
false)(channel.
GetId())(
":");
209 for (
size_t bin = 0; bin < numberOfSamples || fLog(
"|", debugLevel); ++bin )
210 if( traceRec.
At(bin) ) fLog(
"|",debugLevel,
false)(traceRec.
At(bin))(
":")(bin);
215 return nRecPatternMatches;
223 std::ostringstream os;
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.
PatternMatchBinIterator PatternMatchBinsBegin() const
Begin of the collection of times.
Counter level event data.
std::string GetRejectionReason() const
PatternMatchBinContainer::const_iterator PatternMatchBinIterator
ChannelRecData & GetRecData()
Functor implementing a constant window consecutive-rows-of-ones criteria.
#define INFO(message)
Macro for logging informational messages.
void Init()
Initialise the registry.
bool IsRejected() const
Check if the counter is rejected.
Detector associated to muon detector hierarchy.
Class representing a document branch.
ChannelConstIterator ChannelsBegin() const
void ClearPatternMatchBins()
Clears pattern match detection times information.
PatternMatchBinIterator PatternMatchBinsEnd() const
End of the collection of times.
unsigned int GetNumberOfPatternMatchs() const
Retrieve the number of pattern matchs that impinged this scintillator.
#define WARNING(message)
Macro for logging warning messages.
void SetWindowSize(const unsigned int ws)
unsigned int GetBufferLength() const
Number of bins of the buffer.
const FrontEnd & GetFrontEnd() const
InternalModuleCollection::ComponentIterator ModuleIterator
void SetSegmentation(const size_t nm)
ModuleConstIterator ModulesBegin() const
Root detector of the muon detector hierarchy.
utl::TraceUI & GetTrace()
ChannelConstIterator ChannelsEnd() const
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.
ModuleRecData & GetRecData()
const FrontEndSiPM & GetFrontEndSiPM() const
Channel level event data.
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
void SetTotalNumberOfChannelsOn(const unsigned int n)
Total number of channels with at least one pattern match (it cannot be greater than 64) ...
Channel level reconstruction data.
const Counter & GetCounter(int id) const
Retrieve Counter by id.
void PushBack(const T &value)
Insert a single value at the end.
Root of the Muon event hierarchy.
size_t GetNumberOfActiveChannels() const
utl::Branch GetTopBranch(const std::string &id)
Get top branch for moduleConfigLink with given id (XML files)
InternalChannelCollection::ComponentIterator ChannelIterator
unsigned int GetBufferLength() const
Number of bins of the buffer.