StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEEmcTower.cxx
1 
17 #include "StEEmcTower.h"
18 #include <iostream>
19 #include "StEEmcUtil/EEmcGeom/EEmcGeomSimple.h"
20 
21 ClassImp(StEEmcTower);
22 
23 // ----------------------------------------------------------------------------
25  : StEEmcElement()
26 {
27  mIndex=-1;
28  mLayer=-1;
29  mSector=-1;
30  mPhibin=-1;
31  mSubsector=-1;
32  mEtabin=-1;
33 }
34 
35 // ----------------------------------------------------------------------------
37  : StEEmcElement(other)
38 {
39  mIndex=other.mIndex;
40  mLayer=other.mLayer;
41  mSector=other.mSector;
42  mPhibin=other.mPhibin;
43  mSubsector=other.mSubsector;
44  mEtabin=other.mEtabin;
45  mET=other.mET;
46  mNeighbors=other.mNeighbors;
47 
48  mRaw=other.mRaw;
49  mAdc=other.mAdc;
50  mEnergy=other.mEnergy;
51  mStat=other.mStat;
52  mFail=other.mFail;
53  mName=other.mName;
54  mstRawHit=other.mstRawHit;
55 }
56 
57 // ----------------------------------------------------------------------------
58 void StEEmcTower::print() const
59 {
60 
61  std::cout << "--------------------------- StEEmcTower::print()" << std::endl;
62  std::cout << "name = " << mName << std::endl;
63  std::cout << "index = " << mIndex << std::endl;
64  std::cout << "energy = " << energy() << std::endl;
65  std::cout << "raw = " << raw() << std::endl;
66  std::cout << "adc = " << adc() << std::endl;
67 
68 }
69 
71 {
72  std::cout << mName << " ADC=" << raw() << " " << adc() << " E=" << energy();
73 }
74 
75 // ----------------------------------------------------------------------------
76 void StEEmcTower::index( Int_t i )
77 {
78 
79  mIndex = i;
80  mPhibin = i / 12;
81  mEtabin = i % 12;
82  mSector = mPhibin / 5;
83  mSubsector = mPhibin % 5;
84 
85  const Char_t *secs[]={"01","02","03","04","05","06","07","08","09","10","11","12"};
86  const Char_t *subs[]={"A","B","C","D","E"};
87  const Char_t *lays[]={"T","P","Q","R","S"};
88 
89  mName="";
90  mName += secs[mSector];
91  mName += lays[mLayer];
92  mName += subs[mSubsector];
93  mName += secs[mEtabin];
94 
95 }
96 
97 // ----------------------------------------------------------------------------
98 Bool_t StEEmcTower::isNeighbor( const StEEmcTower &t ) const
99 {
100 
102  if ( t.index() == index() ) return true;
103 
105  if ( TMath::Abs(t.etabin()-etabin()) > 1 ) return false;
106 
107  Int_t phi1 = t.phibin();
108  Int_t phi2 = phibin();
109 
110  Int_t dphi = phi1 - phi2;
111 
113  if ( TMath::Abs(dphi) <= 1 ) return true;
114 
116  if ( phi1==59 ) phi1=-1;
117  if ( phi2==59 ) phi2=-1;
118  dphi = phi1 - phi2;
119 
121  if ( TMath::Abs(dphi) <= 1 ) return true;
122 
123  return false;
124 
125 }
126 // ----------------------------------------------------------------------------
127 TVector3 StEEmcTower::direction( Float_t zvertex ) const
128 {
129  TVector3 vertex(0.,0.,zvertex);
131  TVector3 position=geom.getTowerCenter( (UInt_t)sector(), (UInt_t)subsector(), (UInt_t)etabin() );
132  position -= vertex;
133  return position.Unit();
134 }
TVector3 getTowerCenter(const UInt_t sec, const UInt_t sub, const UInt_t etabin) const
Bool_t isNeighbor(const StEEmcTower &t) const
Definition: StEEmcTower.cxx:98
static EEmcGeomSimple & Instance()
returns a reference to a static instance of EEmcGeomSimple
Int_t index() const
Returns index of this tower, pre- or postshower element.
Definition: StEEmcTower.h:37
StEEmcTower()
Constructor.
Definition: StEEmcTower.cxx:24
StEEmcTowerPtrVec_t mNeighbors
Definition: StEEmcTower.h:88
Float_t raw() const
Return raw ADC for this element.
Definition: StEEmcElement.h:30
Int_t mEtabin
Definition: StEEmcTower.h:80
Float_t energy() const
Return the EM energy (towers) or energy deposit for this element (SMD,pre,post). If a fail bit is set...
Definition: StEEmcElement.h:34
Int_t etabin() const
Returns the etabin of this tower, pre- or postshower element.
Definition: StEEmcTower.h:45
Int_t mSector
Definition: StEEmcTower.h:78
Int_t subsector() const
Returns subsector of this tower, pre- or postshower element.
Definition: StEEmcTower.h:43
void print() const
Print a summary of this tower.
Definition: StEEmcTower.cxx:58
void printLine() const
Print a one line summary of this tower.
Definition: StEEmcTower.cxx:70
Float_t mEnergy
Definition: StEEmcElement.h:54
void index(Int_t i)
Definition: StEEmcTower.cxx:76
Base class for representing tower, preshower and postshower elements.
Definition: StEEmcTower.h:11
unsigned mFail
Definition: StEEmcElement.h:56
Float_t adc() const
Return the pedestal-subtracted ADC for this element.
Definition: StEEmcElement.h:32
Int_t sector() const
Returns sector of this tower, pre- or postshower element.
Definition: StEEmcTower.h:41
Float_t mET
Equivalent transverse energy, assuming a vertex of 0,0,0.
Definition: StEEmcTower.h:84
Int_t mLayer
Definition: StEEmcTower.h:77
Int_t mPhibin
Definition: StEEmcTower.h:81
EEMC simple geometry.
Int_t phibin() const
Returns the phibin of this tower.
Definition: StEEmcTower.h:47
Int_t mSubsector
Definition: StEEmcTower.h:79
unsigned mStat
Definition: StEEmcElement.h:55
TVector3 direction(Float_t zvertex=0.0) const
Base class for EEMC detectors.
Definition: StEEmcElement.h:9
Int_t mIndex
Definition: StEEmcTower.h:76