Jpp  17.1.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JAcoustics/JEvtToolkit.hh
Go to the documentation of this file.
1 #ifndef __JACOUSTICS__JEVTTOOLKIT__
2 #define __JACOUSTICS__JEVTTOOLKIT__
3 
4 #include <set>
5 
6 #include "JAcoustics/JModel.hh"
7 #include "JAcoustics/JEvt.hh"
8 
9 
10 /**
11  * \file
12  *
13  * Acoustic event fit.
14  * \author mdejong
15  */
16 namespace JACOUSTICS {}
17 namespace JPP { using namespace JACOUSTICS; }
18 
19 namespace JACOUSTICS {
20 
21  /**
22  * Get quality of fit.\n
23  * The larger the quality, the better the fit.
24  *
25  * \param chi2 chi2
26  * \param NDF number of degrees of freedom
27  * \return quality
28  */
29  inline double getQuality(const double chi2, const int NDF)
30  {
31  return NDF - 0.25 * chi2 / NDF;
32  }
33 
34 
35  /**
36  * Get number of emitters.
37  *
38  * \param __begin begin of events
39  * \param __end end of events
40  * \return number of emitters
41  */
42  template<class T>
43  inline size_t getNumberOfEmitters(T __begin, T __end)
44  {
45  std::set<int> buffer;
46 
47  for (T i = __begin; i != __end; ++i) {
48  if (!i->empty()) {
49  buffer.insert(i->getID());
50  }
51  }
52 
53  return buffer.size();
54  }
55 
56 
57  /**
58  * Get model parameters of string.
59  *
60  * \param fit fit parameters
61  * \return model parameters
62  */
63  inline JMODEL::JString getModel(const JFit& fit)
64  {
65  return JMODEL::JString(fit.tx, fit.ty, fit.tx2, fit.ty2, fit.vs);
66  }
67 
68 
69  /**
70  * Get fit parameters of string.
71  *
72  * \param id identifier
73  * \param string model parameters
74  * \return fit parameters
75  */
76  inline JFit getFit(const int id, const JMODEL::JString& string)
77  {
78  return JFit(id, string.tx, string.ty, string.tx2, string.ty2, string.vs);
79  }
80 
81 
82  /**
83  * Get model of detector.
84  *
85  * \param evt event
86  * \return model
87  */
88  inline JModel getModel(const JEvt& evt)
89  {
90  JModel model;
91 
92  for (JEvt::const_iterator i = evt.begin(); i != evt.end(); ++i) {
93  model.string[i->id] = getModel(*i);
94  }
95 
96  return model;
97  }
98 
99 
100  /**
101  * Get event.
102  *
103  * \param header header
104  * \param model model
105  * \return event
106  */
107  inline JEvt getEvt(const JHead& header,
108  const JModel& model)
109  {
110  JEvt evt(header);
111 
112  for (JModel::string_type::const_iterator i = model.string.begin(); i != model.string.end(); ++i) {
113  evt.push_back(getFit(i->first, i->second));
114  }
115 
116  return evt;
117  }
118 }
119 
120 #endif
double getQuality(const double chi2, const int NDF)
Get quality of fit.
JEvt getEvt(const JHead &header, const JModel &model)
Get event.
double ty
slope dy/dz
Acoustic single fit.
size_t getNumberOfEmitters(T __begin, T __end)
Get number of emitters.
Model for fit to acoustics data.
double tx
slope dx/dz
Acoustic event header.
Acoustic event fit.
do set_variable OUTPUT_DIRECTORY $WORKDIR T
JMODEL::JString getModel(const JFit &fit)
Get model parameters of string.
double ty2
2nd order correction of slope dy/dz
double vs
stretching factor
JACOUSTICS::JModel::string_type string
JFit getFit(const int id, const JMODEL::JString &string)
Get fit parameters of string.
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
container_type::const_iterator const_iterator
Definition: JHashMap.hh:86
double tx2
2nd order correction of slope dx/dz
Model for fit to acoutsics data.
Acoustic event fit.