Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:19:39

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 // File: CCalHit.cc
0028 // Description: Hit class for Calorimeters (Ecal, Hcal, ...)
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 }