Jpp  master_rocky-37-gf0c5bc59d
the software that should make you happy
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 112 of file JMuonStart.hh.

Member Typedef Documentation

◆ JRegressor_t

Definition at line 117 of file JMuonStart.hh.

◆ hit_type

Definition at line 118 of file JMuonStart.hh.

◆ buffer_type

Definition at line 119 of file JMuonStart.hh.

Constructor & Destructor Documentation

◆ JMuonStart()

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 133 of file JMuonStart.hh.

138  :
139  JMuonStartParameters_t(parameters),
140  JRegressor_t(pdfFile),
141  router(router),
142  summary(summary),
144  debug(debug)
145  {
147  JRegressor_t::T_ns.setRange(parameters.TMin_ns, parameters.TMax_ns);
148 
149  if (this->getRmax() < parameters.roadWidth_m) {
150  roadWidth_m = this->getRmax();
151  }
152  }
int debug
debug level
Definition: JSirene.cc:69
const JSummaryRouter & summary
Definition: JMuonStart.hh:321
JRegressor< JEnergy > JRegressor_t
Definition: JMuonStart.hh:117
const JModuleRouter & router
Definition: JMuonStart.hh:320
const JK40Rates rates_Hz
Definition: JMuonStart.hh:322
double TMin_ns
minimal time w.r.t. Cherenkov hypothesis [ns]
double TMax_ns
maximal time w.r.t. Cherenkov hypothesis [ns]

Member Function Documentation

◆ operator()() [1/2]

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

Fit function.

Parameters
eventevent
instart values
Returns
fit results

Definition at line 162 of file JMuonStart.hh.

163  {
164  using namespace std;
165  using namespace JPP;
166 
167  const JBuildL0<hit_type> buildL0;
168 
169  buffer_type dataL0;
170 
171  buildL0(event, router, true, back_inserter(dataL0));
172 
173  return (*this)(dataL0, in);
174  }
Template L0 hit builder.
Definition: JBuildL0.hh:38
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JSTDTypes.hh:14

◆ operator()() [2/2]

JEvt JRECONSTRUCTION::JMuonStart::operator() ( const buffer_type data,
const JEvt in 
)
inline

Fit function.

Parameters
datadataL0
instart values
Returns
fit results

Definition at line 184 of file JMuonStart.hh.

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

◆ reset()

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  }

◆ equals()

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  }

◆ ClassDef()

JRECONSTRUCTION::JMuonStartParameters_t::ClassDef ( JMuonStartParameters_t  ,
 
)
inherited

Member Data Documentation

◆ router

const JModuleRouter& JRECONSTRUCTION::JMuonStart::router
private

Definition at line 320 of file JMuonStart.hh.

◆ summary

const JSummaryRouter& JRECONSTRUCTION::JMuonStart::summary
private

Definition at line 321 of file JMuonStart.hh.

◆ rates_Hz

const JK40Rates JRECONSTRUCTION::JMuonStart::rates_Hz
private

Definition at line 322 of file JMuonStart.hh.

◆ debug

int JRECONSTRUCTION::JMuonStart::debug
private

Definition at line 323 of file JMuonStart.hh.

◆ roadWidth_m

double JRECONSTRUCTION::JMuonStartParameters_t::roadWidth_m
inherited

road width [m]

Definition at line 75 of file JMuonStartParameters_t.hh.

◆ R_Hz

double JRECONSTRUCTION::JMuonStartParameters_t::R_Hz
inherited

default rate [Hz]

Definition at line 76 of file JMuonStartParameters_t.hh.

◆ numberOfPrefits

size_t JRECONSTRUCTION::JMuonStartParameters_t::numberOfPrefits
inherited

number of prefits

Definition at line 77 of file JMuonStartParameters_t.hh.

◆ TMin_ns

double JRECONSTRUCTION::JMuonStartParameters_t::TMin_ns
inherited

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

Definition at line 78 of file JMuonStartParameters_t.hh.

◆ TMax_ns

double JRECONSTRUCTION::JMuonStartParameters_t::TMax_ns
inherited

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

Definition at line 79 of file JMuonStartParameters_t.hh.

◆ Pmin1

double JRECONSTRUCTION::JMuonStartParameters_t::Pmin1
inherited

minimal probability single observation

Definition at line 80 of file JMuonStartParameters_t.hh.

◆ Pmin2

double JRECONSTRUCTION::JMuonStartParameters_t::Pmin2
inherited

minimal probability for twofold observations

Definition at line 81 of file JMuonStartParameters_t.hh.

◆ Nmax2

int JRECONSTRUCTION::JMuonStartParameters_t::Nmax2
inherited

maximal number for twofold observations

Definition at line 82 of file JMuonStartParameters_t.hh.

◆ reprocess

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: