BOSS 7.0.7
BESIII Offline Software System
Loading...
Searching...
No Matches
BesEmcDigitization Class Reference

#include <BesEmcDigitization.hh>

Public Member Functions

 BesEmcDigitization ()
 
 ~BesEmcDigitization ()
 
G4bool Digitize (const G4Event *, G4double)
 
G4double GetEmcSignal (G4int, G4int)
 
G4int GetNSignal ()
 
G4double * GetESignal ()
 
G4int * GetNThetaSignal ()
 
G4int * GetNPhiSignal ()
 
void Print ()
 

Detailed Description

Definition at line 16 of file BesEmcDigitization.hh.

Constructor & Destructor Documentation

◆ BesEmcDigitization()

BesEmcDigitization::BesEmcDigitization ( )

Definition at line 21 of file BesEmcDigitization.cc.

22 :calorimeterCollID(-1),fNHits(0),fTotECrystal(0),fTotLCrystal(0),
23 fNCrystalSignal(0)
24{
25 for(int i=0;i<50;i++)
26 {for(int j=0;j<150;j++)
27 fSingleECrystal[i][j]=0;
28 }
29 G4SDManager * SDman = G4SDManager::GetSDMpointer();
30 calorimeterCollID= SDman->GetCollectionID("CalCollection");
31}

◆ ~BesEmcDigitization()

BesEmcDigitization::~BesEmcDigitization ( )

Definition at line 33 of file BesEmcDigitization.cc.

34{
35 delete[]fEnergySignal;
36 delete[]fNThetaSignal;
37 delete[]fNPhiSignal;
38}

Member Function Documentation

◆ Digitize()

G4bool BesEmcDigitization::Digitize ( const G4Event *  evt,
G4double  ecut 
)

Definition at line 40 of file BesEmcDigitization.cc.

41{
42 G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
43 BesEmcHitsCollection* CHC = 0;
44
45 if (HCE)
46 CHC = (BesEmcHitsCollection*)(HCE->GetHC(calorimeterCollID));
47 else
48 return false;
49
50 G4int i=0,j=0;
51 if (CHC)
52 {
53 fNHits = CHC->entries();
54 if(fNHits)
55 for (i=0;i<fNHits;i++)
56 {
57 fTotECrystal += (*CHC)[i]->GetEdepCrystal();
58 fTotLCrystal += (*CHC)[i]->GetTrakCrystal();
59 G4int nTheta=45-(*CHC)[i]->GetNumThetaCrystal();
60 G4int nPhi =(*CHC)[i]->GetNumPhiCrystal();
61 if(nTheta>0&&nTheta<50&&nPhi>0&&nPhi<150)//waiting upgrade
62 {
63 fSingleECrystal[nTheta][nPhi]+=(*CHC)[i]->GetEdepCrystal();
64 //G4cout << "EMC Hit in crystal("
65 // << nTheta << "," <<nPhi<< ")" << G4endl;
66 }
67 else
68 {
69 G4cout << "EMC Hit out range:"
70 << nTheta <<','<< nPhi << G4endl;
71 }
72 }
73 }
74 else
75 return false;
76
77 for(i=1;i<50;i++)
78 {for(j=1;j<150;j++)
79 {
80 if(fSingleECrystal[i][j]>ecut)
81 {
82 fNCrystalSignal++;
83 }
84 }
85 }
86 if((fEnergySignal=new G4double[fNCrystalSignal+1])==NULL||
87 (fNThetaSignal=new G4int[fNCrystalSignal+1])==NULL||
88 (fNPhiSignal=new G4int[fNCrystalSignal+1])==NULL)
89 {
90 G4Exception("BesEmcDigitization:can't allocate memory for Signal");
91 }
92 G4int n=0;
93 for(i=1;i<50;i++)
94 {for(j=1;j<150;j++)
95 {
96 if(fSingleECrystal[i][j]>ecut)
97 {
98 n++;
99 fEnergySignal[n]=fSingleECrystal[i][j];
100 fNThetaSignal[n]=45-i;
101 fNPhiSignal [n]=j;
102 }
103 }
104 }
105
106 return true;
107}
G4THitsCollection< BesEmcHit > BesEmcHitsCollection
Definition: BesEmcHit.hh:83
const int nPhi

◆ GetEmcSignal()

G4double BesEmcDigitization::GetEmcSignal ( G4int  nTheta,
G4int  nPhi 
)

Definition at line 109 of file BesEmcDigitization.cc.

110{
111 if(nTheta>0&&nTheta<50&&nPhi>0&&nPhi<150)
112 return fSingleECrystal[nTheta][nPhi];
113 else
114 return 0;
115}

◆ GetESignal()

G4double * BesEmcDigitization::GetESignal ( )
inline

Definition at line 27 of file BesEmcDigitization.hh.

27{return fEnergySignal;};

◆ GetNPhiSignal()

G4int * BesEmcDigitization::GetNPhiSignal ( )
inline

Definition at line 29 of file BesEmcDigitization.hh.

29{return fNPhiSignal;};

◆ GetNSignal()

G4int BesEmcDigitization::GetNSignal ( )
inline

Definition at line 25 of file BesEmcDigitization.hh.

25{return fNCrystalSignal;};//amount of crystals

◆ GetNThetaSignal()

G4int * BesEmcDigitization::GetNThetaSignal ( )
inline

Definition at line 28 of file BesEmcDigitization.hh.

28{return fNThetaSignal;};

◆ Print()

void BesEmcDigitization::Print ( )

Definition at line 117 of file BesEmcDigitization.cc.

118{
119 G4cout
120 << " Absorber: total energy: "
121 << fTotECrystal/GeV << " GeV" << G4endl
122 << " total track length: "
123 << fTotLCrystal/cm << " cm" << G4endl;
124
125 G4cout << "\n " << fNHits
126 << " hits are stored in BesEmcHitsCollection." << G4endl;
127}

The documentation for this class was generated from the following files: