REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestGeant4BiasingVolume.h
1
15
16#ifndef RestCore_TRestGeant4BiasingVolume
17#define RestCore_TRestGeant4BiasingVolume
18
19#include <iostream>
20
21#include "TObject.h"
22#include "TString.h"
23#include "TVector3.h"
24
25class TRestGeant4BiasingVolume : public TObject {
26 protected:
27 TVector3 fVolumePosition;
28 Double_t fVolumeSize;
29 TString fBiasingVolumeType;
30 Double_t fBiasingFactor;
31 TVector2 fEnergyRange;
32 TString fVolumeType;
33
34 public:
35 inline Double_t GetBiasingFactor() const { return fBiasingFactor; }
36 inline Double_t GetBiasingVolumeSize() const { return fVolumeSize; }
37 inline TString GetBiasingVolumeType() const { return fVolumeType; }
38 inline TVector3 GetBiasingVolumePosition() const { return fVolumePosition; }
39 inline TVector2 GetEnergyRange() const { return fEnergyRange; }
40 inline Double_t GetMaxEnergy() const { return fEnergyRange.Y(); }
41 inline Double_t GetMinEnergy() const { return fEnergyRange.X(); }
42
43 void SetBiasingVolumeSize(Double_t size) { fVolumeSize = size; }
44 void SetBiasingVolumeType(TString type) { fVolumeType = type; }
45 void SetBiasingVolumePosition(TVector3 pos) { fVolumePosition = pos; }
46 void SetBiasingFactor(Double_t factor) { fBiasingFactor = factor; }
47 void SetEnergyRange(TVector2 eRange) { fEnergyRange = eRange; }
48
49 // Check if it is inside the sphere
50 Int_t isInside(Double_t x, Double_t y, Double_t z) {
51 if (fVolumeType == "virtualBox") {
52 if (x < fVolumeSize / 2. && x > -fVolumeSize / 2.)
53 if (y < fVolumeSize / 2. && y > -fVolumeSize / 2.)
54 if (z < fVolumeSize / 2. && z > -fVolumeSize / 2.) return 1;
55 }
56
57 if (fVolumeType == "virtualSphere") {
58 Double_t r2 = x * x + y * y + z * z;
59 if (r2 < fVolumeSize * fVolumeSize) return 1;
60 }
61 return 0;
62 }
63
64 void PrintBiasingVolume();
65
66 // Constructor
68 // Destructor
70
71 ClassDef(TRestGeant4BiasingVolume, 2); // REST event superclass
72};
73#endif