File indexing completed on 2025-08-05 08:18:16
0001 #ifndef G4TPC_PHG4TPCDIRECTLASER_H
0002 #define G4TPC_PHG4TPCDIRECTLASER_H
0003
0004 #include <fun4all/SubsysReco.h>
0005
0006 #include <phparameter/PHParameterInterface.h>
0007
0008 #include <TNtuple.h>
0009 #include <TVector3.h>
0010
0011 #include <cmath>
0012 #include <limits>
0013 #include <string> // for string, allocator
0014 #include <vector> // for vector
0015
0016 class PHG4HitContainer;
0017 class SvtxTrackMap;
0018 class PHG4TruthInfoContainer;
0019 class PHCompositeNode;
0020
0021 class PHG4TpcDirectLaser : public SubsysReco, public PHParameterInterface
0022 {
0023 public:
0024
0025 PHG4TpcDirectLaser(const std::string &name = "PHG4TpcDirectLaser");
0026
0027
0028 ~PHG4TpcDirectLaser() override = default;
0029
0030
0031 int InitRun(PHCompositeNode *) override;
0032
0033
0034 int process_event(PHCompositeNode *) override;
0035
0036
0037 void SetDefaultParameters() override;
0038
0039
0040 void Detector(const std::string &d)
0041 {
0042 detector = d;
0043 }
0044
0045
0046 void SetPhiStepping(int n, double min, double max);
0047
0048
0049 void SetThetaStepping(int n, double min, double max);
0050
0051
0052 void SetFileStepping(int n);
0053
0054
0055 int GetNpatternSteps() const
0056 {
0057 return nPhiSteps * nThetaSteps;
0058 };
0059
0060
0061 void SetCurrentPatternStep(int value)
0062 {
0063 currentPatternStep = value;
0064 }
0065
0066
0067 void SetDirectLaserAuto(bool value)
0068 {
0069 m_autoAdvanceDirectLaser = value;
0070 };
0071
0072
0073 void SetDirectLaserPatternfromFile(bool value)
0074 {
0075 m_steppingpattern = value;
0076 };
0077
0078 void SetArbitraryThetaPhi(double theta, double phi)
0079 {
0080 arbitrary_theta = theta;
0081 arbitrary_phi = phi;
0082 }
0083
0084 private:
0085
0086
0087 void SetupLasers();
0088
0089
0090 void AimToThetaPhi(double theta, double phi);
0091
0092
0093 void AimToPatternStep(int n);
0094
0095
0096 void AimToPatternStep_File(int n);
0097
0098 float theta_p{0};
0099 float phi_p{0};
0100 TNtuple *pattern{nullptr};
0101
0102
0103 void AimToNextPatternStep();
0104
0105
0106 class Laser
0107 {
0108 public:
0109
0110 TVector3 m_position;
0111
0112
0113 double m_phi{0};
0114
0115
0116 int m_direction{1};
0117 };
0118
0119
0120 void AppendLaserTrack(double theta, double phi, const Laser &);
0121
0122
0123 std::string detector{"TPC"};
0124
0125
0126 std::string hitnodename;
0127
0128
0129 std::vector<Laser> m_lasers;
0130
0131
0132 int electrons_per_cm{300};
0133
0134
0135
0136
0137
0138
0139
0140 double electrons_per_gev{std::numeric_limits<double>::signaling_NaN()};
0141
0142 double arbitrary_theta{-30.0};
0143 double arbitrary_phi{-30.0};
0144
0145
0146
0147 int nPhiSteps{1};
0148 int nThetaSteps{1};
0149 int nTotalSteps{1};
0150 double minPhi{0};
0151 double maxPhi{0};
0152 double minTheta{0};
0153 double maxTheta{0};
0154
0155
0156
0157 int currentPatternStep{0};
0158
0159
0160 bool m_autoAdvanceDirectLaser{false};
0161
0162
0163 bool m_steppingpattern{false};
0164
0165
0166 PHG4HitContainer *m_g4hitcontainer{nullptr};
0167
0168
0169 PHG4TruthInfoContainer *m_g4truthinfo{nullptr};
0170
0171
0172 std::string m_track_map_name{"SvtxTrackMap"};
0173 SvtxTrackMap *m_track_map{nullptr};
0174 };
0175
0176 #endif