1 #ifndef __JTRIGGER__JALGORITHM__
2 #define __JTRIGGER__JALGORITHM__
16 namespace JPP {
using namespace JTRIGGER; }
42 template<
class JHitIterator_t,
class JMatch_t>
43 inline JHitIterator_t operator()(JHitIterator_t __begin,
45 const JMatch_t& match,
46 const int Nmin = 1)
const
48 return (*
this)(__begin,
std::distance(__begin,__end), match,
Nmin,
typename std::iterator_traits<JHitIterator_t>::iterator_category());
64 template<
class JHitIterator_t,
class JComparator_t,
class JMatch_t>
65 inline JHitIterator_t operator()(JHitIterator_t __begin,
67 const JComparator_t& comparator,
68 const JMatch_t& match)
const
70 if (__begin != __end) {
72 std::sort(__begin, __end, comparator);
74 JHitIterator_t
root = __begin;
76 return std::partition(++__begin, __end,
JBind2nd(match, *root));
95 template<
class JHitIterator_t,
class JMatch_t>
96 inline JHitIterator_t operator()(JHitIterator_t buffer,
98 const JMatch_t& match,
100 std::random_access_iterator_tag tag)
const
117 for (i = 0; i !=
N; ++i) {
118 for (j = i; ++j !=
N; ) {
119 if (match(buffer[i], buffer[j])) {
133 int M = (
count[0] >= Nmin ? 1 : 0);
137 for (i = 1; i !=
n; ++i) {
141 if (
count[i] >= Nmin) {
162 swap(buffer[j], buffer[n]);
167 for (i = 0; i != n &&
count[
n] != 1; ++i) {
168 if (match(buffer[i], buffer[n])) {
188 static const struct {
206 template<
class JHitIterator_t,
class JMatch_t>
207 inline JHitIterator_t operator()(JHitIterator_t __begin,
208 JHitIterator_t __end,
209 const JMatch_t& match)
const
211 return (*
this)(__begin,
std::distance(__begin,__end), match,
typename std::iterator_traits<JHitIterator_t>::iterator_category());
224 template<
class JHitIterator_t,
class JMatch_t>
225 inline JHitIterator_t operator()(JHitIterator_t buffer,
227 const JMatch_t& match,
228 std::random_access_iterator_tag tag)
const
244 for (i = 0; i !=
N; ++i) {
245 for (j = 0; j != i; ++
j) {
246 if (match(buffer[i], buffer[j])) {
256 for (
int n = 0; ; ++
n) {
260 for (i = j; ++i !=
N; ) {
274 swap(buffer[j], buffer[n]);
279 for (i = n; ++i !=
N; ) {
280 if (match(buffer[i], buffer[n])) {
300 static const struct {
321 template<
class JHitIterator_t,
class JMatch_t>
322 inline JHitIterator_t operator()(JHitIterator_t __begin,
323 JHitIterator_t __end,
324 const JMatch_t& match)
const
326 return (*
this)(__begin,
std::distance(__begin,__end), match,
typename std::iterator_traits<JHitIterator_t>::iterator_category());
339 template<
class JHitIterator_t,
class JMatch_t>
340 inline JHitIterator_t operator()(JHitIterator_t buffer,
342 const JMatch_t& match,
343 std::random_access_iterator_tag tag)
const
355 for (i = 0; i !=
N; ++i) {
356 weight[i] = buffer[i].getW();
359 for (i = 0; i !=
N; ++i) {
360 for (j = i; ++j !=
N; ) {
361 if (match(buffer[i], buffer[j])) {
380 for (i = 1; i !=
n; ++i) {
399 swap(buffer[j], buffer[n]);
404 for (i = 0; i != n &&
weight[
n] > buffer[
n].getW(); ++i) {
405 if (match(buffer[i], buffer[n])) {
432 template<
class JHit_t>
435 return first.getW() > second.getW();
449 template<
class JHit_t>
452 return first.getT() < second.getT();
static struct JTRIGGER::@74 clusterize
Anonymous structure for clustering of hits.
JBinder2nd< JHit_t > JBind2nd(const JMatch< JHit_t > &match, const JHit_t &second)
Auxiliary method to create JBinder2nd object.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
then JPlot1D f $WORKDIR postfit[prefit\] root
static struct JTRIGGER::@75 reverse_clusterize
Anonymous structure for reverse clustering of hits.
static struct JTRIGGER::@76 clusterizeWeight
Anonymous struct for weighed clustering of hits.
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
bool timeSorter(const JHit_t &first, const JHit_t &second)
Compare two hits by weight.
bool weightSorter(const JHit_t &first, const JHit_t &second)
Compare two hits by weight.
alias put_queue eval echo n
then usage $script[input file[working directory[option]]] nWhere option can be N
std::vector< double > weight