Geant4.10
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
geant4.10.00.p01
examples
advanced
lAr_calorimeter
src
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
54
FCALTestbeamSetupSD::FCALTestbeamSetupSD
(
G4String
name
) :
G4VSensitiveDetector
(name)
55
{;}
56
57
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
58
59
FCALTestbeamSetupSD::~FCALTestbeamSetupSD
()
60
{;}
61
62
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
63
64
void
FCALTestbeamSetupSD::Initialize
(
G4HCofThisEvent
*)
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
77
G4bool
FCALTestbeamSetupSD::ProcessHits
(
G4Step
* aStep,
G4TouchableHistory
*)
78
{
79
80
G4double
edep = aStep->
GetTotalEnergyDeposit
();
81
if
(edep==0.)
return
false
;
82
83
G4TouchableHistory
* theTouchable
84
= (
G4TouchableHistory
*)(aStep->
GetPreStepPoint
()->
GetTouchable
());
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
130
void
FCALTestbeamSetupSD::EndOfEvent
(
G4HCofThisEvent
*)
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
175
void
FCALTestbeamSetupSD::clear
()
176
{}
177
178
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
179
180
void
FCALTestbeamSetupSD::DrawAll
()
181
{}
182
183
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
184
185
void
FCALTestbeamSetupSD::PrintAll
()
186
{}
187
188
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
189
testem0.app
tuple app
Definition:
python3/testem0.py:189
FCALTestbeamSetupSD::ProcessHits
G4bool ProcessHits(G4Step *, G4TouchableHistory *)
Definition:
FCALTestbeamSetupSD.cc:77
FCALTestbeamSetupSD::EHoleScint
G4double EHoleScint
Definition:
FCALTestbeamSetupSD.hh:72
G4TouchableHistory.hh
FCALTestbeamSetupSD::clear
void clear()
Definition:
FCALTestbeamSetupSD.cc:175
G4TouchableHistory::GetVolume
G4VPhysicalVolume * GetVolume(G4int depth=0) const
G4Track.hh
G4VPhysicalVolume
Definition:
G4VPhysicalVolume.hh:80
FCALTestbeamSetupSD::ETailDep
G4double ETailDep[7]
Definition:
FCALTestbeamSetupSD.hh:75
FCALTestbeamSetupSD::EBeamS3
G4double EBeamS3
Definition:
FCALTestbeamSetupSD.hh:71
python.hepunit.MeV
MeV
Definition:
hepunit.py:117
G4VSensitiveDetector
Definition:
G4VSensitiveDetector.hh:50
G4Step.hh
name
const XML_Char * name
Definition:
include/expat.h:151
G4StepPoint::GetTouchable
const G4VTouchable * GetTouchable() const
FCALTestbeamSetupSD::PrintAll
void PrintAll()
Definition:
FCALTestbeamSetupSD.cc:185
G4int
int G4int
Definition:
G4Types.hh:78
G4Step::GetPreStepPoint
G4StepPoint * GetPreStepPoint() const
FCALTestbeamSetupSD::ETailVis
G4double ETailVis[8]
Definition:
FCALTestbeamSetupSD.hh:75
FCALTestbeamSetupSD.hh
FCALTestbeamSetupSD::DrawAll
void DrawAll()
Definition:
FCALTestbeamSetupSD.cc:180
G4cout
G4GLOB_DLL std::ostream G4cout
G4VPhysicalVolume::GetName
const G4String & GetName() const
G4SDManager.hh
FCALTestbeamSetupSD::EBeamS1
G4double EBeamS1
Definition:
FCALTestbeamSetupSD.hh:71
G4bool
bool G4bool
Definition:
G4Types.hh:79
FCALCalorHit.hh
FCALTestbeamSetupSD::FCALTestbeamSetupSD
FCALTestbeamSetupSD(G4String)
Definition:
FCALTestbeamSetupSD.cc:54
G4Step
Definition:
G4Step.hh:76
G4Step::GetTotalEnergyDeposit
G4double GetTotalEnergyDeposit() const
FCALTestbeamSetupSD::EndOfEvent
void EndOfEvent(G4HCofThisEvent *)
Definition:
FCALTestbeamSetupSD.cc:130
G4TouchableHistory
Definition:
G4TouchableHistory.hh:53
FCALTestbeamSetupSD::~FCALTestbeamSetupSD
~FCALTestbeamSetupSD()
Definition:
FCALTestbeamSetupSD.cc:59
FCALTestbeamSetupSD::Initialize
void Initialize(G4HCofThisEvent *)
Definition:
FCALTestbeamSetupSD.cc:64
G4ios.hh
G4VPhysicalVolume::GetCopyNo
virtual G4int GetCopyNo() const =0
G4HCofThisEvent
Definition:
examples/extended/parallel/TopC/ParN02/AnnotatedFiles/G4HCofThisEvent.hh:64
FCALTestbeamSetup.hh
G4VTouchable.hh
G4endl
#define G4endl
Definition:
G4ios.hh:61
FCALTestbeamSetupSD::TailCatcherID
G4int TailCatcherID
Definition:
FCALTestbeamSetupSD.hh:74
G4VPhysicalVolume.hh
G4double
double G4double
Definition:
G4Types.hh:76
G4SystemOfUnits.hh
FCALTestbeamSetupSD::EBeamDead
G4double EBeamDead
Definition:
FCALTestbeamSetupSD.hh:73
FCALTestbeamSetupSD::EBeamS2
G4double EBeamS2
Definition:
FCALTestbeamSetupSD.hh:71
FCALTestbeamSetupSD::EBeamHole
G4double EBeamHole
Definition:
FCALTestbeamSetupSD.hh:72
G4String
Definition:
examples/extended/parallel/TopC/ParN02/AnnotatedFiles/G4String.hh:45
Generated on Wed Apr 30 2014 15:54:35 for Geant4.10 by
1.8.7