35 #include "DetectorConstruction.hh"
36 #include "PrimaryGeneratorAction.hh"
37 #include "HistoManager.hh"
51 fDetector(det), fParticle(0), fEkin(0.)
77 std::map<G4String,G4int>::iterator it1 =
fProcCounter1.find(procName);
87 std::map<G4String,G4int>::iterator it2 =
fProcCounter2.find(procName);
112 if (Ekin < emin) data.
fEmin = Ekin;
114 if (Ekin > emax) data.
fEmax = Ekin;
129 if (Ekin < emin) data.
fEmin = Ekin;
131 if (Ekin > emax) data.
fEmax = Ekin;
150 const Run* localRun =
static_cast<const Run*
>(run);
166 std::map<G4String,G4int>::const_iterator itp1;
171 G4int localCount = itp1->second;
182 std::map<G4String,G4int>::const_iterator itp2;
187 G4int localCount = itp2->second;
197 std::map<G4String,ParticleData>::const_iterator itc;
202 const ParticleData& localData = itc->second;
205 = ParticleData(localData.fCount,
212 data.fCount += localData.fCount;
213 data.fEmean += localData.fEmean;
215 if (emin < data.fEmin) data.fEmin = emin;
217 if (emax > data.fEmax) data.fEmax =
emax;
222 std::map<G4String,ParticleData>::const_iterator itn;
227 const ParticleData& localData = itn->second;
230 = ParticleData(localData.fCount,
237 data.fCount += localData.fCount;
238 data.fEmean += localData.fEmean;
240 if (emin < data.fEmin) data.fEmin = emin;
242 if (emax > data.fEmax) data.fEmax =
emax;
262 G4cout <<
"\n Target : Length = "
268 G4cout <<
"\n Detector : Length = "
282 if (rmsEdep>0.) rmsEdep = std::sqrt(rmsEdep);
285 G4cout <<
"\n Mean energy deposit in target, in time window = "
286 <<
G4BestUnit(fEdepTarget,
"Energy") <<
"; rms = "
294 if (rmsEdep>0.) rmsEdep = std::sqrt(rmsEdep);
297 G4cout <<
" Mean energy deposit in detector, in time window = "
298 <<
G4BestUnit(fEdepDetect,
"Energy") <<
"; rms = "
304 G4cout <<
"\n Process calls frequency in target :" <<
G4endl;
306 std::map<G4String,G4int>::iterator it1;
309 G4int count = it1->second;
310 G4String space =
" ";
if (++index%3 == 0) space =
"\n";
311 G4cout <<
" " << std::setw(20) << procName <<
"="<< std::setw(7) << count
318 G4cout <<
"\n Process calls frequency in detector:" <<
G4endl;
320 std::map<G4String,G4int>::iterator it2;
323 G4int count = it2->second;
324 G4String space =
" ";
if (++index%3 == 0) space =
"\n";
325 G4cout <<
" " << std::setw(20) << procName <<
"="<< std::setw(7) << count
332 G4cout <<
"\n List of generated particles in target:" <<
G4endl;
334 std::map<G4String,ParticleData>::iterator itc;
337 ParticleData data = itc->second;
338 G4int count = data.fCount;
343 G4cout <<
" " << std::setw(13) << name <<
": " << std::setw(7) << count
344 <<
" Emean = " << std::setw(wid) <<
G4BestUnit(eMean,
"Energy")
352 G4cout <<
"\n List of generated particles in detector:" <<
G4endl;
354 std::map<G4String,ParticleData>::iterator itn;
357 ParticleData data = itn->second;
358 G4int count = data.fCount;
363 G4cout <<
" " << std::setw(13) << name <<
": " << std::setw(7) << count
364 <<
" Emean = " << std::setw(wid) <<
G4BestUnit(eMean,
"Energy")
390 pTable->
FindProcess(
"RadioactiveDecay",
"GenericIon");
396 G4String fileName = G4AnalysisManager::Instance()->GetFileName() +
".activity";
397 std::ofstream outfile (fileName, std::ios::out );
399 std::vector<G4RadioactivityTable*> theTables =
402 for (
size_t i = 0 ; i < theTables.size(); i++) {
404 outfile <<
"Radioactivities in decay window no. " << i <<
G4endl;
405 outfile <<
"Z \tA \tE \tActivity (decays/window) \tError (decays/window) "
408 map<G4ThreeVector,G4TwoVector> *aMap = theTables[i]->GetTheMap();
409 map<G4ThreeVector,G4TwoVector>::iterator iter;
410 for (iter=aMap->begin(); iter != aMap->end(); iter++) {
411 rate = iter->second.x()/nevent;
412 error = std::sqrt(iter->second.y())/nevent;
413 if (rate < 0.) rate = 0.;
414 outfile << iter->first.x() <<
"\t"<< iter->first.y() <<
"\t"
415 << iter->first.z() <<
"\t" << rate <<
"\t" << error <<
G4endl;
virtual void Merge(const G4Run *)
void CountProcesses(G4String procName)
const G4String & GetName() const
void WriteActivity(G4int)
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
G4double GetTargetRadius()
const G4String & GetParticleName() const
G4bool IsAnalogueMonteCarlo()
void AddEdep(G4double val)
G4GLOB_DLL std::ostream G4cout
std::map< G4String, G4int > fProcCounter2
G4Material * GetDetectorMaterial()
std::vector< G4RadioactivityTable * > GetTheRadioactivityTables()
std::map< G4String, G4int > fProcCounter1
G4double GetDetectorLength()
const G4String & GetProcessName() const
static const G4double emax
G4double energy(const ThreeVector &p, const G4double m)
std::map< G4String, ParticleData > fParticleDataMap1
std::map< G4String, ParticleData > fParticleDataMap2
DetectorConstruction * fDetector
Detector construction class to demonstrate various ways of placement.
G4ParticleDefinition * fParticle
static PROLOG_HANDLER error
void SetPrimary(G4ParticleDefinition *particle, G4double energy)
G4double GetTargetLength()
virtual void Merge(const G4Run *)
static G4ProcessTable * GetProcessTable()
G4VProcess * FindProcess(const G4String &processName, const G4String &particleName) const
const G4Material * GetTargetMaterial() const
G4double GetDetectorThickness()
void ParticleCount(G4String, G4double)