00001
00017 #include "StEEmcTower.h"
00018 #include <iostream>
00019 #include "StEEmcUtil/EEmcGeom/EEmcGeomSimple.h"
00020
00021 ClassImp(StEEmcTower);
00022
00023
00024 StEEmcTower::StEEmcTower()
00025 : StEEmcElement()
00026 {
00027 mIndex=-1;
00028 mLayer=-1;
00029 mSector=-1;
00030 mPhibin=-1;
00031 mSubsector=-1;
00032 mEtabin=-1;
00033 }
00034
00035
00036 StEEmcTower::StEEmcTower( const StEEmcTower &other )
00037 : StEEmcElement(other)
00038 {
00039 mIndex=other.mIndex;
00040 mLayer=other.mLayer;
00041 mSector=other.mSector;
00042 mPhibin=other.mPhibin;
00043 mSubsector=other.mSubsector;
00044 mEtabin=other.mEtabin;
00045 mET=other.mET;
00046 mNeighbors=other.mNeighbors;
00047
00048 mRaw=other.mRaw;
00049 mAdc=other.mAdc;
00050 mEnergy=other.mEnergy;
00051 mStat=other.mStat;
00052 mFail=other.mFail;
00053 mName=other.mName;
00054 mstRawHit=other.mstRawHit;
00055 }
00056
00057
00058 void StEEmcTower::print() const
00059 {
00060
00061 std::cout << "--------------------------- StEEmcTower::print()" << std::endl;
00062 std::cout << "name = " << mName << std::endl;
00063 std::cout << "index = " << mIndex << std::endl;
00064 std::cout << "energy = " << energy() << std::endl;
00065 std::cout << "raw = " << raw() << std::endl;
00066 std::cout << "adc = " << adc() << std::endl;
00067
00068 }
00069
00070 void StEEmcTower::printLine() const
00071 {
00072 std::cout << mName << " ADC=" << raw() << " " << adc() << " E=" << energy();
00073 }
00074
00075
00076 void StEEmcTower::index( Int_t i )
00077 {
00078
00079 mIndex = i;
00080 mPhibin = i / 12;
00081 mEtabin = i % 12;
00082 mSector = mPhibin / 5;
00083 mSubsector = mPhibin % 5;
00084
00085 const Char_t *secs[]={"01","02","03","04","05","06","07","08","09","10","11","12"};
00086 const Char_t *subs[]={"A","B","C","D","E"};
00087 const Char_t *lays[]={"T","P","Q","R","S"};
00088
00089 mName="";
00090 mName += secs[mSector];
00091 mName += lays[mLayer];
00092 mName += subs[mSubsector];
00093 mName += secs[mEtabin];
00094
00095 }
00096
00097
00098 Bool_t StEEmcTower::isNeighbor( const StEEmcTower &t ) const
00099 {
00100
00102 if ( t.index() == index() ) return true;
00103
00105 if ( TMath::Abs(t.etabin()-etabin()) > 1 ) return false;
00106
00107 Int_t phi1 = t.phibin();
00108 Int_t phi2 = phibin();
00109
00110 Int_t dphi = phi1 - phi2;
00111
00113 if ( TMath::Abs(dphi) <= 1 ) return true;
00114
00116 if ( phi1==59 ) phi1=-1;
00117 if ( phi2==59 ) phi2=-1;
00118 dphi = phi1 - phi2;
00119
00121 if ( TMath::Abs(dphi) <= 1 ) return true;
00122
00123 return false;
00124
00125 }
00126
00127 TVector3 StEEmcTower::direction( Float_t zvertex ) const
00128 {
00129 TVector3 vertex(0.,0.,zvertex);
00130 const EEmcGeomSimple &geom=EEmcGeomSimple::Instance();
00131 TVector3 position=geom.getTowerCenter( (UInt_t)sector(), (UInt_t)subsector(), (UInt_t)etabin() );
00132 position -= vertex;
00133 return position.Unit();
00134 }