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

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

#include <JShowerDirectionPrefit.hh>

Inheritance diagram for JRECONSTRUCTION::JShowerDirectionPrefit:
JRECONSTRUCTION::JShowerDirectionPrefitParameters_t JFIT::JRegressor< JModel_t, JMinimiser_t > TObject

Public Member Functions

 JShowerDirectionPrefit (const JShowerDirectionPrefitParameters_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 JShowerDirectionPrefitParameters_t &parameters) const
 Equality. More...
 
 ClassDef (JShowerDirectionPrefitParameters_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 R_Hz
 default rate [Hz] More...
 
double VMax_npe
 maximum number of of photo-electrons More...
 
double scanAngle_deg
 scanning angle step in [deg] 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...
 

Private Types

typedef JRegressor< JShower3EZ,
JAbstractMinimiser
JRegressor_t
 

Private Attributes

vector< double > Ev
 
JPP::JOmega3D omega
 

Detailed Description

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

Definition at line 70 of file JShowerDirectionPrefit.hh.

Member Typedef Documentation

Definition at line 75 of file JShowerDirectionPrefit.hh.

Constructor & Destructor Documentation

JRECONSTRUCTION::JShowerDirectionPrefit::JShowerDirectionPrefit ( const JShowerDirectionPrefitParameters_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, available in $JPP_DATA.
routermodule router, this is built via detector file.
summarysummary router
pdfFilePDF file
debugdebug

Definition at line 91 of file JShowerDirectionPrefit.hh.

95  :
97  JRegressor_t(pdfFile),
98  omega(parameters.scanAngle_deg * JMATH::PI / 180.0),
99  router(router),
100  summary(summary)
101  {
102  using namespace JPP;
103 
105  JRegressor_t::T_ns.setRange(parameters.TMin_ns, parameters.TMax_ns);
107 
108  if (Emin_GeV > Emax_GeV || En <= 1) {
109  THROW(JException, "Invalid energy input " << Emin_GeV << ' ' << Emax_GeV << ' ' << En);
110  }
111 
112  const double base = std::pow((Emax_GeV / Emin_GeV), 1.0 / (En - 1));
113 
114  for (int i = 0; i != En; ++i) {
115  Ev.push_back(Emin_GeV * std::pow(base, i));
116  }
117  }
static int debug
debug level (default is off).
Definition: JMessage.hh:45
double TMax_ns
maximum time for local coincidences [ns]
General exception.
Definition: JException.hh:24
JRegressor< JShower3EZ, JAbstractMinimiser > JRegressor_t
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
static JTimeRange T_ns
Time window with respect to Cherenkov hypothesis [ns].
T pow(const T &x, const double y)
Power .
Definition: JMath.hh:97
static const double PI
Mathematical constants.
static double Vmax_npe
Maximal integral of PDF [npe].
double TMin_ns
minimum time for local coincidences [ns]
int debug
debug level

Member Function Documentation

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

Declaration of the member function that actually performs the reconstruction.

Parameters
eventDAQ event
ininput fits
Returns
result fits

Definition at line 126 of file JShowerDirectionPrefit.hh.

127  {
128  using namespace std;
129  using namespace JPP;
130 
131  typedef vector<JHitL0> JDataL0_t;
132  JBuildL0<JHitL0> buildL0;
133 
134  JEvt out;
135 
137 
138  JDataL0_t dataL0;
139 
140  buildL0(JDAQTimeslice(event, true), router, back_inserter(dataL0));
141 
142  for (JEvt::const_iterator shower = in.begin(); shower != in.end(); ++shower) {
143 
144  const JVertex3D Vertex(getPosition(*shower),shower->getT());
146 
147  const JFIT::JModel<JPoint4D> match(Vertex, DMax_m, JRegressor_t::T_ns);
148 
149  for (JDataL0_t::const_iterator i = dataL0.begin(); i != dataL0.end(); ++i) {
150  if (match(*i)) {
151  top.insert(i->getPMTIdentifier());
152  }
153  }
154 
155  const JDetectorSubset_t subdetector(detector, Vertex.getPosition(), DMax_m);
156 
158  for (JDetectorSubset_t::const_iterator module = subdetector.begin(); module != subdetector.end(); ++module) {
159  const JDAQSummaryFrame& frame = summary.getSummaryFrame(module->getID());
160 
161  JModule dom(*module);
162 
163  for (size_t i = 0; i != dom.size(); ++i) {
164 
165  if (getDAQStatus(frame, *module, i) &&
166  getPMTStatus(frame, *module, i) &&
167  frame[i].is_valid() &&
168  !module->getPMT(i).has(PMT_DISABLE)) {
169 
170  const JDAQPMTIdentifier id(module->getID(), i);
171 
172  const double rate_Hz = summary.getRate(id);
173  const size_t count = top.count(id);
174 
175  data.push_back(JPMTW0(dom.getPMT(i), rate_Hz, count));
176  }
177  }
178  }
179 
180  const JShower3EZ sh(JVertex3D(JVector3D(0,0,0), sh.getT()), JVersor3Z(), 1);
181 
182  for (JOmega3D_t::const_iterator dir = omega.begin(); dir != omega.end(); ++dir) {
183  const JRotation3D R(*dir);
184  vector<double> chi2v(En, 0.0);
185  for (vector<JPMTW0>::const_iterator i = data.begin(); i != data.end(); ++i) {
186  JPMTW0 pmt = *i;
187  pmt.rotate(R);
188  JNPE_t::result_type H1 = (*this).getH1(sh, pmt);
189  JNPE_t::result_type H0 = (*this).getH0(pmt.getR()); // getH0 = Get background hypothesis value for time integrated PDF.
190  const bool hit = pmt.getN() != 0;
191  for(size_t j=0;j!=chi2v.size();++j){
192  chi2v[j]+= getChi2(get_value(H0+Ev[j]*H1), hit); // H1 is linear with E
193  }
194  }
195  //Store only the lowest chi2 for a given direction
196  auto minChi2 = std::min_element(chi2v.begin(), chi2v.end());
197  JShower3E sh_fit(Vertex, JDirection3D(*dir), Ev[minChi2-chi2v.begin()]);
198  out.push_back(getFit(JHistory(shower->getHistory()).add(JSHOWERDIRECTIONPREFIT), sh_fit, getQuality(*minChi2), data.size(), sh_fit.getE()));
199  }
200  }
201 
202  return out;
203 
204  }
double getR() const
Get rate.
Definition: JPMTW0.hh:56
Data structure for direction in three dimensions.
Definition: JDirection3D.hh:33
Data structure for a composite optical module.
Definition: JModule.hh:67
Template specialisation of L0 builder for JHitL0 data type.
Definition: JBuildL0.hh:102
Auxiliary class for handling PMT geometry, rate and response.
Definition: JPMTW0.hh:22
Detector data structure.
Definition: JDetector.hh:89
Rotation matrix.
Definition: JRotation3D.hh:111
double getRate() const
Get default rate.
then usage $script< input file >[option] nPossible options count
Definition: JVolume1D.sh:31
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.
const JDAQSummaryFrame & getSummaryFrame() const
Get default summary frame.
3D track with energy.
Definition: JTrack3E.hh:30
double getQuality(const double chi2, const int N, const int NDF)
Get quality of fit.
static JTimeRange T_ns
Time window with respect to Cherenkov hypothesis [ns].
Data structure for fit of straight line in positive z-direction with energy.
Definition: JShower3EZ.hh:27
JAxis3D & rotate(const JRotation3D &R)
Rotate axis.
Definition: JAxis3D.hh:225
Detector file.
Definition: JHead.hh:226
Data structure for vector in three dimensions.
Definition: JVector3D.hh:34
Acoustic event fit.
Data storage class for rate measurements of all PMTs in one module.
static const int JSHOWERDIRECTIONPREFIT
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
Data time slice.
Detector subset without binary search functionality.
then JCookie sh JDataQuality D $DETECTOR_ID R
Definition: JDataQuality.sh:41
bool getPMTStatus(const JStatus &status)
Test status of PMT.
JFIT::JHistory JHistory
Definition: JHistory.hh:354
const JClass_t & getReference() const
Get reference to object.
Definition: JReference.hh:38
int getN() const
Get number of hits.
Definition: JPMTW0.hh:67
JPosition3D getPosition(const JFit &fit)
Get position.
int j
Definition: JPolint.hh:792
bool getDAQStatus(const JDAQFrameStatus &frame, const JStatus &status)
Test status of DAQ.
Template specialisation of class JModel to match hit with bright point.
Definition: JFit/JModel.hh:121
double getChi2(const double P)
Get chi2 corresponding to given probability.
Definition: JFitToolkit.hh:56
Data structure for normalised vector in positive z-direction.
Definition: JVersor3Z.hh:39
JResultEvaluator< JResult_t >::result_type get_value(const JResult_t &value)
Helper method to recursively evaluate a to function value.
Definition: JResult.hh:998
void JRECONSTRUCTION::JShowerDirectionPrefitParameters_t::reset ( )
inlineinherited

Reset fit parameters.

Definition at line 35 of file JShowerDirectionPrefitParameters_t.hh.

36  {
37  numberOfPrefits = 1;
38  TMax_ns = 30;
39  TMin_ns = -30;
40  DMax_m = 80;
41  scanAngle_deg = 10;
42  R_Hz = 10.0e3;
43  VMax_npe = 20.0;
44  Emin_GeV = 1;
45  Emax_GeV = 1000;
46  En = 50;
47  }
double TMax_ns
maximum time for local coincidences [ns]
double TMin_ns
minimum time for local coincidences [ns]
bool JRECONSTRUCTION::JShowerDirectionPrefitParameters_t::equals ( const JShowerDirectionPrefitParameters_t parameters) const
inlineinherited

Equality.

Parameters
parametersfit parameters
Returns
true if equals; else false

Definition at line 55 of file JShowerDirectionPrefitParameters_t.hh.

56  {
57  return (this->TMax_ns == parameters.TMax_ns &&
58  this->TMin_ns == parameters.TMin_ns &&
59  this->numberOfPrefits == parameters.numberOfPrefits &&
60  this->DMax_m == parameters.DMax_m &&
61  this->R_Hz == parameters.R_Hz &&
62  this->scanAngle_deg == parameters.scanAngle_deg &&
63  this->VMax_npe == parameters.VMax_npe &&
64  this->Emin_GeV == parameters.Emin_GeV &&
65  this->Emax_GeV == parameters.Emax_GeV &&
66  this->En == parameters.En );
67  }
double TMax_ns
maximum time for local coincidences [ns]
*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
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
JRECONSTRUCTION::JShowerDirectionPrefitParameters_t::ClassDef ( JShowerDirectionPrefitParameters_t  ,
 
)
inherited

Member Data Documentation

vector<double> JRECONSTRUCTION::JShowerDirectionPrefit::Ev
private

Definition at line 77 of file JShowerDirectionPrefit.hh.

JPP::JOmega3D JRECONSTRUCTION::JShowerDirectionPrefit::omega
private

Definition at line 78 of file JShowerDirectionPrefit.hh.

const JModuleRouter& JRECONSTRUCTION::JShowerDirectionPrefit::router

Definition at line 205 of file JShowerDirectionPrefit.hh.

const JSummaryRouter& JRECONSTRUCTION::JShowerDirectionPrefit::summary

Definition at line 206 of file JShowerDirectionPrefit.hh.

size_t JRECONSTRUCTION::JShowerDirectionPrefitParameters_t::numberOfPrefits
inherited

number of prefits

Definition at line 71 of file JShowerDirectionPrefitParameters_t.hh.

double JRECONSTRUCTION::JShowerDirectionPrefitParameters_t::TMax_ns
inherited

maximum time for local coincidences [ns]

Definition at line 72 of file JShowerDirectionPrefitParameters_t.hh.

double JRECONSTRUCTION::JShowerDirectionPrefitParameters_t::TMin_ns
inherited

minimum time for local coincidences [ns]

Definition at line 73 of file JShowerDirectionPrefitParameters_t.hh.

double JRECONSTRUCTION::JShowerDirectionPrefitParameters_t::DMax_m
inherited

maximal distance to optical module [m]

Definition at line 74 of file JShowerDirectionPrefitParameters_t.hh.

double JRECONSTRUCTION::JShowerDirectionPrefitParameters_t::R_Hz
inherited

default rate [Hz]

Definition at line 75 of file JShowerDirectionPrefitParameters_t.hh.

double JRECONSTRUCTION::JShowerDirectionPrefitParameters_t::VMax_npe
inherited

maximum number of of photo-electrons

Definition at line 76 of file JShowerDirectionPrefitParameters_t.hh.

double JRECONSTRUCTION::JShowerDirectionPrefitParameters_t::scanAngle_deg
inherited

scanning angle step in [deg]

Definition at line 77 of file JShowerDirectionPrefitParameters_t.hh.

double JRECONSTRUCTION::JShowerDirectionPrefitParameters_t::Emin_GeV
inherited

minimum energy to scan

Definition at line 78 of file JShowerDirectionPrefitParameters_t.hh.

double JRECONSTRUCTION::JShowerDirectionPrefitParameters_t::Emax_GeV
inherited

maximum energy to scan

Definition at line 79 of file JShowerDirectionPrefitParameters_t.hh.

int JRECONSTRUCTION::JShowerDirectionPrefitParameters_t::En
inherited

number of points to scan in energy range

Definition at line 80 of file JShowerDirectionPrefitParameters_t.hh.


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