Jpp 19.3.0-rc.3
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 JShowerEnergyCorrection &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 JShowerEnergyCorrectioncorrect
 
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

 
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 78 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 JShowerEnergyCorrection & correct,
const int debug = 0 )
inline

Parameterized constructor.

Parameters
parametersstruct that holds default-optimized parameters for the reconstruction, available in $JPP_DATA.
storagestorage
correctenergy correction
debugdebug

Definition at line 132 of file JShowerFit.hh.

135 :
136 JShowerFitParameters_t(parameters),
137 JRegressor_t(storage),
139 {
140 using namespace JPP;
141
142 JRegressor_t::debug = debug;
143 JRegressor_t::T_ns.setRange(parameters.TMin_ns, parameters.TMax_ns);
144 JRegressor_t::Vmax_npe = parameters.Vmax_npe;
145 JRegressor_t::MAXIMUM_ITERATIONS = 1000;
146 JRegressor_t::EPSILON = 1e-3;
147 JRegressor_t::EPSILON_ABSOLUTE = true;
148
149 this->parameters.resize(3);
150
151 this->parameters[0] = JShower3EZ::pDX();
152 this->parameters[1] = JShower3EZ::pDY();
153 this->parameters[2] = JShower3EZ::pE();
154
155 this->estimator.reset(getMEstimator(parameters.mestimator));
156 }
int debug
debug level
Definition JSirene.cc:72
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:83
const JShowerEnergyCorrection & correct
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
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 168 of file JShowerFit.hh.

173 {
174 using namespace std;
175 using namespace JTRIGGER;
176
177 input_type input(event.getDAQEventHeader(), in, coverage);
178
179 const JBuildL0 <JHitR0> buildL0;
181
182 const JDAQTimeslice timeslice(event, true);
183
184 JSuperFrame2D<JHit> buffer;
185
186 for (JDAQTimeslice::const_iterator i = timeslice.begin(); i != timeslice.end(); ++i) {
187
188 if (router.hasModule(i->getModuleID())) {
189
190 buffer(*i, router.getModule(i->getModuleID()));
191
192 buildL0(buffer, back_inserter(data[i->getModuleID()]));
193 }
194 }
195
196 for (const auto& module : router.getReference()) {
197 if (!module.empty()) {
198 input.data.push_back(module_type(module, summary.getSummaryFrame(module.getID()), data[module.getID()]));
199 }
200 }
201
202 return input;
203 }
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 211 of file JShowerFit.hh.

212 {
213 using namespace std;
214 using namespace JPP;
215
217
218 JEvt out;
219
220 JEvt in = input.in;
221
222 in.select(numberOfPrefits, qualitySorter);
223
224 if (!in.empty()) {
225 in.select(JHistory::is_event(in.begin()->getHistory()));
226 }
227
228 for (JEvt::const_iterator shower = in.begin(); shower != in.end(); ++shower) {
229
231
232 const JPosition3D vertex(getPosition(*shower));
233 const double time = shower->getT();
234 const double distance = DMax_m + DStep_m * log10(shower->getE());
235 const JRotation3D R(getDirection(*shower));
236
237 for (const auto& module : input.data) {
238
239 JPosition3D pos(module->getPosition());
240 pos.sub(vertex);
241
242 if(pos.getLength() < distance){
243
244 for (size_t i = 0; i != module->size(); ++i) {
245 if (module.getStatus(i)) {
246
247 const double t1 = time + pos.getLength() * getInverseSpeedOfLight() * getIndexOfRefraction();
248
249 struct {
250
251 bool operator()(const JHitR0& hit) const
252 {
253 return (hit.getPMT() == pmt && T_ns(hit.getT()));
254 }
255
256 const JTimeRange T_ns;
257 const size_t pmt;
258
259 } match = { JRegressor_t::T_ns + t1, i };
260
261 JPMT pmt = module->getPMT(i);
262 pmt.sub(vertex);
263 pmt.rotate(R);
264
265 data.push_back(JPMTW0(pmt, module.frame.getRate(i), count_if(module.begin(), module.end(), match)));
266 }
267 }
268 }
269 }
270
271
272 double chi2 = (*this)(JShower3EZ(JVertex3D(JVector3D(0,0,0), shower->getT()), JVersor3Z(),
273 shower->getE()), data.begin(), data.end());
274
275 double NDF = getCount(data.begin(), data.end()) - this->parameters.size();
276
277 JShower3E sh_fit(this->value.getPosition(), this->value.getDirection(),
278 this->value.getT(), correct(this->value.getE()));
279
280 // check error matrix
281 bool status = true;
282
283 for (size_t i = 0; i != this->V.size(); ++i) {
284 if (std::isnan(this->V(i,i)) || this->V(i,i) < 0.0) {
285 status = false;
286 }
287 }
288
289 if (status) {
290 sh_fit.rotate_back(R);
291
292 sh_fit.add(vertex.getPosition());
293
294 out.push_back(getFit(JHistory(shower->getHistory(), event()), sh_fit, getQuality(chi2),
295 NDF, sh_fit.getE()));
296 out.rbegin()->setV(this->V.size(), this->V);
297 out.rbegin()->setW(JSHOWERFIT_ENERGY, this->value.getE()); // Uncorrected Energy
298 out.rbegin()->setW(JPP_COVERAGE_ORIENTATION, input.coverage.orientation);
299 out.rbegin()->setW(JPP_COVERAGE_POSITION, input.coverage.position);
300 }
301 }
302
303 // apply default sorter
304
305 sort(out.begin(), out.end(), qualitySorter);
306
307 copy(input.in.begin(), input.in.end(), back_inserter(out));
308
309 return out;
310 }
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 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 track with energy.
Definition JTrack3E.hh:32
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 JSHOWERCOMPLETEFIT
static const int JPP_COVERAGE_POSITION
coverage of dynamic position calibration from any Jpp application
static const int JSHOWERFIT_ENERGY
uncorrected energy [GeV] from JShowerFit.cc
static const int JPP_COVERAGE_ORIENTATION
coverage of dynamic orientation calibration from any Jpp application
void copy(const Head &from, JHead &to)
Copy header from from to to.
Definition JHead.cc:163
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:405
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.
Acoustic event fit.
Auxiliary class to test history.
Definition JHistory.hh:136
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

◆ correct

const JShowerEnergyCorrection& JRECONSTRUCTION::JShowerFit::correct

Definition at line 312 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

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: