BOSS 7.1.2
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 22 of file BesEmcDigitization.cc.

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

◆ ~BesEmcDigitization()

BesEmcDigitization::~BesEmcDigitization ( )

Definition at line 34 of file BesEmcDigitization.cc.

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

Member Function Documentation

◆ Digitize()

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

Definition at line 41 of file BesEmcDigitization.cc.

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

◆ GetEmcSignal()

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

Definition at line 112 of file BesEmcDigitization.cc.

113{
114 if(nTheta>0&&nTheta<50&&nPhi>0&&nPhi<150)
115 return fSingleECrystal[nTheta][nPhi];
116 else
117 return 0;
118}

◆ 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 120 of file BesEmcDigitization.cc.

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

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