1 #ifndef __JRECONSTRUCTION__JMUONENERGY__
2 #define __JRECONSTRUCTION__JMUONENERGY__
45 namespace JRECONSTRUCTION {}
46 namespace JPP {
using namespace JRECONSTRUCTION; }
48 namespace JRECONSTRUCTION {
68 using JRegressor_t::operator();
82 const std::string& pdfFile,
101 if (!this->estimator.is_valid()) {
102 FATAL(
"Invalid M-Estimator." << endl);
118 const double chi2 = std::numeric_limits<double>::max())
129 operator bool()
const
131 return chi2 != std::numeric_limits<double>::max();
162 for (JEvt::const_iterator track = in.begin(); track != in.end(); ++track) {
172 for (JDataL0_t::const_iterator i = dataL0.begin(); i !=dataL0.end(); ++i) {
179 top.insert(i->getPMTIdentifier());
191 for (JDetector::const_iterator module = subdetector.begin(); module != subdetector.end(); ++module) {
197 for (
size_t i = 0; i != module->size(); ++i) {
206 const size_t count = top.count(
id);
208 data.push_back(
JNPEHit(this->
getNPE(module->getPMT(i), rate_Hz), count));
214 const int NDF =
distance(data.begin(), data.end()) - 1;
224 for (
int i = 0; i !=
N; ++i) {
234 for (
int i = 0; i !=
N; ++i) {
239 const double chi2 = (*this)(
x, data.begin(), data.end());
242 buffer[
chi2] = x.getE();
245 if (result[i].
chi2 < result[j].
chi2) {
251 for (
int i = 0; i !=
N; ++i) {
261 result[4] = result[1];
262 result[2] = result[0];
263 result[0] =
JResult(2*result[2].
x - result[4].
x);
267 result[4] = result[2];
268 result[2] = result[1];
272 result[0] = result[1];
273 result[4] = result[3];
277 result[0] = result[2];
278 result[2] = result[3];
282 result[0] = result[3];
283 result[2] = result[4];
284 result[4] =
JResult(2*result[2].x - result[0].x);
288 result[1] =
JResult(0.5 * (result[0].
x + result[2].
x));
289 result[3] =
JResult(0.5 * (result[2].x + result[4].x));
294 if (result[1].
chi2 != result[3].
chi2) {
296 result[2].
x += 0.25 * (result[3].
x - result[1].
x) * (result[1].chi2 - result[3].chi2) / (result[1].
chi2 + result[3].
chi2 - 2*result[2].
chi2);
297 result[2].
chi2 = (*this)(result[2].
x, data.begin(), data.end());
301 const double chi2 = result[2].
chi2;
302 const double E = result[2].
x.
getE();
306 double Emin = numeric_limits<double>::max();
307 double Emax = numeric_limits<double>::lowest();
310 if (i->second < Emin) { Emin = i->second; }
311 if (i->second > Emax) { Emax = i->second; }
314 const double mu_range =
gWater(E);
316 double noise_likelihood = 0.0;
317 int number_of_hits = 0;
320 noise_likelihood +=
log10(
getP(i->getY0(), i->getN()));
321 number_of_hits += i->getN();
326 out.rbegin()->setE(E);
328 out.rbegin()->setW(track->getW());
static int debug
debug level (default is off).
Template definition of a data regressor of given model.
double getE() const
Get energy.
JResult(const JEnergy &x=0.0, const double chi2=std::numeric_limits< double >::max())
Constructor.
double TMin_ns
minimal time w.r.t. Cherenkov hypothesis [ns]
static const int JENERGY_ENERGY
uncorrected energy [GeV] from JEnergy.cc
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Regressor function object for fit of muon energy.
Template specialisation of L0 builder for JHitL0 data type.
static const int JENERGY_MAXIMAL_ENERGY
maximal energy [GeV] from JEnergy.cc
double roadWidth_m
road width [m]
const JSummaryRouter & summary
Router for direct addressing of module data in detector data structure.
double ZMin_m
minimal z-position [m]
double getRate() const
Get default rate.
JTRIGGER::JHitR1 hit_type
then JShowerPostfit f $INPUT_FILE o $OUTPUT_FILE N
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Template specialisation of class JModel to match hit with muon trajectory along z-axis.
static const JGeaneWater gWater
Function object for energy loss of muon in sea water.
Auxiliary data structure for floating point format specification.
const JDAQSummaryFrame & getSummaryFrame() const
Get default summary frame.
JFit & add(const int type)
Add event to history.
static const int JENERGY_CHI2
chi2 from JEnergy.cc
Data structure for detector geometry and calibration.
double resolution
energy resolution [log10(GeV)]
static const int JENERGY_NOISE_LIKELIHOOD
log likelihood of every hit being K40 from JEnergy.cc
JRegressor< JEnergy > JRegressor_t
Basic data structure for L0 hit.
static const int JENERGY_NDF
number of degrees of freedom from JEnergy.cc
static const int JENERGY_MINIMAL_ENERGY
minimal energy [GeV] from JEnergy.cc
JTOOLS::JRange< JEnergy > JEnergyRange
Auxiliary class to extract a subset of optical modules from a detector.
const JModuleRouter & router
JDirection3D getDirection(const Vec &dir)
Get direction.
static const int JENERGY_NUMBER_OF_HITS
number of hits from JEnergy.cc
set_variable E_E log10(E_{fit}/E_{#mu})"
Data storage class for rate measurements of all PMTs in one module.
JEvt operator()(const KM3NETDAQ::JDAQEvent &event, const JEvt &in)
Fit function.
JAxis3D getAxis(const Trk &track)
Get axis.
static JTimeRange T_ns
Time window with respect to Cherenkov hypothesis [ns].
static const int PMT_DISABLE
KM3NeT Data Definitions v2.2.0-16-gbef370c https://git.km3net.de/common/km3net-dataformat.
JPosition3D getPosition(const Vec &pos)
Get position.
Auxiliary class for simultaneously handling light yields and response of PMT.
Router for fast addressing of summary data in KM3NETDAQ::JDAQSummaryslice data structure as a functio...
then usage $script[distance] fi case set_variable R
Detector subset without binary search functionality.
JMuonEnergy(const JMuonEnergyParameters_t ¶meters, const JModuleRouter &router, const JSummaryRouter &summary, const std::string &pdfFile, const int debug=0)
Constructor.
std::vector< hit_type > buffer_type
Data structure for fit parameters.
double getP(const double expval, bool hit)
Get Poisson probability to observe a hit or not for given expectation value for the number of hits...
Direct access to module in detector data structure.
Reduced data structure for L1 hit.
bool getPMTStatus(const JStatus &status)
Test status of PMT.
const JClass_t & getReference() const
Get reference to object.
static const int JSTART_LENGTH_METRES
distance between first and last hits in metres from JStart.cc
Data structure for set of track fit results.
bool hasSummaryFrame(const JDAQModuleIdentifier &module) const
Has summary frame.
double EMin_log
minimal energy [log10(GeV)]
then if[[!-f $DETECTOR]] then JDetector sh $DETECTOR fi cat $WORKDIR trigger_parameters txt<< EOFtrigger3DMuon.enabled=1;trigger3DMuon.numberOfHits=5;trigger3DMuon.gridAngle_deg=1;ctMin=0.0;TMaxLocal_ns=15.0;EOF set_variable TRIGGEREFFICIENCY_TRIGGERED_EVENTS_ONLY INPUT_FILES=() for((i=1;$i<=$NUMBER_OF_RUNS;++i));do JSirene.sh $DETECTOR $JPP_DATA/genhen.km3net_wpd_V2_0.evt.gz $WORKDIR/sirene_ ${i}.root JTriggerEfficiency.sh $DETECTOR $DETECTOR $WORKDIR/sirene_ ${i}.root $WORKDIR/trigger_efficiency_ ${i}.root $WORKDIR/trigger_parameters.txt $JPP_DATA/PMT_parameters.txt INPUT_FILES+=($WORKDIR/trigger_efficiency_ ${i}.root) done for ANGLE_DEG in $ANGLES_DEG[*];do set_variable SIGMA_NS 3.0 set_variable OUTLIERS 3 set_variable OUTPUT_FILE $WORKDIR/matrix\[${ANGLE_DEG}\deg\].root $JPP_DIR/examples/JReconstruction-f"$INPUT_FILES[*]"-o $OUTPUT_FILE-S ${SIGMA_NS}-A ${ANGLE_DEG}-O ${OUTLIERS}-d ${DEBUG}--!fiif[[$OPTION=="plot"]];then if((0));then for H1 in h0 h1;do JPlot1D-f"$WORKDIR/matrix["${^ANGLES_DEG}" deg].root:${H1}"-y"1 2e3"-Y-L TR-T""-\^"number of events [a.u.]"-> o chi2
Data structure for fit of straight line paralel to z-axis.
Reduced data structure for L1 hit.
Data structure for fit of energy.
double getNPE(const Hit &hit)
Get true charge of hit.
double TMax_ns
maximal time w.r.t. Cherenkov hypothesis [ns]
Data regression method for JFIT::JEnergy.
Auxiliary class to to determine muon energy.
int mestimator
M-estimator.
JMEstimator * getMEstimator(const int type)
Get M-Estimator.
bool getDAQStatus(const JDAQFrameStatus &frame, const JStatus &status)
Test status of DAQ.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
JPosition3D & rotate(const JRotation3D &R)
Rotate.
static const int JENERGY_MUON_RANGE_METRES
range of a muon with the reconstructed energy [m] from JEnergy.cc
static const int JMUONENERGY
double EMax_log
maximal energy [log10(GeV)]
#define DEBUG(A)
Message macros.
Auxiliary class for energy estimation.