Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:30:10

0001 #ifndef PPS_TotemRPSD_h
0002 #define PPS_TotemRPSD_h
0003 
0004 /**
0005    In this example the TotemSensitiveDetector serves as a master for two different ExampleSD
0006  */
0007 
0008 #include "SimG4CMS/PPS/interface/TotemRPG4Hit.h"
0009 #include "SimG4CMS/PPS/interface/TotemRPG4HitCollection.h"
0010 #include "SimG4CMS/PPS/interface/TotemRPVDetectorOrganization.h"
0011 
0012 #include "SimG4Core/Notification/interface/Observer.h"
0013 #include "SimG4Core/SensitiveDetector/interface/SensitiveTkDetector.h"
0014 #include "SimG4Core/Notification/interface/BeginOfEvent.h"
0015 #include "SimG4Core/Notification/interface/EndOfEvent.h"
0016 
0017 #include "FWCore/Framework/interface/Frameworkfwd.h"
0018 #include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
0019 
0020 #include <string>
0021 
0022 class G4Step;
0023 class G4HCofThisEvent;
0024 class G4Track;
0025 class G4StepPoint;
0026 class TrackingSlaveSD;
0027 class SimTrackManager;
0028 class TotemTestHitHBNtuple;
0029 
0030 class TotemRPSD : public SensitiveTkDetector, public Observer<const BeginOfEvent*>, public Observer<const EndOfEvent*> {
0031 public:
0032   TotemRPSD(const std::string&, const SensitiveDetectorCatalog&, edm::ParameterSet const&, const SimTrackManager*);
0033   ~TotemRPSD() override;
0034 
0035   // Geant4 methods
0036   bool ProcessHits(G4Step* step, G4TouchableHistory* tHistory) override;
0037 
0038   void Initialize(G4HCofThisEvent* HCE) override;
0039   void EndOfEvent(G4HCofThisEvent* eventHC) override;
0040   void PrintAll() override;
0041 
0042   // CMSSW methods
0043   uint32_t setDetUnitId(const G4Step* step) override;
0044   void fillHits(edm::PSimHitContainer&, const std::string&) override;
0045   void clearHits() override;
0046 
0047 protected:
0048   void update(const BeginOfEvent*) override;
0049   void update(const ::EndOfEvent*) override;
0050 
0051 private:
0052   G4ThreeVector setToLocal(const G4ThreeVector& globalPoint);
0053   void stepInfo(const G4Step* aStep);
0054   void createNewHit();
0055   void storeHit(TotemRPG4Hit*);
0056   void printHitInfo();
0057 
0058   std::unique_ptr<TrackingSlaveSD> slave_;
0059   std::unique_ptr<TotemRPVDetectorOrganization> numberingScheme_;
0060 
0061   TotemRPG4HitCollection* theHC_ = nullptr;
0062   TotemRPG4Hit* currentHit_ = nullptr;
0063   G4Track* theTrack_ = nullptr;
0064   G4VPhysicalVolume* currentPV_ = nullptr;
0065   G4int hcID_ = -1;
0066   G4int primaryID_ = 0;
0067   G4int parentID_ = 0;
0068   G4int tSliceID_ = 0;
0069   G4double tSlice_ = 0.0;
0070 
0071   G4StepPoint* preStepPoint_ = nullptr;
0072   G4StepPoint* postStepPoint_ = nullptr;
0073   G4ThreeVector hitPoint_;
0074   G4ThreeVector exitPoint_;
0075   G4ThreeVector theLocalEntryPoint_;
0076   G4ThreeVector theLocalExitPoint_;
0077 
0078   double incidentEnergy_ = 0.0;
0079   double pabs_ = 0.0;
0080   double thePx_ = 0.0;
0081   double thePy_ = 0.0;
0082   double thePz_ = 0.0;
0083   double tof_ = 0.0;
0084   double eloss_ = 0.0;
0085 
0086   double thetaAtEntry_ = 0.0;
0087   double phiAtEntry_ = 0.0;
0088 
0089   double vx_ = 0.0;
0090   double vy_ = 0.0;
0091   double vz_ = 0.0;
0092 
0093   unsigned int unitID_ = 0;
0094   int verbosity_;
0095   int eventno_ = 0;
0096   short particleType_ = 0;
0097 };
0098 
0099 #endif  // PPS_TotemRPSD_h