15#include "GaudiKernel/ISvcLocator.h"
16#include "GaudiKernel/Bootstrap.h"
17#include "GaudiKernel/IDataProviderSvc.h"
18#include "CLHEP/Random/RanecuEngine.h"
19#include "CLHEP/Random/RandGauss.h"
39 ISvcLocator* svcLocator = Gaudi::svcLocator();
41 StatusCode status = svcLocator->service(
"RealizationSvc",tmpReal);
42 if (!status.isSuccess())
44 cout <<
"FATAL: Could not initialize Realization Service" << endl;
50 status = svcLocator->service(
"EmcCalibConstSvc", emcCalibConstSvc);
51 if(status != StatusCode::SUCCESS) {
52 cout <<
"EmcRecDigit2Hit Error: Can't get EmcCalibConstSvc." << endl;
62 double adc = 0., adc1 = 0., tdc = 0.;
65 for(
int i=0;i<TrigConf::TCTHETANO_B;i++)
66 for(
int j=0;j<TrigConf::TCPHINO_B;j++) {
68 BTCEnergy_adc[i][j] = 0;
70 for(
int i=0;i<TrigConf::TCTHETANO_E;i++)
71 for(
int j=0;j<TrigConf::TCPHINO_E;j++)
75 EETCEnergy_adc[i][j] = 0;
76 WETCEnergy_adc[i][j] = 0;
78 EmcDigiCol::iterator iter3;
80 for (iter3=emcDigiCol->begin();iter3!= emcDigiCol->end();iter3++) {
81 id=(*iter3)->identify();
89 adc = double ((*iter3)->getChargeChannel());
90 adc1 = double ((*iter3)->getChargeChannel());
91 measure = (*iter3)->getMeasure();
92 tdc = (*iter3)->getTimeChannel();
94 int index = emcCalibConstSvc->
getIndex(module,theta,phi);
97 double trgGain = m_RealizationSvc->
getTrgGain(index);
98 std::cout <<
"partId, thetaId, phiId, trgGain: " << module <<
", " << theta <<
", " << phi <<
", " << trgGain << std::endl;
102 if((*iter3)->getMeasure()==0) adc = adc*2*800.*2/65535.*(trgGain);
103 else if((*iter3)->getMeasure()==1) adc = adc*16*800.*2/65535*(trgGain);
104 else adc = adc*64*800.*2/65535*(trgGain);
119 if(module==1) BTCEnergy[TCThetaId][TCPhiId] += adc;
120 if(module==0) EETCEnergy[TCThetaId][TCPhiId] += adc;
121 if(module==2) WETCEnergy[TCThetaId][TCPhiId] += adc;
122 if(module==1) BTCEnergy_adc[TCThetaId][TCPhiId] += adc;
123 if(module==0) EETCEnergy_adc[TCThetaId][TCPhiId] += adc;
124 if(module==2) WETCEnergy_adc[TCThetaId][TCPhiId] += adc;
146 for(
int i=0;i<TrigConf::TCTHETANO_B;i++)
147 for(
int j=0;j<TrigConf::TCPHINO_B;j++) {
150 for(
int i=0;i<TrigConf::TCTHETANO_E;i++)
151 for(
int j=0;j<TrigConf::TCPHINO_E;j++)
156 for(std::vector<uint32_t>::iterator
iter = vTC.begin();
iter != vTC.end();
iter++) {
157 int par_TC = (*
iter & 0xFF0000) >> 16;
158 int the_TC = (*
iter & 0xFF00) >> 8;
159 int phi_TC = (*
iter & 0xFF);
160 if(par_TC == 0) EETC[the_TC][phi_TC] = 1;
161 if(par_TC == 1) BTC[the_TC][phi_TC] = 1;
162 if(par_TC == 2) WETC[the_TC][phi_TC] = 1;
168 for(
int i = 0; i < 16; i++) {
171 if(vBE.size() != 0) {
172 if(vBE.size() != 16 ) std::cerr <<
"The number of block is not equal 16, please check it (in EmcTCFinder::setEmcBE() )" << std::endl;
173 for(
int i = 0; i < vBE.size(); i++) {
191 TCThetaNb = (int)ThetaNb/4;
218 if(partId==0) TCThetaNb = 0;
219 if(partId==2) TCThetaNb = 0;
225 TCPhiNb = int(PhiNb/4);
244 if(ThetaNb<2) TCPhiNb = int(PhiNb/2);
247 int quot = int(PhiNb/5);
249 if(rema <= 1) TCPhiNb = 2*quot;
250 if(rema > 1) TCPhiNb = 2*quot + 1;
254 int quot = int(PhiNb/5);
256 if(rema <= 2) TCPhiNb = 2*quot;
257 if(rema > 2) TCPhiNb = 2*quot + 1;
259 if(ThetaNb>=4) TCPhiNb = int(PhiNb/3);
263 if(ThetaNb<2) TCPhiNb = int(PhiNb/2);
266 int quot = int(PhiNb/5);
268 if(rema <= 1) TCPhiNb = 2*quot;
269 if(rema > 1) TCPhiNb = 2*quot + 1;
273 int quot = int(PhiNb/5);
275 if(rema <= 2) TCPhiNb = 2*quot;
276 if(rema > 2) TCPhiNb = 2*quot + 1;
278 if(ThetaNb>=4) TCPhiNb = int(PhiNb/3);
286 parity = (int)TCPhi/5;
289 if(TCTheta<6)
id = parity;
290 if(TCTheta>=6)
id = parity+6;
294 if(TCTheta<5)
id = parity;
295 if(TCTheta>=5)
id = parity+6;
ObjectVector< EmcDigi > EmcDigiCol
static unsigned int barrel_ec(const Identifier &id)
Values of different levels (failure returns 0)
static unsigned int theta_module(const Identifier &id)
static unsigned int phi_module(const Identifier &id)
int getTCThetaId(int partId, int ThetaNb, int PhiNb)
static EmcTCFinder * get_Emc(void)
void setEmcBE(std::vector< double > vBE)
int getTCPhiId(int partId, int ThetaNb, int PhiNb)
void setEmcTC(std::vector< uint32_t > vTC)
void setEmcDigi(EmcDigiCol *emcDigiCol)
int getBLKId(int TCTheta, int TCPhi) const
virtual int getIndex(unsigned int PartId, unsigned int ThetaIndex, unsigned int PhiIndex) const =0
double getTrgGain(int cry_id)