Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion SimG4CMS/Calo/interface/CaloTrkProcessing.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class CaloTrkProcessing : public SensitiveCaloDetector,
G4LogicalVolume* detLV(const G4VTouchable*, int) const;
void detectorLevel(const G4VTouchable*, int&, int*, G4String*) const;

bool testBeam_, putHistory_, doFineCalo_;
bool testBeam_, putHistory_, doFineCalo_, storeHGCBoundaryCross_;
double eMin_, eMinFine_, eMinFinePhoton_;
int lastTrackID_;
std::vector<Detector> detectors_, fineDetectors_;
Expand Down
16 changes: 12 additions & 4 deletions SimG4CMS/Calo/src/CaloTrkProcessing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ CaloTrkProcessing::CaloTrkProcessing(const std::string& name,
eMin_ = m_p.getParameter<double>("EminTrack") * CLHEP::MeV;
putHistory_ = m_p.getParameter<bool>("PutHistory");
doFineCalo_ = m_p.getParameter<bool>("DoFineCalo");
storeHGCBoundaryCross_ = m_p.getParameter<bool>("StoreHGCBoundaryCross");
eMinFine_ = m_p.getParameter<double>("EminFineTrack") * CLHEP::MeV;
eMinFinePhoton_ = m_p.getParameter<double>("EminFinePhoton") * CLHEP::MeV;

Expand Down Expand Up @@ -242,12 +243,19 @@ void CaloTrkProcessing::update(const G4Step* aStep) {
}
}
}
if (doFineCalo_ && (!trkInfo->isInHistory())) {
const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
if (isItCalo(touch, fineDetectors_) >= 0) {
if ((doFineCalo_ || storeHGCBoundaryCross_) && (!trkInfo->isInHistory())) {
const G4VTouchable* pre_touch = aStep->GetPreStepPoint()->GetTouchable();

bool crossedHGCBoundary = false;
if (storeHGCBoundaryCross_) {
const G4VTouchable* post_touch = aStep->GetPostStepPoint()->GetTouchable();
crossedHGCBoundary = isItCalo(pre_touch, fineDetectors_) < 0 && isItCalo(post_touch, fineDetectors_) >= 0;
}

if (isItCalo(pre_touch, fineDetectors_) >= 0 || crossedHGCBoundary) {
int pdg = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
double cut = (pdg == 22) ? eMinFinePhoton_ : eMinFine_;
if (aStep->GetTrack()->GetKineticEnergy() / CLHEP::MeV > cut) {
if (crossedHGCBoundary || aStep->GetTrack()->GetKineticEnergy() / CLHEP::MeV > cut) {
trkInfo->putInHistory();
trkInfo->setIDfineCalo(id);
}
Expand Down
3 changes: 2 additions & 1 deletion SimG4Core/Application/python/g4SimHits_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,8 @@
PutHistory = cms.bool(False),
DoFineCalo = cms.bool(False),
EminFineTrack = cms.double(10000.0),
EminFinePhoton = cms.double(5000.0)
EminFinePhoton = cms.double(5000.0),
StoreHGCBoundaryCross = cms.bool(True),
),
HFShower = cms.PSet(
common_UsePMT,
Expand Down