00001
00002
00003
00004
00005
00006
00007
00008 #include <iostream>
00009
00010 #include "EmcRecEventModel/RecEmcFraction.h"
00011 #include "Identifier/EmcID.h"
00012
00013
00014 RecEmcFraction::RecEmcFraction():RecEmcHit()
00015 {
00016 fFraction=-1;
00017 }
00018
00019 RecEmcFraction::RecEmcFraction(const RecEmcHit& aHit):RecEmcHit(aHit)
00020 {
00021 fFraction=-1;
00022 }
00023
00024 RecEmcFraction::~RecEmcFraction()
00025 {
00026
00027 }
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 RecEmcFrac RecEmcFraction::getFraction() const
00055 {
00056 return fFraction;
00057 }
00058
00059 RecEmcFrac RecEmcFraction::Fraction(const RecEmcFrac& Fraction)
00060 {
00061 fFraction=Fraction;
00062 return fFraction;
00063 }
00064
00065
00066 double RecEmcFraction::Distance(const RecEmcID id) const
00067 {
00068 unsigned int tht,phi;
00069 unsigned int tht2,phi2;
00070 unsigned int dtht,dphi;
00071 double dist;
00072
00073 tht=EmcID::theta_module(fCellId);
00074 phi=EmcID::phi_module(fCellId);
00075 tht2=EmcID::theta_module(id);
00076 phi2=EmcID::phi_module(id);
00077
00078 dtht=tht>tht2 ? tht-tht2 : tht2-tht;
00079 dphi=phi>phi2 ? phi-phi2 : phi2-phi;
00080 if(dphi>(EmcID::getPHI_BARREL_MAX()+1)/2)
00081 {
00082 dphi=EmcID::getPHI_BARREL_MAX()+1-dphi;
00083 }
00084 dist=sqrt(double(dtht*dtht+dphi*dphi));
00085
00086 return dist;
00087 }
00088
00089
00090 void RecEmcFraction::Dump() const
00091 {
00092 cout<<"Fraction: ";
00093
00094 cout<<fCellId<<", ";
00095
00096 cout.width(12);
00097 cout.setf(ios::right);
00098 cout<<fEnergy<<", ";
00099
00100 cout.width(12);
00101 cout.setf(ios::right);
00102 cout<<fTime<<", ";
00103
00104 cout.width(12);
00105 cout.setf(ios::right);
00106 cout<<fFraction;
00107
00108 cout<<endl;
00109 }
00110
00111 ostream& operator<<(ostream & os, const RecEmcFraction& aFraction)
00112 {
00113 os<<"Fraction: ";
00114
00115 os<<aFraction.getCellId()<<", ";
00116
00117 os.width(12);
00118 os.setf(ios::right);
00119 os<<aFraction.getEnergy()<<", ";
00120
00121 os.width(12);
00122 os.setf(ios::right);
00123 os<<aFraction.getTime()<<", ";
00124
00125 os.width(12);
00126 os.setf(ios::right);
00127 os<<aFraction.getFraction()<<", ";
00128
00129 os.width(12);
00130 os.setf(ios::right);
00131 os<<aFraction.getEnergy()*aFraction.getFraction();
00132
00133 os<<endl;
00134
00135 return os;
00136 }