Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FCALTestbeamSetupSD.cc
Go to the documentation of this file.
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 //
26 // $Id: FCALTestbeamSetupSD.cc 68716 2013-04-05 09:13:43Z gcosmo $
27 //
28 //
29 
30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
32 
33 #include <iostream>
34 #include <fstream>
35 
36 #include "FCALTestbeamSetupSD.hh"
37 
38 #include "FCALCalorHit.hh"
39 
40 #include "FCALTestbeamSetup.hh"
41 
42 #include "G4SystemOfUnits.hh"
43 #include "G4VPhysicalVolume.hh"
44 #include "G4Step.hh"
45 #include "G4Track.hh"
46 #include "G4VTouchable.hh"
47 #include "G4TouchableHistory.hh"
48 #include "G4SDManager.hh"
49 
50 #include "G4ios.hh"
51 
52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
53 
55 {;}
56 
57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
58 
60 {;}
61 
62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
63 
65 {
66  EBeamS1 = EBeamS2 = EBeamS3 = 0.;
67  EHoleScint = EBeamHole = 0.;
68  EBeamDead = 0;
69  G4int j;
70  for (j =0 ; j<8 ; j++) { ETailVis[j] = 0.;};
71  for (j =0 ; j<7 ; j++) { ETailDep[j] = 0.;};
72  TailCatcherID = 0;
73 }
74 
75 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
76 
78 {
79 
80  G4double edep = aStep->GetTotalEnergyDeposit();
81  if (edep==0.) return false;
82 
83  G4TouchableHistory* theTouchable
85  G4VPhysicalVolume* physVol = theTouchable->GetVolume();
86 
87 
88  if(strcmp(physVol->GetName(),"ScintS1Physical")==0) {
89  EBeamS1 = EBeamS1 + edep;}
90 
91  if(strcmp(physVol->GetName(),"ScintS2Physical")==0) {
92  EBeamS2 = EBeamS2 + edep;}
93 
94  if(strcmp(physVol->GetName(),"ScintS3Physical")==0) {
95  EBeamS3 = EBeamS3 + edep;}
96 
97  if(strcmp(physVol->GetName(),"HoleScintPhysical")==0){ EHoleScint += edep;}
98  if(strcmp(physVol->GetName(),"HoleCntrScintPhysical")==0){
99  EBeamHole = EBeamHole + edep;}
100 
101  if(strcmp(physVol->GetName(),"MWPCPhysical")==0) { EBeamDead += edep;};
102  if(strcmp(physVol->GetName(),"HoleCntrPbPhysical")==0) { EBeamDead += edep;};
103  if(strcmp(physVol->GetName(),"HoleCntrAlPhysical")==0) { EBeamDead += edep;};
104  if(strcmp(physVol->GetName(),"LeadWallPhysical")==0) { EBeamDead += edep;};
105  if(strcmp(physVol->GetName(),"IronWallPhysical")==0) { EBeamDead += edep;};
106 
107  if(strcmp(physVol->GetName(),"BigScintPhysical")==0) {
108  TailCatcherID = physVol->GetCopyNo();
109  if(TailCatcherID > 0) ETailVis[TailCatcherID] += edep;
110  }
111  if(strcmp(physVol->GetName(),"SmallScintPhysical")==0) {
112  TailCatcherID = physVol->GetCopyNo();
113  if(TailCatcherID > 0) ETailVis[TailCatcherID + 3] += edep;
114  }
115 
116  if(strcmp(physVol->GetName(),"BigIronPhysical")==0) {
117  TailCatcherID = physVol->GetCopyNo();
118  if(TailCatcherID > 0) ETailDep[TailCatcherID] += edep;
119  }
120  if(strcmp(physVol->GetName(),"SmallIronPhysical")==0) {
121  TailCatcherID = physVol->GetCopyNo();
122  if(TailCatcherID > 0) ETailDep[TailCatcherID+2] += edep;
123  }
124 
125  return true;
126 }
127 
128 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
129 
131 {
132  G4cout << " Visisble Energy in S1 , S2 , S3 in (MeV)" << G4endl;
133  G4cout << EBeamS1/MeV << " " << EBeamS2/MeV << " " << EBeamS3/MeV << " " << G4endl;
134 
135  G4cout << " Visible Energy in Hole Counter (MeV) " << G4endl;
136  G4cout << EHoleScint/MeV << " " << EBeamHole/MeV << G4endl;
137 
138  G4cout << " Visible Energy in Upstream Dead Materials " << G4endl;
139  G4cout << EBeamDead/MeV << G4endl;
140 
141  G4cout << " Visible Energy in Tail Catcher Scintillator" << G4endl;
142  G4int j;
143  for (j=1; j<8 ; j++) {G4cout << ETailVis[j]/MeV << " " ;}; G4cout << G4endl;
144 
145  G4cout << " Visible Energy in Tail Catcher Absorber" << G4endl;
146  for (j=1; j<7 ; j++) {G4cout << ETailDep[j]/MeV << " " ;}; G4cout << G4endl;
147 
148 // Write data in File
149  //-------------------
150  G4String FileName = "Beam_802_1mm.dat";
151  std::ios::openmode iostemp;
152  if(InitBeam == 0) {
153  iostemp = std::ios::out;
154  InitBeam++;
155  } else {
156  iostemp = std::ios::out|std::ios::app;
157  };
158 
159  std::ofstream BeamDatafile(FileName, iostemp);
160  // BeamDatafile.precision(5);
161 
162  BeamDatafile << EBeamS1/MeV << " " << EBeamS2/MeV << " " << EBeamS3/MeV << std::endl;
163  BeamDatafile << EBeamHole/MeV << std::endl;
164  BeamDatafile << EBeamDead/MeV << std::endl;
165  for (j=1; j<8 ; j++) { BeamDatafile << ETailVis[j]/MeV << " " ;} ; BeamDatafile << std::endl;
166  for (j=1; j<7 ; j++) { BeamDatafile << ETailDep[j]/MeV << " " ;} ; BeamDatafile << std::endl;
167 
168  BeamDatafile.close();
169 
170 
171 }
172 
173 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
174 
176 {}
177 
178 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
179 
181 {}
182 
183 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
184 
186 {}
187 
188 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
189 
G4bool ProcessHits(G4Step *, G4TouchableHistory *)
G4VPhysicalVolume * GetVolume(G4int depth=0) const
const XML_Char * name
const G4VTouchable * GetTouchable() const
int G4int
Definition: G4Types.hh:78
G4StepPoint * GetPreStepPoint() const
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
bool G4bool
Definition: G4Types.hh:79
Definition: G4Step.hh:76
G4double GetTotalEnergyDeposit() const
void EndOfEvent(G4HCofThisEvent *)
void Initialize(G4HCofThisEvent *)
virtual G4int GetCopyNo() const =0
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76