Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Private Types | Private Attributes | List of all members
JFIT::JMuonGandalf Class Reference

class to handle Muon Gandalf reconstruction first, two other angular reconstructionS should be ran : JMuonPrefit and JMuonSimplex More...

#include <JMuonGandalf.hh>

Public Member Functions

 JMuonGandalf ()
 Default constructor. More...
 
 JMuonGandalf (const JLANG::JSharedPointer< const JDETECTOR::JModuleRouter > &router, const JFIT::JMuonGandalfParameters_t &parameters, std::string pdfFile)
 Parameterized constructor. More...
 
 ~JMuonGandalf ()
 
void getJEvt (const KM3NETDAQ::JDAQTimeslice &timeSlice, JFIT::JEvt &InPreFits, JFIT::JEvt &OutFits) const
 Declaration of Member function that actually performs the reconstruction. More...
 

Static Public Member Functions

static bool compare (const JTRIGGER::JHitL0 &first, const JTRIGGER::JHitL0 &second)
 Compare hits by PMT identifier and time. More...
 

Private Types

typedef JFIT::JRegressor
< JFIT::JLine3Z,
JFIT::JGandalf
JRegressor_t
 

Private Attributes

JLANG::JSharedPointer< const
JDETECTOR::JModuleRouter
router_
 
JFIT::JMuonGandalfParameters_t parameters_
 
JRegressor_t fitRegresor_
 

Detailed Description

class to handle Muon Gandalf reconstruction first, two other angular reconstructionS should be ran : JMuonPrefit and JMuonSimplex

Definition at line 47 of file JMuonGandalf.hh.

Member Typedef Documentation

Definition at line 50 of file JMuonGandalf.hh.

Constructor & Destructor Documentation

JFIT::JMuonGandalf::JMuonGandalf ( )
inline

Default constructor.

Definition at line 62 of file JMuonGandalf.hh.

63  {}
JFIT::JMuonGandalf::JMuonGandalf ( const JLANG::JSharedPointer< const JDETECTOR::JModuleRouter > &  router,
const JFIT::JMuonGandalfParameters_t parameters,
std::string  pdfFile 
)
inline

Parameterized constructor.

Parameters
routerJSharedPointer of JModuleRouter, this is built via detector file.
parametersstruct that holds default-optimized parameters for the reconstruction, for ARCA and ORCA configuration. These default parameters could be found in $JPP_DATA.
pdfFilePDF file descriptor

Definition at line 72 of file JMuonGandalf.hh.

74  :
75  router_(router),
76  parameters_(parameters)
77  {
78  JRegressor_t::debug = 1;//see what to do with this
79  JRegressor_t::T_ns.setRange(-50.0, +450.0);// ns
80  JRegressor_t::Vmax_npe = 10.0;
81  JRegressor_t::MAXIMUM_ITERATIONS = 10000;
82 
83  fitRegresor_ = {pdfFile, parameters.TTS_ns};
84 
85  fitRegresor_.parameters.resize(5);
86 
87  fitRegresor_.parameters[0] = JFIT::JLine3Z::pX();
88  fitRegresor_.parameters[1] = JFIT::JLine3Z::pY();
89  fitRegresor_.parameters[2] = JFIT::JLine3Z::pT();
90  fitRegresor_.parameters[3] = JFIT::JLine3Z::pDX();
91  fitRegresor_.parameters[4] = JFIT::JLine3Z::pDY();
92  }
JRegressor_t fitRegresor_
Definition: JMuonGandalf.hh:55
static parameter_type pT()
Definition: JLine1Z.hh:182
JLANG::JSharedPointer< const JDETECTOR::JModuleRouter > router_
Definition: JMuonGandalf.hh:52
static parameter_type pDX()
Definition: JLine3Z.hh:319
int debug
debug level
Definition: JSirene.cc:59
static parameter_type pY()
Definition: JLine1Z.hh:181
static parameter_type pDY()
Definition: JLine3Z.hh:320
static parameter_type pX()
Definition: JLine1Z.hh:180
JFIT::JMuonGandalfParameters_t parameters_
Definition: JMuonGandalf.hh:53
JFIT::JMuonGandalf::~JMuonGandalf ( )
inline

Definition at line 94 of file JMuonGandalf.hh.

94 {}

Member Function Documentation

void JFIT::JMuonGandalf::getJEvt ( const KM3NETDAQ::JDAQTimeslice timeSlice,
JFIT::JEvt InPreFits,
JFIT::JEvt OutFits 
) const

Declaration of Member function that actually performs the reconstruction.

Member function definition.

Parameters
timeSlicewhich is contructed via a JDAQEvent
InPreFitsinput JEvt which is a container of prefits, normally JMuonSimplex
OutFitsnon const (output) JEvt.

Definition at line 133 of file JMuonGandalf.hh.

136 {
137  if ( InPreFits.empty() ) return;
138 
139  const bool reprocess = parameters_.reprocess;
140  double roadWidth_m = parameters_.roadWidth_m;
141  const double R_Hz = parameters_.R_Hz;
142  const size_t numberOfPrefits = parameters_.numberOfPrefits;
143  const double E_GeV = parameters_.E_GeV;
144 
145  typedef std::vector<JTRIGGER::JHitL0> JDataL0_t;
146  typedef std::vector<JHitW0> JDataW0_t;
147 
149 
150  if (fitRegresor_.getRmax() < roadWidth_m) {
151  roadWidth_m = fitRegresor_.getRmax();
152  }
153 
154  JEvt::iterator __end = InPreFits.end();
155 
156  if (reprocess) {
157  __end = std::partition( InPreFits.begin(), __end,
159  );
160  }
161 
162  if (InPreFits.begin() != __end) {
163 
164  std::copy(InPreFits.begin(), __end, std::back_inserter(OutFits));
165 
166  if (numberOfPrefits > 0) {
167  std::advance(__end = InPreFits.begin(), std::min(numberOfPrefits, OutFits.size()));
168  }
169 
170  std::partial_sort(InPreFits.begin(), __end, InPreFits.end(), qualitySorter);
171 
172  __end = std::partition(InPreFits.begin(), __end,
173  JFIT::JHistory::is_event(InPreFits.begin()->getHistory())
174  );
175 
176  JDataL0_t dataL0;
177 
178  buildL0(timeSlice, *router_, std::back_inserter(dataL0));
179 
180  if (dataL0.size() >= fitRegresor_.parameters.size()) {
181 
182  for (JEvt::const_iterator track = InPreFits.begin(); track != __end; ++track) {
183 
185  const JFIT::JLine1Z tz(getPosition (*track).rotate(R), track->getT());
186  const JFIT::JModel<JFIT::JLine1Z> match(tz, roadWidth_m,
188 
189  //hit selection based on start value
190 
191  JDataW0_t data;
192 
193  for (JDataL0_t::const_iterator i = dataL0.begin(); i != dataL0.end(); ++i) {
194 
195  JFIT::JHitW0 hit(*i, R_Hz);
196 
197  hit.rotate(R);
198 
199  if (match(hit)) {
200  data.push_back(hit);
201  }
202  }
203 
204  //select first hit
205 
206  std::sort(data.begin(), data.end(), compare);
207 
208  JDataW0_t::iterator __end = std::unique( data.begin(), data.end(),
209  std::equal_to<KM3NETDAQ::JDAQPMTIdentifier>()
210  );
211 
212  const int NDF = std::distance(data.begin(), __end) - fitRegresor_.parameters.size();
213 
214  if (NDF >= 0) {
215 
216  //set fit parameters
217 
218  if (track->getE() > 0.1)
219  fitRegresor_.E_GeV = track->getE();
220  else
221  fitRegresor_.E_GeV = E_GeV;
222 
223  const double chi2 = fitRegresor_(JLine3Z(tz), data.begin(), __end);
224 
226 
227  tb.rotate_back(R);
228 
229  const double energy(0);
230  OutFits.push_back(JFIT::getFit(JFIT::JHistory(track->getHistory()).add(JFIT::JFitApplication_t::JMUONGANDALF), tb,
231  JFIT::getQuality(chi2), NDF,energy,JFIT::JFitStatus_t::OKAY));
232 
233  //set additional weights
234 
235  OutFits.rbegin()->setW(JGANDALF_BETA0_RAD,sqrt(fitRegresor_.error.getDX() * fitRegresor_.error.getDX() +
236  fitRegresor_.error.getDY() * fitRegresor_.error.getDY()));
237  OutFits.rbegin()->setW(JGANDALF_BETA1_RAD,sqrt(fitRegresor_.error.getDX() * fitRegresor_.error.getDY()));
238  OutFits.rbegin()->setW(JGANDALF_CHI2, chi2);
239  OutFits.rbegin()->setW(JGANDALF_NUMBER_OF_HITS, distance(data.begin(), __end));
240  OutFits.rbegin()->setW(JGANDALF_LAMBDA, fitRegresor_.lambda);
241  OutFits.rbegin()->setW(JGANDALF_NUMBER_OF_ITERATIONS, fitRegresor_.numberOfIterations);
242  }
243  }
244  }
245  //apply default sorter
246 
247  std::sort(OutFits.begin(), OutFits.end(), qualitySorter);
248  }
249 
250 }
Template definition of a data regressor of given model.
Definition: JRegressor.hh:66
JRegressor_t fitRegresor_
Definition: JMuonGandalf.hh:55
number of iterations from JGandalf.cc
Rotation matrix.
Definition: JRotation3D.hh:108
Auxiliary class to test history.
Definition: JHistory.hh:149
Container for historical events.
Definition: JHistory.hh:95
chi2 from JGandalf.cc
JLANG::JSharedPointer< const JDETECTOR::JModuleRouter > router_
Definition: JMuonGandalf.hh:52
angular resolution [rad] from JGandalf.cc
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.
Definition: JEvtToolkit.hh:116
control parameter from JGandalf.cc
Auxiliary class to test history.
Definition: JHistory.hh:101
Auxiliary class for a hit with background rate value.
Definition: JHitW0.hh:21
JDirection3D getDirection(const JFit &fit)
Get direction.
Definition: JEvtToolkit.hh:75
Auxiliary class to match data points with given model.
Definition: JModel.hh:24
angular resolution [rad] from JGandalf.cc
counter_type advance(counter_type &counter, const counter_type value, const counter_type limit=std::numeric_limits< counter_type >::max())
Advance counter.
Definition: JCounter.hh:35
number of hits from JGandalf.cc
JPosition3D getPosition(const JFit &fit)
Get position.
Definition: JEvtToolkit.hh:63
JFIT::JMuonGandalfParameters_t parameters_
Definition: JMuonGandalf.hh:53
double getQuality(const double chi2, const int NDF)
Get quality of fit.
Definition: JEvtToolkit.hh:195
Data structure for fit of straight line paralel to z-axis.
Definition: JLine1Z.hh:27
void copy(const Head &from, JHead &to)
Copy header from from to to.
Definition: JHead.cc:40
bool qualitySorter(const JFit &first, const JFit &second)
Comparison of fit results.
Definition: JEvtToolkit.hh:223
static bool compare(const JTRIGGER::JHitL0 &first, const JTRIGGER::JHitL0 &second)
Compare hits by PMT identifier and time.
Template L0 hit builder.
Definition: JBuildL0.hh:35
JPosition3D & rotate(const JRotation3D &R)
Rotate.
Definition: JPosition3D.hh:185
static bool JFIT::JMuonGandalf::compare ( const JTRIGGER::JHitL0 first,
const JTRIGGER::JHitL0 second 
)
inlinestatic

Compare hits by PMT identifier and time.

Parameters
firstfirst hit
secondsecond hit
Returns
true if first before second; else false

Definition at line 116 of file JMuonGandalf.hh.

118  {
119  if (std::equal_to<KM3NETDAQ::JDAQPMTIdentifier>()(first, second))
120  return std::less<JTRIGGER::JHit>()(first, second);
121  else
122  return std::less<KM3NETDAQ::JDAQPMTIdentifier>()(first, second);
123  }

Member Data Documentation

JLANG::JSharedPointer<const JDETECTOR::JModuleRouter> JFIT::JMuonGandalf::router_
private

Definition at line 52 of file JMuonGandalf.hh.

JFIT::JMuonGandalfParameters_t JFIT::JMuonGandalf::parameters_
private

Definition at line 53 of file JMuonGandalf.hh.

JRegressor_t JFIT::JMuonGandalf::fitRegresor_
mutableprivate

Definition at line 55 of file JMuonGandalf.hh.


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