BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
BesTofDigitizer Class Reference

#include <BesTofDigitizer.hh>

+ Inheritance diagram for BesTofDigitizer:

Public Member Functions

 BesTofDigitizer (G4String modName)
 
 ~BesTofDigitizer ()
 
void GroupHits ()
 
void GroupHits_mrpc ()
 
virtual void Digitize ()
 

Detailed Description

Definition at line 30 of file BesTofDigitizer.hh.

Constructor & Destructor Documentation

◆ BesTofDigitizer()

BesTofDigitizer::BesTofDigitizer ( G4String  modName)

Definition at line 39 of file BesTofDigitizer.cc.

40 :G4VDigitizerModule(modName)
41{
42 collectionName.push_back("BesTofDigitsCollection");
43 m_besTofDigitsCollection=0;
44 //m_digiMessenger = new BesTofDigitizerMessenger(this);
45
46 tofDMBr1 = new BesTofDigitizerBrV1();
47 tofDMEc1 = new BesTofDigitizerEcV1();
48 tofDMBr2 = new BesTofDigitizerBrV2();
49 tofDMEc2 = new BesTofDigitizerEcV2();
50 tofDMEc3 = new BesTofDigitizerEcV3();
51
52 tofDMEc4 = new BesTofDigitizerEcV4();//MRPC Digitizer
53
54 //retrieve G4Svc
55 /*ISvcLocator* svcLocator = Gaudi::svcLocator();
56 IG4Svc* tmpSvc;
57 StatusCode sc=svcLocator->service("G4Svc", tmpSvc);
58 G4Svc* g4Svc=dynamic_cast<G4Svc *>(tmpSvc);*/
59
60
61 m_versionBr=2;
62
64 {
65 m_versionEc=4;
66 std::cout << std::endl << "BesTofDigitizer You are using the new EC Tof (MRPC) Digitizer!" << std::endl;
67 }
68 else
69 {
70 m_versionEc=3;
71 std::cout << std::endl << "BesTofDigitizer You are using the old EC Tof Digitizer!" << std::endl;
72 }
73
74
75
76}
static G4int GetTof()

◆ ~BesTofDigitizer()

BesTofDigitizer::~BesTofDigitizer ( )

Definition at line 78 of file BesTofDigitizer.cc.

79{
80 //delete m_digiMessenger;
81 delete tofDMEc4;
82}

Member Function Documentation

◆ Digitize()

void BesTofDigitizer::Digitize ( )
virtual

Definition at line 84 of file BesTofDigitizer.cc.

85{
86 m_besTofDigitsCollection=new BesTofDigitsCollection (moduleName, collectionName[0]);
87 G4DigiManager* digiManager = G4DigiManager::GetDMpointer();
88 G4int THCID = digiManager->GetHitsCollectionID("BesTofHitsCollection");
89 m_THC = (BesTofHitsCollection*) (digiManager->GetHitsCollection(THCID));
90
91
92
93
94
95
96 if(m_THC) //Haben wir eine Hit-Collection?
97 {
98
99
100 m_scintGroup = new vector<ScintSingle*>;//ScintSingle contains: partId, scintnb, edep <--only the basics
101 GroupHits(); //If one finds more hits in one scintillator, they are grouped together
102 G4int size=m_scintGroup->size();
103
104 //std::cout << "BesTofDigitizer m_scintGroup->size(): " << size << std::endl;
105
106
107 ScintSingle* scint;
108 G4int partId;
109 for (G4int i=0;i<size;i++)
110 {
111 scint = (*m_scintGroup)[i];
112 partId = scint->GetPartId();
113
114
115
116 if (partId==1) // for barrel part
117 {
118 if (m_versionBr==1)
119 tofDMBr1->Digitize(scint,m_besTofDigitsCollection);
120 else if (m_versionBr==2){
121 //std::cout << " tofDMBr2->Digitize" << std::endl;
122 tofDMBr2->Digitize(scint,m_besTofDigitsCollection);
123 }
124 else
125 tofDMBr2->Digitize(scint,m_besTofDigitsCollection);
126 }
127 else // for endcap part
128 {
129 if (m_versionEc==1)
130 tofDMEc1->Digitize(scint,m_besTofDigitsCollection);
131 else if (m_versionEc==2)
132 tofDMEc2->Digitize(scint,m_besTofDigitsCollection);
133 else if (m_versionEc==3){
134 tofDMEc3->Digitize(scint,m_besTofDigitsCollection);}
135 else if (m_versionEc==4)
136 tofDMEc4->Digitize(scint,m_besTofDigitsCollection);
137 else
138 {
139 cout << "Warning: BesTofDigitizerEcV2 is utilized otherwise!" << endl;
140 tofDMEc2->Digitize(scint,m_besTofDigitsCollection);
141 }
142 }//Close endcappart
143 }//close for
144 if (m_scintGroup)
145 {
146 for (size_t i=0;i<m_scintGroup->size();i++)
147 {
148 delete (*m_scintGroup)[i];
149 //std::cout << "i: " << i << std::endl;
150 //std::cout << "delete m_scintGroup[i] successfully " << std::endl;
151 }
152 m_scintGroup->clear();
153 delete m_scintGroup;
154 }
155
156 }//close if(m_THC)
157
158 StoreDigiCollection(m_besTofDigitsCollection);
159}
G4TDigiCollection< BesTofDigi > BesTofDigitsCollection
Definition: BesTofDigi.hh:83
G4THitsCollection< BesTofHit > BesTofHitsCollection
Definition: BesTofHit.hh:108
virtual void Digitize(ScintSingle *, BesTofDigitsCollection *)
virtual void Digitize(ScintSingle *, BesTofDigitsCollection *)
virtual void Digitize(ScintSingle *, BesTofDigitsCollection *)
virtual void Digitize(ScintSingle *, BesTofDigitsCollection *)
virtual void Digitize(ScintSingle *, BesTofDigitsCollection *)
virtual void Digitize(ScintSingle *, BesTofDigitsCollection *)
G4int GetPartId()
Definition: ScintSingle.hh:44

◆ GroupHits()

void BesTofDigitizer::GroupHits ( )

Definition at line 161 of file BesTofDigitizer.cc.

162{
163 G4int partId, scinNb,size,flag;
164 G4double edep;
165 BesTofHit* hit;
166 G4int nHits = m_THC->entries();
167
168 //group the hits which are in the same scintillator
169 for (G4int i=0;i<nHits;i++)
170 {
171 hit=(*m_THC)[i];
172 partId=hit->GetPartId();
173 scinNb=hit->GetScinNb();
174 edep = hit->GetEdep();
175 size=m_scintGroup->size();
176 flag=0;
177 if (size>0)
178 {
179 ScintSingle* oldScint;
180 for (G4int j=0; j<size;j++)
181 {
182 oldScint = (*m_scintGroup)[j];
183 if (oldScint->GetPartId()==partId &&oldScint->GetScinNb()==scinNb)
184 {
185
186 //std::cout << "BesTodDigitizer: GroupHits: 'Oldhit:' partID | scinnb : " << partId << " | " << scinNb << std::endl;
187
188 oldScint->GetHitIndexes()->push_back(i);
189 oldScint->AddEdep(edep);
190 flag=1;
191 break;
192 }
193 }
194 }
195 if (flag==0)
196 {
197 ScintSingle* newScint = new ScintSingle;
198 newScint->SetPartId(partId);
199 newScint->SetScinNb(scinNb);
200 newScint->SetEdep(edep);
201 newScint->GetHitIndexes()->push_back(i);
202 m_scintGroup->push_back(newScint);
203
204 //std::cout << "BesTodDigitizer: GroupHits: NewHitGroup: " << partId << " " << scinNb << std::endl;
205
206 }
207 }
208}
G4double GetEdep()
Definition: BesTofHit.hh:62
G4int GetScinNb()
Definition: BesTofHit.hh:61
G4int GetPartId()
Definition: BesTofHit.hh:60
void SetEdep(G4double e)
Definition: ScintSingle.hh:53
void SetScinNb(G4int nb)
Definition: ScintSingle.hh:52
vector< G4int > * GetHitIndexes()
Definition: ScintSingle.hh:47
G4int GetScinNb()
Definition: ScintSingle.hh:45
void SetPartId(G4int id)
Definition: ScintSingle.hh:51
void AddEdep(G4double e)
Definition: ScintSingle.hh:54

Referenced by Digitize().

◆ GroupHits_mrpc()

void BesTofDigitizer::GroupHits_mrpc ( )

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