Jpp  17.1.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
JTRIGGER::JBuildL2< JHit_t > Class Template Reference

Template L2 builder. More...

#include <JBuildL2.hh>

Inheritance diagram for JTRIGGER::JBuildL2< JHit_t >:
JTRIGGER::JL2Parameters JTRIGGER::JBuildL1< JHit_t > JTRIGGER::JBuildHelper< JBuildL2< JHit_t > > TObject JTRIGGER::JBuildL1Parameters JTRIGGER::JBuildHelper< JBuildL1< JHit_t > > JTRIGGER::JBuild< JHit_t > JTRIGGER::JHitToolkit< JHit_t >

Public Types

typedef JHit_t value_type
 
typedef JMatch< value_typematch_type
 
typedef JDAQHitSelector selector_type
 

Public Member Functions

 JBuildL2 (const JL2Parameters &parameters)
 Constructor. More...
 
template<class JOutput_t >
void operator() (const JSuperFrame2D< JHit_t > &inputL0, const std::vector< JHit_t > &inputL1, JOutput_t out) const
 Build hits from calibrated data. More...
 
template<class T , class JOutput_t >
void operator() (T __begin, T __end, const std::vector< JHit_t > &inputL1, JOutput_t out) const
 Build hits from calibrated data. More...
 
template<class JOutput_t >
void operator() (const JSuperFrame2D< JHit_t > &inputL0, JOutput_t out) const
 Build hits from calibrated data. More...
 
template<class JOutput_t >
void operator() (const JDAQSuperFrame &input, const JModule &module, JOutput_t out) const
 Build hits from DAQ data. More...
 
void reset ()
 Reset L2 parameters. More...
 
bool equals (const JL2Parameters &parameters) const
 Equality. More...
 
bool is_valid () const
 Check validity. More...
 
 ClassDef (JL2Parameters, 1)
 
template<class JOutput_t >
void operator() (typename JSuperFrame2D< JHit_t >::const_iterator __begin, typename JSuperFrame2D< JHit_t >::const_iterator __end, JOutput_t out) const
 Build hits from set of frames with calibrated data. More...
 
template<class JOutput_t >
void operator() (const JSuperFrame1D< JHit_t > &input, JOutput_t out) const
 Build hits from calibrated data. More...
 
void operator() (const JDAQTimeslice &timeslice, const JModuleRouter &router, JOutput_t out) const
 Build hits from uncalibrated DAQ data. More...
 
void operator() (const JDAQEvent &event, const JModuleRouter &router, const bool snapshot, JOutput_t out) const
 Build hits from uncalibrated DAQ data. More...
 
void operator() (const JDAQEvent &event, const JModuleRouter &router, JOutput_t out) const
 Build hits from uncalibrated DAQ data. More...
 
void setPreprocessor (const JPreprocessor::JOption_t option, const match_type &match)
 Set pre-processor of consecutive hits. More...
 
void resetPreprocessor ()
 Reset pre-processor of consecutive hits. More...
 
void setDAQHitSelector (const JDAQHitSelector &selector)
 Set DAQ hit selector. More...
 
void resetDAQHitSelector ()
 Reset DAQ hit selector. More...
 
JSuperFrame2D< JHit_t > & demultiplex (const JDAQSuperFrame &input, const JModule &module) const
 Demultiplex and pre-process DAQ super frame. More...
 
void operator() (const JDAQTimeslice &timeslice, const JModuleRouter &router, JOutput_t out) const
 Build hits from uncalibrated DAQ data. More...
 
void operator() (const JDAQEvent &event, const JModuleRouter &router, const bool snapshot, JOutput_t out) const
 Build hits from uncalibrated DAQ data. More...
 
void operator() (const JDAQEvent &event, const JModuleRouter &router, JOutput_t out) const
 Build hits from uncalibrated DAQ data. More...
 

Public Attributes

int numberOfHits
 minimal number of hits More...
 
double TMaxLocal_ns
 maximal time difference [ns] More...
 
double ctMin
 minimal cosine space angle between PMT axes More...
 
double TMax_ns
 
bool combine
 
JPreprocessor::JOption_t option
 pre-processor option More...
 
JLANG::JSharedPointer< match_typematch
 pre-processor match criterion More...
 
JLANG::JSharedPointer
< selector_type
selector
 DAQ hit selector. More...
 

Protected Member Functions

bool isL2 (const JSuperFrameClone2D< JHit_t > &clone, const JHit_t &hit) const
 Test if requirements for given hit are satisfied. More...
 

Protected Attributes

std::vector< JHit_tbufferL1
 

Detailed Description

template<class JHit_t>
class JTRIGGER::JBuildL2< JHit_t >

Template L2 builder.

An L2 hit is a local coincidence between two or more hits from different PMTs within the same optical module satisfying:

Definition at line 45 of file JBuildL2.hh.

Member Typedef Documentation

template<class JHit_t>
typedef JHit_t JTRIGGER::JBuildL2< JHit_t >::value_type

Definition at line 54 of file JBuildL2.hh.

template<class JHit_t>
typedef JMatch<value_type> JTRIGGER::JBuild< JHit_t >::match_type
inherited

Definition at line 39 of file JBuild.hh.

template<class JHit_t>
typedef JDAQHitSelector JTRIGGER::JBuild< JHit_t >::selector_type
inherited

Definition at line 40 of file JBuild.hh.

Constructor & Destructor Documentation

template<class JHit_t>
JTRIGGER::JBuildL2< JHit_t >::JBuildL2 ( const JL2Parameters parameters)
inline

Constructor.

Parameters
parametersL2 parameters

Definition at line 62 of file JBuildL2.hh.

62  :
63  JL2Parameters (parameters),
65  {}
*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
JL2Parameters()
Default constructor.
Template L1 hit builder.
Definition: JBuildL1.hh:85

Member Function Documentation

template<class JHit_t>
template<class JOutput_t >
void JTRIGGER::JBuildL2< JHit_t >::operator() ( const JSuperFrame2D< JHit_t > &  inputL0,
const std::vector< JHit_t > &  inputL1,
JOutput_t  out 
) const
inline

Build hits from calibrated data.

Only the input hits that satisfy the predefined requirements are copied from input to output.
The requirements are checked using the calibrated data of each PMT inside the same module. The input data should be time sorted. The output data are time sorted.

Parameters
inputL0input L0 data
inputL1input L1 data
outoutput L2 data

Definition at line 81 of file JBuildL2.hh.

84  {
85  const JSuperFrameClone2D<JHit_t> clone(inputL0);
86 
87  for (typename std::vector<JHit_t>::const_iterator p = inputL1.begin(); p != inputL1.end(); ++p) {
88 
89  clone.fast_forward(*p);
90 
91  if (isL2(clone,*p)) {
92  *out = *p;
93  ++out;
94  }
95  }
96  }
Clone of JSuperFrame2D.
bool isL2(const JSuperFrameClone2D< JHit_t > &clone, const JHit_t &hit) const
Test if requirements for given hit are satisfied.
Definition: JBuildL2.hh:182
template<class JHit_t>
template<class T , class JOutput_t >
void JTRIGGER::JBuildL2< JHit_t >::operator() ( T  __begin,
T  __end,
const std::vector< JHit_t > &  inputL1,
JOutput_t  out 
) const
inline

Build hits from calibrated data.

Only the input hits that satisfy the predefined requirements are copied from input to output.
The requirements are checked using the calibrated data of each PMT inside the same module. The input data should be time sorted. The output data are time sorted.

Parameters
__beginbegin L0 data
__endend L0 data
inputL1input L1 data
outoutput L2 data

Definition at line 113 of file JBuildL2.hh.

117  {
118  const JSuperFrameClone2D<JHit_t> clone(__begin, __end);
119 
120  for (typename std::vector<JHit_t>::const_iterator p = inputL1.begin(); p != inputL1.end(); ++p) {
121 
122  clone.fast_forward(*p);
123 
124  if (isL2(clone,*p)) {
125  *out = *p;
126  ++out;
127  }
128  }
129  }
Clone of JSuperFrame2D.
bool isL2(const JSuperFrameClone2D< JHit_t > &clone, const JHit_t &hit) const
Test if requirements for given hit are satisfied.
Definition: JBuildL2.hh:182
template<class JHit_t>
template<class JOutput_t >
void JTRIGGER::JBuildL2< JHit_t >::operator() ( const JSuperFrame2D< JHit_t > &  inputL0,
JOutput_t  out 
) const
inline

Build hits from calibrated data.

The calibrated data of each PMT inside the optical module are used to build L2 coincidences. The predefined requirements are then checked using the same calibrated data of each PMT. The output data are time sorted.

Parameters
inputL0input L0 data
outoutput L2 data

Definition at line 143 of file JBuildL2.hh.

144  {
145  bufferL1.clear();
146 
147  static_cast<const JBuildL1<JHit_t>&>(*this)(inputL0, std::back_inserter(bufferL1));
148 
149  (*this)(inputL0, bufferL1, out);
150  }
std::vector< JHit_t > bufferL1
Definition: JBuildL2.hh:218
Template L1 hit builder.
Definition: JBuildL1.hh:85
template<class JHit_t>
template<class JOutput_t >
void JTRIGGER::JBuildL2< JHit_t >::operator() ( const JDAQSuperFrame input,
const JModule module,
JOutput_t  out 
) const
inline

Build hits from DAQ data.

The time calibration is applied and the requirements are applied to the calibrated data. The output data are time sorted.

Parameters
inputDAQ super frame
modulemodule
outoutput L2 data

Definition at line 164 of file JBuildL2.hh.

167  {
168  if (!input.empty()) {
169  (*this)(this->demultiplex(input, module), out);
170  }
171  }
bool empty() const
Definition: JDAQFrame.hh:180
JSuperFrame2D< JHit_t > & demultiplex(const JDAQSuperFrame &input, const JModule &module) const
Demultiplex and pre-process DAQ super frame.
Definition: JBuild.hh:103
template<class JHit_t>
bool JTRIGGER::JBuildL2< JHit_t >::isL2 ( const JSuperFrameClone2D< JHit_t > &  clone,
const JHit_t hit 
) const
inlineprotected

Test if requirements for given hit are satisfied.


The internal iterators of the cloned L0 data should be set before this test operation.

Parameters
cloneL0 data
hitL1 hit
Returns
true is L2 condition is satisfied; else false

Definition at line 182 of file JBuildL2.hh.

183  {
184  using namespace JPP;
185 
186  if (numberOfHits < 2) {
187  return true;
188  }
189 
190  for (typename JSuperFrameClone2D<JHit_t>::const_iterator i = clone.begin(); i != clone.end(); ++i) {
191 
192  if (this->getTimeDifference(hit,*(i->get())) <= TMaxLocal_ns) {
193 
194  int n = 1;
195 
196  for (typename JSuperFrameClone2D<JHit_t>::const_iterator j = clone.begin(); j != clone.end(); ++j) {
197 
198  if (i != j) {
199 
200  if (this->getTimeDifference(hit,*(j->get())) <= TMaxLocal_ns) {
201 
202  if (getDot(i->getDirection(), j->getDirection()) >= ctMin) {
203 
204  if (++n >= numberOfHits) {
205  return true;
206  }
207  }
208  }
209  }
210  }
211  }
212  }
213 
214  return false;
215  }
std::vector< value_type >::const_iterator const_iterator
double getDot(const JNeutrinoDirection &first, const JNeutrinoDirection &second)
Dot product.
Definition: JAstronomy.hh:409
double ctMin
minimal cosine space angle between PMT axes
int numberOfHits
minimal number of hits
const int n
Definition: JPolint.hh:697
double getTimeDifference(const JDAQChronometer &first, const JDAQChronometer &second)
Get time difference between two chronometers.
double TMaxLocal_ns
maximal time difference [ns]
int j
Definition: JPolint.hh:703
void JTRIGGER::JL2Parameters::reset ( )
inlineinherited

Reset L2 parameters.

Definition at line 72 of file JTrigger/JTriggerParameters.hh.

73  {
74  numberOfHits = 0;
75  TMaxLocal_ns = 0.0;
76  ctMin = 1.0;
77  }
double ctMin
minimal cosine space angle between PMT axes
int numberOfHits
minimal number of hits
double TMaxLocal_ns
maximal time difference [ns]
bool JTRIGGER::JL2Parameters::equals ( const JL2Parameters parameters) const
inlineinherited

Equality.

Parameters
parametersL2 parameters
Returns
true if equals; else false

Definition at line 86 of file JTrigger/JTriggerParameters.hh.

87  {
88  return (this->numberOfHits == parameters.numberOfHits &&
89  this->TMaxLocal_ns == parameters.TMaxLocal_ns &&
90  this->ctMin == parameters.ctMin);
91  }
double ctMin
minimal cosine space angle between PMT axes
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
int numberOfHits
minimal number of hits
double TMaxLocal_ns
maximal time difference [ns]
bool JTRIGGER::JL2Parameters::is_valid ( ) const
inlineinherited

Check validity.

Returns
true if not-equal to default value; else false

Definition at line 99 of file JTrigger/JTriggerParameters.hh.

100  {
101  return !this->equals(JL2Parameters());
102  }
bool equals(const JL2Parameters &parameters) const
Equality.
JL2Parameters()
Default constructor.
JTRIGGER::JL2Parameters::ClassDef ( JL2Parameters  ,
 
)
inherited
template<class JHit_t>
template<class JOutput_t >
void JTRIGGER::JBuildL1< JHit_t >::operator() ( typename JSuperFrame2D< JHit_t >::const_iterator  __begin,
typename JSuperFrame2D< JHit_t >::const_iterator  __end,
JOutput_t  out 
) const
inlineinherited

Build hits from set of frames with calibrated data.

The output data are time sorted.

Parameters
__beginbegin of input L0 data
__endend of input L0 data
outoutput L1 data

Definition at line 133 of file JBuildL1.hh.

136  {
137  (*this)(JSuperFrame1D<JHit_t>::multiplex(__begin, __end), out);
138  }
static JSuperFrame1D< JElement_t, JAllocator_t > multiplex
Multiplexer.
template<class JHit_t>
template<class JOutput_t >
void JTRIGGER::JBuildL1< JHit_t >::operator() ( const JSuperFrame1D< JHit_t > &  input,
JOutput_t  out 
) const
inlineinherited

Build hits from calibrated data.

The output data are time sorted.

Parameters
inputinput L0 data
outoutput L1 data

Definition at line 150 of file JBuildL1.hh.

151  {
152  int n = input.size();
153 
154  for (typename JSuperFrame1D<JHit_t>::const_iterator q = input.begin(), p = q++; n != 0; ++q, --n) {
155 
156  if (this->getTimeDifference(*p,*q) <= TMax_ns) {
157 
158  *out = *p;
159  ++out;
160 
161  if (combine) {
162  for (++q, --n; this->getTimeDifference(*p,*q) <= TMax_ns; ++q, --n) {}
163  }
164  }
165 
166  p = q;
167  }
168  }
1-dimensional frame with time calibrated data from one optical module.
const int n
Definition: JPolint.hh:697
double getTimeDifference(const JDAQChronometer &first, const JDAQChronometer &second)
Get time difference between two chronometers.
void JTRIGGER::JBuildHelper< JBuildL1< JHit_t > >::operator() ( const JDAQTimeslice timeslice,
const JModuleRouter router,
JOutput_t  out 
) const
inlineinherited

Build hits from uncalibrated DAQ data.

The time calibration is applied. Note that the output data are not time sorted.

Parameters
timesliceDAQ time slice
routermodule router
outoutput data

Definition at line 57 of file JBuildHelper.hh.

60  {
61  for (JDAQTimeslice::const_iterator i = timeslice.begin(); i != timeslice.end(); ++i) {
62  if (router.hasModule(i->getModuleID())) {
63  static_cast<const JBuild_t&>(*this)(*i, router.getModule(i->getModuleID()), out);
64  }
65  }
66  }
const JModule & getModule(const JObjectID &id) const
Get module parameters.
bool hasModule(const JObjectID &id) const
Has module.
void JTRIGGER::JBuildHelper< JBuildL1< JHit_t > >::operator() ( const JDAQEvent event,
const JModuleRouter router,
const bool  snapshot,
JOutput_t  out 
) const
inlineinherited

Build hits from uncalibrated DAQ data.

The time calibration is applied. Note that the output data are not time sorted.

Parameters
eventDAQ event
routermodule router
snapshotuse shapshot hits (else use triggered hits)
outoutput data

Definition at line 81 of file JBuildHelper.hh.

85  {
86  static_cast<const JBuild_t&>(*this)(JDAQTimeslice(event, snapshot), router, out);
87  }
Data time slice.
void JTRIGGER::JBuildHelper< JBuildL1< JHit_t > >::operator() ( const JDAQEvent event,
const JModuleRouter router,
JOutput_t  out 
) const
inlineinherited

Build hits from uncalibrated DAQ data.

The snapshot data of the DAQ event are used. The time calibration is applied. Note that the output data are not time sorted.

Parameters
eventDAQ event
routermodule router
outoutput data

Definition at line 102 of file JBuildHelper.hh.

105  {
106  static_cast<const JBuild_t&>(*this)(JDAQTimeslice(event, true), router, out);
107  }
Data time slice.
template<class JHit_t>
void JTRIGGER::JBuild< JHit_t >::setPreprocessor ( const JPreprocessor::JOption_t  option,
const match_type match 
)
inlineinherited

Set pre-processor of consecutive hits.

Parameters
optionoption
matchmatch criterion

Definition at line 59 of file JBuild.hh.

60  {
61  this->option = option;
62  this->match.reset(match.clone());
63  }
JPreprocessor::JOption_t option
pre-processor option
Definition: JBuild.hh:115
JLANG::JSharedPointer< match_type > match
pre-processor match criterion
Definition: JBuild.hh:116
virtual void reset() override
Reset pointer.
template<class JHit_t>
void JTRIGGER::JBuild< JHit_t >::resetPreprocessor ( )
inlineinherited

Reset pre-processor of consecutive hits.

Definition at line 69 of file JBuild.hh.

70  {
72  this->match.reset();
73  }
JPreprocessor::JOption_t option
pre-processor option
Definition: JBuild.hh:115
JLANG::JSharedPointer< match_type > match
pre-processor match criterion
Definition: JBuild.hh:116
virtual void reset() override
Reset pointer.
template<class JHit_t>
void JTRIGGER::JBuild< JHit_t >::setDAQHitSelector ( const JDAQHitSelector selector)
inlineinherited

Set DAQ hit selector.

Parameters
selectorDAQ hit selector

Definition at line 81 of file JBuild.hh.

82  {
83  this->selector.reset(selector.clone());
84  }
virtual clone_type clone() const override
Get clone of this object.
Definition: JClonable.hh:69
template<class JHit_t>
void JTRIGGER::JBuild< JHit_t >::resetDAQHitSelector ( )
inlineinherited

Reset DAQ hit selector.

Definition at line 90 of file JBuild.hh.

91  {
92  this->selector.reset(new JDAQHitDefaultSelector());
93  }
JLANG::JSharedPointer< selector_type > selector
DAQ hit selector.
Definition: JBuild.hh:117
Default class to select DAQ hits.
template<class JHit_t>
JSuperFrame2D<JHit_t>& JTRIGGER::JBuild< JHit_t >::demultiplex ( const JDAQSuperFrame input,
const JModule module 
) const
inlineinherited

Demultiplex and pre-process DAQ super frame.

Parameters
inputDAQ super frame
modulemodule data
Returns
2D super frame

Definition at line 103 of file JBuild.hh.

105  {
107 
108  if (match.is_valid()) {
109  buffer.preprocess(option, *match);
110  }
111 
112  return buffer;
113  }
JPreprocessor::JOption_t option
pre-processor option
Definition: JBuild.hh:115
JLANG::JSharedPointer< selector_type > selector
DAQ hit selector.
Definition: JBuild.hh:117
JLANG::JSharedPointer< match_type > match
pre-processor match criterion
Definition: JBuild.hh:116
bool is_valid() const
Check validity of pointer.
void preprocess(JPreprocessor::JOption_t option, const match_type &match)
Pre-process data.
static JSuperFrame2D< JElement_t, JAllocator_t > demultiplex
Demultiplexer.
2-dimensional frame with time calibrated data from one optical module.
void JTRIGGER::JBuildHelper< JBuildL2< JHit_t > >::operator() ( const JDAQTimeslice timeslice,
const JModuleRouter router,
JOutput_t  out 
) const
inlineinherited

Build hits from uncalibrated DAQ data.

The time calibration is applied. Note that the output data are not time sorted.

Parameters
timesliceDAQ time slice
routermodule router
outoutput data

Definition at line 57 of file JBuildHelper.hh.

60  {
61  for (JDAQTimeslice::const_iterator i = timeslice.begin(); i != timeslice.end(); ++i) {
62  if (router.hasModule(i->getModuleID())) {
63  static_cast<const JBuild_t&>(*this)(*i, router.getModule(i->getModuleID()), out);
64  }
65  }
66  }
const JModule & getModule(const JObjectID &id) const
Get module parameters.
bool hasModule(const JObjectID &id) const
Has module.
void JTRIGGER::JBuildHelper< JBuildL2< JHit_t > >::operator() ( const JDAQEvent event,
const JModuleRouter router,
const bool  snapshot,
JOutput_t  out 
) const
inlineinherited

Build hits from uncalibrated DAQ data.

The time calibration is applied. Note that the output data are not time sorted.

Parameters
eventDAQ event
routermodule router
snapshotuse shapshot hits (else use triggered hits)
outoutput data

Definition at line 81 of file JBuildHelper.hh.

85  {
86  static_cast<const JBuild_t&>(*this)(JDAQTimeslice(event, snapshot), router, out);
87  }
Data time slice.
void JTRIGGER::JBuildHelper< JBuildL2< JHit_t > >::operator() ( const JDAQEvent event,
const JModuleRouter router,
JOutput_t  out 
) const
inlineinherited

Build hits from uncalibrated DAQ data.

The snapshot data of the DAQ event are used. The time calibration is applied. Note that the output data are not time sorted.

Parameters
eventDAQ event
routermodule router
outoutput data

Definition at line 102 of file JBuildHelper.hh.

105  {
106  static_cast<const JBuild_t&>(*this)(JDAQTimeslice(event, true), router, out);
107  }
Data time slice.

Member Data Documentation

template<class JHit_t>
std::vector<JHit_t> JTRIGGER::JBuildL2< JHit_t >::bufferL1
mutableprotected

Definition at line 218 of file JBuildL2.hh.

int JTRIGGER::JL2Parameters::numberOfHits
inherited

minimal number of hits

Definition at line 107 of file JTrigger/JTriggerParameters.hh.

double JTRIGGER::JL2Parameters::TMaxLocal_ns
inherited

maximal time difference [ns]

Definition at line 108 of file JTrigger/JTriggerParameters.hh.

double JTRIGGER::JL2Parameters::ctMin
inherited

minimal cosine space angle between PMT axes

Definition at line 109 of file JTrigger/JTriggerParameters.hh.

double JTRIGGER::JBuildL1Parameters::TMax_ns
inherited

Definition at line 74 of file JBuildL1.hh.

bool JTRIGGER::JBuildL1Parameters::combine
inherited

Definition at line 75 of file JBuildL1.hh.

template<class JHit_t>
JPreprocessor::JOption_t JTRIGGER::JBuild< JHit_t >::option
inherited

pre-processor option

Definition at line 115 of file JBuild.hh.

template<class JHit_t>
JLANG::JSharedPointer<match_type> JTRIGGER::JBuild< JHit_t >::match
inherited

pre-processor match criterion

Definition at line 116 of file JBuild.hh.

template<class JHit_t>
JLANG::JSharedPointer<selector_type> JTRIGGER::JBuild< JHit_t >::selector
inherited

DAQ hit selector.

Definition at line 117 of file JBuild.hh.


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