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 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/extended/runAndEvent/RE06/src/RE06Run.cc (Version 11.3.0) and /examples/extended/runAndEvent/RE06/src/RE06Run.cc (Version 11.2)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 /// \file RE06/src/RE06Run.cc                      26 /// \file RE06/src/RE06Run.cc
 27 /// \brief Implementation of the RE06Run class     27 /// \brief Implementation of the RE06Run class
 28 //                                                 28 //
 29 //                                                 29 //
 30                                                    30 
 31 #include "RE06Run.hh"                              31 #include "RE06Run.hh"
 32                                                << 
 33 #include "G4Event.hh"                              32 #include "G4Event.hh"
 34 #include "G4HCofThisEvent.hh"                      33 #include "G4HCofThisEvent.hh"
 35 #include "G4SDManager.hh"                          34 #include "G4SDManager.hh"
 36                                                    35 
 37 //....oooOO0OOooo........oooOO0OOooo........oo     36 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 38                                                    37 
 39 RE06Run::RE06Run() : G4Run()                   <<  38 RE06Run::RE06Run()
                                                   >>  39  : G4Run()
 40 {                                                  40 {
 41   G4String detName[6] = {"Calor-A_abs", "Calor <<  41   G4String detName[6] 
 42                          "Calor-B_gap", "Calor <<  42     = {"Calor-A_abs","Calor-A_gap",
 43                                                <<  43        "Calor-B_abs","Calor-B_gap",
 44   G4String primNameSum[6] = {"eDep", "nGamma", <<  44        "Calor-C_abs","Calor-C_gap"};
                                                   >>  45        
                                                   >>  46   G4String primNameSum[6] 
                                                   >>  47     = {"eDep","nGamma","nElectron","nPositron","trackLength","nStep"};
                                                   >>  48     
                                                   >>  49   G4String primNameMin[3] 
                                                   >>  50     = {"minEkinGamma","minEkinElectron","minEkinPositron"};
 45                                                    51 
 46   G4String primNameMin[3] = {"minEkinGamma", " <<  52   G4String paraName[3] 
 47                                                <<  53     = {"Calor-AP_para","Calor-BP_para","Calor-CP_para"};
 48   G4String paraName[3] = {"Calor-AP_para", "Ca << 
 49                                                    54 
 50   G4SDManager* SDMan = G4SDManager::GetSDMpoin     55   G4SDManager* SDMan = G4SDManager::GetSDMpointer();
 51   G4String fullName;                               56   G4String fullName;
 52   size_t i, j;                                 <<  57   size_t i,j;
 53   for (i = 0; i < 6; i++) {                    <<  58   for(i=0;i<6;i++)
 54     for (j = 0; j < 6; j++) {                  <<  59   {
 55       fullName = detName[i] + "/" + primNameSu <<  60     for(j=0;j<6;j++)
                                                   >>  61     {
                                                   >>  62       fullName = detName[i]+"/"+primNameSum[j];
 56       fColIDSum[i][j] = SDMan->GetCollectionID     63       fColIDSum[i][j] = SDMan->GetCollectionID(fullName);
 57     }                                              64     }
 58     for (j = 0; j < 3; j++) {                  <<  65     for(j=0;j<3;j++)
 59       fullName = detName[i] + "/" + primNameMi <<  66     {
                                                   >>  67       fullName = detName[i]+"/"+primNameMin[j];
 60       fColIDMin[i][j] = SDMan->GetCollectionID     68       fColIDMin[i][j] = SDMan->GetCollectionID(fullName);
 61     }                                              69     }
 62   }                                                70   }
 63   for (i = 0; i < 3; i++) {                    <<  71   for(i=0;i<3;i++)
 64     for (j = 0; j < 6; j++) {                  <<  72   {
 65       fullName = paraName[i] + "/" + primNameS <<  73     for(j=0;j<6;j++)
                                                   >>  74     {
                                                   >>  75       fullName = paraName[i]+"/"+primNameSum[j];
 66       fColIDPara[i][j] = SDMan->GetCollectionI     76       fColIDPara[i][j] = SDMan->GetCollectionID(fullName);
 67     }                                              77     }
 68   }                                                78   }
                                                   >>  79   
 69 }                                                  80 }
 70                                                    81 
 71 //....oooOO0OOooo........oooOO0OOooo........oo     82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 72                                                    83 
 73 RE06Run::~RE06Run()                                84 RE06Run::~RE06Run()
 74 {                                              <<  85 {;}
 75   ;                                            << 
 76 }                                              << 
 77                                                    86 
 78 //....oooOO0OOooo........oooOO0OOooo........oo     87 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 79                                                    88 
 80 void RE06Run::RecordEvent(const G4Event* evt)      89 void RE06Run::RecordEvent(const G4Event* evt)
 81 {                                                  90 {
 82   G4HCofThisEvent* HCE = evt->GetHCofThisEvent     91   G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
 83   if (!HCE) return;                            <<  92   if(!HCE) return;
 84   numberOfEvent++;                                 93   numberOfEvent++;
 85   size_t i, j;                                 <<  94   size_t i,j;
 86   for (i = 0; i < 6; i++) {                    <<  95   for(i=0;i<6;i++)
 87     for (j = 0; j < 6; j++) {                  <<  96   {
 88       G4THitsMap<G4double>* evtMap = (G4THitsM <<  97     for(j=0;j<6;j++)
                                                   >>  98     {
                                                   >>  99       G4THitsMap<G4double>* evtMap 
                                                   >> 100         = (G4THitsMap<G4double>*)(HCE->GetHC(fColIDSum[i][j]));
 89       fMapSum[i][j] += *evtMap;                   101       fMapSum[i][j] += *evtMap;
 90     }                                             102     }
 91                                                   103 
 92     for (j = 0; j < 3; j++) {                  << 104     for(j=0;j<3;j++)
 93       G4THitsMap<G4double>* evtMap = (G4THitsM << 105     {
 94       std::map<G4int, G4double*>::iterator itr << 106       G4THitsMap<G4double>* evtMap 
 95       for (; itr != evtMap->GetMap()->end(); i << 107         = (G4THitsMap<G4double>*)(HCE->GetHC(fColIDMin[i][j]));
                                                   >> 108       std::map<G4int,G4double*>::iterator itr = evtMap->GetMap()->begin();
                                                   >> 109       for(; itr != evtMap->GetMap()->end(); itr++)
                                                   >> 110       {
 96         G4int key = (itr->first);                 111         G4int key = (itr->first);
 97         G4double val = *(itr->second);            112         G4double val = *(itr->second);
 98         G4double* mapP = fMapMin[i][j][key];      113         G4double* mapP = fMapMin[i][j][key];
 99         if (mapP && (val > *mapP)) continue;   << 114         if( mapP && (val>*mapP) ) continue;
100         fMapMin[i][j].set(key, val);           << 115         fMapMin[i][j].set(key,val);
101       }                                           116       }
102     }                                             117     }
                                                   >> 118 
103   }                                               119   }
104   for (i = 0; i < 3; i++) {                    << 120   for(i=0;i<3;i++)
105     for (j = 0; j < 6; j++) {                  << 121   {
106       G4THitsMap<G4double>* evtMap = (G4THitsM << 122     for(j=0;j<6;j++)
                                                   >> 123     {
                                                   >> 124       G4THitsMap<G4double>* evtMap 
                                                   >> 125         = (G4THitsMap<G4double>*)(HCE->GetHC(fColIDPara[i][j]));
107       fMapPara[i][j] += *evtMap;                  126       fMapPara[i][j] += *evtMap;
108     }                                             127     }
109   }                                               128   }
110 }                                                 129 }
111                                                   130 
112 //....oooOO0OOooo........oooOO0OOooo........oo    131 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
113 void RE06Run::Merge(const G4Run* aRun)         << 132 void RE06Run::Merge(const G4Run * aRun) {
114 {                                              << 133   const RE06Run * localRun = static_cast<const RE06Run *>(aRun);
115   const RE06Run* localRun = static_cast<const  << 134   
116                                                << 135   for(G4int i = 0; i < 6; i++) {
117   for (G4int i = 0; i < 6; i++) {              << 136     for(G4int j = 0; j < 6; j++) {
118     for (G4int j = 0; j < 6; j++) {            << 
119       fMapSum[i][j] += localRun->fMapSum[i][j]    137       fMapSum[i][j] += localRun->fMapSum[i][j];
120     }                                             138     }
121                                                   139 
122     for (G4int j = 0; j < 3; j++) {            << 140     for(G4int j = 0; j < 3; j++) {
123       std::map<G4int, G4double*>::iterator itr    141       std::map<G4int, G4double*>::iterator itr = localRun->fMapMin[i][j].GetMap()->begin();
124       for (; itr != localRun->fMapMin[i][j].Ge << 142       for(; itr != localRun->fMapMin[i][j].GetMap()->end(); itr++) {
125         G4int key = itr->first;                   143         G4int key = itr->first;
126         G4double val = *(itr->second);            144         G4double val = *(itr->second);
127         G4double* mapP = fMapMin[i][j][key];   << 145         G4double * mapP = fMapMin[i][j][key];
128         if (!mapP || val < *mapP) fMapMin[i][j << 146         if(!mapP || val < *mapP) fMapMin[i][j].set(key, val);
129       }                                           147       }
130     }                                             148     }
131   }                                               149   }
132                                                   150 
133   for (G4int i = 0; i < 3; i++) {              << 151   for(G4int i = 0; i < 3; i++) {
134     for (G4int j = 0; j < 6; j++) {            << 152       for(G4int j = 0; j < 6; j++) {
135       fMapPara[i][j] += localRun->fMapPara[i][ << 153         fMapPara[i][j] += localRun->fMapPara[i][j];
136     }                                          << 154       }
137   }                                               155   }
138                                                << 156   
139   G4Run::Merge(aRun);                             157   G4Run::Merge(aRun);
140 }                                                 158 }
141                                                   159 
142 //....oooOO0OOooo........oooOO0OOooo........oo    160 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
143 G4double RE06Run::GetTotal(const G4THitsMap<G4 << 161 G4double RE06Run::GetTotal(const G4THitsMap<G4double> &map) const
144 {                                                 162 {
145   G4double tot = 0.;                              163   G4double tot = 0.;
146   if (map.GetSize() == 0) return tot;          << 164   if(map.GetSize()==0) return tot;
147   std::map<G4int, G4double*>::iterator itr = m << 165   std::map<G4int,G4double*>::iterator itr = map.GetMap()->begin();
148   for (; itr != map.GetMap()->end(); itr++) {  << 166   for(; itr != map.GetMap()->end(); itr++) 
149     tot += *(itr->second);                     << 167   { tot += *(itr->second); }
150   }                                            << 
151   return tot;                                     168   return tot;
152 }                                                 169 }
153                                                   170 
154 //....oooOO0OOooo........oooOO0OOooo........oo    171 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
155                                                   172 
156 G4double RE06Run::FindMinimum(const G4THitsMap << 173 G4double RE06Run::FindMinimum(const G4THitsMap<G4double> &map) const
157 {                                                 174 {
158   G4double val = DBL_MAX;                         175   G4double val = DBL_MAX;
159                                                   176 
160   if (map.GetSize() == 0) return val;          << 177   if(map.GetSize()==0) return val;
161   std::map<G4int, G4double*>::iterator itr = m << 178   std::map<G4int,G4double*>::iterator itr = map.GetMap()->begin();
162   for (; itr != map.GetMap()->end(); itr++) {  << 179   for(; itr != map.GetMap()->end(); itr++) 
163     if (val > *(itr->second)) val = *(itr->sec << 180   { if(val>*(itr->second)) val = *(itr->second); }
164   }                                            << 
165   return val;                                     181   return val;
166 }                                                 182 }
167                                                   183 
168 //....oooOO0OOooo........oooOO0OOooo........oo    184 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
169                                                   185