File indexing completed on 2023-03-17 11:24:38
0001 #ifndef _PPSPixelSD_h
0002 #define _PPSPixelSD_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025 #include "SimG4Core/Notification/interface/Observer.h"
0026 #include "SimG4Core/SensitiveDetector/interface/SensitiveTkDetector.h"
0027 #include "SimG4Core/Notification/interface/BeginOfEvent.h"
0028 #include "SimG4Core/Notification/interface/EndOfEvent.h"
0029
0030 #include "SimG4CMS/PPS/interface/PPSPixelG4Hit.h"
0031 #include "SimG4CMS/PPS/interface/PPSPixelG4HitCollection.h"
0032 #include "SimG4CMS/PPS/interface/PPSVDetectorOrganization.h"
0033 #include "SimG4Core/Notification/interface/SimTrackManager.h"
0034
0035 #include "FWCore/Framework/interface/Frameworkfwd.h"
0036 #include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
0037
0038 #include <string>
0039
0040 class TrackingSlaveSD;
0041 class SimTrackManager;
0042 class G4Step;
0043 class G4StepPoint;
0044 class G4Track;
0045
0046 class PPSPixelSD : public SensitiveTkDetector,
0047 public Observer<const BeginOfEvent*>,
0048 public Observer<const EndOfEvent*> {
0049 public:
0050 PPSPixelSD(const std::string&, const SensitiveDetectorCatalog&, edm::ParameterSet const&, SimTrackManager const*);
0051 ~PPSPixelSD() override;
0052
0053
0054 bool ProcessHits(G4Step*, G4TouchableHistory*) override;
0055
0056 void Initialize(G4HCofThisEvent* HCE) override;
0057 void EndOfEvent(G4HCofThisEvent* eventHC) override;
0058 void PrintAll() override;
0059
0060
0061 uint32_t setDetUnitId(const G4Step*) override;
0062 void fillHits(edm::PSimHitContainer&, const std::string&) override;
0063 void clearHits() override;
0064
0065 protected:
0066 void update(const BeginOfEvent*) override;
0067 void update(const ::EndOfEvent*) override;
0068
0069 private:
0070 G4ThreeVector setToLocal(const G4ThreeVector& globalPoint);
0071 void stepInfo(const G4Step* aStep);
0072 bool hitExists();
0073 void createNewHit();
0074 void updateHit();
0075 void storeHit(PPSPixelG4Hit*);
0076
0077 std::unique_ptr<TrackingSlaveSD> slave_;
0078 std::unique_ptr<PPSVDetectorOrganization> numberingScheme_;
0079
0080 PPSPixelG4HitCollection* theHC_ = nullptr;
0081 const SimTrackManager* theManager_;
0082 PPSPixelG4Hit* currentHit_ = nullptr;
0083 G4Track* theTrack_ = nullptr;
0084 G4VPhysicalVolume* currentPV_ = nullptr;
0085 G4int hcID_ = -1;
0086
0087 G4StepPoint* preStepPoint_ = nullptr;
0088 G4StepPoint* postStepPoint_ = nullptr;
0089 G4ThreeVector hitPoint_;
0090 G4ThreeVector exitPoint_;
0091 G4ThreeVector theLocalEntryPoint_;
0092 G4ThreeVector theLocalExitPoint_;
0093
0094 double tSlice_ = 0.0;
0095 double eloss_ = 0.0;
0096 float incidentEnergy_ = 0.f;
0097 float pabs_ = 0.f;
0098 float tof_ = 0.f;
0099
0100 float thetaAtEntry_ = 0.f;
0101 float phiAtEntry_ = 0.f;
0102 float vx_ = 0.f;
0103 float vy_ = 0.f;
0104 float vz_ = 0.f;
0105
0106 uint32_t unitID_ = 0;
0107 uint32_t previousUnitID_ = 0;
0108 int tsID_ = 0;
0109 int primaryID_ = 0;
0110 int parentID_ = 0;
0111 int tSliceID_ = 0;
0112 int eventno_ = 0;
0113 short particleType_ = 0;
0114 };
0115
0116 #endif