00001
00002
00003
00004
00005
00006 #include <iostream>
00007
00008 #include "EmcRecEventModel/RecEmcHit.h"
00009 #include "EmcRecGeoSvc/EmcRecGeoSvc.h"
00010 #include "GaudiKernel/Bootstrap.h"
00011 #include "GaudiKernel/ISvcLocator.h"
00012
00013
00014 RecEmcHit::RecEmcHit()
00015 {
00016 fCellId.clear();
00017 fEnergy=-1;
00018 fTime=-1;
00019 }
00020
00021 RecEmcHit::RecEmcHit(const RecEmcID& CellId,
00022 const RecEmcEnergy& Energy,
00023 const RecEmcTime& Time)
00024 {
00025 fCellId=CellId;
00026 fEnergy=Energy;
00027 fTime=Time;
00028 }
00029
00030 RecEmcHit::~RecEmcHit()
00031 {
00032
00033 }
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 HepPoint3D RecEmcHit::getCenter() const
00058 {
00059 IEmcRecGeoSvc* iGeoSvc;
00060 ISvcLocator* svcLocator = Gaudi::svcLocator();
00061 StatusCode sc = svcLocator->service("EmcRecGeoSvc",iGeoSvc);
00062 if(sc!=StatusCode::SUCCESS) {
00063 cout<<"Error: Can't get EmcRecGeoSvc"<<endl;
00064 }
00065
00066 return iGeoSvc->GetCCenter(fCellId);
00067 }
00068
00069 HepPoint3D RecEmcHit::getFrontCenter() const
00070 {
00071 IEmcRecGeoSvc* iGeoSvc;
00072 ISvcLocator* svcLocator = Gaudi::svcLocator();
00073 StatusCode sc = svcLocator->service("EmcRecGeoSvc",iGeoSvc);
00074 if(sc!=StatusCode::SUCCESS) {
00075 cout<<"Error: Can't get EmcRecGeoSvc"<<endl;
00076 }
00077
00078 return iGeoSvc->GetCFrontCenter(fCellId);
00079 }
00080
00081 RecEmcID RecEmcHit::CellId(const RecEmcID& CellId)
00082 {
00083 fCellId=CellId;
00084 return fCellId;
00085 }
00086
00087 RecEmcEnergy RecEmcHit::Energy(const RecEmcEnergy& Energy)
00088 {
00089 fEnergy=Energy;
00090 return fEnergy;
00091 }
00092
00093 RecEmcTime RecEmcHit::Time(const RecEmcTime& Time)
00094 {
00095 fTime=Time;
00096 return fTime;
00097 }
00098
00099 void RecEmcHit::Assign(const RecEmcID& CellId,
00100 const RecEmcEnergy& Energy,
00101 const RecEmcTime& Time)
00102 {
00103 fCellId=CellId;
00104 fEnergy=Energy;
00105 fTime=Time;
00106 }
00107
00108 void RecEmcHit::Dump() const
00109 {
00110 cout<<"Hit: ";
00111
00112 cout<<fCellId<<", ";
00113
00114 cout.width(12);
00115 cout.setf(ios::right);
00116 cout<<fEnergy<<", ";
00117
00118 cout.width(12);
00119 cout.setf(ios::right);
00120 cout<<fTime<<endl;
00121 }
00122
00123 ostream& operator<<(ostream & os, const RecEmcHit& aHit)
00124 {
00125 os<<"Hit: ";
00126
00127 os<<aHit.getCellId()<<", ";
00128
00129 os.width(12);
00130 os.setf(ios::right);
00131 os<<aHit.getEnergy()<<", ";
00132
00133 os.width(12);
00134 os.setf(ios::right);
00135 os<<aHit.getTime()<<endl;
00136
00137 return os;
00138 }
00139