9 WELCOME_LOG <<
"Hello from the HyperPointSet() Constructor";
25 _dimension(point.getDimension())
28 for (
int i = 0; i < npoints; i++)
push_back(point);
36 _dimension(point.getDimension())
44 _dimension(point1.getDimension())
53 _dimension(point1.getDimension())
66 if (printError)
ERROR_LOG <<
"This HyperPoint is NOT compatible with this HyperPointSet";
103 for(
unsigned i = 0; i <
size(); i++){
115 for(
unsigned i = 0; i <
size(); i++){
129 int nPoints =
size();
133 ERROR_LOG <<
"Trying to perform the Gram Schmidt Process on a set of L.D. vectors";
138 for (
int i = 1; i < nPoints; i++){
140 for (
int j = 0; j < i; j++){
141 nextPoint = nextPoint - orthogonalPoints.
at(j).
project(
at(i));
147 return orthogonalPoints;
162 for(
unsigned i = 0; i <
size(); i++){
186 hyperPointSet.
push_back(currentHyperPoint);
188 for(
unsigned int i = 1; i <
size(); i++){
189 if (
_points.at(i) != currentHyperPoint ) {
190 currentHyperPoint =
_points.at(i);
191 hyperPointSet.
push_back(currentHyperPoint);
196 *
this = hyperPointSet;
205 ERROR_LOG <<
"Removing all duplicates from the HyperPointSet - did you remember to call sort() first?!?";
209 for (
unsigned int i = 0; i < other.
size(); i++){
222 for (
unsigned evt = 0; evt <
size(); evt++){
227 double meani = statsi.
mean();
228 double meanj = statsj.
mean();
229 double widthi = statsi.
width();
230 double widthj = statsj.
width();
232 double correlation = 0.0;
234 for (
unsigned evt = 0; evt <
size(); evt++){
235 correlation += (
at(evt).
at(i) - meani)*(
at(evt).
at(j) - meanj);
238 correlation = correlation / (widthi * widthj *
size());
250 for (
unsigned evt = 0; evt <
size(); evt++){
255 double meani = statsi.
mean();
256 double meanj = statsj.
mean();
258 double correlation = 0.0;
260 for (
unsigned evt = 0; evt <
size(); evt++){
261 correlation += (
at(evt).
at(i) - meani)*(
at(evt).
at(j) - meanj);
264 correlation = correlation /
size();
303 os <<
"---------- HyperPointSet ------------" << std::endl;
304 for (
unsigned i = 0; i <
size(); i++){
305 os <<
"HyperPoint " << i <<
": ";
316 TFile* file =
new TFile(path,
"RECREATE");
319 ERROR_LOG <<
"Cannot open file at " << path;
334 TTree* tree =
new TTree(
"HyperPointSet",
"HyperPointSet");
341 std::vector<double> values;
342 std::vector<double> weights;
344 tree->Branch(
"values" , &values );
345 tree->Branch(
"weights", &weights);
347 for(
unsigned i = 0; i <
size(); i++ ){
353 tree->ResetBranchAddresses();
364 TFile* file =
new TFile(path,
"READ");
366 ERROR_LOG <<
"Cannot open file at " << path;
370 TTree* tree = (TTree*)file->Get(
"HyperPointSet");
376 std::vector<double>* values = 0;
377 std::vector<double>* weights = 0;
379 tree->SetBranchAddress(
"values" , &values );
380 tree->SetBranchAddress(
"weights", &weights);
382 int nEntries = tree->GetEntries();
384 for(
int i = 0; i < nEntries; i++ ){
388 if (
int(values->size()) !=
_dimension)
ERROR_LOG <<
"You are loading HyperPoints that do not have the correct dimensionality for this HyperPointSet";
391 for(
unsigned w = 0; w < weights->size(); w++){
397 tree->ResetBranchAddresses();
425 for (
unsigned j = 0; j <
size(); j++){
426 minMax.
add( this->
at(j).
at(i) );
439 for (
unsigned j = 0; j <
size(); j++){
440 minMax.
add( this->
at(j).
at(i) );
452 for (
unsigned i = 0; i <
size(); i++){
455 return temp/double(
size());
463 for (
unsigned i = 0; i <
size(); i++){
466 temp.
at(j) = log( this->
at(i).
at(j) );
468 geoMean = geoMean + temp;
471 geoMean = geoMean/double(
size());
474 geoMean.
at(j) = exp( geoMean.
at(j) );
486 for (
unsigned i = 0; i <
size(); i++){
489 temp.
at(j) = 1.0 / this->
at(i).
at(j);
491 geoMean = geoMean + temp;
494 geoMean = geoMean/double(
size());
497 geoMean.
at(j) = 1.0 / geoMean.
at(j);
507 GOODBYE_LOG <<
"Goodbye from the HyperPointSet() Destructor";
bool linearlyIndependant() const
double getCorrelation(int i, int j) const
const std::vector< double > & getVector()
HyperPoint getMin() const
Get a HyperCuboid that surrounds the points.
virtual void print(std::ostream &os=std::cout, int endline=1) const
HyperPoint geometricMean() const
void addWeight(const double &weight)
HyperPoint harmonicMean() const
void add(const double &x, const double &weight=1.0)
const double & getMin() const
TMatrixD getCorrelationMatrix() const
const std::vector< double > & getWeightsVector()
const HyperPoint & at(int i) const
TMatrixD getCovarienceMatrix() const
HyperPointSet(int dimension)
std::vector< HyperPoint > _points
HyperPointSet gramSchmidtProcess() const
const double & at(int i) const
const int & getDimension() const
double getCovarience(int i, int j) const
unsigned int size() const
HyperPoint project(const HyperPoint &other) const
void print(std::ostream &os=std::cout) const
double getWeight(int i=0) const
bool compatible(const HyperPoint &other, bool printError=true) const
void addHyperPointSet(const HyperPointSet &other)
const double & getMax() const
HyperPoint getMax() const
Get a HyperPoint that gives the maximum in each dim.
void push_back(const HyperPoint &point)