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