20 #include "Math/VectorUtil.h" 41 reducedEndcapRecHitCollectionToken_(
43 reducedBarrelRecHitCollectionToken_(
49 muonPathsToPass_(iConfig.getParameter<std::vector<std::string>>(
"muonPathsToPass")),
50 minMuPt_(iConfig.getParameter<
double>(
"minMuPt")),
51 maxMuEta_(iConfig.getParameter<
double>(
"maxMuEta")),
52 minTrackEta_(iConfig.getParameter<
double>(
"minTrackEta")),
53 maxTrackEta_(iConfig.getParameter<
double>(
"maxTrackEta")),
54 minTrackPt_(iConfig.getParameter<
double>(
"minTrackPt")),
55 maxTransDCA_(iConfig.getParameter<
double>(
"maxTransDCA")),
56 maxLongDCA_(iConfig.getParameter<
double>(
"maxLongDCA")),
57 maxVtxChi_(iConfig.getParameter<
double>(
"maxVtxChi")),
58 minInvMass_(iConfig.getParameter<
double>(
"minInvMass")),
59 maxInvMass_(iConfig.getParameter<
double>(
"maxInvMass")),
60 trackIsoConesize_(iConfig.getParameter<
double>(
"trackIsoConesize")),
61 trackIsoInnerCone_(iConfig.getParameter<
double>(
"trackIsoInnerCone")),
62 ecalIsoConesize_(iConfig.getParameter<
double>(
"ecalIsoConesize")),
63 minEcalHitE_(iConfig.getParameter<
double>(
"minEcalHitE")),
64 maxTrackIso_(iConfig.getParameter<
double>(
"maxTrackIso")),
65 maxEcalIso_(iConfig.getParameter<
double>(
"maxEcalIso")),
66 minSigInvMass_(iConfig.getParameter<
double>(
"minSigInvMass")),
67 maxSigInvMass_(iConfig.getParameter<
double>(
"maxSigInvMass")),
68 minStandaloneDr_(iConfig.getParameter<
double>(
"minStandaloneDr")),
69 maxStandaloneDE_(iConfig.getParameter<
double>(
"maxStandaloneDE")),
70 keepOffPeak_(iConfig.getParameter<
bool>(
"keepOffPeak")),
71 keepSameSign_(iConfig.getParameter<
bool>(
"keepSameSign")),
72 keepTotalRegion_(iConfig.getParameter<
bool>(
"keepTotalRegion")),
73 keepPartialRegion_(iConfig.getParameter<
bool>(
"keepPartialRegion")) {}
85 bool totalRegion =
false;
86 bool sameSign =
false;
88 bool partialRegion =
false;
102 int nMuonTrackCand = 0;
103 float MuonTrackMass = 0.;
106 for (
const auto& iMuon : recoMuons) {
107 if (!(iMuon.isPFMuon() && iMuon.isGlobalMuon()))
118 for (
const auto& iTrack : thePATTracks) {
130 unsigned int vtxIndex;
131 unsigned int tkIndex;
149 std::vector<reco::TransientTrack> tracksToVertex;
150 tracksToVertex.push_back(tk);
151 tracksToVertex.push_back(transientTrackBuilder->
build(iMuon.globalTrack()));
164 tracksToVertex[0].trajectoryStateClosestToPoint(fittedVertex.
position());
166 tracksToVertex[1].trajectoryStateClosestToPoint(fittedVertex.
position());
170 double total_energy =
sqrt(one_momentum.
mag2() + 0.106 * 0.106) +
sqrt(two_momentum.
mag2() + 0.106 * 0.106);
171 double total_px = one_momentum.
x() + two_momentum.
x();
172 double total_py = one_momentum.
y() + two_momentum.
y();
173 double total_pz = one_momentum.
z() + two_momentum.
z();
174 MuonTrackMass =
sqrt(
pow(total_energy, 2) -
pow(total_px, 2) -
pow(total_py, 2) -
pow(total_pz, 2));
181 if (MuonTrackMass < minInvMass_ || MuonTrackMass >
maxInvMass_)
193 if (iMuon.charge() == iTrack.charge()) {
198 double staMinDr2 = 1000;
199 double staMinDEoverE = -10;
204 track.impactPointTSCP().momentum().phi(),
207 double staDE = (
std::sqrt(
track.impactPointTSCP().momentum().mag2()) - iTrack.p()) / iTrack.p();
208 if (
dR2 < staMinDr2) {
212 if (dR2 < minStandaloneDr_ * minStandaloneDr_ && staDE > staMinDEoverE) {
213 staMinDEoverE = staDE;
218 if (MuonTrackMass < minSigInvMass_ || MuonTrackMass >
maxSigInvMass_) {
225 if (MuonTrackMass < minSigInvMass_ || MuonTrackMass >
maxSigInvMass_) {
228 partialRegion =
true;
236 if (nMuonTrackCand == 0)
260 const std::vector<std::string>& m_muonPathsToPass) {
265 for (
auto&
pathName : m_muonPathsToPass) {
279 unsigned int& vtxIndex,
280 unsigned int& trackIndex) {
285 bool foundtrack{
false};
286 unsigned int idx = 0;
288 if (!
vtx.isValid()) {
293 const auto& thePVtracks{
vtx.tracks()};
294 std::vector<unsigned int> thePVkeys;
295 thePVkeys.reserve(thePVtracks.size());
296 for (
const auto& tv : thePVtracks) {
297 thePVkeys.push_back(tv.key());
300 auto result = std::find_if(
301 thePVkeys.begin(), thePVkeys.end(), [tkToMatch](
const auto& tkRef) {
return tkRef == tkToMatch.
key(); });
302 if (
result != thePVkeys.end()) {
317 unsigned int vtxindex;
318 unsigned int trackIndex;
321 LogDebug(
"DisappearingMuonsSkimming") <<
"getTrackIsolation vtx Index: " << vtxindex
322 <<
" track Index: " << trackIndex;
330 double Isolation = 0;
331 for (
unsigned int i = 0;
i < primaryVtx->tracksSize();
i++) {
335 if (
deltaR2(tkToMatch.
get()->eta(), tkToMatch.
get()->phi(), secondarytrack->
eta(), secondarytrack->
phi()) >
337 deltaR2(tkToMatch.
get()->eta(), tkToMatch.
get()->phi(), secondarytrack->
eta(), secondarytrack->
phi()) <
340 Isolation += secondarytrack->
pt();
343 return Isolation / tkToMatch.
get()->pt();
360 const DetId id = (*hit).detid();
363 if ((hitPos.
eta() *
t0.momentum().eta()) < 0) {
370 eDR += (*hit).energy();
374 const DetId id = (*hit).detid();
376 if ((hitPos.
eta() *
t0.momentum().eta()) < 0) {
383 eDR += (*hit).energy();
400 desc.add<std::vector<std::string>>(
"muonPathsToPass",
405 desc.add<
double>(
"minMuPt", 26);
406 desc.add<
double>(
"maxMuEta", 2.4);
407 desc.add<
double>(
"minTrackEta", 0);
408 desc.add<
double>(
"maxTrackEta", 2.4);
409 desc.add<
double>(
"minTrackPt", 20);
410 desc.add<
double>(
"maxTransDCA", 0.005);
411 desc.add<
double>(
"maxLongDCA", 0.05);
412 desc.add<
double>(
"maxVtxChi", 3.0);
413 desc.add<
double>(
"minInvMass", 50);
414 desc.add<
double>(
"maxInvMass", 150);
415 desc.add<
double>(
"trackIsoConesize", 0.3);
416 desc.add<
double>(
"trackIsoInnerCone", 0.01);
417 desc.add<
double>(
"ecalIsoConesize", 0.4);
418 desc.add<
double>(
"minEcalHitE", 0.3);
419 desc.add<
double>(
"maxTrackIso", 0.05);
420 desc.add<
double>(
"maxEcalIso", 10);
421 desc.add<
double>(
"minSigInvMass", 76);
422 desc.add<
double>(
"maxSigInvMass", 106);
423 desc.add<
double>(
"minStandaloneDr", 1.0);
424 desc.add<
double>(
"maxStandaloneDE", -0.5);
425 desc.add<
bool>(
"keepOffPeak",
true);
426 desc.add<
bool>(
"keepSameSign",
true);
427 desc.add<
bool>(
"keepTotalRegion",
true);
428 desc.add<
bool>(
"keepPartialRegion",
true);
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
const double minEcalHitE_
const double minStandaloneDr_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
const std::vector< std::string > muonPathsToPass_
const double maxStandaloneDE_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const edm::EDGetTokenT< edm::TriggerResults > trigResultsToken_
Global3DPoint GlobalPoint
std::vector< Track > TrackCollection
collection of Tracks
std::vector< EcalRecHit >::const_iterator const_iterator
std::vector< Vertex > VertexCollection
collection of Vertex objects
double transverseImpactParameter() const
const edm::EDGetTokenT< reco::VertexCollection > primaryVerticesToken_
std::vector< Vertex > VertexCollection
key_type key() const
Accessor for product key.
std::vector< Muon > MuonCollection
collection of Muon objects
float totalChiSquared() const
reco::TransientTrack build(const reco::Track *p) const
const double ecalIsoConesize_
double pt() const
track transverse momentum
ALPAKA_FN_ACC static ALPAKA_FN_INLINE float dR2(Position4 pos1, Position4 pos2)
GlobalPoint position() const
const double trackIsoInnerCone_
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > transientTrackToken_
const edm::EDGetTokenT< EcalRecHitCollection > reducedEndcapRecHitCollectionToken_
const double minTrackEta_
bool passTriggers(const edm::Event &iEvent, const edm::TriggerResults &results, const std::vector< std::string > &m_muonPathsToPass)
Abs< T >::type abs(const T &t)
double phi() const
azimuthal angle of momentum vector
#define DEFINE_FWK_MODULE(type)
const edm::EDGetTokenT< reco::MuonCollection > recoMuonToken_
double getECALIsolation(const edm::Event &, const edm::EventSetup &, const reco::TransientTrack &track)
const_iterator begin() const
static std::string const triggerResults
const bool keepPartialRegion_
double getTrackIsolation(const reco::TrackRef &tkToMatch, const reco::VertexCollection &vertices)
bool findTrackInVertices(const reco::TrackRef &tkToMatch, const reco::VertexCollection &vertices, unsigned int &vtxIndex, unsigned int &trackIndex)
const PerigeeTrajectoryParameters & perigeeParameters() const
bool filter(edm::Event &, const edm::EventSetup &) override
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
const_iterator end() const
static const char *const trigNames[]
double eta() const
pseudorapidity of momentum vector
static TrackQuality qualityByName(const std::string &name)
const bool keepTotalRegion_
double longitudinalImpactParameter() const
XYZVectorD XYZVector
spatial vector with cartesian internal representation
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
const double maxTrackIso_
const double maxSigInvMass_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geometryToken_
const edm::EDGetTokenT< reco::TrackCollection > standaloneMuonToken_
const double maxTrackEta_
T const * get() const
Returns C++ pointer to the item.
float degreesOfFreedom() const
const double trackIsoConesize_
GlobalVector momentum() const
const edm::EDGetTokenT< EcalRecHitCollection > reducedBarrelRecHitCollectionToken_
const edm::EDGetTokenT< reco::TrackCollection > trackCollectionToken_
GlobalPoint position() const
DisappearingMuonsSkimming(const edm::ParameterSet &)
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
const double maxTransDCA_
Power< A, B >::type pow(const A &a, const B &b)