MdMuonCounter.h
Go to the documentation of this file.
1 #ifndef _MdMuonCounterAG_MdMuonCounter_h_
2 #define _MdMuonCounterAG_MdMuonCounter_h_
3 
4 #include <utl/config.h> // before all
5 
6 #include <fwk/VModule.h>
7 #include <mevt/MEvent.h>
8 #include <mevt/Counter.h>
9 #include <mdet/MDetector.h>
10 #include <evt/ShowerRecData.h>
11 
12 #include <utl/Trace-fwd.h>
13 #include <utl/MessageLoggerConfig.h>
14 #include <utl/UnitsConfig.h>
15 
16 #include <string>
17 #include <iostream>
18 #include <memory>
19 
20 #include <boost/utility.hpp>
21 
22 
23 namespace MdMuonCounterAG {
24 
26  class VMuonCounterFunctor;
27 
28 
39  class MdMuonCounter : public boost::noncopyable, public fwk::VModule {
40 
41  public:
43  enum Strategy {
44  eGap, //< Require a gap in 1s.
45  eGapRelax, //< Require at least a number of gaps in between the 1s.
46  eAmountInWindow, //< Only check quantity of 1s in window.
47  eConsecutive, //< Check consecutiveness of 1s.
48  eAmountGlobal //< Count ones and divide by constant.
49  };
51  static const char* const kStrategyTags[];
52 
55  VModule::ResultFlag Init();
56  VModule::ResultFlag Run(evt::Event& e);
57  VModule::ResultFlag Finish();
58 
59  private:
62 
64  unsigned int fWindowSize;
65 
67  unsigned int fNOnes;
68 
70  unsigned int fNGaps;
71 
74 
76  unsigned int fNMinOnes;
77 
80 
83 
85  std::unique_ptr<VMuonCounterFunctor> fCounter;
86 
89 
91  void DowngradeTrace(utl::TraceB& trace, unsigned int dataReduction = 4);
92 
94  unsigned int FillChannelRecData(mevt::Channel& ch);
95 
97  void FillModuleRecData(mevt::Module& m, const mdet::Module&) /*const*/;
98 
100  std::vector<unsigned int> GetPatternMatchBins(mevt::Module& m) /*const*/;
101 
103  void FillChannelsOn(mevt::Module& m, const std::vector<unsigned int>&, const mdet::Module&) const;
104 
106  double EstimateNumberOfMuons(const utl::TraceUI&, const size_t segmentation) const;
107 
109  utl::TimeInterval GetTraceOffset(const mevt::Module& m, const int counterId) const;
110 
115  utl::TimeStamp GetSdTraceStartTime(const evt::Event&, const int counterId) const;
116 
118  double ComputeSignalT50(mevt::Counter&, const utl::Vector& rAxis) const;
119 
123  double GetMedian(const std::vector<double> v) const;
124 
128  double GetTimeCorrection(const utl::Vector& dposition, const utl::Vector& axis) const;
129 
132 
135 
140  typedef std::map<int, double> TModuleDelay;
142 
143  REGISTER_MODULE("MdMuonCounterAG", MdMuonCounter);
144 
145  };
146 
147 }
148 
149 
150 #endif
VModule::ResultFlag Finish()
Finish: invoked at end of the run (NOT end of the event)
double fNOnesPerPatternMatch
Number of 1s required.
Definition: MdMuonCounter.h:73
Helper class for configuration of units: value and name.
Definition: UnitsConfig.h:22
Counter level event data.
utl::TimeInterval GetTraceOffset(const mevt::Module &m, const int counterId) const
Get the offset in nanoseconds between the MD trace start time wrt the SD trace start time...
utl::MessageLoggerConfig fLog
Output messages handler.
Definition: MdMuonCounter.h:61
unsigned int fNMinOnes
Number of 1s required.
Definition: MdMuonCounter.h:76
bool fConvertTo80Mhz
Downgrad trace to 80Mhz.
Definition: MdMuonCounter.h:79
void DowngradeTrace(utl::TraceB &trace, unsigned int dataReduction=4)
convert trace from 320Mhz sampling to 80Mhz storing.
double EstimateNumberOfMuons(const utl::TraceUI &, const size_t segmentation) const
Calculate the maximum likelihood estimator of the number of muons in this module. ...
A TimeStamp holds GPS second and nanosecond for some event.
Definition: TimeStamp.h:110
std::vector< unsigned int > GetPatternMatchBins(mevt::Module &m)
Get a vector with the bin numbers of the pattern matches for all channels.
void FillModuleRecData(mevt::Module &m, const mdet::Module &)
Fill the data reconstructed for a module.
Wraps a message to logger (received as parameter or created here), its access and configuration...
void FillChannelsOn(mevt::Module &m, const std::vector< unsigned int > &, const mdet::Module &) const
Calculate the number of windows with a signal per time window.
Module level event data.
Definition: MEvent/Module.h:41
VModule::ResultFlag Init()
Initialize: invoked at beginning of run (NOT beginning of event)
Array of Scintillator.
utl::TimeStamp GetSdTraceStartTime(const evt::Event &, const int counterId) const
REGISTER_MODULE("MdMuonCounterAG", MdMuonCounter)
unsigned int fNGaps
maximum number of gaps in a muon pattern (Gap strategy only).
Definition: MdMuonCounter.h:70
Strategy
Kind of possible counting criteria to be used.
Definition: MdMuonCounter.h:43
Module interface.
Definition: VModule.h:53
unsigned int FillChannelRecData(mevt::Channel &ch)
Fill the data reconstructed for a channel.
bool fSyncCountingHisto
Open the counting histogram at the time of the first muon.
Describe your module. In one sentence.
Definition: MdMuonCounter.h:39
A TimeInterval is used to represent time elapsed between two events.
Definition: TimeInterval.h:43
Template class for a FADC data or calibrated data container. Use the typedefs (TraceD, TraceI, etc.) defined in Trace-fwd.h.
Definition: Trace-fwd.h:19
utl::UnitsConfig fUnits
Units configuration.
Definition: MdMuonCounter.h:88
Channel level event data.
unsigned int fNOnes
Number of 1s required.
Definition: MdMuonCounter.h:67
Vector object.
Definition: Vector.h:30
double GetMedian(const std::vector< double > v) const
VModule::ResultFlag Run(evt::Event &e)
Run: invoked once per event.
std::unique_ptr< VMuonCounterFunctor > fCounter
Object performing the counting.
Definition: MdMuonCounter.h:85
unsigned int fWindowSize
The number of bins in the inhibition window.
Definition: MdMuonCounter.h:64
std::map< int, double > TModuleDelay
constexpr double m
Definition: AugerUnits.h:121
double GetTimeCorrection(const utl::Vector &dposition, const utl::Vector &axis) const
double ComputeSignalT50(mevt::Counter &, const utl::Vector &rAxis) const
Set the median arrival time of muons in a counter combining the signals recorded by all associated mo...
Strategy fStrategy
Counting stategy to be performed.
Definition: MdMuonCounter.h:82
static const char *const kStrategyTags[]
Tags for the types of strategy.
Definition: MdMuonCounter.h:51
bool fSetTimeStamps
Flag to indicate if the MD timestamps are set or not.

, generated on Tue Sep 26 2023.