Jpp 20.0.0-195-g190c9e876
the software that should make you happy
Loading...
Searching...
No Matches
JRECONSTRUCTION::JShowerFit Class Reference

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

#include <JShowerFit.hh>

Inheritance diagram for JRECONSTRUCTION::JShowerFit:
JRECONSTRUCTION::JShowerFitParameters_t JFIT::JRegressor< JModel_t, JMinimiser_t > TObject

Classes

struct  input_type
 Input data type. More...
 

Public Member Functions

 JShowerFit (const JShowerFitParameters_t &parameters, const storage_type &storage, const JPMTParametersMap &pmtParameters, const JEnergyCorrection &correct, const int debug=0)
 Parameterized constructor.
 
input_type getInput (const JModuleRouter &router, const JSummaryRouter &summary, const JDAQEvent &event, const JEvt &in, const coverage_type &coverage) const
 Get input data.
 
JEvt operator() (const input_type &input)
 Fit function.
 
void reset ()
 Reset fit parameters.
 
bool equals (const JShowerFitParameters_t &parameters) const
 Equality.
 
 ClassDef (JShowerFitParameters_t, 2)
 

Public Attributes

const JPMTParametersMappmtParameters
 
const JEnergyCorrectioncorrect
 
size_t numberOfPrefits
 number of prefits

 
double TMax_ns
 maximum time for local coincidences [ns]

 
double TMin_ns
 minimum time for local coincidences [ns]

 
double DStep_m
 step increase for the distance to optical module [m]

 
double R_Hz
 default rate [Hz]

 
int mestimator
 M-estimator (see JFIT::JMEstimator_t)
 
double Vmax_npe
 maximum number of of photo-electrons
 
double DMax_m
 maximal distance to optical module [m]
 

Private Types

typedef JRegressor< JShower3EZ, JGandalfJRegressor_t
 
typedef JModuleL0 module_type
 
typedef std::vector< module_typedetector_type
 

Detailed Description

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

Definition at line 62 of file JShowerFit.hh.

Member Typedef Documentation

◆ JRegressor_t

◆ module_type

◆ detector_type

Constructor & Destructor Documentation

◆ JShowerFit()

JRECONSTRUCTION::JShowerFit::JShowerFit ( const JShowerFitParameters_t & parameters,
const storage_type & storage,
const JPMTParametersMap & pmtParameters,
const JEnergyCorrection & correct,
const int debug = 0 )
inline

Parameterized constructor.

Parameters
parametersparameters
storagestorage
pmtParametersPMT parameters
correctenergy correction
debugdebug

Definition at line 117 of file JShowerFit.hh.

121 :
122 JShowerFitParameters_t(parameters),
123 JRegressor_t (storage),
126 {
127 using namespace JPP;
128
129 JRegressor_t::debug = debug;
130 JRegressor_t::T_ns.setRange(parameters.TMin_ns, parameters.TMax_ns);
131 JRegressor_t::Vmax_npe = parameters.Vmax_npe;
132 JRegressor_t::MAXIMUM_ITERATIONS = 1000;
133 JRegressor_t::EPSILON = 1e-3;
134 JRegressor_t::EPSILON_ABSOLUTE = true;
135
136 this->parameters.resize(3);
137
138 this->parameters[0] = JShower3EZ::pDX();
139 this->parameters[1] = JShower3EZ::pDY();
140 this->parameters[2] = JShower3EZ::pE();
141
142 this->estimator.reset(getMEstimator(parameters.mestimator));
143 }
int debug
debug level
Definition JSirene.cc:74
static parameter_type pE()
static parameter_type pDY()
Definition JShower3Z.hh:172
static parameter_type pDX()
Definition JShower3Z.hh:171
JRegressor< JShower3EZ, JGandalf > JRegressor_t
Definition JShowerFit.hh:67
const JEnergyCorrection & correct
const JPMTParametersMap & pmtParameters
JMEstimator * getMEstimator(const int type)
Get M-Estimator.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
double Vmax_npe
maximum number of of photo-electrons
int mestimator
M-estimator (see JFIT::JMEstimator_t)
double TMax_ns
maximum time for local coincidences [ns]
double TMin_ns
minimum time for local coincidences [ns]

Member Function Documentation

◆ getInput()

input_type JRECONSTRUCTION::JShowerFit::getInput ( const JModuleRouter & router,
const JSummaryRouter & summary,
const JDAQEvent & event,
const JEvt & in,
const coverage_type & coverage ) const
inline

Get input data.

Parameters
routermodule router
summarysummary data
eventevent
instart values
coveragecoverage
Returns
input data

Definition at line 155 of file JShowerFit.hh.

160 {
161 using namespace std;
162 using namespace JTRIGGER;
163
164 input_type input(event.getDAQEventHeader(), in, coverage);
165
166 const JBuildL0 <JHitR0> buildL0;
168
169 const JDAQTimeslice timeslice(event, true);
170
171 JSuperFrame2D<JHit> buffer;
172
173 for (JDAQTimeslice::const_iterator i = timeslice.begin(); i != timeslice.end(); ++i) {
174
175 if (router.hasModule(i->getModuleID())) {
176
177 buffer(*i, router.getModule(i->getModuleID()));
178
179 buildL0(buffer, back_inserter(data[i->getModuleID()]));
180 }
181 }
182
183 for (const auto& module : router.getReference()) {
184 if (!module.empty()) {
185 input.data.push_back(module_type(module, summary.getSummaryFrame(module.getID(), R_Hz), data[module.getID()]));
186 }
187 }
188
189 return input;
190 }
bool hasModule(const JObjectID &id) const
Has module.
const JModule & getModule(const JObjectID &id) const
Get module parameters.
const JClass_t & getReference() const
Get reference to object.
Definition JReference.hh:38
const JDAQSummaryFrame & getSummaryFrame(const JDAQModuleIdentifier &module) const
Get summary frame.
2-dimensional frame with time calibrated data from one optical module.
const JDAQEventHeader & getDAQEventHeader() const
Get DAQ event header.
Auxiliary classes and methods for triggering.

◆ operator()()

JEvt JRECONSTRUCTION::JShowerFit::operator() ( const input_type & input)
inline

Fit function.

Parameters
inputinput data
Returns
fit results

Definition at line 198 of file JShowerFit.hh.

199 {
200 using namespace std;
201 using namespace JPP;
202
204
205 JEvt out;
206
207 JEvt in = input.in;
208
209 in.select(numberOfPrefits, qualitySorter);
210
211 if (!in.empty()) {
212 in.select(JHistory::is_event(in.begin()->getHistory()));
213 }
214
215 for (JEvt::const_iterator shower = in.begin(); shower != in.end(); ++shower) {
216
218
219 const JPosition3D vertex(getPosition(*shower));
220 const double time = shower->getT();
221 const double distance = DMax_m + DStep_m * log10(shower->getE());
222 const JRotation3D R(getDirection(*shower));
223
224 for (const auto& module : input.data) {
225
226 JPosition3D pos(module->getPosition());
227
228 pos.sub(vertex);
229
230 if (pos.getLength() < distance) {
231
232 for (size_t i = 0; i != module->size(); ++i) {
233
234 if (module.getStatus(i)) {
235
236 const double t1 = time + pos.getLength() * getInverseSpeedOfLight() * getIndexOfRefraction();
237
238 struct {
239
240 bool operator()(const JHitR0& hit) const
241 {
242 return (hit.getPMT() == pmt && T_ns(hit.getT()));
243 }
244
245 const JTimeRange T_ns;
246 const size_t pmt;
247
248 } match = { JRegressor_t::T_ns + t1, i };
249
250 const JPMTIdentifier id(module->getID(), i);
251
253
254 const size_t ns = count_if(module.begin(), module.end(), match);
255 const double QE = wip.QE;
256
257 JPMT pmt = module->getPMT(i);
258
259 pmt.sub(vertex);
260 pmt.rotate(R);
261
262 data.push_back(JPMTW0(pmt, QE, module.frame.getRate(i), ns));
263 }
264 }
265 }
266 }
267
268
269 double chi2 = (*this)(JShower3EZ(JVertex3D(JVector3D(0,0,0), shower->getT()), JVersor3Z(),
270 shower->getE()), data.begin(), data.end());
271
272 double NDF = getCount(data.begin(), data.end()) - this->parameters.size();
273
274 JShower3E result(JShower3D(this->value.getVertex(), this->value.getDirection()), correct(this->value.getE()));
275
276 // check error matrix
277 bool status = true;
278
279 for (size_t i = 0; i != this->V.size(); ++i) {
280 if (std::isnan(this->V(i,i)) || this->V(i,i) < 0.0) {
281 status = false;
282 }
283 }
284
285 if (status) {
286
287 result.rotate_back(R);
288
289 result.add(vertex.getPosition());
290
291 out.push_back(getFit(JHistory(shower->getHistory(), event()), result, getQuality(chi2), NDF, result.getE()));
292
293 out.rbegin()->setV(this->V.size(), this->V);
294 out.rbegin()->setW(JSHOWERFIT_ENERGY, this->value.getE()); // Uncorrected Energy
295 out.rbegin()->setW(JPP_COVERAGE_ORIENTATION, input.coverage.orientation);
296 out.rbegin()->setW(JPP_COVERAGE_POSITION, input.coverage.position);
297 }
298 }
299
300 // apply default sorter
301
302 sort(out.begin(), out.end(), qualitySorter);
303
304 copy(input.in.begin(), input.in.end(), back_inserter(out));
305
306 return out;
307 }
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
const JPMTParameters & getPMTParameters(const JPMTIdentifier &id) const
Get PMT parameters.
Data structure for PMT parameters.
double QE
relative quantum efficiency
Data structure for PMT geometry, calibration and status.
Definition JPMT.hh:49
Data structure for fit of straight line in positive z-direction with energy.
Definition JShower3EZ.hh:30
JAxis3D & rotate(const JRotation3D &R)
Rotate axis.
Definition JAxis3D.hh:225
Data structure for position in three dimensions.
3D shower with energy.
Definition JShower3E.hh:31
Data structure for vector in three dimensions.
Definition JVector3D.hh:36
JVector3D & sub(const JVector3D &vector)
Subtract vector.
Definition JVector3D.hh:158
Data structure for normalised vector in positive z-direction.
Definition JVersor3Z.hh:41
JEvt operator()(const input_type &input)
Fit function.
Reduced data structure for L0 hit.
Definition JHitR0.hh:27
JPMT_t getPMT() const
Get PMT.
Definition JHitR0.hh:60
double getT() const
Get calibrated time of hit.
static const int JPP_COVERAGE_POSITION
coverage of dynamic position calibration of this event
static const int JSHOWERFIT_ENERGY
uncorrected energy [GeV] see JRECONSTRUCTION::JShowerFit
static const int JPP_COVERAGE_ORIENTATION
coverage of dynamic orientation calibration of this event
size_t getCount(const array_type< T > &buffer, const JCompare_t &compare)
Count number of unique values.
double getIndexOfRefraction()
Get average index of refraction of water corresponding to group velocity.
const double getInverseSpeedOfLight()
Get inverse speed of light.
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:455
void copy(const JFIT::JEvt::const_iterator __begin, const JFIT::JEvt::const_iterator __end, Evt &out)
Copy tracks.
bool qualitySorter(const JFit &first, const JFit &second)
Comparison of fit results.
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.
JDirection3D getDirection(const JFit &fit)
Get direction.
return result
Definition JPolint.hh:862
Acoustic event fit.
Auxiliary class to test history.
Definition JHistory.hh:157
Auxiliary class for handling PMT geometry, rate and response.
Definition JPMTW0.hh:24
double DMax_m
maximal distance to optical module [m]
double DStep_m
step increase for the distance to optical module [m]

◆ reset()

void JRECONSTRUCTION::JShowerFitParameters_t::reset ( )
inlineinherited

Reset fit parameters.

Definition at line 35 of file JShowerFitParameters_t.hh.

36 {
38 TMax_ns = 30;
39 TMin_ns = -30;
40 DStep_m = 0;
41 DMax_m = 60;
42 R_Hz = 10.0e3;
44 Vmax_npe = 20;
45 }

◆ equals()

bool JRECONSTRUCTION::JShowerFitParameters_t::equals ( const JShowerFitParameters_t & parameters) const
inlineinherited

Equality.

Parameters
parametersfit parameters
Returns
true if equals; else false

Definition at line 53 of file JShowerFitParameters_t.hh.

54 {
55 return (this->TMax_ns == parameters.TMax_ns &&
56 this->TMin_ns == parameters.TMin_ns &&
57 this->numberOfPrefits == parameters.numberOfPrefits &&
58 this->DStep_m == parameters.DStep_m &&
59 this->DMax_m == parameters.DMax_m &&
60 this->R_Hz == parameters.R_Hz &&
61 this->mestimator == parameters.mestimator &&
62 this->Vmax_npe == parameters.Vmax_npe
63 );
64 }

◆ ClassDef()

JRECONSTRUCTION::JShowerFitParameters_t::ClassDef ( JShowerFitParameters_t ,
2  )
inherited

Member Data Documentation

◆ pmtParameters

const JPMTParametersMap& JRECONSTRUCTION::JShowerFit::pmtParameters

Definition at line 310 of file JShowerFit.hh.

◆ correct

const JEnergyCorrection& JRECONSTRUCTION::JShowerFit::correct

Definition at line 311 of file JShowerFit.hh.

◆ numberOfPrefits

size_t JRECONSTRUCTION::JShowerFitParameters_t::numberOfPrefits
inherited

number of prefits

Definition at line 69 of file JShowerFitParameters_t.hh.

◆ TMax_ns

double JRECONSTRUCTION::JShowerFitParameters_t::TMax_ns
inherited

maximum time for local coincidences [ns]

Definition at line 70 of file JShowerFitParameters_t.hh.

◆ TMin_ns

double JRECONSTRUCTION::JShowerFitParameters_t::TMin_ns
inherited

minimum time for local coincidences [ns]

Definition at line 71 of file JShowerFitParameters_t.hh.

◆ DStep_m

double JRECONSTRUCTION::JShowerFitParameters_t::DStep_m
inherited

step increase for the distance to optical module [m]

Definition at line 72 of file JShowerFitParameters_t.hh.

◆ R_Hz

double JRECONSTRUCTION::JShowerFitParameters_t::R_Hz
inherited

default rate [Hz]

Definition at line 73 of file JShowerFitParameters_t.hh.

◆ mestimator

int JRECONSTRUCTION::JShowerFitParameters_t::mestimator
inherited

M-estimator (see JFIT::JMEstimator_t)

Definition at line 74 of file JShowerFitParameters_t.hh.

◆ Vmax_npe

double JRECONSTRUCTION::JShowerFitParameters_t::Vmax_npe
inherited

maximum number of of photo-electrons

Definition at line 75 of file JShowerFitParameters_t.hh.

◆ DMax_m

double JRECONSTRUCTION::JShowerFitParameters_t::DMax_m
inherited

maximal distance to optical module [m]

Definition at line 76 of file JShowerFitParameters_t.hh.


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