CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
EmcStructure.cxx
Go to the documentation of this file.
1
3#include <vector>
4#include <iostream>
5
6using namespace std;
7
8//----------------
9// Constructors --
10//----------------
12{
13
14}
15
16//--------------
17// Destructor --
18//--------------
20{
21}
22
24{
25 int index;
26 int nrOfTheRings = getNumberOfTheRings();
27 for ( int the = startingTheta(); the< nrOfTheRings; the++) {
28
29 for ( int phi=0; phi < crystalsInRing((unsigned int) the ); phi++) {
30
31 index = getIndex( (unsigned int)the , (unsigned int)phi);
32
33 m_phiIndex[index]=phi;
34 if (the>=0 && the<=5) {
35 m_partID[index]=0;
36 m_thetaIndex[index]=the;
37 }
38 if (the>=6 && the<=49) {
39 m_partID[index]=1;
40 m_thetaIndex[index]=the-6;
41 }
42 if (the>=50 && the<=55){
43 m_partID[index]=2;
44 m_thetaIndex[index]=55 - the;
45 }
46
47 }
48 m_ThetaMaxIndex[the]=index;
49 }
50
51}
52int
53EmcStructure::getGeomIndex( unsigned int PartId,
54 unsigned int ThetaIndex,
55 unsigned int PhiIndex) const
56{
57 if (PartId>2){
58 cout<<"PartId is out of EMC"<<endl;
59 return -1;
60 } else {
61 unsigned int newThetaIndex;
62 //The newThetaIndex is defined by Endcap_east(0-5),Barrel(6-49),Endcap_west(50-55)
63 if (PartId==0) newThetaIndex = ThetaIndex;
64 if (PartId==1) newThetaIndex = ThetaIndex + 6;
65 if (PartId==2) newThetaIndex = 55 - ThetaIndex;
66
67 if ( isOutofAccep(newThetaIndex, PhiIndex) )
68 {
69 return -1;
70 } else {
71
72 int index;
73 index = getIndex(newThetaIndex,PhiIndex);
74
75 return index;
76 }
77 }
78}
79
80long
81EmcStructure::getIndex(unsigned int thetaIndex, unsigned int phiIndex ) const
82{
83 long index = -1;
84 if(thetaIndex==0){
85 index=phiIndex;
86 } else {
87 index = getThisThetaMaxIndex( thetaIndex-1 ) +1 + phiIndex;
88 }
89 return index;
90}
91
92bool
93EmcStructure::isOutofAccep(unsigned int thetaIndex,
94 unsigned int phiIndex) const
95{
96 if ( thetaIndex > 55 )
97 {
98 cout<<"warning " << " theta out of acceptance !"
99 << endl;
100 return true;
101
102 }
103 else
104 {
105 if ( ((thetaIndex==0 || thetaIndex==1 || thetaIndex==55 || thetaIndex==54)
106 && (phiIndex > 63))
107 || ((thetaIndex==2 || thetaIndex==3 || thetaIndex==53 || thetaIndex==52)
108 && (phiIndex > 79))
109 || ((thetaIndex==4 || thetaIndex==5 || thetaIndex==51 || thetaIndex==50)
110 && ( phiIndex > 95))
111 || ((thetaIndex>=6 && thetaIndex<=49) && ( phiIndex > 119)) )
112 {
113 cout<<"warning "<< " phi out of acceptance !" << endl;
114 return true;
115 }
116 else
117 {
118 return false;
119 }
120 }
121}
122
123unsigned int
125{
126 unsigned int numberOfTheRings=0;
127 numberOfTheRings = (aEmcId->getTHETA_BARREL_MAX() + 1)
128 + (aEmcId->getTHETA_ENDCAP_MAX() + 1 ) * 2;
129
130 return numberOfTheRings;
131
132}
133unsigned int
135{
136 unsigned int numberOfXtals=0;
137 unsigned int numberOfBarrelXtals, numberOfEndcapXtals;
138
139 numberOfEndcapXtals = numberOfOneEndcapRings * (aEmcId->getPHI_ENDCAP_MAX(0)+1)
140 + numberOfTwoEndcapRings * (aEmcId->getPHI_ENDCAP_MAX(2)+1)
141 + numberOfThreeEndcapRings * (aEmcId->getPHI_ENDCAP_MAX(4)+1);
142
143 numberOfBarrelXtals = (aEmcId->getTHETA_BARREL_MAX()+1)*(aEmcId->getPHI_BARREL_MAX()+1);
144
145 numberOfXtals = numberOfBarrelXtals + numberOfEndcapXtals * 2;
146
147 return numberOfXtals;
148}
149
150unsigned int
151EmcStructure::crystalsInRing( unsigned int theta ) const
152{
153 //The theta index is defined by Endcap_east(0-5),Barrel(6-49),Endcap_west(50-55)
154 //in Emc Bhabha Calibration
155 unsigned int theXtalInRing;
156
157 if (theta==0 || theta==1 || theta==55 || theta==54)
158 {
159 theXtalInRing= aEmcId->getPHI_ENDCAP_MAX(0)+1;
160 }
161
162 if (theta==2 || theta==3 || theta==53 || theta==52)
163 {
164 theXtalInRing=aEmcId->getPHI_ENDCAP_MAX(2)+1;
165 }
166
167 if (theta==4 || theta==5 || theta==51 || theta==50)
168 {
169 theXtalInRing=aEmcId->getPHI_ENDCAP_MAX(4)+1;
170 }
171
172 if (theta>=6 && theta<=49)
173 {
174 theXtalInRing=aEmcId->getPHI_BARREL_MAX()+1;
175 }
176
177 // if (theta<0 || theta>55) theXtalInRing= 0;
178 if (theta>55)
179 {
180 theXtalInRing= 0;
181 }
182
183 return theXtalInRing;
184}
static unsigned int getPHI_BARREL_MAX()
Definition: EmcID.cxx:107
static unsigned int getTHETA_ENDCAP_MAX()
Definition: EmcID.cxx:99
static unsigned int getTHETA_BARREL_MAX()
Definition: EmcID.cxx:91
static unsigned int getPHI_ENDCAP_MAX(const unsigned int theta)
Definition: EmcID.cxx:115
int getGeomIndex(unsigned int PartId, unsigned int ThetaIndex, unsigned int PhiIndex) const
void setEmcStruc()
long getIndex(unsigned int thetaIndex, unsigned int phiIndex) const
unsigned int getNumberOfTheRings()
unsigned int startingTheta()
Definition: EmcStructure.h:26
unsigned int crystalsInRing(unsigned int theta) const
long getThisThetaMaxIndex(int Theta) const
Definition: EmcStructure.h:34
bool isOutofAccep(unsigned int thetaIndex, unsigned int phiIndex) const
unsigned int getNumberOfXtals()