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