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);
187 m_tupleEmc1->write();
193 m_besEmcDigitsCollection->insert(digi);
209 m_tupleEmc2->write();
212 StoreDigiCollection(m_besEmcDigitsCollection);
214 for(
size_t i=0;i<m_crystalGroup->size();i++)
216 delete (*m_crystalGroup)[i];
218 m_crystalGroup->clear();
219 delete m_crystalGroup;
225 G4int partId, nTheta,
nPhi, size, flag;
228 G4int nHits = m_EHC->entries();
231 for(G4int i=0;i<nHits;i++)
238 size = m_crystalGroup->size();
244 for(G4int j=0; j<size;j++)
246 oldCryst = (*m_crystalGroup)[j];
265 m_crystalGroup->push_back(newCryst);
274 vector<BesEmcDigi*>* vecDC = m_besEmcDigitsCollection->GetVector();
275 G4int nDigi = m_besEmcDigitsCollection->entries();
276 G4int partMax,thetaMax,phiMax;
277 partMax=thetaMax=phiMax=-99;
280 for(G4int i=0;i<nDigi;i++) {
292 G4int thetan,thetap,phin,phip;
300 }
else if(thetaMax==1) {
310 }
else if(phiMax==1) {
318 for(G4int theta=thetan;theta<=thetap;theta++) {
319 for(G4int phi=phin;phi<=phip;phi++) {
323 for(G4int i=0;i<nDigi;i++) {
349 m_energy = wave->
max(
bin);
362 ecorr = -0.1285*log(m_energy/6805.);
364 ecorr = -2.418+9.513e-4*m_energy;
368 m_besEmcDigitsCollection->insert(digi);
382 vector<BesEmcDigi*>* vecDC = m_besEmcDigitsCollection->GetVector();
383 G4int nDigi = m_besEmcDigitsCollection->entries();
386 for(G4int part=0;part<3;part++) {
395 for(G4int theta=0;theta<thetaNb;theta++) {
404 for(G4int phi=0;phi<phiNb;phi++) {
411 for(G4int i=0;i<nDigi;i++) {
430 bool fastSimulation =
true;
435 digi->
SetTime((G4int)(G4UniformRand()*60));
447 m_energy = wave->
max(
bin);
460 ecorr = -0.1285*log(m_energy/6805.);
462 ecorr = -2.418+9.513e-4*m_energy;
466 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_nphot 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 int getIndex(unsigned int PartId, unsigned int ThetaIndex, unsigned int PhiIndex) const =0