35 #include "ScoreSpecies.hh"
88 if ( edep == 0. )
return FALSE;
126 if(species.get() == 0 || species->size() == 0)
128 G4cout <<
"No molecule recorded, energy deposited= "
140 #ifdef _ScoreSpecies_FOR_ALL_EVENTS
161 double gValue = (n_mol/(
fEdep/
eV)) * 100.;
162 molInfo.
fG += gValue;
163 molInfo.
fG2 += gValue*gValue;
165 #ifdef _ScoreSpecies_FOR_ALL_EVENTS
167 fSpeciesInfoPerEvent[time_mol][
molecule];
168 molInfoPerEvent.fNumber.push_back(n_mol);
169 molInfoPerEvent.
fG.push_back(gValue);
170 molInfoPerEvent.fG2.push_back(gValue*gValue);
171 molInfoPerEvent.fEventID.push_back(eventID);
211 for(; it_map1 != end_map1; ++it_map1)
214 InnerSpeciesMap::iterator it_map2 = map2.begin();
215 InnerSpeciesMap::iterator end_map2 = map2.end();
217 for(; it_map2 != end_map2; ++it_map2)
221 molInfo.
fNumber += it_map2->second.fNumber;
222 molInfo.
fG += it_map2->second.fG;
223 molInfo.
fG2 += it_map2->second.fG2;
234 #ifdef _ScoreSpecies_FOR_ALL_EVENTS
236 SpeciesMapPerEvent::iterator it_map1 = right->fSpeciesInfoPerEvent.begin();
237 SpeciesMapPerEvent::iterator end_map1 = right->fSpeciesInfoPerEvent.end();
239 for(; it_map1 != end_map1; ++it_map1)
241 auto& map2 = it_map1->second;
242 InnerSpeciesMapPerEvent::iterator it_map2 = map2.begin();
243 InnerSpeciesMapPerEvent::iterator end_map2 = map2.end();
245 for(; it_map2 != end_map2; ++it_map2)
248 fSpeciesInfoPerEvent[it_map1->first][it_map2->first] ;
249 molInfo.fNumber.insert(molInfo.fNumber.end(),
250 it_map2->second.fNumber.begin(),
251 it_map2->second.fNumber.end());
252 molInfo.
fG.insert(molInfo.
fG.end(),
253 it_map2->second.fG.begin(),
254 it_map2->second.fG.end());
255 molInfo.fG2.insert(molInfo.fG2.end(),
256 it_map2->second.fG2.begin(),
257 it_map2->second.fG2.end());
258 molInfo.fEventID.insert(molInfo.fEventID.end(),
259 it_map2->second.fEventID.begin(),
260 it_map2->second.fEventID.end());
268 right->fSpeciesInfoPerEvent.
clear();
299 G4cout <<
" Number of energy deposition recorded "
303 G4cout <<
" copy no.: " << itr.first
304 <<
" energy deposit: "
315 std::ofstream out(
"Species.Txt");
318 out <<
"Time is in ns" <<
G4endl;
324 out << it_map1.first <<
G4endl;
326 for(
auto it_map2: map2)
328 out << it_map2.first->GetName()<<
" "
329 << it_map2.second.fNumber <<
G4endl;
376 analysisManager->
OpenFile(
"Species.root");
377 int fNtupleID = analysisManager->
CreateNtuple(
"species",
"species");
391 for(
auto it_map2 : map2)
393 double time = it_map1.first;
394 auto species = it_map2.first;
396 int molID = it_map2.
first->GetMoleculeID();
397 int number = it_map2.second.fNumber;
398 double G = it_map2.second.fG;
399 double G2 = it_map2.second.fG2;
415 #ifdef _ScoreSpecies_FOR_ALL_EVENTS
416 fNtupleID = analysisManager->
CreateNtuple(
"species_all",
"species_all");
427 for(
auto it_map1: fSpeciesInfoPerEvent)
429 InnerSpeciesMapPerEvent& map2 = it_map1.second;
431 for(
auto it_map2 : map2)
433 double time = it_map1.first;
434 const Species& species = it_map2.first;
436 int molID = it_map2.
first->GetMoleculeID();
438 size_t nG = it_map2.second.fG.size();
440 for(
size_t i=0; i<nG;++i){
441 int number = it_map2.second.fNumber[i];
442 double G = it_map2.second.fG[i];
443 double G2 = it_map2.second.fG2[i];
444 int eventID = it_map2.second.fEventID[i];
461 analysisManager->
Write();