Jpp - 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 | Static 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, 1)
 

Public Attributes

const JModuleRouterrouter
 
const JSummaryRoutersummary
 
int debug
 
double roadWidth_m
 
double R_Hz
 
size_t numberOfPrefits
 
double TTS_ns
 
double E_GeV
 
double TMin_ns
 
double TMax_ns
 
double ZMin_m
 
double ZMax_m
 
bool reprocess
 

Static Public Attributes

struct {
compare
 Auxiliary data structure for sorting of hits. 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 
109  JRegressor_t::Vmax_npe = 10.0;
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
const JModuleRouter & router
JRegressor< JLine3Z, JGandalf > JRegressor_t
Definition: JMuonGandalf.hh:76
static parameter_type pT()
Definition: JLine1Z.hh:182
const JSummaryRouter & summary
static JTimeRange T_ns
Time window with respect to Cherenkov hypothesis [ns].
static parameter_type pDX()
Definition: JLine3Z.hh:319
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:248

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 source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:38
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  Z_m = JZRange(ZMin_m, ZMax_m + track->getW(JSTART_LENGTH_METRES));
168  }
169 
170  const JModel<JLine1Z> match(tz, roadWidth_m, JRegressor_t::T_ns, Z_m);
171 
172  // hit selection based on start value
173 
174  vector<JHitW0> buffer;
175 
176  for (buffer_type::const_iterator i = data.begin(); i != data.end(); ++i) {
177 
178  const double rate_Hz = summary.getRate(*i);
179 
180  JHitW0 hit(*i, rate_Hz);
181 
182  hit.rotate(R);
183 
184  if (match(hit)) {
185  buffer.push_back(hit);
186  }
187  }
188 
189  // select first hit
190 
191  sort(buffer.begin(), buffer.end(), compare);
192 
193  vector<JHitW0>::iterator __end = unique(buffer.begin(), buffer.end(), equal_to<JDAQPMTIdentifier>());
194 
195 
196  const int NDF = distance(buffer.begin(), __end) - this->parameters.size();
197 
198  if (NDF > 0) {
199 
200  // set fit parameters
201 
202  if (track->getE() > 0.1)
203  JRegressor_t::E_GeV = track->getE();
204  else
206 
207  const double chi2 = (*this)(JLine3Z(tz), buffer.begin(), __end);
208 
209  JTrack3D tb(this->value);
210 
211  tb.rotate_back(R);
212 
213  out.push_back(getFit(JHistory(track->getHistory()).add(JMUONGANDALF), tb, getQuality(chi2), NDF));
214 
215  // set additional values
216 
217  out.rbegin()->setW(track->getW());
218  out.rbegin()->setW(JGANDALF_BETA0_RAD, sqrt(this->error.getDX() * this->error.getDX() +
219  this->error.getDY() * this->error.getDY()));
220  out.rbegin()->setW(JGANDALF_BETA1_RAD, sqrt(this->error.getDX() * this->error.getDY()));
221  out.rbegin()->setW(JGANDALF_CHI2, chi2);
222  out.rbegin()->setW(JGANDALF_NUMBER_OF_HITS, distance(buffer.begin(), __end));
223  out.rbegin()->setW(JGANDALF_LAMBDA, this->lambda);
224  out.rbegin()->setW(JGANDALF_NUMBER_OF_ITERATIONS, this->numberOfIterations);
225  }
226  }
227 
228  return out;
229  }
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
static struct JRECONSTRUCTION::JMuonGandalf::@56 compare
Auxiliary data structure for sorting of hits.
Rotation matrix.
Definition: JRotation3D.hh:111
double getRate() const
Get default rate.
static const int JGANDALF_BETA1_RAD
angular resolution [rad] from JGandalf.cc
*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
double getQuality(const double chi2, const int N, const int NDF)
Get quality of fit.
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 v2.0.0-14-gbeccebb https://git.km3net.de/common/km3net-dataformat.
then usage $script[distance] fi case set_variable R
Definition: JDrawLED.sh:40
JFit getFit(const JHistory &history, const JTrack3D &track, const double Q, const int NDF, const double energy=0.0, const int status=0)
Get fit.
Auxiliary class for a hit with background rate value.
Definition: JHitW0.hh:21
JFIT::JHistory JHistory
Definition: JHistory.hh:283
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
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
bool JRECONSTRUCTION::JMuonGandalfParameters_t::equals ( const JMuonGandalfParameters_t parameters) const
inlineinherited

Equality.

Parameters
parametersfit parameters
Returns
true if equals; else false

Definition at line 61 of file JMuonGandalfParameters_t.hh.

62  {
63  return (this->roadWidth_m == parameters.roadWidth_m &&
64  this->R_Hz == parameters.R_Hz &&
65  this->numberOfPrefits == parameters.numberOfPrefits &&
66  this->TTS_ns == parameters.TTS_ns &&
67  this->E_GeV == parameters.E_GeV &&
68  this->TMin_ns == parameters.TMin_ns &&
69  this->TMax_ns == parameters.TMax_ns &&
70  this->ZMin_m == parameters.ZMin_m &&
71  this->ZMax_m == parameters.ZMax_m &&
72  this->reprocess == parameters.reprocess);
73  }
JRECONSTRUCTION::JMuonGandalfParameters_t::ClassDef ( JMuonGandalfParameters_t  ,
 
)
inherited

Member Data Documentation

struct { ... } JRECONSTRUCTION::JMuonGandalf::compare

Auxiliary data structure for sorting of hits.

const JModuleRouter& JRECONSTRUCTION::JMuonGandalf::router

Definition at line 257 of file JMuonGandalf.hh.

const JSummaryRouter& JRECONSTRUCTION::JMuonGandalf::summary

Definition at line 258 of file JMuonGandalf.hh.

int JRECONSTRUCTION::JMuonGandalf::debug

Definition at line 259 of file JMuonGandalf.hh.

double JRECONSTRUCTION::JMuonGandalfParameters_t::roadWidth_m
inherited

Definition at line 77 of file JMuonGandalfParameters_t.hh.

double JRECONSTRUCTION::JMuonGandalfParameters_t::R_Hz
inherited

Definition at line 78 of file JMuonGandalfParameters_t.hh.

size_t JRECONSTRUCTION::JMuonGandalfParameters_t::numberOfPrefits
inherited

Definition at line 79 of file JMuonGandalfParameters_t.hh.

double JRECONSTRUCTION::JMuonGandalfParameters_t::TTS_ns
inherited

Definition at line 80 of file JMuonGandalfParameters_t.hh.

double JRECONSTRUCTION::JMuonGandalfParameters_t::E_GeV
inherited

Definition at line 81 of file JMuonGandalfParameters_t.hh.

double JRECONSTRUCTION::JMuonGandalfParameters_t::TMin_ns
inherited

Definition at line 82 of file JMuonGandalfParameters_t.hh.

double JRECONSTRUCTION::JMuonGandalfParameters_t::TMax_ns
inherited

Definition at line 83 of file JMuonGandalfParameters_t.hh.

double JRECONSTRUCTION::JMuonGandalfParameters_t::ZMin_m
inherited

Definition at line 84 of file JMuonGandalfParameters_t.hh.

double JRECONSTRUCTION::JMuonGandalfParameters_t::ZMax_m
inherited

Definition at line 85 of file JMuonGandalfParameters_t.hh.

bool JRECONSTRUCTION::JMuonGandalfParameters_t::reprocess
inherited

Definition at line 86 of file JMuonGandalfParameters_t.hh.


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