Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calo boundary Information #33056

Merged
merged 4 commits into from
Mar 4, 2021
Merged
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
3 changes: 2 additions & 1 deletion SimG4CMS/Calo/src/CaloTrkProcessing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ CaloTrkProcessing::CaloTrkProcessing(const std::string& name,
<< detectors_[i].fromDetL[k] << " at level " << detectors_[i].fromLevels[k];
}

doFineCalo_ = !(fineDetectors_.empty());
doFineCalo_ = doFineCalo_ && !(fineDetectors_.empty());
edm::LogVerbatim("CaloSim") << "CaloTrkProcessing: with " << fineDetectors_.size() << " special calorimetric volumes";
for (unsigned int i = 0; i < detectors_.size(); i++)
edm::LogVerbatim("CaloSim") << "CaloTrkProcessing: Calorimeter volume " << i << " " << detectors_[i].name << " LV "
Expand Down Expand Up @@ -279,6 +279,7 @@ void CaloTrkProcessing::update(const G4Step* aStep) {
trkInfo->setIDonCaloSurface(
id, ical, inside, theTrack->GetDefinition()->GetPDGEncoding(), theTrack->GetMomentum().mag());
trkInfo->setCaloIDChecked(true);
trkInfo->setCrossedBoundary(theTrack);
lastTrackID_ = id;
if (theTrack->GetKineticEnergy() / CLHEP::MeV > eMin_)
trkInfo->putInHistory();
Expand Down
1 change: 1 addition & 0 deletions SimG4Core/Application/interface/TrackingAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class TrackingAction : public G4UserTrackingAction {
const G4Track* g4Track_;
bool checkTrack_;
bool doFineCalo_;
bool saveCaloBoundaryInformation_;
double eMinFine_;
};

Expand Down
9 changes: 8 additions & 1 deletion SimG4Core/Application/python/g4SimHits_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@
)

common_UseLuminosity = cms.PSet(
InstLuminosity = cms.double(0.),
InstLuminosity = cms.double(0.),
DelivLuminosity = cms.double(5000.)
)

common_MCtruth = cms.PSet(
DoFineCalo = cms.bool(False),
SaveCaloBoundaryInformation = cms.bool(False),
Copy link
Contributor

@civanch civanch Mar 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rovere , I am sorry, can you imagine that somebody want DoFineCalo=True and SaveCaloBoundaryInformation=False?

What is the use case?

Copy link
Contributor Author

@rovere rovere Mar 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ciao @civanch
thanks for looking into that!
The use case here is that we would like to have the information at the caloBoundary without requesting the full complexity of tracing everything within the fine-calo volumes.
The two flags, in this sense, are complementary.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rovere , why we see differences in Phase-2 WFs? I would expect regression for this PR. DD4Hep WF may be fine so far.

ciao @civanch
the flag is set to false for all workflows but for Phase2 ones.
The changes are mostly coming from SimTracks that are now saved if they have the crossedBoundary flag set. I found this useful to correctly assign hits to SimTrack and SimClusters.
The extent of the changes is rather limited and of limited impact on the high level Validation.

The DD4HEP workflows shows many differences, but I'm not sure where they are coming from, but you seem to suggest that is fine, right?

# currently unused; left in place for future studies
EminFineTrack = cms.double(10000.0),
FineCaloNames = cms.vstring('ECAL', 'HCAL', 'HGCal', 'HFNoseVol', 'VCAL'),
Expand All @@ -56,6 +57,12 @@
DoFineCalo = True
)

## enable CaloBoundary information for all Phase2 workflows
from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal
phase2_hgcal.toModify(common_MCtruth,
SaveCaloBoundaryInformation =True
)

g4SimHits = cms.EDProducer("OscarMTProducer",
g4GeometryDD4hepSource = cms.bool(False),
NonBeamEvent = cms.bool(False),
Expand Down
8 changes: 7 additions & 1 deletion SimG4Core/Application/src/TrackingAction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ TrackingAction::TrackingAction(EventAction* e, const edm::ParameterSet& p, CMSSt
g4Track_(nullptr),
checkTrack_(p.getUntrackedParameter<bool>("CheckTrack", false)),
doFineCalo_(p.getParameter<bool>("DoFineCalo")),
saveCaloBoundaryInformation_(p.getParameter<bool>("SaveCaloBoundaryInformation")),
eMinFine_(p.getParameter<double>("EminFineTrack") * CLHEP::MeV) {}

TrackingAction::~TrackingAction() {}
Expand Down Expand Up @@ -103,7 +104,12 @@ void TrackingAction::PostUserTrackingAction(const G4Track* aTrack) {
}
}

if (extractor_(aTrack).storeTrack() || currentTrack_->saved()) {
TrackInformation* trkInfo = (TrackInformation*)aTrack->GetUserInformation();
if (extractor_(aTrack).storeTrack() || currentTrack_->saved() ||
(saveCaloBoundaryInformation_ && trkInfo->crossedBoundary())) {
if (trkInfo->crossedBoundary()) {
currentTrack_->setCrossedBoundaryPosMom(id, trkInfo->getPositionAtBoundary(), trkInfo->getMomentumAtBoundary());
}
currentTrack_->save();

eventAction_->addTkCaloStateInfo(id, p);
Expand Down