15#include "G4DigiManager.hh"
17#include "Randomize.hh"
19#include "GaudiKernel/Bootstrap.h"
20#include "GaudiKernel/ISvcLocator.h"
25:G4VDigitizerModule(modName),m_emcCalibConstSvc(0)
27 collectionName.push_back(
"BesEmcDigitsCollection");
28 m_besEmcDigitsCollection = 0;
31 ISvcLocator* svcLocator = Gaudi::svcLocator();
33 StatusCode sc=svcLocator->service(
"G4Svc", iG4Svc);
34 m_G4Svc=
dynamic_cast<G4Svc *
>(iG4Svc);
40 sc = m_tupleEmc1->addItem(
"partId",m_partId);
41 sc = m_tupleEmc1->addItem(
"nTheta",m_nTheta);
42 sc = m_tupleEmc1->addItem(
"nPhi",m_nPhi);
43 sc = m_tupleEmc1->addItem(
"edep",m_eDep);
44 sc = m_tupleEmc1->addItem(
"nHits",m_nHits);
45 sc = m_tupleEmc1->addItem(
"adc",m_adc);
46 sc = m_tupleEmc1->addItem(
"tdc",m_tdc);
49 sc = m_tupleEmc2->addItem(
"etot",m_eTot);
50 sc = m_tupleEmc2->addItem(
"nDigi",m_nDigi);
54 sc = svcLocator->service(
"EmcCalibConstSvc", m_emcCalibConstSvc);
55 if(sc != StatusCode::SUCCESS) {
56 G4cout <<
"BesEmcDigitizer Error: Can't get EmcCalibConstSvc." << G4endl;
65void BesEmcDigitizer::Initialize()
75 (
"BesEmcDigitizer",
"BesEmcDigitsCollection");
76 G4DigiManager* DigiMan = G4DigiManager::GetDMpointer();
81 EHCID = DigiMan->GetHitsCollectionID(
"BesEmcHitsCollection");
90 m_crystalGroup =
new vector<CrystalSingle*>;
92 G4int size=m_crystalGroup->size();
94 G4int partId, nTheta,
nPhi, nHits;
95 G4double eTot=0, eDigi;
100 for(G4int i=0;i<size;i++)
102 cryst = (*m_crystalGroup)[i];
114 const int indexSize = 200;
115 G4double e[indexSize];
116 for(G4int i=0;i<indexSize;i++)
121 for(G4int j=0;j<nHits;j++)
126 if(index<indexSize&&index>=0)
129 G4cout<<
"Track index overload!"<<G4endl;
133 for(G4int i=1;i<indexSize;i++)
156 m_energy = wave->
max(
bin);
158 m_energy -= 0.46*MeV;
164 G4int index = m_emcCalibConstSvc->
getIndex(partId,nTheta,
nPhi);
182 else if (m_G4Svc->
EmcElecSatuDead()==1&&CrystalDeadEcut>0&&m_energy/1000.0>CrystalDeadEcut)
207 m_tupleEmc1->write();
213 m_besEmcDigitsCollection->insert(digi);
229 m_tupleEmc2->write();
232 StoreDigiCollection(m_besEmcDigitsCollection);
234 for(
size_t i=0;i<m_crystalGroup->size();i++)
236 delete (*m_crystalGroup)[i];
238 m_crystalGroup->clear();
239 delete m_crystalGroup;
245 G4int partId, nTheta,
nPhi, size,
flag;
248 G4int nHits = m_EHC->entries();
251 for(G4int i=0;i<nHits;i++)
258 size = m_crystalGroup->size();
264 for(G4int j=0; j<size;j++)
266 oldCryst = (*m_crystalGroup)[j];
285 m_crystalGroup->push_back(newCryst);
294 vector<BesEmcDigi*>* vecDC = m_besEmcDigitsCollection->GetVector();
295 G4int nDigi = m_besEmcDigitsCollection->entries();
296 G4int partMax,thetaMax,phiMax;
297 partMax=thetaMax=phiMax=-99;
300 for(G4int i=0;i<nDigi;i++) {
312 G4int thetan,thetap,phin,phip;
320 }
else if(thetaMax==1) {
330 }
else if(phiMax==1) {
338 for(G4int theta=thetan;theta<=thetap;theta++) {
339 for(G4int phi=phin;phi<=phip;phi++) {
343 for(G4int i=0;i<nDigi;i++) {
369 m_energy = wave->
max(
bin);
382 ecorr = -0.1285*log(m_energy/6805.);
384 ecorr = -2.418+9.513e-4*m_energy;
388 m_besEmcDigitsCollection->insert(digi);
402 vector<BesEmcDigi*>* vecDC = m_besEmcDigitsCollection->GetVector();
403 G4int nDigi = m_besEmcDigitsCollection->entries();
406 for(G4int part=0;part<3;part++) {
415 for(G4int theta=0;theta<thetaNb;theta++) {
424 for(G4int phi=0;phi<phiNb;phi++) {
431 for(G4int i=0;i<nDigi;i++) {
450 bool fastSimulation =
true;
455 digi->
SetTime((G4int)(G4UniformRand()*60));
467 m_energy = wave->
max(
bin);
480 ecorr = -0.1285*log(m_energy/6805.);
482 ecorr = -2.418+9.513e-4*m_energy;
486 m_besEmcDigitsCollection->insert(digi);
G4TDigiCollection< BesEmcDigi > BesEmcDigitsCollection
G4THitsCollection< BesEmcHit > BesEmcHitsCollection
*******INTEGER m_nBinMax INTEGER m_NdiMax !No of bins in histogram for cell exploration division $ !Last vertex $ !Last active cell $ !Last cell in buffer $ !No of sampling when dividing cell $ !No of function total $ !Flag for random ceel for $ !Flag for type of for WtMax $ !Flag which decides whether vertices are included in the sampling $ entire domain is hyp !Maximum effective eevents per bin
************Class m_ypar INTEGER m_KeyWgt INTEGER m_KeyIHVP INTEGER m_KeyGPS INTEGER m_IsBeamPolarized INTEGER m_EvtGenInterface DOUBLE PRECISION m_Emin DOUBLE PRECISION m_sphot DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_q2 DOUBLE PRECISION m_PolBeam2 DOUBLE PRECISION m_xErrPb *COMMON c_KK2f $ !CMS energy average $ !Spin Polarization vector first beam $ !Spin Polarization vector second beam $ !Beam energy spread[GeV] $ !minimum hadronization energy[GeV] $ !input READ never touch them !$ !debug facility $ !maximum weight $ !inverse alfaQED $ !minimum real photon energy
void SetTrackIndex(G4int index)
void SetTime(G4double time)
void SetEnergy(G4double energy)
void SetThetaNb(G4int nTheta)
BesEmcWaveform * GetWaveform()
void SetWaveform(BesEmcWaveform *wave)
void SetPhiNb(G4int nPhi)
virtual void AddNoiseAll(G4double coherentNoise)
virtual void AddNoise5x5(G4double coherentNoise)
virtual void GroupHits(BesEmcHitsCollection *)
BesEmcDigitizer(G4String modName)
G4double GetEdepCrystal()
G4int GetNumThetaCrystal()
G4int GetCryInOneLayer(G4int nb)
static BesEmcParameter & GetInstance()
G4double GetLightOutput(G4int i)
void SetNTheta(G4int theta)
vector< G4int > * GetHitIndexes()
double EmcNoiseThreshold()
double EmcIncoherentNoise()
double EmcCoherentNoise()
NTuple::Tuple * GetTupleEmc2()
NTuple::Tuple * GetTupleEmc1()
virtual double getDigiCalibConst(int No) const =0
virtual double getCrystalDeadEcut(int Index) const =0
virtual int getIndex(unsigned int PartId, unsigned int ThetaIndex, unsigned int PhiIndex) const =0
virtual double getCrystalEmaxData(int Index) const =0