File indexing completed on 2025-01-18 09:16:57
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032 #include <iostream>
0033
0034 #include "FCALTestbeamSetupSD.hh"
0035
0036 #include "FCALCalorHit.hh"
0037
0038 #include "FCALTestbeamSetup.hh"
0039
0040 #include "G4SystemOfUnits.hh"
0041 #include "G4VPhysicalVolume.hh"
0042 #include "G4Step.hh"
0043 #include "G4Track.hh"
0044 #include "G4VTouchable.hh"
0045 #include "G4TouchableHistory.hh"
0046 #include "G4SDManager.hh"
0047
0048 #include "G4ios.hh"
0049
0050
0051
0052 FCALTestbeamSetupSD::FCALTestbeamSetupSD(G4String name) : G4VSensitiveDetector(name)
0053 {}
0054
0055
0056
0057 FCALTestbeamSetupSD::~FCALTestbeamSetupSD()
0058 {}
0059
0060
0061
0062 void FCALTestbeamSetupSD::Initialize(G4HCofThisEvent*)
0063 {
0064 EBeamS1 = EBeamS2 = EBeamS3 = 0.;
0065 EHoleScint = EBeamHole = 0.;
0066 EBeamDead = 0;
0067 G4int j;
0068 for (j =0 ; j<NLENGTH ; j++) {
0069 ETailVis[j] = 0.;
0070 ETailDep[j] = 0.;
0071 }
0072 TailCatcherID = 0;
0073 }
0074
0075
0076
0077 G4bool FCALTestbeamSetupSD::ProcessHits(G4Step* aStep,G4TouchableHistory*)
0078 {
0079
0080 G4double edep = aStep->GetTotalEnergyDeposit();
0081 if (edep==0.) return true;
0082
0083 G4TouchableHistory* theTouchable
0084 = (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
0085 G4VPhysicalVolume* physVol = theTouchable->GetVolume();
0086
0087 G4String name = physVol->GetName();
0088 TailCatcherID = physVol->GetCopyNo();
0089
0090 if(name == "ScintS1Physical") {
0091 EBeamS1 = EBeamS1 + edep;}
0092
0093 else if(name == "ScintS2Physical") {
0094 EBeamS2 = EBeamS2 + edep;}
0095
0096 else if(name == "ScintS3Physical") {
0097 EBeamS3 = EBeamS3 + edep;}
0098
0099 else if(name == "HoleScintPhysical"){ EHoleScint += edep;}
0100 else if(name == "HoleCntrScintPhysical"){
0101 EBeamHole = EBeamHole + edep;}
0102
0103 else if(name == "MWPCPhysical") { EBeamDead += edep;}
0104 else if(name == "HoleCntrPbPhysical") { EBeamDead += edep;}
0105 else if(name == "HoleCntrAlPhysical") { EBeamDead += edep;}
0106 else if(name == "LeadWallPhysical") { EBeamDead += edep;}
0107 else if(name == "IronWallPhysical") { EBeamDead += edep;}
0108 else if(TailCatcherID >= 0 && TailCatcherID < NLENGTH) {
0109 if(name == "BigScintPhysical") {
0110 ETailVis[TailCatcherID] += edep;
0111 }
0112 else if(name == "SmallScintPhysical") {
0113 if(TailCatcherID+3 < NLENGTH) ETailVis[TailCatcherID + 3] += edep;
0114 }
0115 else if(name == "BigIronPhysical") {
0116 ETailDep[TailCatcherID] += edep;
0117 }
0118 else if(name == "SmallIronPhysical") {
0119 if(TailCatcherID+2 < NLENGTH) ETailDep[TailCatcherID+2] += edep;
0120 }
0121 }
0122
0123 return true;
0124 }
0125
0126
0127
0128 void FCALTestbeamSetupSD::EndOfEvent(G4HCofThisEvent*)
0129 {
0130 G4cout << " Visisble Energy in S1 , S2 , S3 in (MeV)" << G4endl;
0131 G4cout << EBeamS1/MeV << " " << EBeamS2/MeV << " " << EBeamS3/MeV << " " << G4endl;
0132
0133 G4cout << " Visible Energy in Hole Counter (MeV) " << G4endl;
0134 G4cout << EHoleScint/MeV << " " << EBeamHole/MeV << G4endl;
0135
0136 G4cout << " Visible Energy in Upstream Dead Materials " << G4endl;
0137 G4cout << EBeamDead/MeV << G4endl;
0138
0139 G4cout << " Visible Energy in Tail Catcher Scintillator" << G4endl;
0140 G4int j;
0141 for (j=1; j<8 ; j++) {G4cout << ETailVis[j]/MeV << " " ;}; G4cout << G4endl;
0142
0143 G4cout << " Visible Energy in Tail Catcher Absorber" << G4endl;
0144 for (j=1; j<7 ; j++) {G4cout << ETailDep[j]/MeV << " " ;}; G4cout << G4endl;
0145
0146 }
0147
0148
0149
0150 void FCALTestbeamSetupSD::clear()
0151 {}
0152
0153
0154
0155 void FCALTestbeamSetupSD::DrawAll()
0156 {}
0157
0158
0159
0160 void FCALTestbeamSetupSD::PrintAll()
0161 {}
0162
0163
0164