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

class to handle first step of the shower reconstruction in ORCA: it reconstructs the shower vertex, intended as the shower brightest point, as the barycenter of the hits More...

#include <JShowerPrefit.hh>

Inheritance diagram for JRECONSTRUCTION::JShowerPrefit:
JRECONSTRUCTION::JShowerPrefitParameters_t TObject

Classes

struct  match_t
 Auxiliary class to match hit to root hit. More...
 

Public Types

typedef JTRIGGER::JHitR1 hit_type
 
typedef std::vector< hit_typebuffer_type
 

Public Member Functions

 JShowerPrefit (const JShowerPrefitParameters_t &parameters, const JModuleRouter &router, const int debug=0)
 Parameterized constructor. More...
 
JEvt operator() (const KM3NETDAQ::JDAQEvent &event) const
 Declaration of the operator that performs the reconstruction. More...
 
void reset ()
 Reset fit parameters. More...
 
bool equals (const JShowerPrefitParameters_t &parameters) const
 Equality. More...
 
 ClassDef (JShowerPrefitParameters_t, 2)
 

Public Attributes

const JModuleRouterrouter
 
int factoryLimit
 factory limit for combinatorics More...
 
size_t NMaxHits
 maximal number of hits More...
 
double sigma_ns
 time resolution [ns] More...
 
int numberOfOutliers
 maximum number of outliers More...
 
double TMaxLocal_ns
 time window for local coincidences [ns] More...
 
double ctMin
 minimal cosine space angle between PMT axes More...
 
double roadWidth_m
 road width [m] More...
 
size_t numberOfPrefits
 number of prefits to be saved in output More...
 

Detailed Description

class to handle first step of the shower reconstruction in ORCA: it reconstructs the shower vertex, intended as the shower brightest point, as the barycenter of the hits

Definition at line 50 of file JShowerPrefit.hh.

Member Typedef Documentation

Definition at line 55 of file JShowerPrefit.hh.

Definition at line 56 of file JShowerPrefit.hh.

Constructor & Destructor Documentation

JRECONSTRUCTION::JShowerPrefit::JShowerPrefit ( const JShowerPrefitParameters_t parameters,
const JModuleRouter router,
const int  debug = 0 
)
inline

Parameterized constructor.

Parameters
parametersstruct that holds default-optimized parameters for the reconstruction.
routermodule router, this is built via detector file.
debugdebug

Definition at line 66 of file JShowerPrefit.hh.

68  :
69  JShowerPrefitParameters_t(parameters),
70  router(router)
71  {}
const JModuleRouter & router

Member Function Documentation

JEvt JRECONSTRUCTION::JShowerPrefit::operator() ( const KM3NETDAQ::JDAQEvent event) const
inline

Declaration of the operator that performs the reconstruction.

Parameters
eventwhich is a JDAQEvent

Definition at line 79 of file JShowerPrefit.hh.

80  {
81 
82  using namespace std;
83  using namespace JPP;
84 
85  const double STANDARD_DEVIATIONS = 3.0;
86 
87  typedef JEstimator<JPoint4D> JEstimator_t;
88 
89  const JBuildL0<hit_type> buildL0;
91  const JMatch3G<hit_type> match3G(roadWidth_m, TMaxLocal_ns); // causality relation for showers
92 
93  //define empty vectors to be filled with JHitL0 and JHitL1
94  buffer_type dataL0;
95  buffer_type dataL1;
96 
97  JEvt out;
98 
99  buffer_type buffer;
100 
101  buildL0(JDAQTimeslice(event, true), router, back_inserter(buffer)); // true => snapshot
102  buildL2(JDAQTimeslice(event, false), router, back_inserter(dataL1)); // false => triggered
103 
104  copy(dataL1.begin(), dataL1.end(), back_inserter(dataL0));
105 
106  for (buffer_type::const_iterator i = buffer.begin(); i != buffer.end(); ++i) {
107 
108  if (find_if(dataL1.begin(), dataL1.end(), match_t(*i, TMaxLocal_ns)) == dataL1.end()) {
109  dataL0.push_back(*i);
110  }
111  }
112 
113  for (buffer_type::const_iterator root = dataL1.begin(); root != dataL1.end(); ++root) {
114 
115  buffer_type data(1, *root);
116 
117  JBinder2nd<hit_type> matching = JBind2nd(match3G, *root);
118 
119  for (buffer_type::const_iterator i = dataL0.begin(); i != dataL0.end(); ++i) {
120 
121  if(( root->getModuleIdentifier() != i->getModuleIdentifier() ) && matching(*i)){
122  data.push_back(*i);
123  }
124  }
125 
126  buffer_type::iterator __end1 = clusterizeWeight(data.begin() + 1, data.end(), match3G);
127 
128  // 4D fit
129  JEstimator_t fit;
130  JPoint4D vx;
131  double chi2 = numeric_limits<double>::max();
132  int NDF = distance(data.begin(), __end1) - JEstimator_t::NUMBER_OF_PARAMETERS;
133  int N = getCount(data.begin(), __end1);
134 
135  if(distance(data.begin(), __end1) <= factoryLimit){
136 
137  double ymin = numeric_limits<double>::max();
138 
139  buffer_type::iterator __end2 = __end1;
140 
141  for (int n = 0; n <= numberOfOutliers && distance(data.begin(), __end2) >=
142  JEstimator_t::NUMBER_OF_PARAMETERS; ++n, --__end2) {
143 
144  sort(data.begin() + 1, __end1, hit_type::compare);
145 
146  do {
147  try {
148 
149  fit(data.begin(), __end2);
150 
151  double y = getChi2(fit, data.begin(), __end2, sigma_ns);
152 
153  if (y < ymin) {
154  ymin = y;
155  vx = fit;
156  chi2 = ymin;
157  NDF = distance(data.begin(), __end2) - JEstimator_t::NUMBER_OF_PARAMETERS;
158  N = getCount(data.begin(), __end2);
159  }
160  }
161  catch(JException& error) { }
162 
163  } while (next_permutation(data.begin() + 1, __end2, __end1, hit_type::compare));
164 
165  ymin -= STANDARD_DEVIATIONS * STANDARD_DEVIATIONS;
166  }
167 
168  } else {
169 
170  const int number_of_outliers = distance(data.begin(), __end1) - JEstimator_t::NUMBER_OF_PARAMETERS - 1;
171 
172  buffer_type::iterator __end2 = __end1;
173 
174  for (int n = 0; n <= number_of_outliers; ++n) {
175 
176  try{
177 
178  fit(data.begin(), __end2);
179  vx = fit;
180  chi2 = getChi2(fit, data.begin(), __end2, sigma_ns);
181  NDF = distance(data.begin(), __end2) - JEstimator_t::NUMBER_OF_PARAMETERS;
182  N = getCount(data.begin(), __end2);
183 
184  }
185  catch(const JException& error){ }
186 
187  double ymax = 0;
188  buffer_type::iterator imax = __end2;
189 
190  for (buffer_type::iterator i = data.begin() + 1; i != __end2; ++i) {
191 
192  double y = getChi2(fit, *i, sigma_ns);
193 
194  if (y > ymax) {
195  ymax = y;
196  imax = i;
197  }
198  }
199 
200  if (ymax > STANDARD_DEVIATIONS * STANDARD_DEVIATIONS) {
201  --__end2;
202  swap(*imax, *__end2);
203  } else {
204  break;
205  }
206  }
207  }
208 
209  if (NDF >= 0 && chi2 > numeric_limits<double>::lowest()) {
210 
211  const JGEOMETRY3D::JTrack3D fitResult(vx, JGEOMETRY3D::JVersor3Z());
212 
213  out.push_back(getFit(JHistory(JSHOWERPREFIT), fitResult, getQuality(chi2, N), NDF));
214 
215  out.rbegin()->setW(13, chi2);
216  out.rbegin()->setW(14, N);
217  }
218  }
219 
220  return out;
221 
222  }
int factoryLimit
factory limit for combinatorics
General exception.
Definition: JException.hh:23
3G match criterion.
Definition: JMatch3G.hh:29
JBinder2nd< JHit_t > JBind2nd(const JMatch< JHit_t > &match, const JHit_t &second)
Auxiliary method to create JBinder2nd object.
Definition: JBind2nd.hh:70
Linear fit of bright point (position and time) between hits (objects with position and time)...
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 vertex fit.
Definition: JPoint4D.hh:22
then JPlot1D f $WORKDIR postfit[prefit\] root
then JShowerPostfit f $INPUT_FILE o $OUTPUT_FILE N
Auxiliary class to convert binary JMatch operator and given hit to unary match operator.
Definition: JBind2nd.hh:26
static struct JTRIGGER::@76 clusterizeWeight
Anonymous struct for weighed clustering of hits.
double getQuality(const double chi2, const int N, const int NDF)
Get quality of fit.
std::vector< hit_type > buffer_type
const int n
Definition: JPolint.hh:660
static const int JSHOWERPREFIT
Template L2 builder.
Definition: JBuildL2.hh:45
const JModuleRouter & router
Acoustic event fit.
double ctMin
minimal cosine space angle between PMT axes
Data time slice.
Data structure for L2 parameters.
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
int getCount(const T &hit)
Get hit count.
void copy(const Head &from, JHead &to)
Copy header from from to to.
Definition: JHead.cc:139
static struct JTRIGGER::JHitR1::@80 compare
Auxiliary data structure for sorting of hits.
bool next_permutation(T __begin, T __last, T __end, JComparator_t compare, std::bidirectional_iterator_tag)
Implementation of method next_permutation for bidirectional iterators.
Definition: JPermutation.hh:20
Template L0 hit builder.
Definition: JBuildL0.hh:35
double getChi2(const double P)
Get chi2 corresponding to given probability.
Definition: JFitToolkit.hh:70
Data structure for normalised vector in positive z-direction.
Definition: JVersor3Z.hh:39
double TMaxLocal_ns
time window for local coincidences [ns]
void JRECONSTRUCTION::JShowerPrefitParameters_t::reset ( )
inlineinherited

Reset fit parameters.

Definition at line 35 of file JShowerPrefitParameters_t.hh.

36  {
37  factoryLimit = 40;
38  NMaxHits = 20;
39  sigma_ns = 3.0;
40  numberOfOutliers = 4;
41  TMaxLocal_ns = 20.0;
42  ctMin = -0.7;
43  roadWidth_m = 50.0;
44  numberOfPrefits = 50;
45  }
int factoryLimit
factory limit for combinatorics
double ctMin
minimal cosine space angle between PMT axes
size_t numberOfPrefits
number of prefits to be saved in output
double TMaxLocal_ns
time window for local coincidences [ns]
bool JRECONSTRUCTION::JShowerPrefitParameters_t::equals ( const JShowerPrefitParameters_t parameters) const
inlineinherited

Equality.

Parameters
parametersfit parameters
Returns
true if equals; else false

Definition at line 53 of file JShowerPrefitParameters_t.hh.

54  {
55  return (this->factoryLimit == parameters.factoryLimit &&
56  this->NMaxHits == parameters.NMaxHits &&
57  this->sigma_ns == parameters.sigma_ns &&
58  this->numberOfOutliers == parameters.numberOfOutliers &&
59  this->TMaxLocal_ns == parameters.TMaxLocal_ns &&
60  this->ctMin == parameters.ctMin &&
61  this->roadWidth_m == parameters.roadWidth_m &&
62  this->numberOfPrefits == parameters.numberOfPrefits);
63  }
int factoryLimit
factory limit for combinatorics
*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::JShowerPrefitParameters_t::ClassDef ( JShowerPrefitParameters_t  ,
 
)
inherited

Member Data Documentation

const JModuleRouter& JRECONSTRUCTION::JShowerPrefit::router

Definition at line 224 of file JShowerPrefit.hh.

int JRECONSTRUCTION::JShowerPrefitParameters_t::factoryLimit
inherited

factory limit for combinatorics

Definition at line 67 of file JShowerPrefitParameters_t.hh.

size_t JRECONSTRUCTION::JShowerPrefitParameters_t::NMaxHits
inherited

maximal number of hits

Definition at line 68 of file JShowerPrefitParameters_t.hh.

double JRECONSTRUCTION::JShowerPrefitParameters_t::sigma_ns
inherited

time resolution [ns]

Definition at line 69 of file JShowerPrefitParameters_t.hh.

int JRECONSTRUCTION::JShowerPrefitParameters_t::numberOfOutliers
inherited

maximum number of outliers

Definition at line 70 of file JShowerPrefitParameters_t.hh.

double JRECONSTRUCTION::JShowerPrefitParameters_t::TMaxLocal_ns
inherited

time window for local coincidences [ns]

Definition at line 71 of file JShowerPrefitParameters_t.hh.

double JRECONSTRUCTION::JShowerPrefitParameters_t::ctMin
inherited

minimal cosine space angle between PMT axes

Definition at line 72 of file JShowerPrefitParameters_t.hh.

double JRECONSTRUCTION::JShowerPrefitParameters_t::roadWidth_m
inherited

road width [m]

Definition at line 73 of file JShowerPrefitParameters_t.hh.

size_t JRECONSTRUCTION::JShowerPrefitParameters_t::numberOfPrefits
inherited

number of prefits to be saved in output

Definition at line 74 of file JShowerPrefitParameters_t.hh.


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