Jpp  18.1.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Public Attributes | List of all members
JRECONSTRUCTION::JMuonGandalf Struct Reference

Wrapper class to make final fit of muon trajectory. More...

#include <JMuonGandalf.hh>

Inheritance diagram for JRECONSTRUCTION::JMuonGandalf:
JRECONSTRUCTION::JMuonGandalfParameters_t JFIT::JRegressor< JModel_t, JMinimiser_t > TObject

Public Types

typedef JRegressor< JLine3Z,
JGandalf
JRegressor_t
 
typedef JTRIGGER::JHitL0 hit_type
 
typedef std::vector< hit_typebuffer_type
 

Public Member Functions

 JMuonGandalf (const JMuonGandalfParameters_t &parameters, const JModuleRouter &router, const JSummaryRouter &summary, const std::string &pdf_file, const int debug=0)
 Constructor. More...
 
JEvt operator() (const KM3NETDAQ::JDAQEvent &event, const JEvt &in)
 Fit function. More...
 
JEvt operator() (const buffer_type &data, const JEvt &in)
 Fit function. More...
 
void reset ()
 Reset fit parameters. More...
 
bool equals (const JMuonGandalfParameters_t &parameters) const
 Equality. More...
 
 ClassDef (JMuonGandalfParameters_t, 2)
 

Public Attributes

const JModuleRouterrouter
 
const JSummaryRoutersummary
 
int debug
 
double roadWidth_m
 road width [m] More...
 
double R_Hz
 default rate [Hz] More...
 
size_t numberOfPrefits
 number of prefits More...
 
double TTS_ns
 transition-time spread [ns] More...
 
double E_GeV
 energy [GeV] More...
 
double TMin_ns
 minimal time w.r.t. Cherenkov hypothesis [ns] More...
 
double TMax_ns
 maximal time w.r.t. Cherenkov hypothesis [ns] More...
 
double ZMin_m
 minimal z-positon [m] More...
 
double ZMax_m
 maximal z-positon [m] More...
 
double VMax_npe
 maximum number of of photo-electrons More...
 
int NMax
 maximum number of iterations More...
 
bool reprocess
 reprocess More...
 

Detailed Description

Wrapper class to make final fit of muon trajectory.

The JMuonGandalf fit uses one or more start values (usually taken from the output of JMuonSimplex).
All hits of which the PMT position lies within a set road width (JMuonGandalfParameters_t::roadWidth_m) and time is within a set window (JMuonGandalfParameters_t::TMin_ns, JMuonGandalfParameters_t::TMax_ns) around the Cherenkov hypothesis are taken.
In case there are multiple hits from the same PMT is the specified window, the first hit is taken and the other hits are discarded.
The PDF is accordingly evaluated, i.e. the normalised probability for a first hit at the given time of the hit is taken. The normalisation is consistently based on the specified time window.
Note that this hit selection is unbiased with respect to the PDF of a single PMT.

Definition at line 72 of file JMuonGandalf.hh.

Member Typedef Documentation

Definition at line 76 of file JMuonGandalf.hh.

Definition at line 77 of file JMuonGandalf.hh.

Definition at line 78 of file JMuonGandalf.hh.

Constructor & Destructor Documentation

JRECONSTRUCTION::JMuonGandalf::JMuonGandalf ( const JMuonGandalfParameters_t parameters,
const JModuleRouter router,
const JSummaryRouter summary,
const std::string pdf_file,
const int  debug = 0 
)
inline

Constructor.

Parameters
parametersparameters
routermodule router
summarysummary file router
pdf_filePDF file
debugdebug

Definition at line 91 of file JMuonGandalf.hh.

95  :
96  JMuonGandalfParameters_t(parameters),
97  JRegressor_t(pdf_file, parameters.TTS_ns),
98  router (router),
99  summary(summary)
100  {
101  using namespace JFIT;
102 
103  if (this->getRmax() < roadWidth_m) {
104  roadWidth_m = this->getRmax();
105  }
106 
111 
112  this->parameters.resize(5);
113 
114  this->parameters[0] = JLine3Z::pX();
115  this->parameters[1] = JLine3Z::pY();
116  this->parameters[2] = JLine3Z::pT();
117  this->parameters[3] = JLine3Z::pDX();
118  this->parameters[4] = JLine3Z::pDY();
119  }
static int debug
debug level (default is off).
Definition: JMessage.hh:45
double TTS_ns
transition-time spread [ns]
const JModuleRouter & router
double TMin_ns
minimal time w.r.t. Cherenkov hypothesis [ns]
JRegressor< JLine3Z, JGandalf > JRegressor_t
Definition: JMuonGandalf.hh:76
static parameter_type pT()
Definition: JLine1Z.hh:182
double VMax_npe
maximum number of of photo-electrons
const JSummaryRouter & summary
static JTimeRange T_ns
Time window with respect to Cherenkov hypothesis [ns].
static parameter_type pDX()
Definition: JLine3Z.hh:319
double TMax_ns
maximal time w.r.t. Cherenkov hypothesis [ns]
static parameter_type pY()
Definition: JLine1Z.hh:181
static parameter_type pDY()
Definition: JLine3Z.hh:320
static parameter_type pX()
Definition: JLine1Z.hh:180
static double Vmax_npe
Maximal integral of PDF [npe].
static int MAXIMUM_ITERATIONS
maximal number of iterations
Definition: JGandalf.hh:280

Member Function Documentation

JEvt JRECONSTRUCTION::JMuonGandalf::operator() ( const KM3NETDAQ::JDAQEvent event,
const JEvt in 
)
inline

Fit function.

Parameters
eventevent
instart values
Returns
fit results

Definition at line 129 of file JMuonGandalf.hh.

130  {
131  using namespace std;
132  using namespace JFIT;
133  using namespace JTRIGGER;
134 
135  const JBuildL0<hit_type> buildL0;
136 
137  buffer_type dataL0;
138 
139  buildL0(event, router, true, back_inserter(dataL0));
140 
141  return (*this)(dataL0, in);
142  }
const JModuleRouter & router
std::vector< hit_type > buffer_type
Definition: JMuonGandalf.hh:78
Template L0 hit builder.
Definition: JBuildL0.hh:35
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
Definition: JCanberra.sh:46
JEvt JRECONSTRUCTION::JMuonGandalf::operator() ( const buffer_type data,
const JEvt in 
)
inline

Fit function.

Parameters
datahit data
instart values
Returns
fit results

Definition at line 152 of file JMuonGandalf.hh.

153  {
154  using namespace std;
155  using namespace JFIT;
156  using namespace JGEOMETRY3D;
157 
158  JEvt out;
159 
160  for (JEvt::const_iterator track = in.begin(); track != in.end(); ++track) {
161 
162  const JRotation3D R (getDirection(*track));
163  const JLine1Z tz(getPosition (*track).rotate(R), track->getT());
164  JRange<double> Z_m;
165 
166  if (track->hasW(JSTART_LENGTH_METRES) &&
167  track->getW(JSTART_LENGTH_METRES) > 0.0) {
168  Z_m = JZRange(ZMin_m, ZMax_m + track->getW(JSTART_LENGTH_METRES));
169  }
170 
171  const JModel<JLine1Z> match(tz, roadWidth_m, JRegressor_t::T_ns, Z_m);
172 
173  // hit selection based on start value
174 
175  vector<JHitW0> buffer;
176 
177  for (buffer_type::const_iterator i = data.begin(); i != data.end(); ++i) {
178 
179  JHitW0 hit(*i, summary.getRate(i->getPMTIdentifier()));
180 
181  hit.rotate(R);
182 
183  if (match(hit)) {
184  buffer.push_back(hit);
185  }
186  }
187 
188  // select first hit
189 
190  sort(buffer.begin(), buffer.end(), JHitL0::compare);
191 
192  vector<JHitW0>::iterator __end = unique(buffer.begin(), buffer.end(), equal_to<JDAQPMTIdentifier>());
193 
194 
195  const int NDF = distance(buffer.begin(), __end) - this->parameters.size();
196 
197  if (NDF > 0) {
198 
199  // set fit parameters
200 
201  if (track->getE() > 0.1)
202  JRegressor_t::E_GeV = track->getE();
203  else
205 
206  const double chi2 = (*this)(JLine3Z(tz), buffer.begin(), __end);
207 
208  JTrack3D tb(this->value);
209 
210  tb.rotate_back(R);
211 
212  out.push_back(getFit(JHistory(track->getHistory()).add(JMUONGANDALF), tb, getQuality(chi2), NDF));
213 
214  // set additional values
215 
216  out.rbegin()->setV(this->V.size(), this->V);
217 
218  out.rbegin()->setW(track->getW());
219  out.rbegin()->setW(JGANDALF_BETA0_RAD, sqrt(this->error.getDX() * this->error.getDX() +
220  this->error.getDY() * this->error.getDY()));
221  out.rbegin()->setW(JGANDALF_BETA1_RAD, sqrt(this->error.getDX() * this->error.getDY()));
222  out.rbegin()->setW(JGANDALF_CHI2, chi2);
223  out.rbegin()->setW(JGANDALF_NUMBER_OF_HITS, distance(buffer.begin(), __end));
224  out.rbegin()->setW(JGANDALF_LAMBDA, this->lambda);
225  out.rbegin()->setW(JGANDALF_NUMBER_OF_ITERATIONS, this->numberOfIterations);
226  }
227  }
228 
229  return out;
230  }
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Rotation matrix.
Definition: JRotation3D.hh:111
double getRate() const
Get default rate.
static const int JGANDALF_BETA1_RAD
angular resolution [rad] from JGandalf.cc
JFit getFit(const JHistory &history, const JTrack3D &track, const double Q, const int NDF, const double energy=0.0, const int status=SINGLE_STAGE)
Get fit.
*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
Definition: diff-Tuna.sh:38
Template specialisation of class JModel to match hit with muon trajectory along z-axis.
Definition: JFit/JModel.hh:34
Data structure for fit of straight line in positive z-direction.
Definition: JLine3Z.hh:36
V(JDAQEvent-JTriggerReprocessor)*1.0/(JDAQEvent+1.0e-10)
double getQuality(const double chi2, const int N, const int NDF)
Get quality of fit.
static struct JTRIGGER::JHitL0::compare compare
const JSummaryRouter & summary
static JTimeRange T_ns
Time window with respect to Cherenkov hypothesis [ns].
static const int JGANDALF_NUMBER_OF_HITS
number of hits from JGandalf.cc
static const int JGANDALF_LAMBDA
control parameter from JGandalf.cc
Acoustic event fit.
static const int JMUONGANDALF
double E_GeV
Energy of muon at vertex [GeV].
JDirection3D getDirection(const JFit &fit)
Get direction.
static const int JGANDALF_BETA0_RAD
KM3NeT Data Definitions v3.1.0 https://git.km3net.de/common/km3net-dataformat.
then JCookie sh JDataQuality D $DETECTOR_ID R
Definition: JDataQuality.sh:41
Auxiliary class for a hit with background rate value.
Definition: JHitW0.hh:21
JFIT::JHistory JHistory
Definition: JHistory.hh:354
static const int JSTART_LENGTH_METRES
distance between first and last hits in metres from JStart.cc
static const int JGANDALF_NUMBER_OF_ITERATIONS
number of iterations from JGandalf.cc
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
Definition: JMatrixNZ.sh:106
Data structure for fit of straight line paralel to z-axis.
Definition: JLine1Z.hh:27
JPosition3D getPosition(const JFit &fit)
Get position.
static const int JGANDALF_CHI2
chi2 from JGandalf.cc
JPosition3D & rotate(const JRotation3D &R)
Rotate.
Definition: JPosition3D.hh:186
JTOOLS::JRange< double > JZRange
Definition: JFit/JModel.hh:21
void JRECONSTRUCTION::JMuonGandalfParameters_t::reset ( )
inlineinherited

Reset fit parameters.

Definition at line 41 of file JMuonGandalfParameters_t.hh.

42  {
43  roadWidth_m = std::numeric_limits<double>::max();
44  R_Hz = 6.0e3;
45  numberOfPrefits = 0;
46  TTS_ns = 2;
47  E_GeV = 1.0e3;
48  TMin_ns = -50.0;
49  TMax_ns = +450.0;
50  ZMin_m = 0.0;
51  ZMax_m = 0.0;
52  VMax_npe = 10.0;
53  NMax = 1000;
54  reprocess = false;
55  }
double TTS_ns
transition-time spread [ns]
double TMin_ns
minimal time w.r.t. Cherenkov hypothesis [ns]
double VMax_npe
maximum number of of photo-electrons
double TMax_ns
maximal time w.r.t. Cherenkov hypothesis [ns]
bool JRECONSTRUCTION::JMuonGandalfParameters_t::equals ( const JMuonGandalfParameters_t parameters) const
inlineinherited

Equality.

Parameters
parametersfit parameters
Returns
true if equals; else false

Definition at line 63 of file JMuonGandalfParameters_t.hh.

64  {
65  return (this->roadWidth_m == parameters.roadWidth_m &&
66  this->R_Hz == parameters.R_Hz &&
67  this->numberOfPrefits == parameters.numberOfPrefits &&
68  this->TTS_ns == parameters.TTS_ns &&
69  this->E_GeV == parameters.E_GeV &&
70  this->TMin_ns == parameters.TMin_ns &&
71  this->TMax_ns == parameters.TMax_ns &&
72  this->ZMin_m == parameters.ZMin_m &&
73  this->ZMax_m == parameters.ZMax_m &&
74  this->VMax_npe == parameters.VMax_npe &&
75  this->NMax == parameters.NMax &&
76  this->reprocess == parameters.reprocess);
77  }
double TTS_ns
transition-time spread [ns]
double TMin_ns
minimal time w.r.t. Cherenkov hypothesis [ns]
then usage $script< detector file >< detectorfile > nIf the range of floors is the first detector file is aligned to the second before the comparison nIn this
double VMax_npe
maximum number of of photo-electrons
double TMax_ns
maximal time w.r.t. Cherenkov hypothesis [ns]
JRECONSTRUCTION::JMuonGandalfParameters_t::ClassDef ( JMuonGandalfParameters_t  ,
 
)
inherited

Member Data Documentation

const JModuleRouter& JRECONSTRUCTION::JMuonGandalf::router

Definition at line 233 of file JMuonGandalf.hh.

const JSummaryRouter& JRECONSTRUCTION::JMuonGandalf::summary

Definition at line 234 of file JMuonGandalf.hh.

int JRECONSTRUCTION::JMuonGandalf::debug

Definition at line 235 of file JMuonGandalf.hh.

double JRECONSTRUCTION::JMuonGandalfParameters_t::roadWidth_m
inherited

road width [m]

Definition at line 81 of file JMuonGandalfParameters_t.hh.

double JRECONSTRUCTION::JMuonGandalfParameters_t::R_Hz
inherited

default rate [Hz]

Definition at line 82 of file JMuonGandalfParameters_t.hh.

size_t JRECONSTRUCTION::JMuonGandalfParameters_t::numberOfPrefits
inherited

number of prefits

Definition at line 83 of file JMuonGandalfParameters_t.hh.

double JRECONSTRUCTION::JMuonGandalfParameters_t::TTS_ns
inherited

transition-time spread [ns]

Definition at line 84 of file JMuonGandalfParameters_t.hh.

double JRECONSTRUCTION::JMuonGandalfParameters_t::E_GeV
inherited

energy [GeV]

Definition at line 85 of file JMuonGandalfParameters_t.hh.

double JRECONSTRUCTION::JMuonGandalfParameters_t::TMin_ns
inherited

minimal time w.r.t. Cherenkov hypothesis [ns]

Definition at line 86 of file JMuonGandalfParameters_t.hh.

double JRECONSTRUCTION::JMuonGandalfParameters_t::TMax_ns
inherited

maximal time w.r.t. Cherenkov hypothesis [ns]

Definition at line 87 of file JMuonGandalfParameters_t.hh.

double JRECONSTRUCTION::JMuonGandalfParameters_t::ZMin_m
inherited

minimal z-positon [m]

Definition at line 88 of file JMuonGandalfParameters_t.hh.

double JRECONSTRUCTION::JMuonGandalfParameters_t::ZMax_m
inherited

maximal z-positon [m]

Definition at line 89 of file JMuonGandalfParameters_t.hh.

double JRECONSTRUCTION::JMuonGandalfParameters_t::VMax_npe
inherited

maximum number of of photo-electrons

Definition at line 90 of file JMuonGandalfParameters_t.hh.

int JRECONSTRUCTION::JMuonGandalfParameters_t::NMax
inherited

maximum number of iterations

Definition at line 91 of file JMuonGandalfParameters_t.hh.

bool JRECONSTRUCTION::JMuonGandalfParameters_t::reprocess
inherited

reprocess

Definition at line 92 of file JMuonGandalfParameters_t.hh.


The documentation for this struct was generated from the following file: