File indexing completed on 2024-04-06 12:30:11
0001 #ifndef SimG4CMS_ShowerLibraryProducer_HFWedgeSD_h
0002 #define SimG4CMS_ShowerLibraryProducer_HFWedgeSD_h
0003
0004 #include "SimG4Core/SensitiveDetector/interface/SensitiveCaloDetector.h"
0005 #include "SimG4Core/Notification/interface/SimTrackManager.h"
0006
0007 #include "SimG4CMS/ShowerLibraryProducer/interface/HFShowerG4Hit.h"
0008 #include "FWCore/Framework/interface/Frameworkfwd.h"
0009 #include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
0010 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0011
0012 #include "G4VPhysicalVolume.hh"
0013 #include "G4Track.hh"
0014
0015 #include <map>
0016
0017 class G4Step;
0018 class G4HCofThisEvent;
0019
0020 class HFWedgeSD : public SensitiveCaloDetector {
0021 public:
0022 explicit HFWedgeSD(const std::string&, const SensitiveDetectorCatalog& clg, const SimTrackManager*);
0023 ~HFWedgeSD() override;
0024
0025 void Initialize(G4HCofThisEvent* HCE) override;
0026 bool ProcessHits(G4Step* step, G4TouchableHistory* tHistory) override;
0027 void EndOfEvent(G4HCofThisEvent* eventHC) override;
0028 void clear() override;
0029 void DrawAll() override;
0030 void PrintAll() override;
0031
0032 void clearHits() override;
0033 uint32_t setDetUnitId(const G4Step*) override;
0034 void fillHits(edm::PCaloHitContainer&, const std::string&) override;
0035
0036 protected:
0037 G4bool hitExists();
0038 HFShowerG4Hit* createNewHit();
0039 void updateHit(HFShowerG4Hit*);
0040
0041 private:
0042 int hcID;
0043 HFShowerG4HitsCollection* theHC;
0044 std::map<int, HFShowerG4Hit*> hitMap;
0045
0046 int currentID, previousID, trackID;
0047 double edep, time;
0048 G4ThreeVector globalPos, localPos, momDir;
0049 HFShowerG4Hit* currentHit;
0050 };
0051
0052 #endif