00001
00002
00003
00004
00005
00007
00008 #include <iostream>
00009 using std::cout;
00010 using std::endl;
00011
00012 #include "TROOT.h"
00013 #include "TVector2.h"
00014
00015 #include "BField/BFLNode.h"
00016
00017 ClassImp(BFLNode)
00018
00019 BFLNode::BFLNode(Int_t nid, Float_t x, Float_t y):
00020 fNodeID(nid),
00021 fx(x),
00022 fy(y)
00023 {
00024 }
00025
00026 BFLNode::BFLNode(Float_t x, Float_t y):
00027 fNodeID(-1),
00028 fx(x),
00029 fy(y)
00030 {
00031 }
00032
00033 BFLNode::~BFLNode()
00034 {
00035
00036 }
00037
00038 TVector2 * BFLNode::GetXY(void) const
00039 {
00040 return(new TVector2(fx,fy));
00041 }
00042
00043 void BFLNode::SetXY(TVector2 & PositionVector)
00044 {
00045 SetX( PositionVector.X() );
00046 SetY( PositionVector.Y() );
00047 }
00048
00049 void BFLNode::Print(Option_t *) const
00050 {
00051 cout << endl;
00052 cout << "node " << fNodeID
00053 << " is at (" << fx << "," << fy << ") " << endl;
00054 }
00055
00056 Int_t BFLNode::Compare(const TObject * node) const
00057 {
00058 if( fx < ((BFLNode *)node)->GetX() ) {
00059 return -1;
00060 } else if( fx > ((BFLNode *)node)->GetX() ) {
00061 return 1;
00062 } else {
00063 if( fy < ((BFLNode *)node)->GetY() ) {
00064 return -1;
00065 } else if( fy > ((BFLNode *)node)->GetY() ) {
00066 return 1;
00067 } else {
00068 return 0;
00069 }
00070 }
00071 }