Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

PhysicsNtuple/kNNAlg/Event.h File Reference

#include <cassert>
#include <iostream>
#include <vector>

Go to the source code of this file.

Namespaces

namespace  Lit

Classes

class  Lit::Event

Typedefs

typedef float VarType
typedef std::vector< VarTypeVarVec

Functions

VarType Distance (const VarType var1, const VarType var2)
VarType Distance (const Event &event1, const Event &event2)
std::ostream & operator<< (std::ostream &os, const Event &event)


Typedef Documentation

typedef float Lit::VarType
 

Definition at line 16 of file PhysicsNtuple/kNNAlg/Event.h.

Referenced by Lit::Node::Add(), Lit::LikeModule::Balance(), Lit::Distance(), Lit::Find(), Lit::LikeModule::Find(), Lit::Node::GetVarDis(), Lit::Node::GetVarMax(), and Lit::Node::GetVarMin().

typedef std::vector<VarType> Lit::VarVec
 

Definition at line 17 of file PhysicsNtuple/kNNAlg/Event.h.

Referenced by Lit::LikeModule::Balance(), Lit::LikeModule::Find(), Lit::Event::GetTgtVec(), Lit::Event::GetVarVec(), and Lit::LikeModule::Scale().


Function Documentation

Lit::VarType Lit::Distance const Event event1,
const Event event2
 

Definition at line 61 of file PhysicsNtuple/kNNAlg/Event.cxx.

References Lit::Distance(), Lit::Event::GetNVar(), Lit::Event::GetVar(), and Lit::VarType.

00062 {
00063    const unsigned int size = event1.GetNVar();
00064 
00065    if(size != event2.GetNVar())
00066    {
00067       std::cerr << "Distance: two events have different dimensions" << std::endl;
00068       return -1.0;
00069    }
00070 
00071    VarType sum = 0.0;
00072    for(unsigned int ivar = 0; ivar != size; ++ivar)
00073    {
00074       sum += Distance(event1.GetVar(ivar), event2.GetVar(ivar));
00075    }
00076    
00077    return sum;
00078 }

VarType Distance const VarType  var1,
const VarType  var2
[inline]
 

Definition at line 54 of file PhysicsNtuple/kNNAlg/Event.h.

References Lit::VarType.

Referenced by Lit::Distance(), and Lit::Find().

00055    {
00056       return (var1 - var2) * (var1 - var2);
00057    }

std::ostream & Lit::operator<< std::ostream &  os,
const Event event
 

Definition at line 135 of file PhysicsNtuple/kNNAlg/Event.cxx.

References Lit::Event::Print().

00136 { 
00137    event.Print(os);
00138    return os;
00139 }


Generated on Mon Feb 15 11:07:57 2010 for loon by  doxygen 1.3.9.1