1 #include <utl/ErrorLogger.h>
2 #include <fwk/CentralConfig.h>
4 #include <det/Detector.h>
5 #include <mdet/MDetector.h>
6 #include <mdet/Counter.h>
7 #include <mdet/Module.h>
10 #include <mevt/MEvent.h>
11 #include <mevt/Counter.h>
12 #include <sevt/SEvent.h>
14 #include <evt/ShowerRecData.h>
15 #include <evt/ShowerSRecData.h>
16 #include <evt/ShowerMRecData.h>
17 #include <mevt/Scintillator.h>
19 #include <utl/Branch.h>
20 #include <utl/ConfigUtils.h>
22 #include <fwk/LocalCoordinateSystem.h>
30 using namespace MdBiasCorrecterAG;
33 namespace MdBiasCorrecterAG {
40 LoadConfig(config,
"biasCorrection", fBiasCorrection,
false);
54 if (!fBiasCorrection) {
55 INFO(
"No bias correction applied.");
60 WARNING(
"Event without MEvent: nothing to be done. Skipping to next event.");
67 const mdet::MDetector& md = det::Detector::GetInstance().GetMDetector();
69 std::ostringstream os;
73 const int counterId = counter.
GetId();
77 os <<
"No bias correction for the rejected counter " << counterId <<
".";
84 os <<
"No bias correction for the silent counter " << counterId <<
".";
90 os <<
"Processing counter " << counterId;
99 const int moduleId = module.
GetId();
102 os <<
"Processing module " << moduleId;
109 os <<
"Module " << module.
GetId() <<
" of counter " << counterId
115 CorrectBias(event, module, mdm);
128 MdBiasCorrecter::CorrectionFactor(
const double phi,
const double theta)
130 const double a = fPar0 + fPar1*(1 + fPar2*std::cos(theta)) * std::sin(theta);
131 const double b = fPar3*(1 + fPar4*std::cos(theta)) * std::sin(theta);
132 return 1 / (1 + a + b*fabs(std::sin(phi)));
144 const double theta = rAxis.
GetTheta(coreLocalCS);
145 const double phi = rAxis.
GetPhi(coreLocalCS);
148 const double phi0 = mdetModule.
GetPhi0();
153 const double corrfac = CorrectionFactor(phi-phi0, theta);
154 const double numberOfMuonsCor = numberOfMuons * corrfac;
160 std::ostringstream os;
161 os <<
"Uncorrected number of muons = " << numberOfMuons <<
", "
162 "corrected = " << numberOfMuonsCor <<
", "
163 "correction factor = " << corrfac <<
", "
164 "for theta = " << theta <<
", "
165 "phi = " << phi <<
", "
Module level reconstruction data. This class contains all data required by the muon reconstruction...
const Module & GetModule(const int mId) const
Retrieve by id a constant module.
CounterConstIterator CountersBegin() const
double GetPhi(const CoordinateSystemPtr &coordinateSystem) const
azimuth (phi) angle in spherical and cylindrical coordinates
Interface class to access to the SD Reconstruction of a Shower.
Counter level event data.
double GetTheta(const CoordinateSystemPtr &coordinateSystem) const
zenith (theta) angle in spherical coordinates
std::string GetRejectionReason() const
double GetNumberOfEstimatedMuons() const
#define INFO(message)
Macro for logging informational messages.
void Init()
Initialise the registry.
bool IsRejected() const
Check if the counter is rejected.
bool IsSilent() const
Check if the counter is silent.
Detector associated to muon detector hierarchy.
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
Class representing a document branch.
#define DEBUGLOG(message)
Macro for logging debugging messages.
void SetNumberOfMuonsErrorHigh(const double e)
const utl::Vector & GetAxis() const
void SetNumberOfEstimatedMuons(const double m)
Number of estimated muons in a module.
#define WARNING(message)
Macro for logging warning messages.
ModuleConstIterator ModulesBegin() const
Root detector of the muon detector hierarchy.
ResultFlag
Flag returned by module methods to the RunController.
int GetId() const
The id of the counter.
ModuleConstIterator ModulesEnd() const
static CentralConfig * GetInstance()
Use this the first time you get an instance of central configuration.
ModuleRecData & GetRecData()
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
const utl::Point & GetCorePosition() const
const Counter & GetCounter(int id) const
Retrieve Counter by id.
static Policy::type Create(const utl::Point &theOrigin)
Create the standard local coordinate system for a Point.
Root of the Muon event hierarchy.
void SetNumberOfMuonsErrorLow(const double e)
utl::Branch GetTopBranch(const std::string &id)
Get top branch for moduleConfigLink with given id (XML files)