Skip to content

Commit

Permalink
Merge pull request #37648 from civanch/pps_sensitive_detectors
Browse files Browse the repository at this point in the history
PPS Geant4 sensitive detectors
  • Loading branch information
cmsbuild committed May 4, 2022
2 parents ed9e032 + 32519b6 commit f2e7577
Show file tree
Hide file tree
Showing 16 changed files with 355 additions and 687 deletions.
17 changes: 0 additions & 17 deletions SimG4CMS/PPS/interface/PPSDiamondNumberingScheme.h

This file was deleted.

96 changes: 47 additions & 49 deletions SimG4CMS/PPS/interface/PPSDiamondSD.h
Expand Up @@ -10,8 +10,6 @@
#include "SimG4CMS/PPS/interface/PPSDiamondG4Hit.h"
#include "SimG4CMS/PPS/interface/PPSDiamondG4HitCollection.h"
#include "SimG4CMS/PPS/interface/PPSVDetectorOrganization.h"
#include "SimG4CMS/PPS/interface/PPSDiamondNumberingScheme.h"
#include "SimG4CMS/PPS/interface/PPSDiamondOrganization.h"

#include "SimG4Core/Notification/interface/Observer.h"
#include "SimG4Core/SensitiveDetector/interface/SensitiveTkDetector.h"
Expand All @@ -34,72 +32,72 @@ class PPSDiamondSD : public SensitiveTkDetector,
public:
PPSDiamondSD(const std::string&, const SensitiveDetectorCatalog&, edm::ParameterSet const&, const SimTrackManager*);
~PPSDiamondSD() override;
void printHitInfo();

// Geant4 methods
bool ProcessHits(G4Step* step, G4TouchableHistory* tHistory) override;

void Initialize(G4HCofThisEvent* HCE) override;
void EndOfEvent(G4HCofThisEvent* eventHC) override;
void clear() override;
void clearTrack(G4Track* Track);
void DrawAll() override;
void PrintAll() override;
void fillHits(edm::PSimHitContainer&, const std::string&) override;

private:
static constexpr unsigned int maxDiamondHits_ = 15000;

// CMSSW methods
uint32_t setDetUnitId(const G4Step*) override;
void fillHits(edm::PSimHitContainer&, const std::string&) override;
void clearHits() override;
bool ProcessHits(G4Step* step, G4TouchableHistory* tHistory) override;
uint32_t setDetUnitId(const G4Step* step) override;

protected:
void update(const BeginOfEvent*) override;
void update(const ::EndOfEvent*) override;
void setNumberingScheme(PPSVDetectorOrganization* scheme);

std::unique_ptr<TrackingSlaveSD> slave_;
std::unique_ptr<PPSVDetectorOrganization> numberingScheme_;

int verbosity_;
int theMPDebug_;

private:
G4ThreeVector setToLocal(const G4ThreeVector& globalPoint);
void stepInfo(const G4Step* aStep);
G4bool hitExists();
void importInfoToHit(); //added pps
void updateHit();
void storeHit(PPSDiamondG4Hit*);
void resetForNewPrimary();
void summarize();
bool isPrimary(const G4Track* track);

G4ThreeVector entrancePoint_;
double incidentEnergy_;
G4String name_;
G4int hcID_;
PPSDiamondG4HitCollection* theHC_;
PPSDiamondG4Hit* currentHit_;
G4Track* theTrack_;
G4VPhysicalVolume* currentPV_;
unsigned int unitID_;
G4int primaryID_, tSliceID_;
G4double tSlice_;

G4StepPoint* preStepPoint_;
G4StepPoint* postStepPoint_;
void printHitInfo();

std::unique_ptr<TrackingSlaveSD> slave_;
std::unique_ptr<PPSVDetectorOrganization> numberingScheme_;

PPSDiamondG4HitCollection* theHC_ = nullptr;
PPSDiamondG4Hit* currentHit_ = nullptr;
G4Track* theTrack_ = nullptr;
G4VPhysicalVolume* currentPV_ = nullptr;
G4int hcID_ = -1;
G4int primaryID_ = 0;
G4int parentID_ = 0;
G4int tSliceID_ = 0;
G4double tSlice_ = 0.0;

G4StepPoint* preStepPoint_ = nullptr;
G4StepPoint* postStepPoint_ = nullptr;
G4ThreeVector hitPoint_;
G4ThreeVector exitPoint_;
G4ThreeVector theLocalEntryPoint_;
G4ThreeVector theLocalExitPoint_;
double Pabs_;
double thePx_, thePy_, thePz_;
double Tof_;
double Eloss_;
short ParticleType_;
double ThetaAtEntry_;
double PhiAtEntry_;
int ParentId_;
double Vx_, Vy_, Vz_;

double incidentEnergy_ = 0.0;
double pabs_ = 0.0;
double thePx_ = 0.0;
double thePy_ = 0.0;
double thePz_ = 0.0;
double tof_ = 0.0;
double eloss_ = 0.0;

double thetaAtEntry_ = 0.0;
double phiAtEntry_ = 0.0;

double vx_ = 0.0;
double vy_ = 0.0;
double vz_ = 0.0;

double Globaltimehit_;
double theglobaltimehit_;
int eventno_;

unsigned int unitID_ = 0;
int verbosity_;
int eventno_ = 0;
short particleType_ = 0;
};

#endif // PPS_PPSDiamondSD_h
35 changes: 0 additions & 35 deletions SimG4CMS/PPS/interface/PPSPixelNumberingScheme.h

This file was deleted.

84 changes: 36 additions & 48 deletions SimG4CMS/PPS/interface/PPSPixelSD.h
Expand Up @@ -50,79 +50,67 @@ class PPSPixelSD : public SensitiveTkDetector,
PPSPixelSD(const std::string&, const SensitiveDetectorCatalog&, edm::ParameterSet const&, SimTrackManager const*);
~PPSPixelSD() override;

// Geant4 methods
bool ProcessHits(G4Step*, G4TouchableHistory*) override;
uint32_t setDetUnitId(const G4Step*) override;

void Initialize(G4HCofThisEvent* HCE) override;
void EndOfEvent(G4HCofThisEvent* eventHC) override;
void clear() override;
void DrawAll() override;
void PrintAll() override;

// CMSSW methods
uint32_t setDetUnitId(const G4Step*) override;
void fillHits(edm::PSimHitContainer&, const std::string&) override;
void clearHits() override;

private:
protected:
void update(const BeginOfEvent*) override;
void update(const ::EndOfEvent*) override;
void clearHits() override;

private:
static constexpr unsigned int maxPixelHits_ = 15000;
G4ThreeVector setToLocal(const G4ThreeVector& globalPoint);
void stepInfo(const G4Step* aStep);
bool hitExists();
void createNewHit();
void updateHit();
void storeHit(PPSPixelG4Hit*);
void resetForNewPrimary();
void summarize();

private:
std::unique_ptr<TrackingSlaveSD> slave_;
std::unique_ptr<PPSVDetectorOrganization> numberingScheme_;

// Data relative to primary particle (the one which triggers a shower)
// These data are common to all Hits of a given shower.
// One shower is made of several hits which differ by the
// unit ID (cristal/fiber/scintillator) and the Time slice ID.

G4ThreeVector entrancePoint_;
float incidentEnergy_;
G4int primID_; //@@ ID of the primary particle.

std::string name_;
G4int hcID_;
PPSPixelG4HitCollection* theHC_;
PPSPixelG4HitCollection* theHC_ = nullptr;
const SimTrackManager* theManager_;
PPSPixelG4Hit* currentHit_ = nullptr;
G4Track* theTrack_ = nullptr;
G4VPhysicalVolume* currentPV_ = nullptr;
G4int hcID_ = -1;

int tsID_;
PPSPixelG4Hit* currentHit_;
G4Track* theTrack_;
G4VPhysicalVolume* currentPV_;
uint32_t unitID_, previousUnitID_;
int primaryID_, tSliceID_;
double tSlice_;

G4StepPoint* preStepPoint_;
G4StepPoint* postStepPoint_;
float edeposit_;
G4StepPoint* preStepPoint_ = nullptr;
G4StepPoint* postStepPoint_ = nullptr;
G4ThreeVector hitPoint_;

G4ThreeVector position_;
G4ThreeVector theEntryPoint_;
G4ThreeVector theExitPoint_;
float Pabs_;
float Tof_;
float Eloss_;
short ParticleType_;

float ThetaAtEntry_;
float PhiAtEntry_;

int ParentId_;
float Vx_, Vy_, Vz_;

int eventno_;
G4ThreeVector exitPoint_;
G4ThreeVector theLocalEntryPoint_;
G4ThreeVector theLocalExitPoint_;

double tSlice_ = 0.0;
double eloss_ = 0.0;
float incidentEnergy_ = 0.f;
float pabs_ = 0.f;
float tof_ = 0.f;

float thetaAtEntry_ = 0.f;
float phiAtEntry_ = 0.f;
float vx_ = 0.f;
float vy_ = 0.f;
float vz_ = 0.f;

uint32_t unitID_ = 0;
uint32_t previousUnitID_ = 0;
int tsID_ = 0;
int primaryID_ = 0;
int parentID_ = 0;
int tSliceID_ = 0;
int eventno_ = 0;
short particleType_ = 0;
};

#endif
12 changes: 0 additions & 12 deletions SimG4CMS/PPS/interface/PPSStripNumberingScheme.h

This file was deleted.

5 changes: 1 addition & 4 deletions SimG4CMS/PPS/interface/PPSStripOrganization.h
Expand Up @@ -3,16 +3,13 @@

#include "globals.hh"
#include "SimG4CMS/PPS/interface/TotemRPVDetectorOrganization.h"
#include "G4Step.hh"

class PPSStripOrganization : public TotemRPVDetectorOrganization {
public:
inline PPSStripOrganization();
PPSStripOrganization(){};
~PPSStripOrganization() override = default;

uint32_t unitID(const G4Step* aStep) override;
};

inline PPSStripOrganization ::PPSStripOrganization() = default;

#endif //PPS_PPSStripOrganization_h

0 comments on commit f2e7577

Please sign in to comment.