/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Emc/EmcRecEventModel/EmcRecEventModel-01-01-18/src/RecEmcFraction.cxx

Go to the documentation of this file.
00001 //
00002 //  Bes EMC Rec Shower Fraction
00003 //  (a fraction of a hit)
00004 //
00005 //  Created by Wang.Zhe  2003, 10, 1
00006 //
00007 
00008 #include <iostream>
00009 
00010 #include "EmcRecEventModel/RecEmcFraction.h"
00011 #include "Identifier/EmcID.h"
00012 
00013 //Constructors and destructors
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    //nothing to do
00027 }
00028 
00029 //Copy and assignment
00030 //RecEmcFraction::RecEmcFraction(const RecEmcFraction& aFraction)
00031 //:ContainedObject(aFraction),RecEmcHit(aFraction)
00032 //{
00033 //   //fCellId=aFraction.CellId();
00034 //   //fEnergy=aFraction.Energy();
00035 //   //fTime=aFraction.Time();
00036 //   //
00037 //   fFraction=aFraction.Fraction();
00038 //}
00039 //
00040 //RecEmcFraction& RecEmcFraction::operator=(const RecEmcFraction& aFraction)
00041 //{
00042 //   if(this!=&aFraction)
00043 //     {
00044 //      fCellId=aFraction.CellId();
00045 //      fEnergy=aFraction.Energy();
00046 //      fTime=aFraction.Time();
00047 //      //
00048 //      fFraction=aFraction.Fraction();
00049 //     }
00050 //   return *this;
00051 //}
00052 
00053 //Other methods(read or write)
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 //Distance to another hit
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 //others
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 }

Generated on Tue Nov 29 22:58:17 2016 for BOSS_7.0.2 by  doxygen 1.4.7