MINT2
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Permutator Class Reference

#include <Permutator.h>

Inheritance diagram for Permutator:
MINT::PolymorphVector< Permutation >

Public Member Functions

 Permutator ()
 
 Permutator (const DalitzEventPattern &pat)
 
void setPattern (const DalitzEventPattern &pat)
 
void print (std::ostream &os=std::cout) const
 
- Public Member Functions inherited from MINT::PolymorphVector< Permutation >
 PolymorphVector ()
 
 PolymorphVector (unsigned int N)
 
 PolymorphVector (unsigned int N, const Permutation &c)
 
 PolymorphVector (const PolymorphVector &other)
 
 PolymorphVector (const typename std::vector< Permutation > &other)
 
virtual ~PolymorphVector ()
 
std::vector< Permutation > & theVector ()
 
const std::vector< Permutation > & theVector () const
 
Permutationoperator[] (unsigned int i)
 
const Permutationoperator[] (unsigned int i) const
 
Permutationat (unsigned int i)
 
const Permutationat (unsigned int i) const
 
std::vector< Permutation >::iterator begin ()
 
std::vector< Permutation >::const_iterator begin () const
 
std::vector< Permutation >::iterator end ()
 
std::vector< Permutation >::const_iterator end () const
 
std::vector< Permutation >::iterator find (const Permutation &c)
 
std::vector< Permutation >::const_iterator find (const Permutation &c) const
 
Permutationfront ()
 
const Permutationfront () const
 
Permutationback ()
 
const Permutationback () const
 
unsigned int size () const
 
bool empty () const
 
void push_back (const Permutation &c)
 
void pop_back ()
 
void erase (typename std::vector< Permutation >::iterator pos)
 
void erase (typename std::vector< Permutation >::iterator first, typename std::vector< Permutation >::iterator last)
 
PolymorphVector< Permutation > & operator= (const PolymorphVector< Permutation > &other)
 
void clear ()
 
void resize (unsigned int N)
 
void resize (unsigned int N, const Permutation &c)
 
 operator const typename std::vector< Permutation > & () const
 
 operator typename std::vector< Permutation > & ()
 
bool operator== (const MINT::PolymorphVector< Permutation > &v2) const
 
bool operator!= (const MINT::PolymorphVector< Permutation > &v2) const
 
bool operator< (const MINT::PolymorphVector< Permutation > &v2) const
 
bool operator> (const MINT::PolymorphVector< Permutation > &v2) const
 

Private Member Functions

int findAllPermutations ()
 

Private Attributes

DalitzEventPattern _pat
 

Additional Inherited Members

- Protected Attributes inherited from MINT::PolymorphVector< Permutation >
std::vector< Permutation_vec
 

Detailed Description

Definition at line 13 of file Permutator.h.

Constructor & Destructor Documentation

◆ Permutator() [1/2]

Permutator::Permutator ( )

Definition at line 9 of file Permutator.cpp.

11  , _pat(){
12  Permutation p(1);
13  this->push_back(p);
14 }
DalitzEventPattern _pat
Definition: Permutator.h:14
void push_back(const Permutation &c)

◆ Permutator() [2/2]

Permutator::Permutator ( const DalitzEventPattern pat)

Definition at line 16 of file Permutator.cpp.

18  , _pat(pat)
19 {
21 }
DalitzEventPattern _pat
Definition: Permutator.h:14
int findAllPermutations()
Definition: Permutator.cpp:29

Member Function Documentation

◆ findAllPermutations()

int Permutator::findAllPermutations ( )
private

Definition at line 29 of file Permutator.cpp.

29  {
30 
31  this->clear();
32  Permutation p(_pat.size());
33  p.makeUnity();
34  this->push_back(p);
35 
36  for(unsigned int i=0; i < _pat.size()-1; i++){
37  for(unsigned int j=i+1; j < _pat.size(); j++){
38  if(_pat[i] == _pat[j]){
39  unsigned int n = this->size();
40  for(unsigned int k = 0; k < n; k++){
41  Permutation ptemp( (*this)[k] );
42  ptemp.swap(i,j);
43  this->push_back(ptemp);
44  }
45  }
46  }
47  }
48 
49  sort(this->begin(), this->end());
50 
51  std::vector<Permutation>::iterator
52  lastUnique = unique(this->begin(), this->end());
53 
54  this->erase(lastUnique, this->end());
55 
56  return this->size();
57 }
DalitzEventPattern _pat
Definition: Permutator.h:14
std::vector< Permutation >::iterator end()
void push_back(const Permutation &c)
void makeUnity()
Definition: Permutation.cpp:42
void erase(typename std::vector< Permutation >::iterator pos)
std::vector< Permutation >::iterator begin()
unsigned int size() const

◆ print()

void Permutator::print ( std::ostream &  os = std::cout) const

Definition at line 59 of file Permutator.cpp.

59  {
60  for(unsigned int i=0; i< this->size(); i++){
61  os << " " << i << ")\n" << (*this)[i] << endl;
62  }
63 }

◆ setPattern()

void Permutator::setPattern ( const DalitzEventPattern pat)

Definition at line 23 of file Permutator.cpp.

23  {
24  _pat = pat;
25  this->clear();
27 }
DalitzEventPattern _pat
Definition: Permutator.h:14
int findAllPermutations()
Definition: Permutator.cpp:29

Member Data Documentation

◆ _pat

DalitzEventPattern Permutator::_pat
private

Definition at line 14 of file Permutator.h.


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