Jpp  17.3.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 | Private Attributes | List of all members
JRECONSTRUCTION::JMuonStart Class Reference

Auxiliary class to determine start and end position of muon trajectory. More...

#include <JMuonStart.hh>

Inheritance diagram for JRECONSTRUCTION::JMuonStart:
JRECONSTRUCTION::JMuonStartParameters_t JFIT::JRegressor< JModel_t, JMinimiser_t > TObject

Public Types

typedef JRegressor< JEnergyJRegressor_t
 
typedef JTRIGGER::JHitL0 hit_type
 
typedef std::vector< hit_typebuffer_type
 

Public Member Functions

 JMuonStart (const JMuonStartParameters_t &parameters, const JModuleRouter &router, const JSummaryRouter &summary, const std::string &pdfFile, const JK40Rates &rates_Hz, 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 JMuonStartParameters_t &parameters) const
 Equality. More...
 
 ClassDef (JMuonStartParameters_t, 2)
 

Public Attributes

double roadWidth_m
 road width [m] More...
 
double R_Hz
 default rate [Hz] More...
 
size_t numberOfPrefits
 number of prefits 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 Pmin1
 minimal probability single observation More...
 
double Pmin2
 minimal probability for twofold observations More...
 
int Nmax2
 maximal number for twofold observations More...
 
bool reprocess
 reprocess More...
 

Private Attributes

const JModuleRouterrouter
 
const JSummaryRoutersummary
 
const JK40Rates rates_Hz
 
int debug
 

Detailed Description

Auxiliary class to determine start and end position of muon trajectory.

Definition at line 111 of file JMuonStart.hh.

Member Typedef Documentation

Definition at line 116 of file JMuonStart.hh.

Definition at line 117 of file JMuonStart.hh.

Definition at line 118 of file JMuonStart.hh.

Constructor & Destructor Documentation

JRECONSTRUCTION::JMuonStart::JMuonStart ( const JMuonStartParameters_t parameters,
const JModuleRouter router,
const JSummaryRouter summary,
const std::string pdfFile,
const JK40Rates rates_Hz,
const int  debug = 0 
)
inline

Constructor.

Parameters
parametersparameters
routermodule router
summarysummary router
pdfFilePDF file
rates_HzK40 rates [Hz]
debugdebug

Definition at line 132 of file JMuonStart.hh.

137  :
138  JMuonStartParameters_t(parameters),
139  JRegressor_t(pdfFile),
140  router(router),
141  summary(summary),
142  rates_Hz(rates_Hz),
143  debug(debug)
144  {
146  JRegressor_t::T_ns.setRange(parameters.TMin_ns, parameters.TMax_ns);
147 
148  if (this->getRmax() < parameters.roadWidth_m) {
149  roadWidth_m = this->getRmax();
150  }
151  }
static int debug
debug level (default is off).
Definition: JMessage.hh:45
JRegressor< JEnergy > JRegressor_t
Definition: JMuonStart.hh:116
const JK40Rates rates_Hz
Definition: JMuonStart.hh:320
double TMax_ns
maximal time w.r.t. Cherenkov hypothesis [ns]
static JTimeRange T_ns
Time window with respect to Cherenkov hypothesis [ns].
const JModuleRouter & router
Definition: JMuonStart.hh:318
const JSummaryRouter & summary
Definition: JMuonStart.hh:319
double TMin_ns
minimal time w.r.t. Cherenkov hypothesis [ns]

Member Function Documentation

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

Fit function.

Parameters
eventevent
instart values
Returns
fit results

Definition at line 161 of file JMuonStart.hh.

162  {
163  using namespace std;
164  using namespace JPP;
165 
166  const JBuildL0<hit_type> buildL0;
167 
168  buffer_type dataL0;
169 
170  buildL0(event, router, true, back_inserter(dataL0));
171 
172  return (*this)(dataL0, in);
173  }
const JModuleRouter & router
Definition: JMuonStart.hh:318
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
std::vector< hit_type > buffer_type
Definition: JMuonStart.hh:118
JEvt JRECONSTRUCTION::JMuonStart::operator() ( const buffer_type data,
const JEvt in 
)
inline

Fit function.

Parameters
datadataL0
instart values
Returns
fit results

Definition at line 183 of file JMuonStart.hh.

184  {
185  using namespace std;
186  using namespace JPP;
187 
188  JEvt out;
189 
191 
192  const JStart start(Pmin1, Pmin2, Nmax2);
193 
194  for (JEvt::const_iterator track = in.begin(); track != in.end(); ++track) {
195 
196  const JRotation3D R (getDirection(*track));
197  const JLine1Z tz(getPosition (*track).rotate(R), track->getT());
199 
201 
202  for (buffer_type::const_iterator i = data.begin(); i != data.end(); ++i) {
203 
204  hit_type hit(*i);
205 
206  hit.rotate(R);
207 
208  if (match(hit)) {
209  top[hit.getModuleID()].insert(hit.getPMTAddress());
210  }
211  }
212 
213  struct JHit_t {
214 
215  double getZ() const { return z; }
216  double getP() const { return p; }
217 
218  double z;
219  double p;
220  };
221 
222  vector<JHit_t> data;
223 
224  for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
225 
226  if (summary.hasSummaryFrame(module->getID())) {
227 
228  const JDAQSummaryFrame& frame = summary.getSummaryFrame(module->getID());
229 
230  JPosition3D pos(module->getPosition());
231 
232  pos.transform(R, tz.getPosition());
233 
234  if (pos.getX() <= roadWidth_m) {
235 
236  const double z = pos.getZ() - pos.getX() / getTanThetaC();
237 
238  const double p = getProbability(*module, frame, rates_Hz.getMultiplesRates(), JRegressor_t::T_ns.getLength(), top[module->getID()]);
239 
240  data.push_back({ z, p });
241  }
242  }
243  }
244 
245  double Zmin = 0.0; // relative start position [m]
246  double Zmax = 0.0; // relative end position [m]
247  double npe_total = 0.0; // npe due to mip
248  double npe_missed = 0.0; // npe due to mip not detected
249 
250  if (!data.empty()) {
251 
252  sort(data.begin(), data.end(), JLANG::make_comparator(&JHit_t::getZ));
253 
254  vector<JHit_t>::const_iterator track_start = start.find(data. begin(), data. end());
255  vector<JHit_t>::const_reverse_iterator track_end = start.find(data.rbegin(), data.rend());
256 
257  if (track_start != data. end()) { Zmin = track_start->getZ(); }
258  if (track_end != data.rend()) { Zmax = track_end ->getZ(); }
259 
260  // additional features
261 
262  for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
263 
264  JPosition3D pos(module->getPosition());
265 
266  pos.transform(R, tz.getPosition());
267 
268  if (pos.getX() <= roadWidth_m) {
269 
270  const double z = pos.getZ() - pos.getX() / getTanThetaC();
271 
272  if (z >= Zmin && z <= Zmax) {
273 
274  for (size_t i = 0; i != module->size(); ++i) {
275 
276  const JDAQSummaryFrame& frame = summary.getSummaryFrame(module->getID());
277 
278  if (getDAQStatus(frame, *module, i) &&
279  getPMTStatus(frame, *module, i) &&
280  !module->getPMT(i).has(PMT_DISABLE)) {
281 
282  JPMT pmt = module->getPMT(i);
283 
284  pmt.transform(R, tz.getPosition());
285 
286  const double ya = this->getNPE(pmt, 0.0).getYA();
287 
288  npe_total += ya;
289 
290  if (top[module->getID()].count(i) == 0) {
291  npe_missed += ya;
292  }
293  }
294  }
295  }
296  }
297  }
298  }
299 
300  JFit fit = *track;
301 
302  // move track
303 
304  fit.move(Zmin, getSpeedOfLight());
305 
306  out.push_back(fit.add(JMUONSTART));
307 
308  out.rbegin()->setW(track->getW());
309  out.rbegin()->setW(JSTART_NPE_MIP_TOTAL, npe_total);
310  out.rbegin()->setW(JSTART_NPE_MIP_MISSED, npe_missed);
311  out.rbegin()->setW(JSTART_LENGTH_METRES, Zmax - Zmin);
312  }
313 
314  return out;
315  }
static const int JMUONSTART
static const int JSTART_NPE_MIP_TOTAL
number of photo-electrons along the whole track from JStart.cc
JComparator< JResult_t T::*, JComparison::lt > make_comparator(JResult_t T::*member)
Helper method to create comparator between values of data member.
Detector data structure.
Definition: JDetector.hh:89
Rotation matrix.
Definition: JRotation3D.hh:111
double Pmin2
minimal probability for twofold observations
Template specialisation of class JModel to match hit with muon trajectory along z-axis.
Definition: JFit/JModel.hh:34
const JDAQSummaryFrame & getSummaryFrame() const
Get default summary frame.
void transform(const JRotation3D &R, const JVector3D &pos)
Transform position.
Definition: JPosition3D.hh:331
Acoustic single fit.
void transform(const JAxis3D &axis)
Transform axis to reference frame of given axis.
Definition: JAxis3D.hh:359
double getProbability(const JModule &module, const JDAQSummaryFrame &frame, const JRateL1_t &R_Hz, const double T_ns, const std::multiset< int > &top)
Get probability of given response in optical module due to random background.
Definition: JMuonStart.hh:75
const JRateL1_t & getMultiplesRates() const
Get multiples rate.
Definition: JK40Rates.hh:82
const JK40Rates rates_Hz
Definition: JMuonStart.hh:320
Detector file.
Definition: JHead.hh:226
static const int JSTART_NPE_MIP_MISSED
number of photo-electrons missed from JStart.cc
Acoustic event fit.
Auxiliary class for start or end point evaluation.
Definition: JStart.hh:21
Data storage class for rate measurements of all PMTs in one module.
static JTimeRange T_ns
Time window with respect to Cherenkov hypothesis [ns].
Data structure for PMT geometry, calibration and status.
Definition: JPMT.hh:43
static const int PMT_DISABLE
KM3NeT Data Definitions v3.0.0-3-gef79250 https://git.km3net.de/common/km3net-dataformat.
Definition: pmt_status.hh:12
JDirection3D getDirection(const JFit &fit)
Get direction.
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...
Definition: JFitToolkit.hh:41
int Nmax2
maximal number for twofold observations
const JModuleRouter & router
Definition: JMuonStart.hh:318
then JCookie sh JDataQuality D $DETECTOR_ID R
Definition: JDataQuality.sh:41
bool getPMTStatus(const JStatus &status)
Test status of PMT.
const JClass_t & getReference() const
Get reference to object.
Definition: JReference.hh:38
const double getSpeedOfLight()
Get speed of light.
static const int JSTART_LENGTH_METRES
distance between first and last hits in metres from JStart.cc
bool hasSummaryFrame(const JDAQModuleIdentifier &module) const
Has summary frame.
Auxiliary class to set-up Hit.
Definition: JSirene.hh:57
Data structure for fit of straight line paralel to z-axis.
Definition: JLine1Z.hh:27
const JSummaryRouter & summary
Definition: JMuonStart.hh:319
double getTanThetaC()
Get average tangent of Cherenkov angle of water corresponding to group velocity.
JPosition3D getPosition(const JFit &fit)
Get position.
double getNPE(const Hit &hit)
Get true charge of hit.
double Pmin1
minimal probability single observation
Data structure for position in three dimensions.
Definition: JPosition3D.hh:36
bool getDAQStatus(const JDAQFrameStatus &frame, const JStatus &status)
Test status of DAQ.
JPosition3D & rotate(const JRotation3D &R)
Rotate.
Definition: JPosition3D.hh:186
void JRECONSTRUCTION::JMuonStartParameters_t::reset ( )
inlineinherited

Reset fit parameters.

Definition at line 41 of file JMuonStartParameters_t.hh.

42  {
43  roadWidth_m = std::numeric_limits<double>::max();
44  R_Hz = 6.0e3;
45  numberOfPrefits = 0;
46  TMin_ns = -25.0;
47  TMax_ns = +75.0;
48  Pmin1 = 0.0;
49  Pmin2 = 0.0;
50  Nmax2 = 2;
51  reprocess = false;
52  }
double Pmin2
minimal probability for twofold observations
double TMax_ns
maximal time w.r.t. Cherenkov hypothesis [ns]
int Nmax2
maximal number for twofold observations
double Pmin1
minimal probability single observation
double TMin_ns
minimal time w.r.t. Cherenkov hypothesis [ns]
bool JRECONSTRUCTION::JMuonStartParameters_t::equals ( const JMuonStartParameters_t parameters) const
inlineinherited

Equality.

Parameters
parametersfit parameters
Returns
true if equals; else false

Definition at line 60 of file JMuonStartParameters_t.hh.

61  {
62  return (this->roadWidth_m == parameters.roadWidth_m &&
63  this->R_Hz == parameters.R_Hz &&
64  this->numberOfPrefits == parameters.numberOfPrefits &&
65  this->TMin_ns == parameters.TMin_ns &&
66  this->TMax_ns == parameters.TMax_ns &&
67  this->Pmin1 == parameters.Pmin1 &&
68  this->Pmin2 == parameters.Pmin2 &&
69  this->Nmax2 == parameters.Nmax2 &&
70  this->reprocess == parameters.reprocess);
71  }
double Pmin2
minimal probability for twofold observations
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 TMax_ns
maximal time w.r.t. Cherenkov hypothesis [ns]
int Nmax2
maximal number for twofold observations
double Pmin1
minimal probability single observation
double TMin_ns
minimal time w.r.t. Cherenkov hypothesis [ns]
JRECONSTRUCTION::JMuonStartParameters_t::ClassDef ( JMuonStartParameters_t  ,
 
)
inherited

Member Data Documentation

const JModuleRouter& JRECONSTRUCTION::JMuonStart::router
private

Definition at line 318 of file JMuonStart.hh.

const JSummaryRouter& JRECONSTRUCTION::JMuonStart::summary
private

Definition at line 319 of file JMuonStart.hh.

const JK40Rates JRECONSTRUCTION::JMuonStart::rates_Hz
private

Definition at line 320 of file JMuonStart.hh.

int JRECONSTRUCTION::JMuonStart::debug
private

Definition at line 321 of file JMuonStart.hh.

double JRECONSTRUCTION::JMuonStartParameters_t::roadWidth_m
inherited

road width [m]

Definition at line 75 of file JMuonStartParameters_t.hh.

double JRECONSTRUCTION::JMuonStartParameters_t::R_Hz
inherited

default rate [Hz]

Definition at line 76 of file JMuonStartParameters_t.hh.

size_t JRECONSTRUCTION::JMuonStartParameters_t::numberOfPrefits
inherited

number of prefits

Definition at line 77 of file JMuonStartParameters_t.hh.

double JRECONSTRUCTION::JMuonStartParameters_t::TMin_ns
inherited

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

Definition at line 78 of file JMuonStartParameters_t.hh.

double JRECONSTRUCTION::JMuonStartParameters_t::TMax_ns
inherited

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

Definition at line 79 of file JMuonStartParameters_t.hh.

double JRECONSTRUCTION::JMuonStartParameters_t::Pmin1
inherited

minimal probability single observation

Definition at line 80 of file JMuonStartParameters_t.hh.

double JRECONSTRUCTION::JMuonStartParameters_t::Pmin2
inherited

minimal probability for twofold observations

Definition at line 81 of file JMuonStartParameters_t.hh.

int JRECONSTRUCTION::JMuonStartParameters_t::Nmax2
inherited

maximal number for twofold observations

Definition at line 82 of file JMuonStartParameters_t.hh.

bool JRECONSTRUCTION::JMuonStartParameters_t::reprocess
inherited

reprocess

Definition at line 83 of file JMuonStartParameters_t.hh.


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