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

class to handle the third step of the shower reconstruction, mainly dedicated for ORCA More...

#include <JShowerEnergyPrefit.hh>

Inheritance diagram for JRECONSTRUCTION::JShowerEnergyPrefit:
JRECONSTRUCTION::JShowerEnergyPrefitParameters_t JFIT::JRegressor< JModel_t, JMinimiser_t > TObject

Classes

struct  JResult
 Auxiliary class for energy estimation. More...
 

Public Member Functions

 JShowerEnergyPrefit (const JShowerEnergyPrefitParameters_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 JShowerEnergyPrefitParameters_t &parameters) const
 Equality. More...
 
 ClassDef (JShowerEnergyPrefitParameters_t, 1)
 

Public Attributes

const JModuleRouterrouter
 
const JSummaryRoutersummary
 
size_t numberOfPrefits
 number of prefits More...
 
size_t numberOfOutfits
 number of fits to be saved in output More...
 
double TMax_ns
 maximum time for local coincidences [ns] More...
 
double TMin_ns
 minimum time for local coincidences [ns] More...
 
double roadWidth_m
 road width [m] More...
 
double Emin_GeV
 minimum energy [GeV] More...
 
double Emax_GeV
 maximum energy [GeV] More...
 
double resolution
 energy resolution [log10(GeV)] More...
 
double R_Hz
 default rate [Hz] More...
 
int mestimator
 M-estimator. More...
 
double VMax_npe
 maximum number of of photo-electrons More...
 
int NMax
 maximum number of iterations More...
 

Private Types

typedef JRegressor< JEnergy,
JSimplex
JRegressor_t
 

Detailed Description

class to handle the third step of the shower reconstruction, mainly dedicated for ORCA

Definition at line 73 of file JShowerEnergyPrefit.hh.

Member Typedef Documentation

Definition at line 78 of file JShowerEnergyPrefit.hh.

Constructor & Destructor Documentation

JRECONSTRUCTION::JShowerEnergyPrefit::JShowerEnergyPrefit ( const JShowerEnergyPrefitParameters_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 92 of file JShowerEnergyPrefit.hh.

96  :
98  JRegressor_t(pdfFile),
99  router(router),
100  summary(summary)
101  {
102  using namespace JPP;
103 
105  JRegressor_t::T_ns.setRange(parameters.TMin_ns, parameters.TMax_ns);
108 
109  this->estimator.reset(getMEstimator(parameters.mestimator));
110  }
static int debug
debug level (default is off).
Definition: JMessage.hh:45
JRegressor< JEnergy, JSimplex > JRegressor_t
static double Vmax_npe
Maximal integral of PDF [npe].
double TMin_ns
minimum time for local coincidences [ns]
double VMax_npe
maximum number of of photo-electrons
static JTimeRange T_ns
Time window with respect to Cherenkov hypothesis [ns].
double TMax_ns
maximum time for local coincidences [ns]
static int MAXIMUM_ITERATIONS
maximal number of iterations
Definition: JSimplex.hh:237
JMEstimator * getMEstimator(const int type)
Get M-Estimator.
Definition: JMEstimator.hh:203

Member Function Documentation

JEvt JRECONSTRUCTION::JShowerEnergyPrefit::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, which should contain a vertex fit

Definition at line 151 of file JShowerEnergyPrefit.hh.

152  {
153  using namespace std;
154  using namespace JPP;
155 
156  typedef vector<JHitL0> JDataL0_t;
157  JBuildL0<JHitL0> buildL0;
158 
159  JEvt out;
160 
162 
163  JDataL0_t dataL0;
164  buildL0(JDAQTimeslice(event, true), router, back_inserter(dataL0));
165 
166  for (JEvt::const_iterator shower = in.begin(); shower != in.end(); ++shower) {
167 
168  JShower3E sh(getPosition(*shower), getDirection(*shower), shower->getT(), shower->getE());
169 
171 
173  vector<JShowerNPEHit> buffer;
174 
175  const JFIT::JModel<JPoint4D> match(JPoint4D(sh.getPosition(), sh.getT()), roadWidth_m, JRegressor_t::T_ns);
176 
177  for (JDataL0_t::const_iterator i = dataL0.begin(); i != dataL0.end(); ++i) {
178 
179  if (match(*i)) {
180  top.insert(i->getPMTIdentifier());
181  }
182  }
183 
184  JDetectorSubset_t subdetector(detector, sh.getPosition(), roadWidth_m);
185 
186  for (JDetector::const_iterator module = subdetector.begin(); module != subdetector.end(); ++module) {
187 
188  const JDAQSummaryFrame& frame = summary.getSummaryFrame(module->getID());
189 
190  for (size_t i = 0; i != module->size(); ++i) {
191 
192  if (getDAQStatus(frame, *module, i) &&
193  getPMTStatus(frame, *module, i) &&
194  frame[i].is_valid() &&
195  !module->getPMT(i).has(PMT_DISABLE)) {
196 
197  const JDAQPMTIdentifier id(module->getID(), i);
198 
199  const double rate_Hz = summary.getRate(id);
200  const size_t count = top.count(id);
201 
202  data.push_back(JShowerNPEHit(this->getNPE(module->getPMT(i), rate_Hz), count));
203  }
204  }
205  }
206 
207  const int NDF = data.size() - 1;
208 
209  if (NDF >= 0) {
210 
211  // 5-point search between given limits
212  const int N = 5;
213 
214  JResult result[N];
215 
216  for (int i = 0; i != N; ++i) {
217 
218  result[i].x = log10(Emin_GeV + i * (Emax_GeV - Emin_GeV) / (N-1));
219 
220  }
221 
222  do{
223 
224  int j = 0;
225 
226  for (int i = 0; i != N; ++i) {
227 
228  if (!result[i]) {
229 
230  result[i].chi2 = (*this)(result[i].x, data.begin(), data.end());
231 
232  }
233 
234  if (result[i].chi2 < result[j].chi2) {
235  j = i;
236  }
237  }
238 
239  // squeeze range
240 
241  switch (j) {
242 
243  case 0:
244  result[4] = result[1];
245  result[2] = JResult(0.5 * (result[0].x + result[4].x));
246  break;
247 
248  case 1:
249  result[4] = result[2];
250  result[2] = result[1];
251  break;
252 
253  case 2:
254  result[0] = result[1];
255  result[4] = result[3];
256  break;
257 
258  case 3:
259  result[0] = result[2];
260  result[2] = result[3];
261  break;
262 
263  case 4:
264  result[0] = result[3];
265  result[2] = JResult(0.5 * (result[0].x + result[4].x));
266  break;
267  }
268 
269  result[1] = JResult(0.5 * (result[0].x + result[2].x));
270  result[3] = JResult(0.5 * (result[2].x + result[4].x));
271 
272  } while (result[4].x - result[0].x > resolution);
273 
274 
275  if (result[1].chi2 != result[3].chi2) {
276 
277  result[2].x += 0.25 * (result[3].x - result[1].x) * (result[1].chi2 - result[3].chi2) / (result[1].chi2 + result[3].chi2 - 2*result[2].chi2);
278 
279  result[2].chi2 = (*this)(result[2].x, data.begin(), data.end());
280 
281  }
282 
283  // const double chi2 = result[2].chi2; // this is not used because fits are sorted wrt the position fit
284  const double E = result[2].x.getE();
285 
286  JShower3E sh_fit(sh.getPosition(), sh.getDirection(), sh.getT(), E);
287 
288  // the fits of this reco step are sorted wrt the previous reco step
289  // because otherwise it tends to degrade the position reco performances
290  out.push_back(getFit(JHistory(shower->getHistory()).add(JSHOWERENERGYPREFIT), sh_fit, shower->getQ(),
291  shower->getNDF(), sh_fit.getE()));
292 
293  }
294  }
295 
296  return out;
297 
298  }
then usage $script< input file >[option[primary[working directory]]] nWhere option can be E
Definition: JMuonPostfit.sh:40
Template specialisation of L0 builder for JHitL0 data type.
Definition: JBuildL0.hh:102
Data structure for vertex fit.
Definition: JPoint4D.hh:22
Detector data structure.
Definition: JDetector.hh:89
double getRate() const
Get default rate.
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.
static const int JSHOWERENERGYPREFIT
3D track with energy.
Definition: JTrack3E.hh:30
Detector file.
Definition: JHead.hh:226
Acoustic event fit.
set_variable E_E log10(E_{fit}/E_{#mu})"
Data storage class for rate measurements of all PMTs in one module.
static const int PMT_DISABLE
KM3NeT Data Definitions v3.3.0-2-g5cc95cf https://git.km3net.de/common/km3net-dataformat.
Definition: pmt_status.hh:12
JDirection3D getDirection(const JFit &fit)
Get direction.
Data time slice.
static JTimeRange T_ns
Time window with respect to Cherenkov hypothesis [ns].
Detector subset without binary search functionality.
bool getPMTStatus(const JStatus &status)
Test status of PMT.
then usage $script< input file >[option[primary[working directory]]] nWhere option can be N
Definition: JMuonPostfit.sh:40
JFIT::JHistory JHistory
Definition: JHistory.hh:354
const JClass_t & getReference() const
Get reference to object.
Definition: JReference.hh:38
then if[[!-f $DETECTOR]] then JDetector sh $DETECTOR fi cat $WORKDIR trigger_parameters txt<< EOFtrigger3DMuon.enabled=1;trigger3DMuon.numberOfHits=5;trigger3DMuon.gridAngle_deg=1;ctMin=0.0;TMaxLocal_ns=15.0;EOF set_variable TRIGGEREFFICIENCY_TRIGGERED_EVENTS_ONLY INPUT_FILES=() for((i=1;$i<=$NUMBER_OF_RUNS;++i));do JSirene.sh $DETECTOR $JPP_DATA/genhen.km3net_wpd_V2_0.evt.gz $WORKDIR/sirene_ ${i}.root JTriggerEfficiency.sh $DETECTOR $DETECTOR $WORKDIR/sirene_ ${i}.root $WORKDIR/trigger_efficiency_ ${i}.root $WORKDIR/trigger_parameters.txt $JPP_DATA/PMT_parameters.txt INPUT_FILES+=($WORKDIR/trigger_efficiency_ ${i}.root) done for ANGLE_DEG in $ANGLES_DEG[*];do set_variable SIGMA_NS 3.0 set_variable OUTLIERS 3 set_variable OUTPUT_FILE $WORKDIR/matrix\[${ANGLE_DEG}\deg\].root $JPP_DIR/examples/JReconstruction-f"$INPUT_FILES[*]"-o $OUTPUT_FILE-S ${SIGMA_NS}-A ${ANGLE_DEG}-O ${OUTLIERS}-d ${DEBUG}--!fiif[[$OPTION=="plot"]];then if((0));then for H1 in h0 h1;do JPlot1D-f"$WORKDIR/matrix["${^ANGLES_DEG}" deg].root:${H1}"-y"1 2e3"-Y-L TR-T""-\^"number of events [a.u.]"-> o chi2
Definition: JMatrixNZ.sh:106
Auxiliary class for simultaneously handling light yields and response of PMT.
JPosition3D getPosition(const JFit &fit)
Get position.
double getNPE(const Hit &hit)
Get true charge of hit.
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
void JRECONSTRUCTION::JShowerEnergyPrefitParameters_t::reset ( )
inlineinherited

Reset fit parameters.

Definition at line 37 of file JShowerEnergyPrefitParameters_t.hh.

38  {
39  TMax_ns = 500;
40  TMin_ns = -500;
41  roadWidth_m = 80;
42  Emin_GeV = 1;
43  Emax_GeV = 100;
44  resolution = 0.01;
45  R_Hz = 10.0e3;
47  numberOfPrefits = 0;
48  numberOfOutfits = 1;
49  VMax_npe = 20;
50  NMax = 1000;
51  }
double TMin_ns
minimum time for local coincidences [ns]
double VMax_npe
maximum number of of photo-electrons
double TMax_ns
maximum time for local coincidences [ns]
size_t numberOfOutfits
number of fits to be saved in output
bool JRECONSTRUCTION::JShowerEnergyPrefitParameters_t::equals ( const JShowerEnergyPrefitParameters_t parameters) const
inlineinherited

Equality.

Parameters
parametersfit parameters
Returns
true if equals; else false

Definition at line 59 of file JShowerEnergyPrefitParameters_t.hh.

60  {
61  return (this->TMax_ns == parameters.TMax_ns &&
62  this->TMin_ns == parameters.TMin_ns &&
63  this->numberOfPrefits == parameters.numberOfPrefits &&
64  this->numberOfOutfits == parameters.numberOfOutfits &&
65  this->roadWidth_m == parameters.roadWidth_m &&
66  this->Emin_GeV == parameters.Emin_GeV &&
67  this->Emax_GeV == parameters.Emax_GeV &&
68  this->resolution == parameters.resolution &&
69  this->R_Hz == parameters.R_Hz &&
70  this->mestimator == parameters.mestimator &&
71  this->VMax_npe == parameters.VMax_npe &&
72  this->NMax == parameters.NMax);
73  }
*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
double TMax_ns
maximum time for local coincidences [ns]
JRECONSTRUCTION::JShowerEnergyPrefitParameters_t::ClassDef ( JShowerEnergyPrefitParameters_t  ,
 
)
inherited

Member Data Documentation

const JModuleRouter& JRECONSTRUCTION::JShowerEnergyPrefit::router

Definition at line 300 of file JShowerEnergyPrefit.hh.

const JSummaryRouter& JRECONSTRUCTION::JShowerEnergyPrefit::summary

Definition at line 301 of file JShowerEnergyPrefit.hh.

size_t JRECONSTRUCTION::JShowerEnergyPrefitParameters_t::numberOfPrefits
inherited

number of prefits

Definition at line 78 of file JShowerEnergyPrefitParameters_t.hh.

size_t JRECONSTRUCTION::JShowerEnergyPrefitParameters_t::numberOfOutfits
inherited

number of fits to be saved in output

Definition at line 79 of file JShowerEnergyPrefitParameters_t.hh.

double JRECONSTRUCTION::JShowerEnergyPrefitParameters_t::TMax_ns
inherited

maximum time for local coincidences [ns]

Definition at line 80 of file JShowerEnergyPrefitParameters_t.hh.

double JRECONSTRUCTION::JShowerEnergyPrefitParameters_t::TMin_ns
inherited

minimum time for local coincidences [ns]

Definition at line 81 of file JShowerEnergyPrefitParameters_t.hh.

double JRECONSTRUCTION::JShowerEnergyPrefitParameters_t::roadWidth_m
inherited

road width [m]

Definition at line 82 of file JShowerEnergyPrefitParameters_t.hh.

double JRECONSTRUCTION::JShowerEnergyPrefitParameters_t::Emin_GeV
inherited

minimum energy [GeV]

Definition at line 83 of file JShowerEnergyPrefitParameters_t.hh.

double JRECONSTRUCTION::JShowerEnergyPrefitParameters_t::Emax_GeV
inherited

maximum energy [GeV]

Definition at line 84 of file JShowerEnergyPrefitParameters_t.hh.

double JRECONSTRUCTION::JShowerEnergyPrefitParameters_t::resolution
inherited

energy resolution [log10(GeV)]

Definition at line 85 of file JShowerEnergyPrefitParameters_t.hh.

double JRECONSTRUCTION::JShowerEnergyPrefitParameters_t::R_Hz
inherited

default rate [Hz]

Definition at line 86 of file JShowerEnergyPrefitParameters_t.hh.

int JRECONSTRUCTION::JShowerEnergyPrefitParameters_t::mestimator
inherited

M-estimator.

Definition at line 87 of file JShowerEnergyPrefitParameters_t.hh.

double JRECONSTRUCTION::JShowerEnergyPrefitParameters_t::VMax_npe
inherited

maximum number of of photo-electrons

Definition at line 88 of file JShowerEnergyPrefitParameters_t.hh.

int JRECONSTRUCTION::JShowerEnergyPrefitParameters_t::NMax
inherited

maximum number of iterations

Definition at line 89 of file JShowerEnergyPrefitParameters_t.hh.


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