Jpp - 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
 
double TMax_ns
 
double TMin_ns
 
double roadWidth_m
 
double Emin_GeV
 
double Emax_GeV
 
double resolution
 
double R_Hz
 
int mestimator
 
size_t numberOfPrefits
 
size_t numberOfOutfits
 

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);
106  JRegressor_t::Vmax_npe = 20.0;
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].
static JTimeRange T_ns
Time window with respect to Cherenkov hypothesis [ns].
static int MAXIMUM_ITERATIONS
maximal number of iterations
Definition: JSimplex.hh:237
JMEstimator * getMEstimator(const int type)
Get M-Estimator.
Definition: JMEstimator.hh:166

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 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  }
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:80
double getRate() const
Get default rate.
static const int JSHOWERENERGYPREFIT
3D track with energy.
Definition: JTrack3E.hh:30
Detector file.
Definition: JHead.hh:196
Acoustic event fit.
return result
Definition: JPolint.hh:727
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.
JFit getFit(const JHistory &history, const JTrack3D &track, const double Q, const int NDF, const double energy=0.0, const int status=0)
Get fit.
JFIT::JHistory JHistory
Definition: JHistory.hh:283
const JClass_t & getReference() const
Get reference to object.
Definition: JReference.hh:38
std::vector< int > count
Definition: JAlgorithm.hh:184
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:666
Template specialisation of class JModel to match hit with bright point.
Definition: JFit/JModel.hh:121
then usage $script[input file[working directory[option]]] nWhere option can be N
Definition: JMuonPostfit.sh:37
then usage $script[input file[working directory[option]]] nWhere option can be E
Definition: JMuonPostfit.sh:37
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  }
bool JRECONSTRUCTION::JShowerEnergyPrefitParameters_t::equals ( const JShowerEnergyPrefitParameters_t parameters) const
inlineinherited

Equality.

Parameters
parametersfit parameters
Returns
true if equals; else false

Definition at line 57 of file JShowerEnergyPrefitParameters_t.hh.

58  {
59  return (this->TMax_ns == parameters.TMax_ns &&
60  this->TMin_ns == parameters.TMin_ns &&
61  this->numberOfPrefits == parameters.numberOfPrefits &&
62  this->numberOfOutfits == parameters.numberOfOutfits &&
63  this->roadWidth_m == parameters.roadWidth_m &&
64  this->Emin_GeV == parameters.Emin_GeV &&
65  this->Emax_GeV == parameters.Emax_GeV &&
66  this->resolution == parameters.resolution &&
67  this->R_Hz == parameters.R_Hz &&
68  this->mestimator == parameters.mestimator);
69  }
*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
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.

double JRECONSTRUCTION::JShowerEnergyPrefitParameters_t::TMax_ns
inherited

Definition at line 73 of file JShowerEnergyPrefitParameters_t.hh.

double JRECONSTRUCTION::JShowerEnergyPrefitParameters_t::TMin_ns
inherited

Definition at line 74 of file JShowerEnergyPrefitParameters_t.hh.

double JRECONSTRUCTION::JShowerEnergyPrefitParameters_t::roadWidth_m
inherited

Definition at line 75 of file JShowerEnergyPrefitParameters_t.hh.

double JRECONSTRUCTION::JShowerEnergyPrefitParameters_t::Emin_GeV
inherited

Definition at line 76 of file JShowerEnergyPrefitParameters_t.hh.

double JRECONSTRUCTION::JShowerEnergyPrefitParameters_t::Emax_GeV
inherited

Definition at line 77 of file JShowerEnergyPrefitParameters_t.hh.

double JRECONSTRUCTION::JShowerEnergyPrefitParameters_t::resolution
inherited

Definition at line 78 of file JShowerEnergyPrefitParameters_t.hh.

double JRECONSTRUCTION::JShowerEnergyPrefitParameters_t::R_Hz
inherited

Definition at line 79 of file JShowerEnergyPrefitParameters_t.hh.

int JRECONSTRUCTION::JShowerEnergyPrefitParameters_t::mestimator
inherited

Definition at line 80 of file JShowerEnergyPrefitParameters_t.hh.

size_t JRECONSTRUCTION::JShowerEnergyPrefitParameters_t::numberOfPrefits
inherited

Definition at line 81 of file JShowerEnergyPrefitParameters_t.hh.

size_t JRECONSTRUCTION::JShowerEnergyPrefitParameters_t::numberOfOutfits
inherited

Definition at line 82 of file JShowerEnergyPrefitParameters_t.hh.


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