/scratch0/jsnuveri/BDSIM/BDSIMgit/bdsim/src/BDSEnergyCounterHit.cc

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 #include "BDSEnergyCounterHit.hh"
00008 #include "G4ios.hh"
00009 
00010 G4Allocator<BDSEnergyCounterHit> BDSEnergyCounterHitAllocator;
00011 
00012 BDSEnergyCounterHit::BDSEnergyCounterHit(G4int    nCopyIn, 
00013                                          G4double energyIn, 
00014                                          G4double XIn, 
00015                                          G4double YIn, 
00016                                          G4double ZIn,
00017                                          G4double SIn,
00018                                          G4double xIn,
00019                                          G4double yIn,
00020                                          G4double zIn,
00021                                          G4String nameIn, 
00022                                          G4int    partIDIn, 
00023                                          G4double weightIn, 
00024                                          G4bool   precisionRegionIn, 
00025                                          G4int    turnsTakenIn,
00026                                          G4int    eventNoIn
00027                                          ):
00028   energy(energyIn*weightIn), 
00029   energyWeightedX(XIn*energyIn*weightIn), 
00030   energyWeightedY(YIn*energyIn*weightIn), 
00031   energyWeightedZ(ZIn*energyIn*weightIn),
00032   energyWeightedS(SIn*energyIn*weightIn),
00033   X(XIn),
00034   Y(YIn),
00035   Z(ZIn),
00036   S(SIn),
00037   x(xIn),
00038   y(yIn),
00039   z(zIn),
00040   weight(weightIn),
00041   copyNumber(nCopyIn),
00042   partID(partIDIn),
00043   name(nameIn),
00044   precisionRegion(precisionRegionIn),
00045   turnsTaken(turnsTakenIn),
00046   eventNo(eventNoIn)
00047 {;}
00048 
00049 BDSEnergyCounterHit::~BDSEnergyCounterHit()
00050 {;}
00051 
00052 BDSEnergyCounterHit* BDS::LowestSPosPrimaryHit(BDSEnergyCounterHitsCollection* hc)
00053 {
00054   G4double sposMin = 1e20; //stupidly large number - spos will always be less than
00055   G4double spos = 0;
00056   G4int indexofHit = -1;
00057   for (G4int i = 0; i < hc->entries(); ++i)
00058     {
00059       spos = (*hc)[i]->GetS();
00060       if (spos < sposMin) {
00061         sposMin = spos; //keep for testing
00062         indexofHit = i; //record which hit it was
00063       }
00064     }
00065   if (indexofHit != -1)
00066     {return (*hc)[indexofHit];}
00067   else
00068     {return NULL;}
00069 }
00070 
00071 
00072 BDSEnergyCounterHit* BDS::HighestSPosPrimaryHit(BDSEnergyCounterHitsCollection* hc)
00073 {
00074   G4double sposMax = -1e10; //negative number - spos will always be greater than
00075   G4double spos = 0;
00076   G4int indexofHit = -1;
00077   for (G4int i = 0; i < hc->entries(); ++i)
00078     {
00079       spos = (*hc)[i]->GetS();
00080       if (spos > sposMax) {
00081         sposMax = spos; //keep for testing
00082         indexofHit = i; //record which hit it was
00083       }
00084     }
00085   if (indexofHit != -1)
00086     {return (*hc)[indexofHit];}
00087   else
00088     {return NULL;}
00089 }

Generated on 28 Jun 2015 for BDSIM by  doxygen 1.4.7