00001 // 00002 // Bes EMC Rec Hit 00003 // 00004 // Created by Wang.Zhe 2003, 12, 15 00005 // 00006 00007 #include <iostream> 00008 00009 #include "EmcRecEventModel/RecEmcDigit.h" 00010 00011 //Constructors and destructors 00012 RecEmcDigit::RecEmcDigit() 00013 { 00014 fCellId.clear(); 00015 fADC=-1; 00016 fTDC=-1; 00017 } 00018 00019 RecEmcDigit::RecEmcDigit(const RecEmcID& CellId, 00020 const RecEmcADC& ADC, 00021 const RecEmcTDC& TDC) 00022 { 00023 fCellId=CellId; 00024 fADC=ADC; 00025 fTDC=TDC; 00026 } 00027 00028 RecEmcDigit::~RecEmcDigit() 00029 { 00030 //nothing to do 00031 } 00032 00033 //Copy and assignment 00034 RecEmcDigit::RecEmcDigit(const RecEmcDigit& aDigit) 00035 { 00036 fCellId=aDigit.CellId(); 00037 fADC=aDigit.ADC(); 00038 fTDC=aDigit.TDC(); 00039 } 00040 00041 RecEmcDigit& RecEmcDigit::operator=(const RecEmcDigit& aDigit) 00042 { 00043 if(this!=&aDigit) 00044 { 00045 fCellId=aDigit.CellId(); 00046 fADC=aDigit.ADC(); 00047 fTDC=aDigit.TDC(); 00048 } 00049 return *this; 00050 } 00051 00052 //Access 00053 //Read 00054 RecEmcID RecEmcDigit::CellId() const 00055 { 00056 return fCellId; 00057 } 00058 00059 RecEmcADC RecEmcDigit::ADC() const 00060 { 00061 return fADC; 00062 } 00063 00064 RecEmcTDC RecEmcDigit::TDC() const 00065 { 00066 return fTDC; 00067 } 00068 00069 //Write 00070 RecEmcID RecEmcDigit::CellId(const RecEmcID& CellId) 00071 { 00072 fCellId=CellId; 00073 return fCellId; 00074 } 00075 00076 RecEmcADC RecEmcDigit::ADC(const RecEmcADC& ADC) 00077 { 00078 fADC=ADC; 00079 return fADC; 00080 } 00081 00082 RecEmcTDC RecEmcDigit::TDC(const RecEmcTDC& TDC) 00083 { 00084 fTDC=TDC; 00085 return fTDC; 00086 } 00087 00088 void RecEmcDigit::Assign(const RecEmcID& CellId, 00089 const RecEmcADC& ADC, 00090 const RecEmcTDC& TDC) 00091 { 00092 fCellId=CellId; 00093 fADC=ADC; 00094 fTDC=TDC; 00095 } 00096 00097 void RecEmcDigit::Assign(const RecEmcDigit& aDigit) 00098 { 00099 fCellId=aDigit.CellId(); 00100 fADC=aDigit.ADC(); 00101 fTDC=aDigit.TDC(); 00102 } 00103 00104 //others 00105 void RecEmcDigit::Dump() const 00106 { 00107 cout<<"Digit: "; 00108 00109 cout<<fCellId<<", "; 00110 00111 cout.width(12); 00112 cout.setf(ios::right); 00113 cout<<fADC<<", "; 00114 00115 cout.width(12); 00116 cout.setf(ios::right); 00117 cout<<fTDC<<endl; 00118 } 00119 00120 ostream& operator<<(ostream & os, const RecEmcDigit& aDigit) 00121 { 00122 os<<"Digit: "; 00123 00124 os<<aDigit.CellId()<<", "; 00125 00126 os.width(12); 00127 os.setf(ios::right); 00128 os<<aDigit.ADC()<<", "; 00129 00130 os.width(12); 00131 os.setf(ios::right); 00132 os<<aDigit.TDC()<<endl; 00133 00134 return os; 00135 }