Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:16:57

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 // 
0028 
0029 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0030 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
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 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0051 
0052 FCALTestbeamSetupSD::FCALTestbeamSetupSD(G4String name) : G4VSensitiveDetector(name)
0053 {}
0054 
0055 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0056 
0057 FCALTestbeamSetupSD::~FCALTestbeamSetupSD()
0058 {}
0059 
0060 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
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 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
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 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
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 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0149 
0150 void FCALTestbeamSetupSD::clear()
0151 {} 
0152 
0153 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0154 
0155 void FCALTestbeamSetupSD::DrawAll()
0156 {} 
0157 
0158 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0159 
0160 void FCALTestbeamSetupSD::PrintAll()
0161 {} 
0162 
0163 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0164