CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
DisappearingMuonsSkimming Class Reference

#include <Skimming/DisappearingMuonsSkimming/plugins/DisappearingMuonsSkimming.cc>

Inheritance diagram for DisappearingMuonsSkimming:
edm::one::EDFilter<> edm::one::EDFilterBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 DisappearingMuonsSkimming (const edm::ParameterSet &)
 
 ~DisappearingMuonsSkimming () override=default
 
- Public Member Functions inherited from edm::one::EDFilter<>
 EDFilter ()=default
 
 EDFilter (const EDFilter &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDFilteroperator= (const EDFilter &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
- Public Member Functions inherited from edm::one::EDFilterBase
 EDFilterBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~EDFilterBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDFilterBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

bool filter (edm::Event &, const edm::EventSetup &) override
 
bool findTrackInVertices (const reco::TrackRef &tkToMatch, const reco::VertexCollection &vertices, unsigned int &vtxIndex, unsigned int &trackIndex)
 
double getECALIsolation (const edm::Event &, const edm::EventSetup &, const reco::TransientTrack &track)
 
double getTrackIsolation (const reco::TrackRef &tkToMatch, const reco::VertexCollection &vertices)
 
bool passTriggers (const edm::Event &iEvent, const edm::TriggerResults &results, const std::vector< std::string > &m_muonPathsToPass)
 

Private Attributes

const double ecalIsoConesize_
 
const edm::ESGetToken< CaloGeometry, CaloGeometryRecordgeometryToken_
 
const bool keepOffPeak_
 
const bool keepPartialRegion_
 
const bool keepSameSign_
 
const bool keepTotalRegion_
 
const double maxEcalIso_
 
const double maxInvMass_
 
const double maxLongDCA_
 
const double maxMuEta_
 
const double maxSigInvMass_
 
const double maxStandaloneDE_
 
const double maxTrackEta_
 
const double maxTrackIso_
 
const double maxTransDCA_
 
const double maxVtxChi_
 
const double minEcalHitE_
 
const double minInvMass_
 
const double minMuPt_
 
const double minSigInvMass_
 
const double minStandaloneDr_
 
const double minTrackEta_
 
const double minTrackPt_
 
const std::vector< std::string > muonPathsToPass_
 
const edm::EDGetTokenT< reco::VertexCollectionprimaryVerticesToken_
 
const edm::EDGetTokenT< reco::MuonCollectionrecoMuonToken_
 
const edm::EDGetTokenT< EcalRecHitCollectionreducedBarrelRecHitCollectionToken_
 
const edm::EDGetTokenT< EcalRecHitCollectionreducedEndcapRecHitCollectionToken_
 
const edm::EDGetTokenT< reco::TrackCollectionstandaloneMuonToken_
 
const edm::EDGetTokenT< reco::TrackCollectiontrackCollectionToken_
 
const double trackIsoConesize_
 
const double trackIsoInnerCone_
 
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecordtransientTrackToken_
 
const edm::EDGetTokenT< edm::TriggerResultstrigResultsToken_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDFilterBase
typedef EDFilterBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 45 of file DisappearingMuonsSkimming.h.

Constructor & Destructor Documentation

◆ DisappearingMuonsSkimming()

DisappearingMuonsSkimming::DisappearingMuonsSkimming ( const edm::ParameterSet iConfig)
explicit

Definition at line 36 of file DisappearingMuonsSkimming.cc.

37  : recoMuonToken_(consumes<reco::MuonCollection>(iConfig.getParameter<edm::InputTag>("recoMuons"))),
38  standaloneMuonToken_(consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("StandaloneTracks"))),
39  trackCollectionToken_(consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("tracks"))),
40  primaryVerticesToken_(consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("primaryVertices"))),
42  consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("EERecHits"))),
44  consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("EBRecHits"))),
45  trigResultsToken_(consumes<edm::TriggerResults>(iConfig.getParameter<edm::InputTag>("TriggerResultsTag"))),
47  esConsumes<TransientTrackBuilder, TransientTrackRecord>(edm::ESInputTag("", "TransientTrackBuilder"))),
48  geometryToken_(esConsumes<CaloGeometry, CaloGeometryRecord>(edm::ESInputTag{})),
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")) {}
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const std::vector< std::string > muonPathsToPass_
const edm::EDGetTokenT< edm::TriggerResults > trigResultsToken_
const edm::EDGetTokenT< reco::VertexCollection > primaryVerticesToken_
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > transientTrackToken_
const edm::EDGetTokenT< EcalRecHitCollection > reducedEndcapRecHitCollectionToken_
const edm::EDGetTokenT< reco::MuonCollection > recoMuonToken_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geometryToken_
const edm::EDGetTokenT< reco::TrackCollection > standaloneMuonToken_
const edm::EDGetTokenT< EcalRecHitCollection > reducedBarrelRecHitCollectionToken_
const edm::EDGetTokenT< reco::TrackCollection > trackCollectionToken_

◆ ~DisappearingMuonsSkimming()

DisappearingMuonsSkimming::~DisappearingMuonsSkimming ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

void DisappearingMuonsSkimming::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 390 of file DisappearingMuonsSkimming.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, and ProducerED_cfi::InputTag.

390  {
392 
393  desc.add<edm::InputTag>("recoMuons", edm::InputTag("muons"));
394  desc.add<edm::InputTag>("tracks", edm::InputTag("generalTracks"));
395  desc.add<edm::InputTag>("StandaloneTracks", edm::InputTag("standAloneMuons"));
396  desc.add<edm::InputTag>("primaryVertices", edm::InputTag("offlinePrimaryVertices"));
397  desc.add<edm::InputTag>("EERecHits", edm::InputTag("reducedEcalRecHitsEE"));
398  desc.add<edm::InputTag>("EBRecHits", edm::InputTag("reducedEcalRecHitsEB"));
399  desc.add<edm::InputTag>("TriggerResultsTag", edm::InputTag("TriggerResults", "", "HLT"));
400  desc.add<std::vector<std::string>>("muonPathsToPass",
401  {
402  "HLT_IsoMu24_v",
403  "HLT_IsoMu27_v",
404  });
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);
429  descriptions.addWithDefaultLabel(desc);
430 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ filter()

bool DisappearingMuonsSkimming::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDFilterBase.

Definition at line 80 of file DisappearingMuonsSkimming.cc.

References funct::abs(), TransientTrackBuilder::build(), reco::Muon::CutBasedIdTight, CachingVertex< N >::degreesOfFreedom(), HLTMuonOfflineAnalyzer_cfi::deltaR2, ALPAKA_ACCELERATOR_NAMESPACE::dR2(), run3scouting_cff::ecalIso, findTrackInVertices(), edm::EventSetup::getData(), getECALIsolation(), getTrackIsolation(), iEvent, CachingVertex< N >::isValid(), keepOffPeak_, keepPartialRegion_, keepSameSign_, keepTotalRegion_, PerigeeTrajectoryParameters::longitudinalImpactParameter(), PV3DBase< T, PVType, FrameType >::mag2(), maxEcalIso_, maxInvMass_, maxLongDCA_, maxMuEta_, maxSigInvMass_, maxStandaloneDE_, maxTrackEta_, maxTrackIso_, maxTransDCA_, maxVtxChi_, minMuPt_, minStandaloneDr_, minTrackEta_, minTrackPt_, TrajectoryStateClosestToPoint::momentum(), muonPathsToPass_, passTriggers(), TrajectoryStateClosestToPoint::perigeeParameters(), reco::Muon::PFIsoTight, CachingVertex< N >::position(), funct::pow(), primaryVerticesToken_, reco::TrackBase::qualityByName(), recoMuonToken_, mathSSE::sqrt(), standaloneMuonToken_, muonTagProbeFilters_cff::staTracks, CachingVertex< N >::totalChiSquared(), HLT_2024v14_cff::track, trackCollectionToken_, run3scouting_cff::trackIso, transientTrackToken_, PerigeeTrajectoryParameters::transverseImpactParameter(), triggerResults, trigResultsToken_, generalV0Candidates_cfi::vertexFitter, AlignmentTracksFromVertexSelector_cfi::vertices, L1BJetProducer_cff::vtx, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

80  {
81  using namespace edm;
82  using namespace std;
83  using namespace reco;
84 
85  bool totalRegion = false;
86  bool sameSign = false;
87  bool offPeak = false;
88  bool partialRegion = false;
89 
90  const auto& staTracks = iEvent.get(standaloneMuonToken_);
91  const auto& vertices = iEvent.get(primaryVerticesToken_);
92  const auto& recoMuons = iEvent.get(recoMuonToken_);
93  const auto& thePATTracks = iEvent.get(trackCollectionToken_);
94  const auto& triggerResults = iEvent.get(trigResultsToken_);
95 
96  // this wraps tracks with additional methods that are used in vertex-calculation
97  const TransientTrackBuilder* transientTrackBuilder = &iSetup.getData(transientTrackToken_);
98 
100  return false;
101 
102  int nMuonTrackCand = 0;
103  float MuonTrackMass = 0.;
104 
105  //Looping over the reconstructed Muons
106  for (const auto& iMuon : recoMuons) {
107  if (!(iMuon.isPFMuon() && iMuon.isGlobalMuon()))
108  continue;
109  if (!(iMuon.passed(reco::Muon::CutBasedIdTight)))
110  continue;
111  if (!(iMuon.passed(reco::Muon::PFIsoTight)))
112  continue;
113  if (iMuon.pt() < minMuPt_ || std::abs(iMuon.eta()) > maxMuEta_)
114  continue;
115 
116  //Looping over tracks for any good muon
117  int indx(0);
118  for (const auto& iTrack : thePATTracks) {
119  reco::TrackRef trackRef = reco::TrackRef(&thePATTracks, indx);
120  indx++;
121 
122  if (!iTrack.quality(reco::Track::qualityByName("highPurity")))
123  continue;
124  if (std::abs(iTrack.eta()) > maxTrackEta_ || std::abs(iTrack.eta()) < minTrackEta_)
125  continue;
126  if (iTrack.pt() < minTrackPt_)
127  continue;
128  //Check if the track belongs to a primary vertex for isolation calculation
129 
130  unsigned int vtxIndex;
131  unsigned int tkIndex;
132  bool foundtrack = this->findTrackInVertices(trackRef, vertices, vtxIndex, tkIndex);
133 
134  if (!foundtrack)
135  continue;
136 
137  reco::VertexRef vtx(&vertices, vtxIndex);
138  GlobalPoint tkVtx = GlobalPoint(vtx->x(), vtx->y(), vtx->z());
139 
140  reco::TransientTrack tk = transientTrackBuilder->build(iTrack);
141  TrajectoryStateClosestToPoint traj = tk.trajectoryStateClosestToPoint(tkVtx);
142  double transDCA = traj.perigeeParameters().transverseImpactParameter();
143  double longDCA = traj.perigeeParameters().longitudinalImpactParameter();
144  if (std::abs(longDCA) > maxLongDCA_)
145  continue;
146  if (std::abs(transDCA) > maxTransDCA_)
147  continue;
148  // make a pair of TransientTracks to feed the vertexer
149  std::vector<reco::TransientTrack> tracksToVertex;
150  tracksToVertex.push_back(tk);
151  tracksToVertex.push_back(transientTrackBuilder->build(iMuon.globalTrack()));
152  // try to fit these two tracks to a common vertex
154  CachingVertex<5> fittedVertex = vertexFitter.vertex(tracksToVertex);
155  double vtxChi = 0;
156  // some poor fits will simply fail to find a common vertex
157  if (fittedVertex.isValid() && fittedVertex.totalChiSquared() >= 0. && fittedVertex.degreesOfFreedom() > 0) {
158  // others we can exclude by their poor fit
159  vtxChi = fittedVertex.totalChiSquared() / fittedVertex.degreesOfFreedom();
160 
161  if (vtxChi < maxVtxChi_) {
162  // important! evaluate momentum vectors AT THE VERTEX
164  tracksToVertex[0].trajectoryStateClosestToPoint(fittedVertex.position());
166  tracksToVertex[1].trajectoryStateClosestToPoint(fittedVertex.position());
167  GlobalVector one_momentum = one_TSCP.momentum();
168  GlobalVector two_momentum = two_TSCP.momentum();
169 
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));
175  } else {
176  continue;
177  }
178  } else {
179  continue;
180  }
181  if (MuonTrackMass < minInvMass_ || MuonTrackMass > maxInvMass_)
182  continue;
183 
184  double trackIso = getTrackIsolation(trackRef, vertices);
185  //Track iso returns -1 when it fails to find the vertex containing the track (already checked in track selection, but might as well make sure)
186  if (trackIso < 0)
187  continue;
188  double ecalIso = getECALIsolation(iEvent, iSetup, transientTrackBuilder->build(iTrack));
190  continue;
191 
192  //A good tag/probe pair has been selected, now check for control or signal regions
193  if (iMuon.charge() == iTrack.charge()) {
194  sameSign = true;
195  }
196 
197  //If not same sign CR, need to check standalone muons for signal regions
198  double staMinDr2 = 1000;
199  double staMinDEoverE = -10;
200  if (!staTracks.empty()) {
201  for (const auto& staTrack : staTracks) {
202  reco::TransientTrack track = transientTrackBuilder->build(staTrack);
203  double dR2 = deltaR2(track.impactPointTSCP().momentum().eta(),
204  track.impactPointTSCP().momentum().phi(),
205  iTrack.eta(),
206  iTrack.phi());
207  double staDE = (std::sqrt(track.impactPointTSCP().momentum().mag2()) - iTrack.p()) / iTrack.p();
208  if (dR2 < staMinDr2) {
209  staMinDr2 = dR2;
210  }
211  //Pick the largest standalone muon within the cone
212  if (dR2 < minStandaloneDr_ * minStandaloneDr_ && staDE > staMinDEoverE) {
213  staMinDEoverE = staDE;
214  }
215  }
216  }
217  if (staMinDr2 > minStandaloneDr_ * minStandaloneDr_) {
218  if (MuonTrackMass < minSigInvMass_ || MuonTrackMass > maxSigInvMass_) {
219  offPeak = true;
220  } else {
221  totalRegion = true;
222  }
223  } else {
224  if (staMinDEoverE < maxStandaloneDE_) {
225  if (MuonTrackMass < minSigInvMass_ || MuonTrackMass > maxSigInvMass_) {
226  offPeak = true;
227  } else {
228  partialRegion = true;
229  }
230  }
231  }
232  nMuonTrackCand++;
233  }
234  }
235 
236  if (nMuonTrackCand == 0)
237  return false;
238  bool passes = false;
239  //Pass all same sign CR events
240  if (sameSign && keepSameSign_) {
241  passes = true;
242  }
243  //Pass all total disappearance events
244  else if (totalRegion && keepTotalRegion_) {
245  passes = true;
246  }
247  //Pass all partial disappearkance off-peak events
248  else if (offPeak && keepOffPeak_) {
249  passes = true;
250  }
251  //Pass partial region events that pass minimum standalone muon DE/E.
252  else if (partialRegion && keepPartialRegion_) {
253  passes = true;
254  }
255  return passes;
256 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const std::vector< std::string > muonPathsToPass_
T z() const
Definition: PV3DBase.h:61
const edm::EDGetTokenT< edm::TriggerResults > trigResultsToken_
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T mag2() const
Definition: PV3DBase.h:63
const edm::EDGetTokenT< reco::VertexCollection > primaryVerticesToken_
float totalChiSquared() const
reco::TransientTrack build(const reco::Track *p) const
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
int iEvent
Definition: GenABIO.cc:224
ALPAKA_FN_ACC static ALPAKA_FN_INLINE float dR2(Position4 pos1, Position4 pos2)
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > transientTrackToken_
T sqrt(T t)
Definition: SSEVec.h:23
bool passTriggers(const edm::Event &iEvent, const edm::TriggerResults &results, const std::vector< std::string > &m_muonPathsToPass)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const edm::EDGetTokenT< reco::MuonCollection > recoMuonToken_
double getECALIsolation(const edm::Event &, const edm::EventSetup &, const reco::TransientTrack &track)
static std::string const triggerResults
Definition: EdmProvDump.cc:47
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
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:126
bool isValid() const
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:20
const edm::EDGetTokenT< reco::TrackCollection > standaloneMuonToken_
fixed size matrix
HLT enums.
float degreesOfFreedom() const
const edm::EDGetTokenT< reco::TrackCollection > trackCollectionToken_
GlobalPoint position() const
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ findTrackInVertices()

bool DisappearingMuonsSkimming::findTrackInVertices ( const reco::TrackRef tkToMatch,
const reco::VertexCollection vertices,
unsigned int &  vtxIndex,
unsigned int &  trackIndex 
)
private

Definition at line 277 of file DisappearingMuonsSkimming.cc.

References HLT_2024v14_cff::distance, heavyIonCSV_trainingSettings::idx, edm::Ref< C, T, F >::key(), mps_fire::result, AlignmentTracksFromVertexSelector_cfi::vertices, and L1BJetProducer_cff::vtx.

Referenced by filter(), and getTrackIsolation().

280  {
281  // initialize indices
282  vtxIndex = -1;
283  trackIndex = -1;
284 
285  bool foundtrack{false};
286  unsigned int idx = 0;
287  for (const auto& vtx : vertices) {
288  if (!vtx.isValid()) {
289  idx++;
290  continue;
291  }
292 
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());
298  }
299 
300  auto result = std::find_if(
301  thePVkeys.begin(), thePVkeys.end(), [tkToMatch](const auto& tkRef) { return tkRef == tkToMatch.key(); });
302  if (result != thePVkeys.end()) {
303  foundtrack = true;
304  trackIndex = std::distance(thePVkeys.begin(), result);
305  vtxIndex = idx;
306  }
307  if (foundtrack)
308  break;
309 
310  idx++;
311  }
312  return foundtrack;
313 }
key_type key() const
Accessor for product key.
Definition: Ref.h:244

◆ getECALIsolation()

double DisappearingMuonsSkimming::getECALIsolation ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const reco::TransientTrack track 
)
private

Definition at line 346 of file DisappearingMuonsSkimming.cc.

References edm::SortedCollection< T, SORT >::begin(), HLTMuonOfflineAnalyzer_cfi::deltaR2, ecalIsoConesize_, edm::SortedCollection< T, SORT >::end(), PV3DBase< T, PVType, FrameType >::eta(), geometryToken_, edm::EventSetup::getData(), CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), CaloGeometry::getSubdetectorGeometry(), iEvent, minEcalHitE_, TrajectoryStateClosestToPoint::position(), reducedBarrelRecHitCollectionToken_, reducedEndcapRecHitCollectionToken_, FrontierCondition_GT_autoExpress_cfi::t0, HLT_2024v14_cff::track, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by filter().

348  {
350  iEvent.getByToken(reducedEndcapRecHitCollectionToken_, rechitsEE);
351 
353  iEvent.getByToken(reducedBarrelRecHitCollectionToken_, rechitsEB);
354 
355  const CaloGeometry& caloGeom = iSetup.getData(geometryToken_);
356  TrajectoryStateClosestToPoint t0 = track.impactPointTSCP();
357  double eDR = 0;
358 
359  for (EcalRecHitCollection::const_iterator hit = rechitsEE->begin(); hit != rechitsEE->end(); hit++) {
360  const DetId id = (*hit).detid();
361  const GlobalPoint hitPos = caloGeom.getSubdetectorGeometry(id)->getGeometry(id)->getPosition();
362  //Check if hit and track trajectory ar in the same endcap (transient track projects both ways)
363  if ((hitPos.eta() * t0.momentum().eta()) < 0) {
364  continue;
365  }
366  TrajectoryStateClosestToPoint traj = track.trajectoryStateClosestToPoint(hitPos);
367  math::XYZVector idPositionRoot(hitPos.x(), hitPos.y(), hitPos.z());
368  math::XYZVector trajRoot(traj.position().x(), traj.position().y(), traj.position().z());
369  if (deltaR2(idPositionRoot, trajRoot) < ecalIsoConesize_ * ecalIsoConesize_ && (*hit).energy() > minEcalHitE_) {
370  eDR += (*hit).energy();
371  }
372  }
373  for (EcalRecHitCollection::const_iterator hit = rechitsEB->begin(); hit != rechitsEB->end(); hit++) {
374  const DetId id = (*hit).detid();
375  const GlobalPoint hitPos = caloGeom.getSubdetectorGeometry(id)->getGeometry(id)->getPosition();
376  if ((hitPos.eta() * t0.momentum().eta()) < 0) {
377  continue;
378  }
379  TrajectoryStateClosestToPoint traj = track.trajectoryStateClosestToPoint(hitPos);
380  math::XYZVector idPositionRoot(hitPos.x(), hitPos.y(), hitPos.z());
381  math::XYZVector trajRoot(traj.position().x(), traj.position().y(), traj.position().z());
382  if (deltaR2(idPositionRoot, trajRoot) < ecalIsoConesize_ * ecalIsoConesize_ && (*hit).energy() > minEcalHitE_) {
383  eDR += (*hit).energy();
384  }
385  }
386 
387  return eDR;
388 }
virtual CellMayOwnPtr getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
T z() const
Definition: PV3DBase.h:61
T eta() const
Definition: PV3DBase.h:73
std::vector< EcalRecHit >::const_iterator const_iterator
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
int iEvent
Definition: GenABIO.cc:224
const edm::EDGetTokenT< EcalRecHitCollection > reducedEndcapRecHitCollectionToken_
const_iterator begin() const
const_iterator end() const
Definition: DetId.h:17
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geometryToken_
virtual const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
const edm::EDGetTokenT< EcalRecHitCollection > reducedBarrelRecHitCollectionToken_
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34

◆ getTrackIsolation()

double DisappearingMuonsSkimming::getTrackIsolation ( const reco::TrackRef tkToMatch,
const reco::VertexCollection vertices 
)
private

Definition at line 315 of file DisappearingMuonsSkimming.cc.

References HLTMuonOfflineAnalyzer_cfi::deltaR2, reco::TrackBase::eta(), findTrackInVertices(), edm::Ref< C, T, F >::get(), mps_fire::i, LogDebug, reco::TrackBase::phi(), reco::TrackBase::pt(), trackIsoConesize_, trackIsoInnerCone_, and AlignmentTracksFromVertexSelector_cfi::vertices.

Referenced by filter().

316  {
317  unsigned int vtxindex;
318  unsigned int trackIndex;
319  bool foundtrack = this->findTrackInVertices(tkToMatch, vertices, vtxindex, trackIndex);
320 
321  LogDebug("DisappearingMuonsSkimming") << "getTrackIsolation vtx Index: " << vtxindex
322  << " track Index: " << trackIndex;
323 
324  if (!foundtrack) {
325  return -1.;
326  }
327 
328  reco::VertexRef primaryVtx(&vertices, vtxindex);
329 
330  double Isolation = 0;
331  for (unsigned int i = 0; i < primaryVtx->tracksSize(); i++) {
332  if (i == trackIndex)
333  continue;
334  reco::TrackBaseRef secondarytrack = primaryVtx->trackRefAt(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()) <
339  continue;
340  Isolation += secondarytrack->pt();
341  }
342 
343  return Isolation / tkToMatch.get()->pt();
344 }
double pt() const
track transverse momentum
Definition: TrackBase.h:637
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:649
bool findTrackInVertices(const reco::TrackRef &tkToMatch, const reco::VertexCollection &vertices, unsigned int &vtxIndex, unsigned int &trackIndex)
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:652
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:226
#define LogDebug(id)

◆ passTriggers()

bool DisappearingMuonsSkimming::passTriggers ( const edm::Event iEvent,
const edm::TriggerResults results,
const std::vector< std::string > &  m_muonPathsToPass 
)
private

Definition at line 258 of file DisappearingMuonsSkimming.cc.

References mps_fire::i, iEvent, mergeVDriftHistosByStation::name, hltMonBTagIPClient_cfi::pathName, AlCaHLTBitMon_QueryRunRegistry::string, triggerResults, and trigNames.

Referenced by filter().

260  {
261  bool passTriggers = false;
262  const edm::TriggerNames& trigNames = iEvent.triggerNames(triggerResults);
263  for (size_t i = 0; i < trigNames.size(); ++i) {
264  const std::string& name = trigNames.triggerName(i);
265  for (auto& pathName : m_muonPathsToPass) {
266  if ((name.find(pathName) != std::string::npos)) {
267  if (triggerResults.accept(i)) {
268  passTriggers = true;
269  break;
270  }
271  }
272  }
273  }
274  return passTriggers;
275 }
int iEvent
Definition: GenABIO.cc:224
bool passTriggers(const edm::Event &iEvent, const edm::TriggerResults &results, const std::vector< std::string > &m_muonPathsToPass)
static std::string const triggerResults
Definition: EdmProvDump.cc:47
static const char *const trigNames[]
Definition: EcalDumpRaw.cc:57

Member Data Documentation

◆ ecalIsoConesize_

const double DisappearingMuonsSkimming::ecalIsoConesize_
private

Definition at line 91 of file DisappearingMuonsSkimming.h.

Referenced by getECALIsolation().

◆ geometryToken_

const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> DisappearingMuonsSkimming::geometryToken_
private

Definition at line 75 of file DisappearingMuonsSkimming.h.

Referenced by getECALIsolation().

◆ keepOffPeak_

const bool DisappearingMuonsSkimming::keepOffPeak_
private

Definition at line 99 of file DisappearingMuonsSkimming.h.

Referenced by filter().

◆ keepPartialRegion_

const bool DisappearingMuonsSkimming::keepPartialRegion_
private

Definition at line 102 of file DisappearingMuonsSkimming.h.

Referenced by filter().

◆ keepSameSign_

const bool DisappearingMuonsSkimming::keepSameSign_
private

Definition at line 100 of file DisappearingMuonsSkimming.h.

Referenced by filter().

◆ keepTotalRegion_

const bool DisappearingMuonsSkimming::keepTotalRegion_
private

Definition at line 101 of file DisappearingMuonsSkimming.h.

Referenced by filter().

◆ maxEcalIso_

const double DisappearingMuonsSkimming::maxEcalIso_
private

Definition at line 94 of file DisappearingMuonsSkimming.h.

Referenced by filter().

◆ maxInvMass_

const double DisappearingMuonsSkimming::maxInvMass_
private

Definition at line 88 of file DisappearingMuonsSkimming.h.

Referenced by filter().

◆ maxLongDCA_

const double DisappearingMuonsSkimming::maxLongDCA_
private

Definition at line 85 of file DisappearingMuonsSkimming.h.

Referenced by filter().

◆ maxMuEta_

const double DisappearingMuonsSkimming::maxMuEta_
private

Definition at line 80 of file DisappearingMuonsSkimming.h.

Referenced by filter().

◆ maxSigInvMass_

const double DisappearingMuonsSkimming::maxSigInvMass_
private

Definition at line 96 of file DisappearingMuonsSkimming.h.

Referenced by filter().

◆ maxStandaloneDE_

const double DisappearingMuonsSkimming::maxStandaloneDE_
private

Definition at line 98 of file DisappearingMuonsSkimming.h.

Referenced by filter().

◆ maxTrackEta_

const double DisappearingMuonsSkimming::maxTrackEta_
private

Definition at line 82 of file DisappearingMuonsSkimming.h.

Referenced by filter().

◆ maxTrackIso_

const double DisappearingMuonsSkimming::maxTrackIso_
private

Definition at line 93 of file DisappearingMuonsSkimming.h.

Referenced by filter().

◆ maxTransDCA_

const double DisappearingMuonsSkimming::maxTransDCA_
private

Definition at line 84 of file DisappearingMuonsSkimming.h.

Referenced by filter().

◆ maxVtxChi_

const double DisappearingMuonsSkimming::maxVtxChi_
private

Definition at line 86 of file DisappearingMuonsSkimming.h.

Referenced by filter().

◆ minEcalHitE_

const double DisappearingMuonsSkimming::minEcalHitE_
private

Definition at line 92 of file DisappearingMuonsSkimming.h.

Referenced by getECALIsolation().

◆ minInvMass_

const double DisappearingMuonsSkimming::minInvMass_
private

Definition at line 87 of file DisappearingMuonsSkimming.h.

◆ minMuPt_

const double DisappearingMuonsSkimming::minMuPt_
private

Definition at line 79 of file DisappearingMuonsSkimming.h.

Referenced by filter().

◆ minSigInvMass_

const double DisappearingMuonsSkimming::minSigInvMass_
private

Definition at line 95 of file DisappearingMuonsSkimming.h.

◆ minStandaloneDr_

const double DisappearingMuonsSkimming::minStandaloneDr_
private

Definition at line 97 of file DisappearingMuonsSkimming.h.

Referenced by filter().

◆ minTrackEta_

const double DisappearingMuonsSkimming::minTrackEta_
private

Definition at line 81 of file DisappearingMuonsSkimming.h.

Referenced by filter().

◆ minTrackPt_

const double DisappearingMuonsSkimming::minTrackPt_
private

Definition at line 83 of file DisappearingMuonsSkimming.h.

Referenced by filter().

◆ muonPathsToPass_

const std::vector<std::string> DisappearingMuonsSkimming::muonPathsToPass_
private

Definition at line 76 of file DisappearingMuonsSkimming.h.

Referenced by filter().

◆ primaryVerticesToken_

const edm::EDGetTokenT<reco::VertexCollection> DisappearingMuonsSkimming::primaryVerticesToken_
private

Definition at line 70 of file DisappearingMuonsSkimming.h.

Referenced by filter().

◆ recoMuonToken_

const edm::EDGetTokenT<reco::MuonCollection> DisappearingMuonsSkimming::recoMuonToken_
private

Definition at line 67 of file DisappearingMuonsSkimming.h.

Referenced by filter().

◆ reducedBarrelRecHitCollectionToken_

const edm::EDGetTokenT<EcalRecHitCollection> DisappearingMuonsSkimming::reducedBarrelRecHitCollectionToken_
private

Definition at line 72 of file DisappearingMuonsSkimming.h.

Referenced by getECALIsolation().

◆ reducedEndcapRecHitCollectionToken_

const edm::EDGetTokenT<EcalRecHitCollection> DisappearingMuonsSkimming::reducedEndcapRecHitCollectionToken_
private

Definition at line 71 of file DisappearingMuonsSkimming.h.

Referenced by getECALIsolation().

◆ standaloneMuonToken_

const edm::EDGetTokenT<reco::TrackCollection> DisappearingMuonsSkimming::standaloneMuonToken_
private

Definition at line 68 of file DisappearingMuonsSkimming.h.

Referenced by filter().

◆ trackCollectionToken_

const edm::EDGetTokenT<reco::TrackCollection> DisappearingMuonsSkimming::trackCollectionToken_
private

Definition at line 69 of file DisappearingMuonsSkimming.h.

Referenced by filter().

◆ trackIsoConesize_

const double DisappearingMuonsSkimming::trackIsoConesize_
private

Definition at line 89 of file DisappearingMuonsSkimming.h.

Referenced by getTrackIsolation().

◆ trackIsoInnerCone_

const double DisappearingMuonsSkimming::trackIsoInnerCone_
private

Definition at line 90 of file DisappearingMuonsSkimming.h.

Referenced by getTrackIsolation().

◆ transientTrackToken_

const edm::ESGetToken<TransientTrackBuilder, TransientTrackRecord> DisappearingMuonsSkimming::transientTrackToken_
private

Definition at line 74 of file DisappearingMuonsSkimming.h.

Referenced by filter().

◆ trigResultsToken_

const edm::EDGetTokenT<edm::TriggerResults> DisappearingMuonsSkimming::trigResultsToken_
private

Definition at line 73 of file DisappearingMuonsSkimming.h.

Referenced by filter().