InfiniteWindowStrategy.cc
Go to the documentation of this file.
2 
3 namespace MdMuonEstimatorAG {
4 
5  InfiniteWindowStrategy::InfiniteWindowStrategy(unsigned int nTraceLength) :
6  fTraceSize(nTraceLength)
7  {
8  }
9 
10  double
11  InfiniteWindowStrategy::operator()(std::vector<std::pair<unsigned int, unsigned int>>& vModulePatternMatches, mevt::ModuleRecData& mRecData)
12  const
13  {
14  //std::cout << "In infinite window strategy" << std::endl;
15  //std::cout << "Size " << vModulePatternMatches.size() << std::endl;
16 
17  double mu = 0;
18  double nmu = 0;
19  bool isSat = 0;
20 
21  if (vModulePatternMatches.size()>0) {
22  unsigned int k = 0; // Count the number of channels on (with signal)
23  //std::cout << "Channels with signal ";
24  //for (std::vector<std::pair<unsigned int, unsigned int>>::const_iterator it = vModulePatternMatches.begin(); it != vModulePatternMatches.end(); ++it) {
25  //std::cout << it->first << " ";
26  //}
27  //std::cout << std::endl;
28  for (unsigned int ich = 1 ; ich <= 64 ; ++ich)
29  {
30  for (std::vector<std::pair<unsigned int, unsigned int>>::const_iterator it = vModulePatternMatches.begin(); it != vModulePatternMatches.end(); ++it) {
31  if (it->first == ich) {
32  ++k;
33  //std::cout << ich << " is on" << std::endl;
34  break;
35  }
36  }
37  }
38  unsigned int nActiveCh = mRecData.GetSegmentation(); // = number of active channels
39  //std::cout << "Total channels on " << k << " out of " << nActiveCh << " active channels " << std::endl;
40  if (k >= nActiveCh){
41  isSat = 1;
42  //std::cout << "Module is saturated" << std::endl;
43  }
44  mu = -(double) nActiveCh * log(1. - (double) k/(double) nActiveCh);
45  nmu = log(1. - (double) k/(double) nActiveCh) / log(1. - 1./(double) nActiveCh);
46  }
47  //std::cout << "Mu " << mu << std::endl;
48  //std::cout << "Nmu " << nmu << std::endl;
49  //std::cout << "IsSat " << isSat << std::endl;
50 
51  mRecData.SetMeanMuons(mu);
52  mRecData.SetNumberOfEstimatedMuons(nmu);
53  mRecData.SetSaturated(isSat);
54 
55  return nmu;
56  }
57 }
58 
59 
Module level reconstruction data. This class contains all data required by the muon reconstruction...
Definition: ModuleRecData.h:29
void SetSaturated(const bool sat)
Definition: ModuleRecData.h:84
InfiniteWindowStrategy(unsigned int fTraceSize)
Creates a functor.
void SetMeanMuons(const double m)
void SetNumberOfEstimatedMuons(const double m)
Number of estimated muons in a module.
size_t GetSegmentation() const
double operator()(std::vector< std::pair< unsigned int, unsigned int >> &vModulePatternMatches, mevt::ModuleRecData &mRecData) const
Performs the counting.

, generated on Tue Sep 26 2023.