include/BDSEnergyCounterHit.hh

00001 /* BDSIM code.    Version 1.0
00002    Author: Grahame A. Blair, Royal Holloway, Univ. of London.
00003    Last modified 24.7.2002
00004    Copyright (c) 2002 by G.A.Blair.  ALL RIGHTS RESERVED. 
00005 */
00006 
00007 #ifndef BDSEnergyCounterHit_h
00008 #define BDSEnergyCounterHit_h 1
00009 
00010 #include "G4VHit.hh"
00011 #include "G4THitsCollection.hh"
00012 #include "G4Allocator.hh"
00013 #include "G4ThreeVector.hh"
00014 
00015 class BDSEnergyCounterHit :public G4VHit
00016 {
00017 public:
00018   BDSEnergyCounterHit(G4int nCopy, G4double Energy=0, G4double x=0, G4double y=0, G4double z=0, G4String name="", G4int partID=0, G4double weight=1, G4bool precisionRegion=false);
00019 
00020   ~BDSEnergyCounterHit();
00021 
00022   inline void* operator new(size_t) ;
00023   inline void operator delete(void *aHit);
00024 
00025   inline G4double GetEnergy();
00026   inline G4int GetCopyNumber();
00027   inline G4String GetName();
00028   inline void SetEnergy(G4double Energy);
00029   inline void AddEnergy(G4double Energy, G4double weight);
00030   inline void AddEnergyWeightedPosition(G4double Energy, G4double xpos, G4double ypos, G4double zpos, G4double weight);
00031   inline G4double GetZ(); 
00032   inline G4double GetX(); 
00033   inline G4double GetY(); 
00034   inline G4double GetEnergyWeightedY(); 
00035   inline G4double GetEnergyWeightedZ(); 
00036   inline G4double GetEnergyWeightedX(); 
00037   inline G4int GetPartID(); 
00038   inline G4double GetWeight(); 
00039   inline void SetWeight(G4double weight);
00040   inline G4bool GetPrecisionRegion();
00041   
00042 private:
00044   BDSEnergyCounterHit();
00045 
00046   G4double itsEnergy;
00047   G4double itsEnergyWeightedX;
00048   G4double itsEnergyWeightedY;
00049   G4double itsEnergyWeightedZ;
00050   G4double itsX;
00051   G4double itsY;
00052   G4double itsZ;
00053   G4double itsWeight;
00054   G4int itsCopyNumber;
00055   G4int itsPartID;
00056   G4String itsName;
00057   G4bool itsPrecisionRegion; //Whether or not the hit is in the precision region
00058 };
00059 
00060 inline G4double BDSEnergyCounterHit::GetEnergy()
00061 {return itsEnergy;}
00062 
00063 inline G4double BDSEnergyCounterHit::GetX()
00064 {return itsX;}
00065 
00066 inline G4double BDSEnergyCounterHit::GetY()
00067 {return itsY;}
00068 
00069 inline G4double BDSEnergyCounterHit::GetZ()
00070 {
00071   return itsZ;
00072 }
00073 
00074 inline G4double BDSEnergyCounterHit::GetEnergyWeightedX()
00075 {return itsEnergyWeightedX;}
00076 
00077 inline G4double BDSEnergyCounterHit::GetEnergyWeightedY()
00078 {return itsEnergyWeightedY;}
00079 
00080 inline G4double BDSEnergyCounterHit::GetEnergyWeightedZ()
00081 {
00082   return itsEnergyWeightedZ;
00083 }
00084 
00085 inline G4double BDSEnergyCounterHit::GetWeight()
00086 {
00087   return itsWeight;
00088 }
00089 
00090 inline G4bool BDSEnergyCounterHit::GetPrecisionRegion()
00091 {
00092   return itsPrecisionRegion;
00093 }
00094 
00095 
00096 
00097 inline G4int BDSEnergyCounterHit::GetCopyNumber()
00098 {return itsCopyNumber;}
00099 
00100 inline G4int BDSEnergyCounterHit::GetPartID()
00101 {return itsPartID;}
00102 
00103 inline G4String BDSEnergyCounterHit::GetName()
00104 {return itsName;}
00105 
00106 inline void BDSEnergyCounterHit::SetEnergy(G4double Energy)
00107 {itsEnergy=Energy;}   
00108 
00109 inline void BDSEnergyCounterHit::AddEnergy(G4double Energy, G4double weight)
00110 {itsEnergy+=Energy*weight;}   
00111 
00112 inline void BDSEnergyCounterHit::AddEnergyWeightedPosition(G4double Energy, G4double X, G4double Y, G4double Z, G4double weight){
00113   itsEnergyWeightedX+=Energy*X*weight;
00114   itsEnergyWeightedY+=Energy*Y*weight;
00115   itsEnergyWeightedZ+=Energy*Z*weight;
00116   itsEnergy+=Energy*weight;
00117   //  G4cout << "BDSEnergyCounterHit.hh::AddEnergyWeightedPosition: weight = " << weight << G4endl;
00118   //  G4cout << "BDSEnergyCounterHit.hh::AddEnergyWeightedPosition: itsWeight = " << itsWeight << G4endl;
00119 }   
00120 
00121 typedef G4THitsCollection<BDSEnergyCounterHit> BDSEnergyCounterHitsCollection;
00122 extern G4Allocator<BDSEnergyCounterHit> BDSEnergyCounterHitAllocator;
00123 
00124 inline void* BDSEnergyCounterHit::operator new(size_t)
00125 {
00126   void* aHit;
00127   aHit=(void*) BDSEnergyCounterHitAllocator.MallocSingle();
00128   return aHit;
00129 }
00130 
00131 inline void BDSEnergyCounterHit::operator delete(void *aHit)
00132 {
00133  BDSEnergyCounterHitAllocator.FreeSingle((BDSEnergyCounterHit*) aHit);
00134 }
00135 
00136 #endif
00137 

Generated on 27 Aug 2013 for BDSIM by  doxygen 1.4.7