15#include "CLHEP/Units/PhysicalConstants.h"
16#include "CLHEP/Random/RandGauss.h"
21#include "GaudiKernel/ISvcLocator.h"
22#include "GaudiKernel/Bootstrap.h"
23#include "GaudiKernel/IDataProviderSvc.h"
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++)
58 double BEnergy = m_EmcTCFinder->getBTC_ADC(i,j);
60 //set each barrel trigger cell energy to service
61 m_pIBGT->setBTCEnergy(i,j,BEnergy);
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.;
67 BLK[blkId] +=BEnergy;//Get each block energy for babar trigger
70 for(int i =0;i<TrigConf::TCTHETANO_E;i++)
71 for(int j =0;j<TrigConf::TCPHINO_E;j++)
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.;
79 if(j >= 0 && j < TrigConf::TCPHINO_E/2) EEBLK[0] += EEnergy; // north energy block
80 else EEBLK[1] += EEnergy; // south energy block
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.;
88 if(j >= 0 && j < TrigConf::TCPHINO_E/2) WEBLK[0] += WEnergy; // north energy block
89 else WEBLK[1] += WEnergy;
92 std::vector<double> BlockE;
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
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
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)
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)
116 //BlockE.push_back(block_E);
117 BlockE.push_back(BLK[i]);
120 double emean[2] = {11.8,12.4};
121 double esigma[2] = {0.77,0.43};
122 double eratio[2] = {3.19,3.19};
124 double wmean[2] = {19.9,8.89};
125 double wsigma[2] = {0.63,0.51};
126 double wratio[2] = {3.19,3.19};
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;
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
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
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; }
156 for(
int i = 0; i < 12; i++) {
157 BLK[i] = m_EmcTCFinder->
getBLKE(i+2);
160 for(
int i = 0; i < 2; i++) {
161 EEBLK[i] = m_EmcTCFinder->
getBLKE(i);
162 WEBLK[i] = m_EmcTCFinder->
getBLKE(i+14);
165 std::vector<double> BlockE;
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};
171 for(
int i = 0; i < 12; i++) {
172 double block_E = (BLK[i]*0.333 - 0xa + RandGauss::shoot(bmean[i],bsigma[i]));
173 if(block_E < 0) block_E = 0;
187 BlockE.push_back(block_E);
190 double emean[2] = {11.8,12.4};
191 double esigma[2] = {0.77,0.43};
193 double wmean[2] = {19.9,8.89};
194 double wsigma[2] = {0.63,0.51};
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;
213 ISvcLocator* svcLocator = Gaudi::svcLocator();
214 StatusCode sc = svcLocator->service(
"BesGlobalTrigSvc", m_tmpSvc);
void setEmcBTotE(double i)
void setEmcETotE(double i)
void setEmcTotE(double i)
void setEmcRBTotE(double i)
void setEmcEETotE(double i)
void setEmcRTotE(double i)
void setEmcLTotE(double i)
void setEmcBlockE(std::vector< double > i)
void setEmcLBTotE(double i)
void setEmcWETotE(double i)
static EmcTCFinder * get_Emc(void)