125{
126
127
128
129
130
131 auto analysisManager = G4AnalysisManager::Instance();
132
133
134 for (G4int iDet = 0; iDet <
kDim; ++iDet) {
136 if ( ! hc ) return;
137
138 auto nhit = hc->GetSize();
140
141 analysisManager->FillNtupleIColumn(iDet, nhit);
142
143 for (unsigned long i = 0; i < nhit; ++i) {
144 auto hit = static_cast<DriftChamberHit*>(hc->GetHit(i));
145 auto localPos = hit->GetLocalPos();
146 analysisManager->FillH2(
fDriftHistoID[
kH2][iDet], localPos.x(), localPos.y());
147 }
148 }
149
150
151 array<G4int, kDim> totalCalHit = {{ 0, 0 }};
152 array<G4double, kDim> totalCalEdep = {{ 0., 0. }};
153
154 for (G4int iDet = 0; iDet <
kDim; ++iDet) {
155 auto hc = GetHC(event,
fCalHCID[iDet]);
156 if ( ! hc ) return;
157
158 totalCalHit[iDet] = 0;
159 totalCalEdep[iDet] = 0.;
160 for (unsigned long i = 0; i < hc->GetSize(); ++i) {
161 G4double edep = 0.;
162
163 if (iDet == 0) {
164 auto hit = static_cast<EmCalorimeterHit*>(hc->GetHit(i));
165 edep = hit->GetEdep();
166 } else {
167 auto hit = static_cast<HadCalorimeterHit*>(hc->GetHit(i));
168 edep = hit->GetEdep();
169 }
170 if ( edep > 0. ) {
171 totalCalHit[iDet]++;
172 totalCalEdep[iDet] += edep;
173 }
175 }
176
177 analysisManager->FillNtupleDColumn(iDet + 2, totalCalEdep[iDet]);
178 }
179
180
181 for (G4int iDet = 0; iDet <
kDim; ++iDet) {
182 auto hc = GetHC(event,
fHodHCID[iDet]);
183 if ( ! hc ) return;
184
185 for (unsigned int i = 0; i<hc->GetSize(); ++i) {
186 auto hit = static_cast<HodoscopeHit*>(hc->GetHit(i));
187
188 analysisManager->FillNtupleDColumn(iDet + 4, hit->GetTime());
189 }
190 }
191 analysisManager->AddNtupleRow();
192
193
194
195
196
197 auto printModulo = G4RunManager::GetRunManager()->GetPrintProgress();
198 if ( printModulo == 0 || event->GetEventID() % printModulo != 0) return;
199
200 auto primary = event->GetPrimaryVertex(0)->GetPrimary(0);
201 G4cout
202 << G4endl
203 << ">>> Event " << event->GetEventID() << " >>> Simulation truth : "
204 << primary->GetG4code()->GetParticleName()
205 << " " << primary->GetMomentum() << G4endl;
206
207
208 for (G4int iDet = 0; iDet <
kDim; ++iDet) {
209 auto hc = GetHC(event,
fHodHCID[iDet]);
210 if ( ! hc ) return;
211 G4cout << "Hodoscope " << iDet + 1 << " has " << hc->GetSize() << " hits." << G4endl;
212 for (unsigned int i = 0; i<hc->GetSize(); ++i) {
213 hc->GetHit(i)->Print();
214 }
215 }
216
217
218 for (G4int iDet = 0; iDet <
kDim; ++iDet) {
220 if ( ! hc ) return;
221 G4cout << "Drift Chamber " << iDet + 1 << " has " << hc->GetSize() << " hits." << G4endl;
223 for (unsigned int i = 0; i < hc->GetSize(); i++) {
224 auto hit = static_cast<DriftChamberHit*>(hc->GetHit(i));
225 if (hit->GetLayerID() == layer) hit->Print();
226 }
227 }
228 }
229
230
231 array<G4String, kDim> calName = {{ "EM", "Hadron" }};
232 for (G4int iDet = 0; iDet <
kDim; ++iDet) {
233 G4cout << calName[iDet] << " Calorimeter has " << totalCalHit[iDet] << " hits."
234 << " Total Edep is " << totalCalEdep[iDet]/MeV << " (MeV)" << G4endl;
235 }
236}
std::array< std::vector< G4double >, kDim > fCalEdep
constexpr G4int kNofChambers