Jpp  18.2.0
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  for (size_t i = 0; i != module->size(); ++i) {
189 
190  const size_t count = top.count(JDAQPMTIdentifier(module->getID(), i));
191 
192  const double rate_Hz = summary.getRate(JDAQPMTIdentifier(module->getID(), i));
193 
194  data.push_back(JShowerNPEHit(this->getNPE(module->getPMT(i), rate_Hz), count));
195  }
196  }
197 
198  const int NDF = data.size() - 1;
199 
200  if (NDF >= 0) {
201 
202  // 5-point search between given limits
203  const int N = 5;
204 
205  JResult result[N];
206 
207  for (int i = 0; i != N; ++i) {
208 
209  result[i].x = log10(Emin_GeV + i * (Emax_GeV - Emin_GeV) / (N-1));
210 
211  }
212 
213  do{
214 
215  int j = 0;
216 
217  for (int i = 0; i != N; ++i) {
218 
219  if (!result[i]) {
220 
221  result[i].chi2 = (*this)(result[i].x, data.begin(), data.end());
222 
223  }
224 
225  if (result[i].chi2 < result[j].chi2) {
226  j = i;
227  }
228  }
229 
230  // squeeze range
231 
232  switch (j) {
233 
234  case 0:
235  result[4] = result[1];
236  result[2] = JResult(0.5 * (result[0].x + result[4].x));
237  break;
238 
239  case 1:
240  result[4] = result[2];
241  result[2] = result[1];
242  break;
243 
244  case 2:
245  result[0] = result[1];
246  result[4] = result[3];
247  break;
248 
249  case 3:
250  result[0] = result[2];
251  result[2] = result[3];
252  break;
253 
254  case 4:
255  result[0] = result[3];
256  result[2] = JResult(0.5 * (result[0].x + result[4].x));
257  break;
258  }
259 
260  result[1] = JResult(0.5 * (result[0].x + result[2].x));
261  result[3] = JResult(0.5 * (result[2].x + result[4].x));
262 
263  } while (result[4].x - result[0].x > resolution);
264 
265 
266  if (result[1].chi2 != result[3].chi2) {
267 
268  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);
269 
270  result[2].chi2 = (*this)(result[2].x, data.begin(), data.end());
271 
272  }
273 
274  // const double chi2 = result[2].chi2; // this is not used because fits are sorted wrt the position fit
275  const double E = result[2].x.getE();
276 
277  JShower3E sh_fit(sh.getPosition(), sh.getDirection(), sh.getT(), E);
278 
279  // the fits of this reco step are sorted wrt the previous reco step
280  // because otherwise it tends to degrade the position reco performances
281  out.push_back(getFit(JHistory(shower->getHistory()).add(JSHOWERENERGYPREFIT), sh_fit, shower->getQ(),
282  shower->getNDF(), sh_fit.getE()));
283 
284  }
285  }
286 
287  return out;
288 
289  }
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.
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})"
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.
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:748
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 291 of file JShowerEnergyPrefit.hh.

const JSummaryRouter& JRECONSTRUCTION::JShowerEnergyPrefit::summary

Definition at line 292 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: