BOSS 7.0.2
BESIII Offline Software System
Loading...
Searching...
No Matches
EmcESum.cxx
Go to the documentation of this file.
1//---------------------------------------------------------------------------//
2//// BOOST --- BESIII Object_Oriented Simulation Tool /
3////
4////---------------------------------------------------------------------------/
5////
6////Description:
7////Author: Caogf
8////Created: Feb, 2006
9////Modified:
10////Comment:
11////
12//
13#include "Trigger/EmcESum.h"
14#include "Trigger/TrigPara.h"
15#include "CLHEP/Units/PhysicalConstants.h"
16#include "CLHEP/Random/RandGauss.h"
17#include <iostream>
18
19#include "Trigger/IBesGlobalTrigSvc.h"
20#include "Trigger/BesGlobalTrigSvc.h"
21#include "GaudiKernel/ISvcLocator.h"
22#include "GaudiKernel/Bootstrap.h"
23#include "GaudiKernel/IDataProviderSvc.h"
24
25using namespace std;
26using namespace TrigConf;
27using namespace CLHEP;
28
30{
31 m_EmcTCFinder = EmcTCFinder::get_Emc();
32}
34{
35}
37{
38 //reset values
39 _TotE = 0;
40 _RTotE = 0;
41 _LTotE = 0;
42 _BTotE = 0;
43 _ETotE = 0;
44 _LBTotE = 0;
45 _RBTotE = 0;
46 _WETotE = 0;
47 _EETotE = 0;
48/*
49 double L1TC_GATE = double (m_pIBGT->getL1TC_GATE());
50
51 for(int i=0;i<12;i++) BLK[i] = 0;
52 for(int i = 0; i < 2; i++) { WEBLK[i] = 0; EEBLK[i] = 0; }
53/////////////////////////////////////////////////////////////////////////////////////////////////
54 //Get total energy ,energy of right part and left part divided by z=0.The energy threshold of each trigger cell is 30*MeV.
55 for(int i=0;i<TrigConf::TCTHETANO_B;i++)
56 for(int j=0;j<TrigConf::TCPHINO_B;j++)
57 {
58 double BEnergy = m_EmcTCFinder->getBTC_ADC(i,j);
59
60 //set each barrel trigger cell energy to service
61 m_pIBGT->setBTCEnergy(i,j,BEnergy);
62
63 int blkId = m_EmcTCFinder->getBLKId(i,j);
64 //low energy threshold of trigger cell
65 if(m_EmcTCFinder->getBTCEnergy(i,j) < L1TC_GATE) BEnergy = 0.;
66
67 BLK[blkId] +=BEnergy;//Get each block energy for babar trigger
68 }
69
70 for(int i =0;i<TrigConf::TCTHETANO_E;i++)
71 for(int j =0;j<TrigConf::TCPHINO_E;j++)
72 {
73 double EEnergy = m_EmcTCFinder->getEETC_ADC(i,j);
74 //set each barrel trigger cell energy to service
75 m_pIBGT->setEETCEnergy(i,j,EEnergy);
76 //low energy threshold of trigger cell
77 if(m_EmcTCFinder->getEETCEnergy(i,j) < L1TC_GATE) EEnergy = 0.;
78
79 if(j >= 0 && j < TrigConf::TCPHINO_E/2) EEBLK[0] += EEnergy; // north energy block
80 else EEBLK[1] += EEnergy; // south energy block
81
82 double WEnergy = m_EmcTCFinder->getWETC_ADC(i,j);
83 //set each barrel trigger cell energy to service
84 m_pIBGT->setWETCEnergy(i,j,WEnergy);
85 //low energy threshold of trigger cell
86 if(m_EmcTCFinder->getWETCEnergy(i,j) < L1TC_GATE) WEnergy = 0.;
87
88 if(j >= 0 && j < TrigConf::TCPHINO_E/2) WEBLK[0] += WEnergy; // north energy block
89 else WEBLK[1] += WEnergy;
90 }
91
92 std::vector<double> BlockE;
93 BlockE.clear();
94
95 double bmean[12] = {8.02,10.1,12.3,7.43,14.8,13.0,12.5,13.2,10.9,12.3,14.7,15.7};
96 double bsigma[12] = {0.88,0.52,0.9,0.72,0.7,0.82,0.64,0.78,0.72,0.76,0.54,0.64};
97 double bratio[12] = {3.28,3.15,3.01,3.12,3.09,3.22,2.90,2.89,2.97,3.00,3.02,3.15};//run10584
98
99 for(int i = 0; i < 12; i++) {
100 //double block_E = (BLK[i]/bratio[i] - 0xa + RandGauss::shoot(bmean[i],bsigma[i]))*m_pIBGT->getEnergy_Ratio(); //mv convert to adc
101 double block_E = (BLK[i] - 0xa); //mv convert to adc
102 if(block_E < 0) block_E = 0;
103 _TotE += block_E; //Total energy of emc including barrel and endcaps
104 _BTotE += block_E;//Total energy of barrel emc
105
106 if(i >= 6)
107 {
108 _LTotE += block_E;//Total energy of left part emc(left barrel and west endcap)
109 _LBTotE += block_E;//Total energy of left part emc (only barrel)
110 }
111 else
112 {
113 _RTotE += block_E;//Total energy of right part emc(right barrel and east endcap)
114 _RBTotE += block_E;//Total energy of right part emc (only barrel)
115 }
116 //BlockE.push_back(block_E);
117 BlockE.push_back(BLK[i]);
118 }
119
120 double emean[2] = {11.8,12.4};
121 double esigma[2] = {0.77,0.43};
122 double eratio[2] = {3.19,3.19};
123
124 double wmean[2] = {19.9,8.89};
125 double wsigma[2] = {0.63,0.51};
126 double wratio[2] = {3.19,3.19};
127
128 for(int i = 0; i < 2; i++) {
129 //double wblock_E = (WEBLK[i]/wratio[i] - 0xa + RandGauss::shoot(wmean[i],wsigma[i]))*m_pIBGT->getEnergy_Ratio();
130 double wblock_E = (WEBLK[i] - 0xa);
131 //double wblock_E = WEBLK[i]*0.51 - 14.4 - 0xa + RandGauss::shoot(wmean[i],wsigma[i]);
132 double eblock_E = (EEBLK[i] - 0xa);
133 //double eblock_E = (EEBLK[i]/eratio[i] - 0xa + RandGauss::shoot(emean[i],esigma[i]))*m_pIBGT->getEnergy_Ratio();
134 //double eblock_E = EEBLK[i]*0.51 - 14.4 - 0xa + RandGauss::shoot(emean[i],esigma[i]);
135 if(wblock_E < 0) wblock_E = 0;
136 if(eblock_E < 0) eblock_E = 0;
137
138 _TotE += eblock_E;//Total energy of emc including barrel and endcaps
139 _RTotE += eblock_E;//Total energy of right part emc(right barrel and east endcap)
140 _ETotE += eblock_E;//Total energy of west and east endcaps
141 _EETotE += eblock_E;//Total energy of east endcap
142 //_EETotE += EEBLK[i];//Total energy of east endcap
143
144 _TotE += wblock_E;//Total energy of emc including barrel and endcaps
145 _LTotE += wblock_E;//Total energy of left part emc(left barrel and west endcap)
146 _ETotE += wblock_E;//Total energy of west and east endcaps
147 _WETotE += wblock_E;//Total energy of west endcap
148 //_WETotE += WEBLK[i];//Total energy of west endcap
149 }
150*/
151
152 for(int i=0;i<12;i++) BLK[i] = 0;
153 for(int i = 0; i < 2; i++) { WEBLK[i] = 0; EEBLK[i] = 0; }
154 /////////////////////////////////////////////////////////////////////////////////////////////////
155 //Get total energy ,energy of right part and left part divided by z=0.The energy threshold of each trigger cell is 30*MeV.
156 for(int i = 0; i < 12; i++) {
157 BLK[i] = m_EmcTCFinder->getBLKE(i+2);
158 }
159
160 for(int i = 0; i < 2; i++) {
161 EEBLK[i] = m_EmcTCFinder->getBLKE(i);
162 WEBLK[i] = m_EmcTCFinder->getBLKE(i+14);
163 }
164
165 std::vector<double> BlockE;
166 BlockE.clear();
167
168 double bmean[12] = {8.02,10.1,12.3,7.43,14.8,13.0,12.5,13.2,10.9,12.3,14.7,15.7};
169 double bsigma[12] = {0.88,0.52,0.9,0.72,0.7,0.82,0.64,0.78,0.72,0.76,0.54,0.64};
170
171 for(int i = 0; i < 12; i++) {
172 double block_E = (BLK[i]*0.333 - 0xa + RandGauss::shoot(bmean[i],bsigma[i])); //mv convert to adc
173 if(block_E < 0) block_E = 0;
174 _TotE += block_E; //Total energy of emc including barrel and endcaps
175 _BTotE += block_E;//Total energy of barrel emc
176
177 if(i >= 6)
178 {
179 _LTotE += block_E;//Total energy of left part emc(left barrel and west endcap)
180 _LBTotE += block_E;//Total energy of left part emc (only barrel)
181 }
182 else
183 {
184 _RTotE += block_E;//Total energy of right part emc(right barrel and east endcap)
185 _RBTotE += block_E;//Total energy of right part emc (only barrel)
186 }
187 BlockE.push_back(block_E);
188 }
189
190 double emean[2] = {11.8,12.4};
191 double esigma[2] = {0.77,0.43};
192
193 double wmean[2] = {19.9,8.89};
194 double wsigma[2] = {0.63,0.51};
195
196 for(int i = 0; i < 2; i++) {
197 double wblock_E = (WEBLK[i]*0.333 - 0xa + RandGauss::shoot(wmean[i],wsigma[i]));
198 double eblock_E = (EEBLK[i]*0.333 - 0xa + RandGauss::shoot(emean[i],esigma[i]));
199 if(wblock_E < 0) wblock_E = 0;
200 if(eblock_E < 0) eblock_E = 0;
201
202 _TotE += eblock_E;//Total energy of emc including barrel and endcaps
203 _RTotE += eblock_E;//Total energy of right part emc(right barrel and east endcap)
204 _ETotE += eblock_E;//Total energy of west and east endcaps
205 _EETotE += eblock_E;//Total energy of east endcap
206
207 _TotE += wblock_E;//Total energy of emc including barrel and endcaps
208 _LTotE += wblock_E;//Total energy of left part emc(left barrel and west endcap)
209 _ETotE += wblock_E;//Total energy of west and east endcaps
210 _WETotE += wblock_E;//Total energy of west endcap
211 }
212
213 ISvcLocator* svcLocator = Gaudi::svcLocator();
214 StatusCode sc = svcLocator->service("BesGlobalTrigSvc", m_tmpSvc);
215 m_pIBGT = dynamic_cast<BesGlobalTrigSvc* >(m_tmpSvc);
216
217 //set energy information related to emc in service
218 m_pIBGT->setEmcTotE(_TotE);
219 m_pIBGT->setEmcLTotE(_LTotE);
220 m_pIBGT->setEmcRTotE(_RTotE);
221 m_pIBGT->setEmcBTotE(_BTotE);
222 m_pIBGT->setEmcETotE(_ETotE);
223 m_pIBGT->setEmcLBTotE(_LBTotE);
224 m_pIBGT->setEmcRBTotE(_RBTotE);
225 m_pIBGT->setEmcWETotE(_WETotE);
226 m_pIBGT->setEmcEETotE(_EETotE);
227 m_pIBGT->setEmcBlockE(BlockE);
228}
EmcESum()
Definition: EmcESum.cxx:29
void getESum()
Definition: EmcESum.cxx:36
~EmcESum()
Definition: EmcESum.cxx:33
static EmcTCFinder * get_Emc(void)
Definition: EmcTCFinder.cxx:32