Jpp  debug
the software that should make you happy
Public Member Functions | Public Attributes | Private Types | Private Attributes | List of all members
JRECONSTRUCTION::JShowerPositionFit Class Reference

class to handle the second position fit of the shower reconstruction, mainly dedicated for ORCA More...

#include <JShowerPositionFit.hh>

Inheritance diagram for JRECONSTRUCTION::JShowerPositionFit:
JRECONSTRUCTION::JShowerPositionFitParameters_t JFIT::JRegressor< JModel_t, JMinimiser_t > TObject

Public Member Functions

 JShowerPositionFit (const JShowerPositionFitParameters_t &parameters, const JModuleRouter &router, const JSummaryRouter &summary, const std::string pdfFile, const int debug=0)
 Parameterized constructor. More...
 
JEvt operator() (const KM3NETDAQ::JDAQEvent &event, const JFIT::JEvt &in)
 Declaration of the member function that actually performs the reconstruction. More...
 
void reset ()
 Reset fit parameters. More...
 
bool equals (const JShowerPositionFitParameters_t &parameters) const
 Equality. More...
 
 ClassDef (JShowerPositionFitParameters_t, 2)
 

Public Attributes

const JModuleRouterrouter
 
const JSummaryRoutersummary
 
size_t numberOfPrefits
 number of prefits More...
 
double TMax_ns
 maximum time for local coincidences [ns]
More...
 
double TMin_ns
 minimum time for local coincidences [ns]
More...
 
double DMax_m
 maximal distance to optical module [m] More...
 
double Emin_GeV
 minimum energy to scan More...
 
double Emax_GeV
 maximum energy to scan More...
 
int En
 number of points to scan in energy range More...
 
double R_Hz
 default rate [Hz] More...
 
double TTS_ns
 transition-time spread [ns] More...
 
double VMax_npe
 maximum number of of photo-electrons More...
 
int NMax
 maximum number of iterations More...
 

Private Types

typedef JRegressor< JPoint4E, JGandalfJRegressor_t
 

Private Attributes

std::vector< double > Ev
 

Detailed Description

class to handle the second position fit of the shower reconstruction, mainly dedicated for ORCA

Definition at line 73 of file JShowerPositionFit.hh.

Member Typedef Documentation

◆ JRegressor_t

Definition at line 80 of file JShowerPositionFit.hh.

Constructor & Destructor Documentation

◆ JShowerPositionFit()

JRECONSTRUCTION::JShowerPositionFit::JShowerPositionFit ( const JShowerPositionFitParameters_t parameters,
const JModuleRouter router,
const JSummaryRouter summary,
const std::string  pdfFile,
const int  debug = 0 
)
inline

Parameterized constructor.

Parameters
parametersstruct that holds default-optimized parameters for the reconstruction
routermodule router, this is built via detector file.
summarysummary router
pdfFilefile name with PDF
debugdebug

Definition at line 94 of file JShowerPositionFit.hh.

98  :
100  JRegressor_t(pdfFile, parameters.TTS_ns),
101  router(router),
103  {
104  using namespace JPP;
105 
107  JRegressor_t::T_ns.setRange(parameters.TMin_ns, parameters.TMax_ns);
108  JRegressor_t::Vmax_npe = VMax_npe;
109  JRegressor_t::MAXIMUM_ITERATIONS = NMax;
110  JRegressor_t::EPSILON = 1e-3;
111 
112  if (Emin_GeV > Emax_GeV || En <= 1) {
113  THROW(JException, "Invalid energy input " << Emin_GeV << ' ' << Emax_GeV << ' ' << En);
114  }
115 
116  const double base = std::pow((Emax_GeV / Emin_GeV), 1.0 / (En - 1));
117 
118  for (int i = 0; i != En; ++i) {
119  Ev.push_back(Emin_GeV * std::pow(base, i));
120  }
121 
122  this->parameters.resize(5);
123 
124  this->parameters[0] = JPoint4E::pX();
125  this->parameters[1] = JPoint4E::pY();
126  this->parameters[2] = JPoint4E::pZ();
127  this->parameters[3] = JPoint4E::pT();
128  this->parameters[4] = JPoint4E::pE();
129  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
int debug
debug level
Definition: JSirene.cc:69
static parameter_type pZ()
Definition: JPoint4E.hh:71
static parameter_type pX()
Definition: JPoint4E.hh:69
static parameter_type pY()
Definition: JPoint4E.hh:70
static parameter_type pE()
Definition: JPoint4E.hh:73
static parameter_type pT()
Definition: JPoint4E.hh:72
General exception.
Definition: JException.hh:24
JRegressor< JPoint4E, JGandalf > JRegressor_t
T pow(const T &x, const double y)
Power .
Definition: JMath.hh:97
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
double VMax_npe
maximum number of of photo-electrons
double TMin_ns
minimum time for local coincidences [ns]
double TMax_ns
maximum time for local coincidences [ns]
int En
number of points to scan in energy range

Member Function Documentation

◆ operator()()

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

Declaration of the member function that actually performs the reconstruction.

Parameters
eventwhich is a JDAQEvent
ininput fits

Definition at line 137 of file JShowerPositionFit.hh.

138  {
139  using namespace std;
140  using namespace JPP;
141 
142  typedef vector<JHitL0> JDataL0_t;
143  const JBuildL0<JHitL0> buildL0;
144 
145  JEvt out;
146 
147  JDataL0_t dataL0;
148  buildL0(JDAQTimeslice(event, true), router, back_inserter(dataL0));
149 
150  for (JEvt::const_iterator shower = in.begin(); shower != in.end(); ++shower) {
151 
152  JPoint4D vx(getPosition(*shower), shower->getT());
153 
155 
156  const JFIT::JModel<JPoint4D> match(vx, DMax_m, JRegressor_t::T_ns);
157 
158  for (JDataL0_t::const_iterator i = dataL0.begin(); i != dataL0.end(); ++i) {
159 
160  const double rate_Hz = summary.getRate(*i);
161 
162  if (match(*i)) {
163  data.push_back(JHitW0(*i, rate_Hz));
164  }
165  }
166 
167  // select first hit
168 
169  sort(data.begin(), data.end(), JHitL0::compare);
170 
171  vector<JHitW0>::iterator __end = unique(data.begin(), data.end(), equal_to<JDAQPMTIdentifier>());
172 
173  const int NDF = distance(data.begin(), __end) - this->parameters.size();
174 
175  if (NDF > 0) {
176 
177  // set fit parameters
178  for (vector<double>::iterator e = Ev.begin(); e != Ev.end(); ++e) {
179  JPoint4E sh(vx, *e);
180  double chi2 = (*this)(sh, data.begin(), __end);
181 
182  JShower3E sh_fit(this->value.getPosition(), JDirection3D(),
183  this->value.getT(), this->value.getE());
184 
185  out.push_back(getFit(JHistory(shower->getHistory()).add(JSHOWERPOSITIONFIT), sh_fit,
186  getQuality(chi2), NDF, sh_fit.getE()));
187 
188  }
189  }
190  }
191 
192  return out;
193  }
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Data structure for vertex fit.
Definition: JPoint4D.hh:24
Data structure for vertex fit.
Definition: JPoint4E.hh:24
Data structure for direction in three dimensions.
Definition: JDirection3D.hh:35
3D track with energy.
Definition: JTrack3E.hh:32
Auxiliary class for a hit with background rate value.
Definition: JHitW0.hh:23
double getRate() const
Get default rate.
Template specialisation of L0 builder for JHitL0 data type.
Definition: JBuildL0.hh:105
static const int JSHOWERPOSITIONFIT
double getQuality(const double chi2, const int N, const int NDF)
Get quality of fit.
JPosition3D getPosition(const JFit &fit)
Get position.
JFIT::JHistory JHistory
Definition: JHistory.hh:354
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.
Definition: JSTDTypes.hh:14
Acoustic event fit.
JHistory & add(const int type)
Add event to history.
Definition: JHistory.hh:295
Template specialisation of class JModel to match hit with bright point.
Definition: JFit/JModel.hh:123
double DMax_m
maximal distance to optical module [m]
Auxiliary data structure for sorting of hits.
Definition: JHitL0.hh:85

◆ reset()

void JRECONSTRUCTION::JShowerPositionFitParameters_t::reset ( )
inlineinherited

Reset fit parameters.

Definition at line 32 of file JShowerPositionFitParameters_t.hh.

33  {
34  numberOfPrefits = 0; // process all inputs from PointSimplex, which should give a max of 100
35  TMax_ns = 100.0;
36  TMin_ns = -100.0;
37  DMax_m = 80.0;
38  R_Hz = 10000;
39  Emin_GeV = 1;
40  Emax_GeV = 200;
41  En = 10;
42  TTS_ns = 2;
43  VMax_npe = 20.0;
44  NMax = 1000;
45  }

◆ equals()

bool JRECONSTRUCTION::JShowerPositionFitParameters_t::equals ( const JShowerPositionFitParameters_t parameters) const
inlineinherited

Equality.

Parameters
parametersfit parameters
Returns
true if equals; else false

Definition at line 53 of file JShowerPositionFitParameters_t.hh.

54  {
55  return (this->numberOfPrefits == parameters.numberOfPrefits &&
56  this->TMax_ns == parameters.TMax_ns &&
57  this->TMin_ns == parameters.TMin_ns &&
58  this->DMax_m == parameters.DMax_m &&
59  this->R_Hz == parameters.R_Hz &&
60  this->TTS_ns == parameters.TTS_ns &&
61  this->Emin_GeV == parameters.Emin_GeV &&
62  this->Emax_GeV == parameters.Emax_GeV &&
63  this->En == parameters.En &&
64  this->VMax_npe == parameters.VMax_npe &&
65  this->NMax == parameters.NMax);
66  }

◆ ClassDef()

JRECONSTRUCTION::JShowerPositionFitParameters_t::ClassDef ( JShowerPositionFitParameters_t  ,
 
)
inherited

Member Data Documentation

◆ Ev

std::vector<double> JRECONSTRUCTION::JShowerPositionFit::Ev
private

Definition at line 82 of file JShowerPositionFit.hh.

◆ router

const JModuleRouter& JRECONSTRUCTION::JShowerPositionFit::router

Definition at line 196 of file JShowerPositionFit.hh.

◆ summary

const JSummaryRouter& JRECONSTRUCTION::JShowerPositionFit::summary

Definition at line 197 of file JShowerPositionFit.hh.

◆ numberOfPrefits

size_t JRECONSTRUCTION::JShowerPositionFitParameters_t::numberOfPrefits
inherited

number of prefits

Definition at line 70 of file JShowerPositionFitParameters_t.hh.

◆ TMax_ns

double JRECONSTRUCTION::JShowerPositionFitParameters_t::TMax_ns
inherited

maximum time for local coincidences [ns]

Definition at line 71 of file JShowerPositionFitParameters_t.hh.

◆ TMin_ns

double JRECONSTRUCTION::JShowerPositionFitParameters_t::TMin_ns
inherited

minimum time for local coincidences [ns]

Definition at line 72 of file JShowerPositionFitParameters_t.hh.

◆ DMax_m

double JRECONSTRUCTION::JShowerPositionFitParameters_t::DMax_m
inherited

maximal distance to optical module [m]

Definition at line 73 of file JShowerPositionFitParameters_t.hh.

◆ Emin_GeV

double JRECONSTRUCTION::JShowerPositionFitParameters_t::Emin_GeV
inherited

minimum energy to scan

Definition at line 74 of file JShowerPositionFitParameters_t.hh.

◆ Emax_GeV

double JRECONSTRUCTION::JShowerPositionFitParameters_t::Emax_GeV
inherited

maximum energy to scan

Definition at line 75 of file JShowerPositionFitParameters_t.hh.

◆ En

int JRECONSTRUCTION::JShowerPositionFitParameters_t::En
inherited

number of points to scan in energy range

Definition at line 76 of file JShowerPositionFitParameters_t.hh.

◆ R_Hz

double JRECONSTRUCTION::JShowerPositionFitParameters_t::R_Hz
inherited

default rate [Hz]

Definition at line 77 of file JShowerPositionFitParameters_t.hh.

◆ TTS_ns

double JRECONSTRUCTION::JShowerPositionFitParameters_t::TTS_ns
inherited

transition-time spread [ns]

Definition at line 78 of file JShowerPositionFitParameters_t.hh.

◆ VMax_npe

double JRECONSTRUCTION::JShowerPositionFitParameters_t::VMax_npe
inherited

maximum number of of photo-electrons

Definition at line 79 of file JShowerPositionFitParameters_t.hh.

◆ NMax

int JRECONSTRUCTION::JShowerPositionFitParameters_t::NMax
inherited

maximum number of iterations

Definition at line 80 of file JShowerPositionFitParameters_t.hh.


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