67 exrdmAnalysisManager::exrdmAnalysisManager()
68 : fVerbose(0), fNEvt1(-1), fNEvt2(-2),
69 fHistEMax (15.0*
MeV), fHistEMin (0.),fHistNBin(100),
79 exrdmAnalysisManager::~exrdmAnalysisManager()
84 #ifdef G4ANALYSIS_USE_ROOT
101 "Energy deposit (MeV) in the traget",fHistNBin,fHistEMin,fHistEMax,
MeV);
103 "Energy deposit (MeV) in the detector",fHistNBin,fHistEMin,fHistEMax,
MeV);
105 "Total energy spectrum (MeV) of the traget and detector",fHistNBin,
106 fHistEMin,fHistEMax,
MeV);
108 "Coincidence spectrum (MeV) between the traget and detector",fHistNBin,
109 fHistEMin,fHistEMax,
MeV);
111 "Anti-coincidence spectrum (MeV) in the traget",fHistNBin,
112 fHistEMin,fHistEMax,
MeV);
114 "Anti-coincidence spectrum (MeV) in the detector",fHistNBin,
115 fHistEMin,fHistEMax,
MeV);
117 "Decay emission spectrum (MeV)",fHistNBin,fHistEMin,fHistEMax,
MeV);
120 fHisto->
AddTuple(
"T1",
"Emitted Particles",
121 "double PID, Energy, Time, Weight" );
122 fHisto->
AddTuple(
"T2",
"RadioIsotopes",
"double PID, Time, Weight" );
123 fHisto->
AddTuple(
"T3",
"Energy Depositions",
"double Energy, Time, Weight" );
124 fHisto->
AddTuple(
"RDecayProducts",
"All Products of RDecay",
125 "double PID, Z, A, Energy, Time, Weight" );
133 G4cout <<
"exrdmAnalysisManager: Histograms are booked and the run has been started" <<
G4endl;
136 pTable->
FindProcess(
"RadioactiveDecay",
"GenericIon");
137 if (rDecay != NULL) {
139 std::vector<G4RadioactivityTable*> theTables =
141 for (
size_t i = 0 ; i < theTables.size(); i++) {
142 theTables[i]->GetTheMap()->clear();
143 G4cout <<
" Clear the radioactivity map: 0, new size = "
144 << theTables[i]->GetTheMap()->size() <<
G4endl;
156 G4cout <<
"exrdmAnalysisManager: Histograms have been saved!" <<
G4endl;
163 pTable->
FindProcess(
"RadioactiveDecay",
"GenericIon");
164 if (rDecay != NULL) {
167 std::ofstream outfile (fileName, std::ios::out );
168 std::vector<G4RadioactivityTable*> theTables =
170 for (
size_t i = 0 ; i < theTables.size(); i++) {
172 outfile <<
"Radioactivities in decay window no. " << i <<
G4endl;
174 "Z \tA \tE \tActivity (decays/window) \tError (decays/window) "
176 map<G4ThreeVector,G4TwoVector> *aMap = theTables[i]->GetTheMap();
177 map<G4ThreeVector,G4TwoVector>::iterator iter;
178 for(iter=aMap->begin(); iter != aMap->end(); iter++) {
179 rate = iter->second.x()/
nevent;
180 error = std::sqrt(iter->second.y())/nevent;
181 if ( rate < 0.) rate = 0.;
182 outfile << iter->first.x() <<
"\t"<< iter->first.y() <<
"\t"
183 << iter->first.z() <<
"\t" << rate <<
"\t" << error <<
G4endl;
204 G4double TarE = fEdepo[0].GetEnergy();
205 G4double Time = fEdepo[0].GetTime();
206 G4double TarW = fEdepo[0].GetEnergy()*fEdepo[0].GetWeight();
216 for (
size_t i = 1; i < fEdepo.size(); i++) {
217 if (std::fabs((fEdepo[i].GetTime()- Time)/
second) <= fPulseWidth) {
218 if ( fEdepo[i].GetEnergy() > 0. ) {
219 TarE += fEdepo[i].GetEnergy();
220 TarW += fEdepo[i].GetEnergy()*fEdepo[i].GetWeight();
222 DetE -= fEdepo[i].GetEnergy();
223 DetW -= fEdepo[i].GetEnergy()*fEdepo[i].GetWeight();
227 if (TarE || DetE) ComW = (TarW+DetW)/(TarE+DetE);
228 if (TarE) TarW /= TarE;
229 if (DetE) DetW /= DetE;
231 if (TarE) fHisto->
FillHisto(0,TarE,TarW);
232 if (DetE) fHisto->
FillHisto(1,DetE,DetW);
233 if (TarE+DetE) fHisto->
FillHisto(2,DetE+TarE,ComW);
234 if (DetE >= fDetectorThresE && TarE >= fTargetThresE )
236 if (TarE >= fTargetThresE && DetE < fDetectorThresE)
238 if (TarE < fTargetThresE && DetE >= fDetectorThresE)
242 TarE = fEdepo[i].GetEnergy();
243 Time = fEdepo[i].GetTime();
244 TarW = fEdepo[i].GetEnergy()*fEdepo[i].GetWeight();
256 if (TarE || DetE) ComW = (TarW+DetW)/(TarE+DetE);
257 if (TarE) TarW /= TarE;
258 if (DetE) DetW /= DetE;
260 if (TarE) fHisto->
FillHisto(0,TarE,TarW);
261 if (DetE) fHisto->
FillHisto(1,DetE,DetW);
262 if (TarE+DetE) fHisto->
FillHisto(2,DetE+TarE,ComW);
263 if (DetE >= fDetectorThresE && TarE >= fTargetThresE )
265 if (TarE >= fTargetThresE && DetE < fDetectorThresE)
267 if (TarE < fTargetThresE && DetE >= fDetectorThresE)
280 G4cout <<
"exrdmAnalysisManager::AddEnergy: e(keV)= " << edep/
keV
281 <<
" weight = " << weight <<
" time (s) = " << time/
second
299 G4cout <<
"exrdmAnalysisManager::AddParticle: " << pid
316 G4cout <<
"exrdmAnalysisManager::AddIsotope: " << pid
const G4String & GetFileName() const
void AddEnergy(G4double, G4double, G4double)
void FillTuple(G4int, const G4String &, G4double)
Definition of the exrdmHisto class.
void FillHisto(G4int, G4double, G4double)
void AddTuple(const G4String &, const G4String &, const G4String &)
G4bool IsAnalogueMonteCarlo()
G4GLOB_DLL std::ostream G4cout
Definition of the exrdmAnalysisManager class.
std::vector< G4RadioactivityTable * > GetTheRadioactivityTables()
void AddDecayProduct(G4double pid, G4int Z, G4int A, G4double energy, G4double time, G4double weight)
void AddParticle(G4double, G4double, G4double, G4double)
static exrdmAnalysisManager * GetInstance()
static G4ProcessTable * GetProcessTable()
G4VProcess * FindProcess(const G4String &processName, const G4String &particleName) const
void Add1D(const G4String &, const G4String &, G4int nb=100, G4double x1=0., G4double x2=1., G4double u=1.)
void AddIsotope(G4double, G4double, G4double)