File indexing completed on 2024-04-06 12:30:19
0001 #ifndef SimG4Core_CustomPhysics_RHStopTracer_H
0002 #define SimG4Core_CustomPhysics_RHStopTracer_H
0003
0004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0005
0006 #include "SimG4Core/Watcher/interface/SimProducer.h"
0007 #include "SimG4Core/Notification/interface/Observer.h"
0008
0009 #include <regex>
0010
0011 class BeginOfRun;
0012 class BeginOfEvent;
0013 class BeginOfTrack;
0014 class EndOfTrack;
0015 class G4Step;
0016 class G4ParticleDefinition;
0017
0018 class RHStopTracer : public SimProducer,
0019 public Observer<const BeginOfRun *>,
0020 public Observer<const BeginOfEvent *>,
0021 public Observer<const BeginOfTrack *>,
0022 public Observer<const EndOfTrack *> {
0023 public:
0024 RHStopTracer(edm::ParameterSet const &p);
0025 ~RHStopTracer() override = default;
0026 void update(const BeginOfRun *) override;
0027 void update(const BeginOfEvent *) override;
0028 void update(const BeginOfTrack *) override;
0029 void update(const EndOfTrack *) override;
0030 void produce(edm::Event &, const edm::EventSetup &) override;
0031
0032 private:
0033 struct StopPoint {
0034 StopPoint(
0035 const std::string &fName, double fX, double fY, double fZ, double fT, int fId, double fMass, double fCharge)
0036 : name(fName), x(fX), y(fY), z(fZ), t(fT), id(fId), mass(fMass), charge(fCharge) {}
0037 std::string name;
0038 double x;
0039 double y;
0040 double z;
0041 double t;
0042 int id;
0043 double mass;
0044 double charge;
0045 };
0046 bool mStopRegular;
0047 double mTraceEnergy;
0048 int minPdgId;
0049 int maxPdgId;
0050 int otherPdgId;
0051 std::string mTraceParticleName;
0052 std::regex rePartName;
0053 std::vector<StopPoint> mStopPoints;
0054 };
0055
0056 #endif