File indexing completed on 2025-02-23 09:19:39
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 #include "CCalHit.hh"
0032 #include <iostream>
0033
0034
0035 CCalHit::CCalHit() :
0036 entry(0), theIncidentEnergy(0.0), theTrackID(-1),
0037 theUnitID(0), theTimeSlice(0.0), theEnergyDeposit(0.0)
0038 {}
0039
0040
0041 CCalHit::~CCalHit() {}
0042
0043
0044 CCalHit::CCalHit(const CCalHit &right) :
0045 entry( right.entry ),
0046 theIncidentEnergy( right.theIncidentEnergy ),
0047 theTrackID( right.theTrackID ),
0048 theUnitID( right.theUnitID ),
0049 theTimeSlice( right.theTimeSlice ),
0050 theEnergyDeposit( right.theEnergyDeposit )
0051 {}
0052
0053
0054 const CCalHit& CCalHit::operator=(const CCalHit &right) {
0055 entry = right.entry;
0056 theIncidentEnergy = right.theIncidentEnergy;
0057 theTrackID = right.theTrackID;
0058 theUnitID = right.theUnitID;
0059 theTimeSlice = right.theTimeSlice;
0060 theEnergyDeposit = right.theEnergyDeposit;
0061 return *this;
0062 }
0063
0064
0065 CLHEP::Hep3Vector CCalHit::getEntry() const {return entry;}
0066 void CCalHit::setEntry(CLHEP::Hep3Vector xyz) { entry = xyz; }
0067
0068 G4double CCalHit::getIncidentEnergy() const {return theIncidentEnergy; }
0069 void CCalHit::setIncidentEnergy (G4double e){theIncidentEnergy = e; }
0070
0071 G4int CCalHit::getTrackID() const {return theTrackID; }
0072 void CCalHit::setTrackID (G4int i) { theTrackID = i; }
0073
0074 unsigned int CCalHit::getUnitID() const {return theUnitID; }
0075 void CCalHit::setUnitID (unsigned int i) { theUnitID = i; }
0076
0077 G4double CCalHit::getTimeSlice() const {return theTimeSlice; }
0078 void CCalHit::setTimeSlice (G4double d) { theTimeSlice = d; }
0079 G4int CCalHit::getTimeSliceID() const { if ( theTimeSlice > 1.0E9 ) return 999999999;
0080 return (G4int)theTimeSlice;}
0081
0082 void CCalHit::setEnergyDeposit(const G4double e) {
0083 theEnergyDeposit = e;
0084 }
0085
0086 G4double CCalHit::getEnergyDeposit() const {
0087 return theEnergyDeposit;
0088 }
0089
0090 void CCalHit::addEnergyDeposit(const CCalHit& aHit) {
0091 addEnergyDeposit( aHit.getEnergyDeposit() );
0092 }
0093
0094 void CCalHit::addEnergyDeposit(const G4double e) {
0095 theEnergyDeposit += e;
0096 }
0097
0098
0099 void CCalHit::print() {
0100 G4cout << (*this);
0101 }
0102
0103
0104 std::ostream& operator<<(std::ostream& os, const CCalHit& hit) {
0105 os << " Data of this CCalHit are:"<< G4endl
0106 << " \t Time slice ID: " << hit.getTimeSliceID() << G4endl
0107 << " \t Energy of primary particle (ID = " << hit.getTrackID()
0108 << ") = " << hit.getIncidentEnergy() << " (MeV)"<< G4endl
0109 << " \t Entry point in Calorimeter unit number " << hit.getUnitID()
0110 << " is: " << hit.getEntry() << " (mm)" << G4endl
0111 << " \t EnergyDeposit = " << hit.getEnergyDeposit() << " (MeV)" << G4endl;
0112 return os;
0113 }