00001 //-------------------------------------------------------------------------- 00002 // File and Version Information: 00003 // $Id: Trajectory.cxx,v 1.2 2009/12/17 00:38:40 zhangy Exp $ 00004 // 00005 // Description: 00006 // Trajectory Virtual Base Class 00007 // 00008 // Environment: 00009 // Software developed for the BaBar Detector at the SLAC B-Factory. 00010 // 00011 // Author List: 00012 // David N Brown - Lawrence Berkeley Lab 00013 // Gautier Hamel de Monchenault - CEN Saclay & Lawrence Berkeley Lab 00014 // Steve Schaffner - SLAC 00015 // 00016 // Copyright Information: 00017 // Copyright (C) 1996 Lawrence Berkeley Laboratory 00018 // 00019 // History: 00020 // Migration for BESIII MDC 00021 // Copyright (C) 1996 CEA - Centre d'Etude de Saclay 00022 // 00023 // History: 00024 // Migration for BESIII MDC 00025 // 00026 //------------------------------------------------------------------------ 00027 //#include "BaBar/BaBar.hh" 00028 #include "MdcGeom/Trajectory.h" 00029 //#include "ErrLogger/ErrLog.hh" 00030 #include <math.h> 00031 #include <iostream> 00032 using std::endl; 00033 using std::ostream; 00034 00035 Trajectory::Trajectory(double lowlim,double hilim) 00036 { 00037 if (hilim < lowlim) { 00038 std::cout<<"ErrMsg(error) " << "Invalid Trajectory range requested." << std::endl; 00039 flightrange[0] = hilim; 00040 flightrange[1] = lowlim; 00041 } 00042 flightrange[0] = lowlim; 00043 flightrange[1] = hilim; 00044 } 00045 00046 Trajectory::~Trajectory( ) 00047 { 00048 } 00049 00050 double 00051 Trajectory::distTo0thError(double , double tolerance, int) const 00052 { 00053 return fabs(tolerance); 00054 } 00055 00056 void 00057 Trajectory::setFlightRange(double newrange[2]) 00058 { 00059 if (newrange[1] >= newrange[0]) { 00060 flightrange[0] = newrange[0]; 00061 flightrange[1] = newrange[1]; 00062 } else { 00063 std::cout<<"ErrMsg(error) "<< "Invalid Trajectory range requested." << std::endl; 00064 flightrange[0] = newrange[1]; 00065 flightrange[1] = newrange[0]; 00066 } 00067 } 00068 00069 void 00070 Trajectory::print(ostream& os) const 00071 { 00072 os << "Trajectory range from " 00073 << flightrange[0] << " to " 00074 << flightrange[1] << endl; 00075 } 00076 00077 void 00078 Trajectory::printAll(ostream& os) const 00079 { 00080 os << "Trajectory range from " 00081 << flightrange[0] << " to " 00082 << flightrange[1] << endl; 00083 } 00084 00085 Trajectory& 00086 Trajectory::operator=(const Trajectory& other) 00087 { 00088 flightrange[0] = other.flightrange[0]; 00089 flightrange[1] = other.flightrange[1]; 00090 return *this; 00091 }