/home/docs/checkouts/readthedocs.org/user_builds/ratpac/checkouts/latest/src/core/include/RAT/TrackInfo.hh Source File

Ratpac-two: /home/docs/checkouts/readthedocs.org/user_builds/ratpac/checkouts/latest/src/core/include/RAT/TrackInfo.hh Source File
Ratpac-two
TrackInfo.hh
1 #ifndef __RAT_TrackInfo__
2 #define __RAT_TrackInfo__
3 
4 #include <G4Allocator.hh>
5 #include <G4VUserTrackInformation.hh>
6 #include <RAT/CentroidCalculator.hh>
7 #include <map>
8 #include <string>
9 
10 namespace RAT {
11 
12 class TrackInfo : public G4VUserTrackInformation {
13  public:
14  TrackInfo(){};
15  virtual ~TrackInfo(){};
16 
17  inline void *operator new(size_t);
18  inline void operator delete(void *);
19 
20  void SetCreatorProcess(std::string &creatorProcess) { fCreatorProcess = creatorProcess; };
21  void SetCreatorProcess(const char *creatorProcess) { fCreatorProcess = creatorProcess; };
22  std::string GetCreatorProcess() const { return fCreatorProcess; };
23 
24  // Ok, I'm tired of getter/setter C++ bondage crap. Just expose the
25  // interface already.
26 
27  // G4 does not guaranttee that preUserTrackingAction is only called once on each track. Track this status to prevent
28  // double counting
29  bool preUserTrackingActionDone = false;
30 
35 
37  std::map<std::string, double> energyLoss;
38 
40  void SetCreatorStep(int _CreatorStep) { CreatorStep = _CreatorStep; };
41  int GetCreatorStep() const { return CreatorStep; };
42 
43  virtual void Print() const {};
44 
45  protected:
46  std::string fCreatorProcess;
47  int CreatorStep;
48 };
49 
50 // GEANT4 uses a custom allocator on subclass, so we need to override it here.
51 extern G4Allocator<TrackInfo> aTrackInfoAllocator;
52 
53 inline void *TrackInfo::operator new(size_t) {
54  void *aTrackInfo;
55  aTrackInfo = (void *)aTrackInfoAllocator.MallocSingle();
56  return aTrackInfo;
57 }
58 
59 inline void TrackInfo::operator delete(void *aTrackInfo) { aTrackInfoAllocator.FreeSingle((TrackInfo *)aTrackInfo); }
60 
61 } // namespace RAT
62 
63 #endif
Definition: CentroidCalculator.hh:19
Definition: TrackInfo.hh:12
void SetCreatorStep(int _CreatorStep)
Definition: TrackInfo.hh:40
std::map< std::string, double > energyLoss
Definition: TrackInfo.hh:37
CentroidCalculator energyCentroid
Definition: TrackInfo.hh:32
CentroidCalculator opticalCentroid
Definition: TrackInfo.hh:34
Definition: CCCrossSecMessenger.hh:29