10 namespace MdLDFFinderAG {
16 ROOT::Minuit2::FunctionMinimum
20 using namespace ROOT::Minuit2;
24 std::ostringstream info(
"");
32 assert ((*fLDFunction).GetName() ==
"KascadeGrandeLDF");
34 DEBUGLOG(
"Start Minuit2 minimization process (LDF \"a la\" KascadeGrande)");
35 MnUserParameters mnpars;
37 mnpars.Add(
"Beta" , pars.at(
eBeta), epars.at(
eBeta), 0.0, 4.0 );
38 mnpars.Add(
"xcore" , pars.at(
eCoreX), epars.at(
eCoreX) );
39 mnpars.Add(
"ycore" , pars.at(
eCoreY), epars.at(
eCoreY) );
55 mnpars.SetLowerLimit(
"Nmu", 0);
61 if (fpars.at(
eBeta)) {
70 DEBUGLOG(
"After fixing the fit parameters");
73 MnMinimize minuit_mn( static_cast<const FCNBase&>((*
this)), mnpars );
74 DEBUGLOG(
"After creating the minimizer");
80 FunctionMinimum fnc_min = minuit_mn(10000);
81 DEBUGLOG(
"After running the minimization");
83 if(!fnc_min.IsValid()) {
100 info <<
"Found minimum after " << fnc_min.NFcn() <<
" evaluations";
104 MnHesse hesseMtrx(1);
105 hesseMtrx(minuit_mn.Fcnbase(), fnc_min);
112 pars = fnc_min.UserParameters().Params();
113 epars = fnc_min.UserParameters().Errors();
134 double nLogLikelihood = 0;
136 const mdet::MDetector& mDetector = det::Detector::GetInstance().GetMDetector();
142 unsigned int counterId = counter->
GetId();
147 const double xcore = par[2];
148 const double ycore = par[3];
156 const double muonDensity = (*fLDFunction)( coreDistance, &par[0] );
159 const double sdArea = 10;
162 const double muonsInSd = muonDensity * sdArea;
167 x += TMath::Power(muonsInSd,
int(i)) / TMath::Factorial(i);
169 const double nLogLikelihood1 = muonsInSd - TMath::Log(x);
171 nLogLikelihood += nLogLikelihood1;
174 return nLogLikelihood;
182 for (CounterList::const_iterator ic = cl.begin(); ic != cl.end(); ++ic) {
183 os << (*ic)->GetId() <<
" ";
void SetAxis(utl::Vector axis)
unsigned int fSilentLimit
CounterList fCandidateCounters
std::ostream & operator<<(std::ostream &os, const CounterList &cl)
Counter level event data.
ROOT::Minuit2::FunctionMinimum Minimize(std::vector< double > &par, std::vector< double > &epar, const std::vector< bool > &fpar) const
double GetCosTheta(const CoordinateSystemPtr &coordinateSystem) const
cos of zenith (theta) angle
double DistanceInShowerPlane(const utl::Vector v) const
#define INFO(message)
Macro for logging informational messages.
utl::Point GetPosition() const
Detector associated to muon detector hierarchy.
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
utl::CoordinateSystemPtr siteCS
CounterList fSilentCounters
#define DEBUGLOG(message)
Macro for logging debugging messages.
double CalculateSilentLikelihood(const std::vector< double > &par) const
Likelihood of silent counters.
int GetId() const
The id of the counter.
const Counter & GetCounter(int id) const
Retrieve Counter by id.
virtual ~VMinMethodFunctor()
Meant to be used as base class: virtual destructor.