13 #include <fwk/CentralConfig.h>
15 #include <utl/config.h>
16 #include <utl/ErrorLogger.h>
17 #include <utl/Reader.h>
19 #include <utl/Vector.h>
20 #include <utl/Point.h>
21 #include <utl/BasicVector.h>
22 #include <utl/GeometryUtilities.h>
23 #include <utl/RadioGeometryUtilities.h>
24 #include <utl/CoordinateSystemPtr.h>
26 #include <utl/AxialVector.h>
28 #include <evt/Event.h>
29 #include <evt/ShowerRecData.h>
30 #include <evt/ShowerSRecData.h>
31 #include <evt/ShowerRRecData.h>
33 #include <revt/REvent.h>
34 #include <revt/Station.h>
35 #include <revt/Header.h>
36 #include <revt/StationRecData.h>
38 #include <det/Detector.h>
39 #include <rdet/RDetector.h>
40 #include <det/VManager.h>
43 #include "TGraphErrors.h"
48 #include "TFitResultPtr.h"
49 #include "TFitResult.h"
76 fEnergyEstimatorDist(0),
77 fEnergyEstimatorPower(0),
78 fEnergyEstimatorCoeff(0)
82 RdLDFMultiFitter::~RdLDFMultiFitter()
88 INFO(
"RdLDFMultiFitter::Init()");
106 if (curmodel.GetName() ==
"Model") {
108 modcontainer.
name = VManager::FindComponent<string>(
"name", curmodel.GetAttributes());
110 if(curp.GetName() ==
"formula") {
111 curp.GetData(modcontainer.
formula);
113 if(curp.GetName() ==
"color") {
114 curp.GetData(modcontainer.
color);
116 if(curp.GetName() ==
"parameter") {
118 p.
id = VManager::FindComponent<int>(
"id", curp.GetAttributes());
119 p.
name = VManager::FindComponent<string>(
"name", curp.GetAttributes());
120 p.
minval = VManager::FindComponent<double>(
"minval", curp.GetAttributes());
121 p.
maxval = VManager::FindComponent<double>(
"maxval", curp.GetAttributes());
122 p.
zenithCorrection = VManager::FindComponent<double>(
"zenithCorrection", curp.GetAttributes());
127 fModels.push_back(modcontainer);
140 WARNING(
"No radio event found!");
145 REvent& rEvent =
event.GetREvent();
151 WARNING(
"No core or axis. LDF Fit can not be performed.");
156 const rdet::RDetector& rDetector = det::Detector::GetInstance().GetRDetector();
164 int Nant = showerrrec.
GetParameter(revt::eNumberOfStationsWithPulseFound);
168 double distance[Nant], fieldStr[Nant], distanceEr[Nant], fieldStrEr[Nant];
169 double distancetoshoweraxis = 0.0;
185 distance[curAnt] = distancetoshoweraxis;
186 distanceEr[curAnt] = 0;
196 TGraphErrors *LateralDistribution =
new TGraphErrors (Nant, distance,fieldStr,distanceEr,fieldStrEr);
199 TF1 *energy_estimator;
200 energy_estimator =
new TF1(
"exp_formula",
"[0]*exp(-[1]*(x-[2]))", 0, 5000);
202 energy_estimator->SetParLimits(0,0.,1.);
203 energy_estimator->SetParameter(0,fieldStr[0]);
205 LateralDistribution->Fit(energy_estimator,
"RS");
211 vector<TF1> ldfResult;
212 vector<TFitResult> ldfFitResult;
215 for (vector<Model>::iterator m_it =
fModels.begin() ; m_it !=
fModels.end(); ++m_it) {
219 fitfuncExp =
new TF1(m_it->name.c_str(),m_it->formula.c_str(), 0, 5000);
221 fitfuncExp->SetLineColor(TColor::GetColor(m_it->color.c_str()));
224 for(vector<parameter>::iterator p_it = m_it->parameters.begin(); p_it != m_it->parameters.end(); ++p_it) {
226 fitfuncExp->SetParName(p_it->id,p_it->name.c_str());
227 fitfuncExp->SetParLimits(p_it->id,p_it->minval,p_it->maxval);
230 if(p_it->zenithCorrection) {
237 TFitResultPtr fitresult = LateralDistribution->Fit(fitfuncExp,
"RS");
238 ldfResult.push_back(*fitfuncExp);
239 ldfFitResult.push_back(*fitresult);
242 fitfuncExp->Delete();
246 showerrrec.SetRdLDF(ldfResult);
247 showerrrec.SetRdLDFFitResult(ldfFitResult);
252 double RdLDFMultiFitter::ZenithCorrection(
double zenith,
double energy) {
253 return p0(energy) +
p1(energy)*cos(zenith);
256 double RdLDFMultiFitter::p0(
double energy) {
260 double RdLDFMultiFitter::p1(
double energy) {
266 INFO(
"RdLDFMultiFitter::Finish()");
Branch GetTopBranch() const
Class to access station level reconstructed data.
utl::Vector GetAxis() const
Returns vector of the shower axis.
static double GetDistanceToAxis(const utl::Vector &ShowerAxis, const utl::Point &CorePosition, const utl::Point &AntennaPosition)
computes the distance from the antenna position to the shower "line" defined by the core position and...
boost::filter_iterator< CandidateStationFilter, AllStationIterator > CandidateStationIterator
Iterator over all CandidateStations (i.e., HasSignal, HasNoSignal)
Report success to RunController.
double fEnergyEstimatorDist
xml settings: parameters for energy pre-estimator
StationRecData & GetRecData()
Get station level reconstructed data.
CandidateStationIterator CandidateStationsEnd()
Interface class to access to the Radio part of an event.
std::vector< parameter > parameters
Configuration of parameters (for fitting)
std::string name
Name (displayed in EventBrowser)
Interface class to access to the RD Reconstruction of a Shower.
double GetParameterError(const Parameter i) const
bool HasCorePosition() const
Return true if all 3 core parameter are set.
#define INFO(message)
Macro for logging informational messages.
void Init()
Initialise the registry.
bool GetPulseFound() const
double minval
Lower bound (for fit)
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
double pow(const double x, const unsigned int i)
std::string color
Color (LDF curve in EventBrowser)
int zenithCorrection
Fix parameter using zenith information and energy pre-estimator (if 1)
Detector description interface for RDetector-related data.
Branch GetNextSibling() const
Get next sibling of this branch.
std::string formula
Formula (in TF1 ROOT format)
unsigned int id
ID (corresponds to one in TF1)
int fInfoLevel
xml settings: info level (0 - 5)
Class representing a document branch.
utl::Point GetCoordinateOrigin() const
class to hold data at the radio Station level.
double GetZenith() const
returns the zenith angle (from the wave fit)
bool HasAxis() const
Return true if all 3 axis parameter are set.
double fEnergyEstimatorPower
CandidateStationIterator CandidateStationsBegin()
double maxval
Upper bound (for fit)
#define WARNING(message)
Macro for logging warning messages.
void GetData(bool &b) const
Overloads of the GetData member template function.
double GetParameter(const Parameter i) const
ResultFlag
Flag returned by module methods to the RunController.
Configuration of fit parameters.
Model (parametrization) used for fitting.
utl::Point GetCorePosition() const
returns pointer of the position vector of the core in the reference coor system
double GetParameter(const Parameter i) const
Branch GetFirstChild() const
Get first child of this Branch.
double fParA200
xml settings: parametrization fro zenith correction
utl::Point GetPosition() const
Tank position in Site Cartesian Coordinates.
const Station & GetStation(const int stationId) const
Get station by Station Id.
double fEnergyEstimatorCoeff
double ZenithCorrection(double zenith, double energy)
return value of fixed parameters corresponding to pre-estimated energy and zenith angle of arrival di...
std::string name
Name (displayed in EventBrowser)
std::vector< Model > fModels
xml settings: list of models
std::vector< double > startvalues
Starting fit values.