Skip to content

Commit

Permalink
Merge pull request #33309 from ebrondol/hgcal_notConvertedOnly_noEl
Browse files Browse the repository at this point in the history
[HGCAL] CaloParticleSelector selects non-converted CP
  • Loading branch information
cmsbuild committed Apr 4, 2021
2 parents 87af7a1 + 60b0b66 commit c7abaf9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
17 changes: 17 additions & 0 deletions Validation/HGCalValidation/interface/CaloParticleSelector.h
Expand Up @@ -22,6 +22,7 @@ class CaloParticleSelector {
bool intimeOnly,
bool chargedOnly,
bool stableOnly,
bool notConvertedOnly,
const std::vector<int>& pdgId = std::vector<int>(),
double minPhi = -3.2,
double maxPhi = 3.2)
Expand All @@ -39,6 +40,7 @@ class CaloParticleSelector {
intimeOnly_(intimeOnly),
chargedOnly_(chargedOnly),
stableOnly_(stableOnly),
notConvertedOnly_(notConvertedOnly),
pdgId_(pdgId) {
if (minPhi >= maxPhi) {
throw cms::Exception("Configuration")
Expand Down Expand Up @@ -101,6 +103,19 @@ class CaloParticleSelector {
}
}

// select only particles which did not convert/decay before the calorimeter
// in case of electrons, bremsstrahlung is usually the cause, thus this selection is skipped
if (std::abs(pdgid) != 11) {
if (notConvertedOnly_) {
if (cp.g4Tracks()[0].getPositionAtBoundary() == math::XYZTLorentzVectorF(0, 0, 0, 0)) {
return false;
}
if (cp.g4Tracks()[0].getMomentumAtBoundary() == math::XYZTLorentzVectorF(0, 0, 0, 0)) {
return false;
}
}
}

auto etaOk = [&](const CaloParticle& p) -> bool {
float eta = etaFromXYZ(p.px(), p.py(), p.pz());
return (eta >= minRapidity_) & (eta <= maxRapidity_);
Expand Down Expand Up @@ -132,6 +147,7 @@ class CaloParticleSelector {
bool intimeOnly_;
bool chargedOnly_;
bool stableOnly_;
bool notConvertedOnly_;
std::vector<int> pdgId_;
};

Expand All @@ -158,6 +174,7 @@ namespace reco {
cfg.getParameter<bool>("intimeOnlyCP"),
cfg.getParameter<bool>("chargedOnlyCP"),
cfg.getParameter<bool>("stableOnlyCP"),
cfg.getParameter<bool>("notConvertedOnlyCP"),
cfg.getParameter<std::vector<int> >("pdgIdCP"),
cfg.getParameter<double>("minPhiCP"),
cfg.getParameter<double>("maxPhiCP"));
Expand Down
1 change: 1 addition & 0 deletions Validation/HGCalValidation/plugins/HGCalValidator.cc
Expand Up @@ -64,6 +64,7 @@ HGCalValidator::HGCalValidator(const edm::ParameterSet& pset)
pset.getParameter<bool>("intimeOnlyCP"),
pset.getParameter<bool>("chargedOnlyCP"),
pset.getParameter<bool>("stableOnlyCP"),
pset.getParameter<bool>("notConvertedOnlyCP"),
pset.getParameter<std::vector<int>>("pdgIdCP"));

tools_.reset(new hgcal::RecHitTools());
Expand Down
Expand Up @@ -11,6 +11,7 @@
tipCP = cms.double(60),
chargedOnlyCP = cms.bool(False),
stableOnlyCP = cms.bool(False),
notConvertedOnlyCP = cms.bool(True),
#311: K0, 130: K0_short, 310: K0_long
pdgIdCP = cms.vint32(11, -11, 13, -13, 22, 111, 211, -211, 321, -321, 311, 130, 310),
#--signal only means no PU particles
Expand All @@ -19,5 +20,5 @@
intimeOnlyCP = cms.bool(True),
#The total number of rechits
minHitCP = cms.int32(0),
maxSimClustersCP = cms.int32(1)
maxSimClustersCP = cms.int32(-1)
)

0 comments on commit c7abaf9

Please sign in to comment.