File indexing completed on 2024-04-06 12:30:13
0001 #ifndef SimG4CMS_TkAccumulatingSensitiveDetector_H
0002 #define SimG4CMS_TkAccumulatingSensitiveDetector_H
0003
0004
0005
0006
0007
0008 #include "SimG4Core/Notification/interface/Observer.h"
0009 #include "SimG4Core/SensitiveDetector/interface/SensitiveTkDetector.h"
0010 #include "SimG4Core/Notification/interface/BeginOfTrack.h"
0011 #include "SimG4Core/Notification/interface/BeginOfEvent.h"
0012 #include "SimG4Core/Notification/interface/EndOfEvent.h"
0013 #include "SimG4Core/Notification/interface/BeginOfJob.h"
0014 #include "FWCore/Framework/interface/Frameworkfwd.h"
0015 #include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
0016 #include "Geometry/TrackerNumberingBuilder/interface/GeometricDet.h"
0017
0018 #include "G4Step.hh"
0019 #include "G4Track.hh"
0020
0021 #include <string>
0022
0023 class TrackInformation;
0024 class SimTrackManager;
0025 class TrackingSlaveSD;
0026 class FrameRotation;
0027 class UpdatablePSimHit;
0028 class G4ProcessTypeEnumerator;
0029 class TrackerG4SimHitNumberingScheme;
0030
0031 class TkAccumulatingSensitiveDetector : public SensitiveTkDetector,
0032 public Observer<const BeginOfEvent *>,
0033 public Observer<const BeginOfTrack *>,
0034 public Observer<const BeginOfJob *> {
0035 public:
0036 TkAccumulatingSensitiveDetector(const std::string &,
0037 const GeometricDet *,
0038 const SensitiveDetectorCatalog &,
0039 edm::ParameterSet const &,
0040 const SimTrackManager *);
0041 ~TkAccumulatingSensitiveDetector() override;
0042 bool ProcessHits(G4Step *, G4TouchableHistory *) override;
0043 uint32_t setDetUnitId(const G4Step *) override;
0044 void EndOfEvent(G4HCofThisEvent *) override;
0045
0046 void fillHits(edm::PSimHitContainer &, const std::string &) override;
0047 void clearHits() override;
0048
0049 private:
0050 void createHit(const G4Step *);
0051 void sendHit();
0052 void updateHit(const G4Step *);
0053 bool newHit(const G4Step *);
0054 bool closeHit(const G4Step *);
0055
0056 protected:
0057 void update(const BeginOfEvent *) override;
0058 void update(const BeginOfTrack *) override;
0059 void update(const BeginOfJob *) override;
0060
0061 private:
0062
0063 const GeometricDet *pDD_;
0064 const SimTrackManager *theManager;
0065 std::unique_ptr<TrackingSlaveSD> slaveLowTof;
0066 std::unique_ptr<TrackingSlaveSD> slaveHighTof;
0067 std::unique_ptr<FrameRotation> theRotation;
0068 std::unique_ptr<const G4ProcessTypeEnumerator> theG4ProcTypeEnumerator;
0069 TrackerG4SimHitNumberingScheme *theNumberingScheme;
0070 bool allowZeroEnergyLoss;
0071 bool printHits;
0072 bool neverAccumulate;
0073 double rTracker2;
0074 double rTracker;
0075 double zTracker;
0076 float theTofLimit;
0077 float energyCut;
0078 float energyHistoryCut;
0079
0080
0081 UpdatablePSimHit *mySimHit;
0082 uint32_t lastId;
0083 int lastTrack;
0084
0085
0086 Local3DPoint globalEntryPoint;
0087 Local3DPoint globalExitPoint;
0088 const G4VPhysicalVolume *oldVolume;
0089 float px, py, pz;
0090 int eventno;
0091 std::string pname;
0092 };
0093
0094 #endif