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

#include <DalitzCoordinate.h>

Inheritance diagram for DalitzCoordinate:
MINT::PolymorphVector< int >

Public Member Functions

 DalitzCoordinate ()
 
 DalitzCoordinate (int i, int j)
 
 DalitzCoordinate (int i, int j, int k)
 
 DalitzCoordinate (const MINT::PolymorphVector< int > &other)
 
 DalitzCoordinate (const DalitzCoordinate &other)
 
DalitzCoordinateoperator= (const DalitzCoordinate &other)
 
virtual ~DalitzCoordinate ()
 
void setMin (double min)
 
void setMax (double max)
 
void setMinMax (double min, double max)
 
void setVal (double val)
 
double min () const
 
double max () const
 
double val () const
 
bool I_am_Consecutive () const
 
DalitzCoordinate mapMe (const Permutation &perm) const
 
std::vector< DalitzCoordinatesplit (int n) const
 
void print (std::ostream &os=std::cout) const
 
const std::string & name () const
 
std::string nameFileSave () const
 
bool sameIndices (const DalitzCoordinate &rhs) const
 
bool operator== (const DalitzCoordinate &rhs) const
 
bool operator!= (const DalitzCoordinate &rhs) const
 
const DalitzCoordKeymyKey () const
 
- Public Member Functions inherited from MINT::PolymorphVector< int >
 PolymorphVector ()
 
 PolymorphVector (unsigned int N)
 
 PolymorphVector (unsigned int N, const int &c)
 
 PolymorphVector (const PolymorphVector &other)
 
 PolymorphVector (const typename std::vector< int > &other)
 
virtual ~PolymorphVector ()
 
std::vector< int > & theVector ()
 
const std::vector< int > & theVector () const
 
int & operator[] (unsigned int i)
 
const int & operator[] (unsigned int i) const
 
int & at (unsigned int i)
 
const int & at (unsigned int i) const
 
std::vector< int >::iterator begin ()
 
std::vector< int >::const_iterator begin () const
 
std::vector< int >::iterator end ()
 
std::vector< int >::const_iterator end () const
 
std::vector< int >::iterator find (const int &c)
 
std::vector< int >::const_iterator find (const int &c) const
 
int & front ()
 
const int & front () const
 
int & back ()
 
const int & back () const
 
unsigned int size () const
 
bool empty () const
 
void push_back (const int &c)
 
void pop_back ()
 
void erase (typename std::vector< int >::iterator pos)
 
void erase (typename std::vector< int >::iterator first, typename std::vector< int >::iterator last)
 
PolymorphVector< int > & operator= (const PolymorphVector< int > &other)
 
void clear ()
 
void resize (unsigned int N)
 
void resize (unsigned int N, const int &c)
 
 operator const typename std::vector< int > & () const
 
 operator typename std::vector< int > & ()
 
bool operator== (const MINT::PolymorphVector< int > &v2) const
 
bool operator!= (const MINT::PolymorphVector< int > &v2) const
 
bool operator< (const MINT::PolymorphVector< int > &v2) const
 
bool operator> (const MINT::PolymorphVector< int > &v2) const
 

Private Member Functions

std::string & makeName ()
 

Private Attributes

double _mi
 
double _ma
 
double _val
 
std::string _name
 

Additional Inherited Members

- Protected Attributes inherited from MINT::PolymorphVector< int >
std::vector< int > _vec
 

Detailed Description

Definition at line 16 of file DalitzCoordinate.h.

Constructor & Destructor Documentation

◆ DalitzCoordinate() [1/5]

DalitzCoordinate::DalitzCoordinate ( )

Definition at line 18 of file DalitzCoordinate.cpp.

20  , _mi(-9999)
21  , _ma(-9999)
22  , _val(-9999)
23 {
24  (*this)[0] = -9999;
25  makeName();
26 }
std::string & makeName()

◆ DalitzCoordinate() [2/5]

DalitzCoordinate::DalitzCoordinate ( int  i,
int  j 
)

Definition at line 28 of file DalitzCoordinate.cpp.

30  , _mi(-9999)
31  , _ma(-9999)
32  , _val(-9999)
33 {
34  (*this)[0] = i;
35  (*this)[1] = j;
36  sort(this->begin(), this->end());
37  makeName();
38 }
std::vector< int >::iterator end()
std::vector< int >::iterator begin()
std::string & makeName()

◆ DalitzCoordinate() [3/5]

DalitzCoordinate::DalitzCoordinate ( int  i,
int  j,
int  k 
)

Definition at line 39 of file DalitzCoordinate.cpp.

41  , _mi(-9999)
42  , _ma(-9999)
43  , _val(-9999)
44 {
45  (*this)[0] = i;
46  (*this)[1] = j;
47  (*this)[2] = k;
48  sort(this->begin(), this->end());
49  makeName();
50 }
std::vector< int >::iterator end()
std::vector< int >::iterator begin()
std::string & makeName()

◆ DalitzCoordinate() [4/5]

DalitzCoordinate::DalitzCoordinate ( const MINT::PolymorphVector< int > &  other)

Definition at line 52 of file DalitzCoordinate.cpp.

54  , _mi(-9999)
55  , _ma(-9999)
56  , _val(-9999)
57 {
58  sort(this->begin(), this->end());
59  makeName();
60 }
std::vector< int >::iterator end()
std::vector< int >::iterator begin()
std::string & makeName()

◆ DalitzCoordinate() [5/5]

DalitzCoordinate::DalitzCoordinate ( const DalitzCoordinate other)

Definition at line 61 of file DalitzCoordinate.cpp.

63  , _mi(other._mi)
64  , _ma(other._ma)
65  , _val(other._val)
66  , _name(other._name)
67 {
68 }

◆ ~DalitzCoordinate()

virtual DalitzCoordinate::~DalitzCoordinate ( )
inlinevirtual

Definition at line 31 of file DalitzCoordinate.h.

31 {}

Member Function Documentation

◆ I_am_Consecutive()

bool DalitzCoordinate::I_am_Consecutive ( ) const

Definition at line 10 of file DalitzCoordinate.cpp.

10  {
11  if(this->size() <=1) return true;
12  for(unsigned int i=1; i< this->size(); i++){
13  if( (*this)[i] != (*this)[i-1] + 1) return false;
14  }
15  return true;
16 }
unsigned int size() const

◆ makeName()

std::string & DalitzCoordinate::makeName ( )
private

Definition at line 128 of file DalitzCoordinate.cpp.

128  {
129  std::stringstream strm;
130  strm << "sij(";
131  for(unsigned int i=0; i < this->size(); i++){
132  if(i > 0) strm << ",";
133  strm << (*this)[i];
134  }
135  strm << ")";
136  std::string ing;
137  strm >> ing;
138  _name = ing;
139  return _name;
140 }
unsigned int size() const

◆ mapMe()

DalitzCoordinate DalitzCoordinate::mapMe ( const Permutation perm) const

Definition at line 81 of file DalitzCoordinate.cpp.

81  {
82  /*
83  cout << "DalitzCoordinate::mapMe of " << (*this)
84  << " called with\n " << perm << endl;
85  */
86  DalitzCoordinate mapped(*this);
87 
88  for(unsigned int i=0; i< this->size(); i++){
89  // cout << "mapping : " << (*this)[i] << endl;
90  mapped[i] = perm[ (*this)[i] ];
91  // cout << "mapped it to " << mapped[i] << endl;
92  }
93  sort(mapped.begin(), mapped.end());
94  return mapped;
95 }
unsigned int size() const

◆ max()

double DalitzCoordinate::max ( ) const
inline

Definition at line 40 of file DalitzCoordinate.h.

40 {return _ma;}

◆ min()

double DalitzCoordinate::min ( ) const
inline

Definition at line 39 of file DalitzCoordinate.h.

39 {return _mi;}

◆ myKey()

const DalitzCoordKey& DalitzCoordinate::myKey ( ) const
inline

Definition at line 57 of file DalitzCoordinate.h.

57 {return *this;}

◆ name()

const std::string & DalitzCoordinate::name ( ) const

Definition at line 124 of file DalitzCoordinate.cpp.

124  {
125  return _name;
126 }

◆ nameFileSave()

std::string DalitzCoordinate::nameFileSave ( ) const

Definition at line 141 of file DalitzCoordinate.cpp.

141  {
142  std::stringstream strm;
143  strm << "s";
144  for(unsigned int i=0; i < this->size(); i++){
145  strm << (*this)[i];
146  }
147  std::string ing;
148  strm >> ing;
149  return ing;
150 }
unsigned int size() const

◆ operator!=()

bool DalitzCoordinate::operator!= ( const DalitzCoordinate rhs) const

Definition at line 181 of file DalitzCoordinate.cpp.

181  {
182  return ! ((*this) == rhs);
183 }

◆ operator=()

DalitzCoordinate & DalitzCoordinate::operator= ( const DalitzCoordinate other)

Definition at line 70 of file DalitzCoordinate.cpp.

71 {
72  this->resize(other.size());
73  for(unsigned int i=0; i< other.size(); i++) (*this)[i] = other[i];
74  _mi = other._mi;
75  _ma = other._ma;
76  _val = other._val;
77  _name = other._name;
78  return *this;
79 }
void resize(unsigned int N)
unsigned int size() const

◆ operator==()

bool DalitzCoordinate::operator== ( const DalitzCoordinate rhs) const

Definition at line 168 of file DalitzCoordinate.cpp.

168  {
169 
170  if(this->size() != rhs.size()) return false;
171  for(unsigned int i=0; i< size(); i++){
172  if((*this)[i] != rhs[i]) return false;
173  }
174  if(this->min() != rhs.min()) return false;
175  if(this->max() != rhs.max()) return false;
176  if(this->val() != rhs.val()) return false;
177 
178  return true;
179 }
double min() const
double max() const
unsigned int size() const
double val() const

◆ print()

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

Definition at line 152 of file DalitzCoordinate.cpp.

152  {
153  os << this->name();
154  os << ": val = " << this->val()
155  << ", mi = " << this->min()
156  << ", ma = " << this->max();
157  return;
158 }
double min() const
double max() const
double val() const
const std::string & name() const

◆ sameIndices()

bool DalitzCoordinate::sameIndices ( const DalitzCoordinate rhs) const

Definition at line 159 of file DalitzCoordinate.cpp.

159  {
160  if(this->size() != rhs.size()) return false;
161  for(unsigned int i=0; i< size(); i++){
162  if((*this)[i] != rhs[i]) return false;
163  }
164 
165  return true;
166 }
unsigned int size() const

◆ setMax()

void DalitzCoordinate::setMax ( double  max)
inline

Definition at line 34 of file DalitzCoordinate.h.

34 {_ma = max;}
double max() const

◆ setMin()

void DalitzCoordinate::setMin ( double  min)
inline

Definition at line 33 of file DalitzCoordinate.h.

33 {_mi = min;}
double min() const

◆ setMinMax()

void DalitzCoordinate::setMinMax ( double  min,
double  max 
)
inline

Definition at line 35 of file DalitzCoordinate.h.

35  {
36  setMin(min); setMax(max);}
double min() const
void setMax(double max)
double max() const
void setMin(double min)

◆ setVal()

void DalitzCoordinate::setVal ( double  val)
inline

Definition at line 37 of file DalitzCoordinate.h.

37 {_val = val;}
double val() const

◆ split()

std::vector< DalitzCoordinate > DalitzCoordinate::split ( int  n) const

Definition at line 98 of file DalitzCoordinate.cpp.

98  {
99 
100  bool dbThis=false;
101 
102  std::vector<DalitzCoordinate> cList;
103  cList.clear();
104 
105  double newWidth = (this->max() - this->min()) /((double) n);
106  if(dbThis){
107  cout << " DalitzCoordinate::split " << *this << endl;
108  cout << "\t Currently: mi = " << min()
109  << " ma = " << max() << "\n\t";
110  }
111  for(int l=0; l < n; l++){
112  DalitzCoordinate c(*this);
113  double mi = this->min() + l*newWidth;
114  double ma = this->min() + (l+1.0)*newWidth;
115  if(dbThis) cout << ", ( " << mi << ", " << ma << " )";
116  c.setMinMax(mi, ma);
117  cList.push_back(c);
118  }
119  if(dbThis) cout << endl;
120  return cList;
121 }
double min() const
double max() const

◆ val()

double DalitzCoordinate::val ( ) const
inline

Definition at line 41 of file DalitzCoordinate.h.

41 {return _val;}

Member Data Documentation

◆ _ma

double DalitzCoordinate::_ma
private

Definition at line 17 of file DalitzCoordinate.h.

◆ _mi

double DalitzCoordinate::_mi
private

Definition at line 17 of file DalitzCoordinate.h.

◆ _name

std::string DalitzCoordinate::_name
private

Definition at line 18 of file DalitzCoordinate.h.

◆ _val

double DalitzCoordinate::_val
private

Definition at line 17 of file DalitzCoordinate.h.


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