35 #include "DetectorConstruction.hh" 
   36 #include "PrimaryGeneratorAction.hh" 
   37 #include "HistoManager.hh" 
   51   fDetector(det), fParticle(0), fEkin(0.)
 
   53   fEdepTarget = fEdepTarget2 = 0.;
 
   54   fEdepDetect = fEdepDetect2 = 0.;  
 
   77     std::map<G4String,G4int>::iterator it1 = fProcCounter1.find(procName);
 
   78     if ( it1 == fProcCounter1.end()) {
 
   79       fProcCounter1[procName] = 1;
 
   82       fProcCounter1[procName]++; 
 
   87     std::map<G4String,G4int>::iterator it2 = fProcCounter2.find(procName);
 
   88     if ( it2 == fProcCounter2.end()) {
 
   89       fProcCounter2[procName] = 1;
 
   92       fProcCounter2[procName]++; 
 
  102    std::map<G4String, ParticleData>::iterator it = fParticleDataMap1.find(name);
 
  103    if ( it == fParticleDataMap1.end()) {
 
  104      fParticleDataMap1[
name] = ParticleData(1, Ekin, Ekin, Ekin);
 
  107      ParticleData& 
data = it->second;
 
  112      if (Ekin < emin) data.fEmin = Ekin;
 
  114      if (Ekin > emax) data.fEmax = Ekin; 
 
  119    std::map<G4String, ParticleData>::iterator it = fParticleDataMap2.find(name);
 
  120    if ( it == fParticleDataMap2.end()) {
 
  121      fParticleDataMap2[
name] = ParticleData(1, Ekin, Ekin, Ekin);
 
  124      ParticleData& 
data = it->second;
 
  129      if (Ekin < emin) data.fEmin = Ekin;
 
  131      if (Ekin > emax) data.fEmax = Ekin; 
 
  140   fEdepTarget  += edep1;
 
  141   fEdepTarget2 += edep1*edep1;
 
  142   fEdepDetect  += edep2;
 
  143   fEdepDetect2 += edep2*edep2;  
 
  150   const Run* localRun = 
static_cast<const Run*
>(run);
 
  154   fParticle = localRun->fParticle;
 
  155   fEkin     = localRun->fEkin;
 
  159   fEdepTarget   += localRun->fEdepTarget;  
 
  160   fEdepTarget2  += localRun->fEdepTarget2;
 
  161   fEdepDetect   += localRun->fEdepDetect;  
 
  162   fEdepDetect2  += localRun->fEdepDetect2;  
 
  166   std::map<G4String,G4int>::const_iterator itp1;
 
  167   for ( itp1 = localRun->fProcCounter1.begin();
 
  168         itp1 != localRun->fProcCounter1.end(); ++itp1 ) {
 
  171     G4int localCount = itp1->second;
 
  172     if ( fProcCounter1.find(procName) == fProcCounter1.end()) {
 
  173       fProcCounter1[procName] = localCount;
 
  176       fProcCounter1[procName] += localCount;
 
  182   std::map<G4String,G4int>::const_iterator itp2;
 
  183   for ( itp2 = localRun->fProcCounter2.begin();
 
  184         itp2 != localRun->fProcCounter2.end(); ++itp2 ) {
 
  187     G4int localCount = itp2->second;
 
  188     if ( fProcCounter2.find(procName) == fProcCounter2.end()) {
 
  189       fProcCounter2[procName] = localCount;
 
  192       fProcCounter2[procName] += localCount;
 
  197   std::map<G4String,ParticleData>::const_iterator itc;
 
  198   for (itc = localRun->fParticleDataMap1.begin(); 
 
  199        itc != localRun->fParticleDataMap1.end(); ++itc) {
 
  202     const ParticleData& localData = itc->second;   
 
  203     if ( fParticleDataMap1.find(name) == fParticleDataMap1.end()) {
 
  204       fParticleDataMap1[
name]
 
  205        = ParticleData(localData.fCount, 
 
  211       ParticleData& 
data = fParticleDataMap1[
name];   
 
  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;
 
  223   for (itn = localRun->fParticleDataMap2.begin(); 
 
  224        itn != localRun->fParticleDataMap2.end(); ++itn) {
 
  227     const ParticleData& localData = itn->second;   
 
  228     if ( fParticleDataMap2.find(name) == fParticleDataMap2.end()) {
 
  229       fParticleDataMap2[
name]
 
  230        = ParticleData(localData.fCount, 
 
  236       ParticleData& data = fParticleDataMap2[
name];   
 
  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; 
 
  260          << 
G4BestUnit(fEkin,
"Energy") << 
" through : ";
 
  262   G4cout << 
"\n Target   : Length = "  
  268   G4cout << 
"\n Detector : Length = "  
  280   fEdepTarget /= TotNbofEvents; fEdepTarget2 /= TotNbofEvents;
 
  281   G4double rmsEdep = fEdepTarget2 - fEdepTarget*fEdepTarget;
 
  282   if (rmsEdep>0.) rmsEdep = std::sqrt(rmsEdep);
 
  285   G4cout << 
"\n Mean energy deposit in target,   in time window = " 
  286          << 
G4BestUnit(fEdepTarget,
"Energy") << 
";  rms = " 
  292   fEdepDetect /= TotNbofEvents; fEdepDetect2 /= TotNbofEvents;
 
  293   rmsEdep = fEdepDetect2 - fEdepDetect*fEdepDetect;
 
  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;    
 
  307   for (it1 = fProcCounter1.begin(); it1 != fProcCounter1.end(); 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;    
 
  321   for (it2 = fProcCounter2.begin(); it2 != fProcCounter2.end(); 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;               
 
  335   for (itc = fParticleDataMap1.begin(); itc != fParticleDataMap1.end(); 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;               
 
  355  for (itn = fParticleDataMap2.begin(); itn != fParticleDataMap2.end(); 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")
 
  375   fProcCounter1.clear();
 
  376   fProcCounter2.clear();
 
  377   fParticleDataMap1.clear();    
 
  378   fParticleDataMap2.clear();
 
  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()
 
const XML_Char const XML_Char * data
 
void AddEdep(G4double val)
 
G4GLOB_DLL std::ostream G4cout
 
G4Material * GetDetectorMaterial()
 
std::vector< G4RadioactivityTable * > GetTheRadioactivityTables()
 
G4double GetDetectorLength()
 
const G4String & GetProcessName() const 
 
static const G4double emax
 
G4double energy(const ThreeVector &p, const G4double m)
 
Detector construction class to define materials and geometry. 
 
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)