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< T > 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< T >
 EDFilter ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDFilterBase
 EDFilterBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~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
 
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)
 
 ~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
 
ESProxyIndex const * esGetTokenIndices (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::vector< ModuleDescription const * > &modules, 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
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices 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
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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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<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)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 46 of file DisappearingMuonsSkimming.h.

Constructor & Destructor Documentation

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

Definition at line 36 of file DisappearingMuonsSkimming.cc.

References ecalIsoConesize_, keepOffPeak_, keepPartialRegion_, keepSameSign_, keepTotalRegion_, maxEcalIso_, maxInvMass_, maxLongDCA_, maxMuEta_, maxSigInvMass_, maxStandaloneDE_, maxTrackEta_, maxTrackIso_, maxTransDCA_, maxVtxChi_, minEcalHitE_, minInvMass_, minMuPt_, minSigInvMass_, minStandaloneDr_, minTrackEta_, minTrackPt_, muonPathsToPass_, trackIsoConesize_, and trackIsoInnerCone_.

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
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 ( )
overridedefault

Member Function Documentation

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

Definition at line 388 of file DisappearingMuonsSkimming.cc.

References edm::ParameterSetDescription::add(), edm::ConfigurationDescriptions::addWithDefaultLabel(), and DEFINE_FWK_MODULE.

388  {
390 
391  desc.add<edm::InputTag>("recoMuons", edm::InputTag("muons"));
392  desc.add<edm::InputTag>("tracks", edm::InputTag("generalTracks"));
393  desc.add<edm::InputTag>("StandaloneTracks", edm::InputTag("standAloneMuons"));
394  desc.add<edm::InputTag>("primaryVertices", edm::InputTag("offlinePrimaryVertices"));
395  desc.add<edm::InputTag>("EERecHits", edm::InputTag("reducedEcalRecHitsEE"));
396  desc.add<edm::InputTag>("EBRecHits", edm::InputTag("reducedEcalRecHitsEB"));
397  desc.add<edm::InputTag>("TriggerResultsTag", edm::InputTag("TriggerResults", "", "HLT"));
398  desc.add<std::vector<std::string>>("muonPathsToPass",
399  {
400  "HLT_IsoMu24_v",
401  "HLT_IsoMu27_v",
402  });
403  desc.add<double>("minMuPt", 26);
404  desc.add<double>("maxMuEta", 2.4);
405  desc.add<double>("minTrackEta", 1.4);
406  desc.add<double>("maxTrackEta", 2.4);
407  desc.add<double>("minTrackPt", 20);
408  desc.add<double>("maxTransDCA", 0.005);
409  desc.add<double>("maxLongDCA", 0.05);
410  desc.add<double>("maxVtxChi", 3.0);
411  desc.add<double>("minInvMass", 50);
412  desc.add<double>("maxInvMass", 150);
413  desc.add<double>("trackIsoConesize", 0.3);
414  desc.add<double>("trackIsoInnerCone", 0.01);
415  desc.add<double>("ecalIsoConesize", 0.4);
416  desc.add<double>("minEcalHitE", 0.3);
417  desc.add<double>("maxTrackIso", 0.05);
418  desc.add<double>("maxEcalIso", 10);
419  desc.add<double>("minSigInvMass", 76);
420  desc.add<double>("maxSigInvMass", 106);
421  desc.add<double>("minStandaloneDr", 1.0);
422  desc.add<double>("maxStandaloneDE", -0.5);
423  desc.add<bool>("keepOffPeak", true);
424  desc.add<bool>("keepSameSign", true);
425  desc.add<bool>("keepTotalRegion", true);
426  desc.add<bool>("keepPartialRegion", true);
427  descriptions.addWithDefaultLabel(desc);
428 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool DisappearingMuonsSkimming::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 80 of file DisappearingMuonsSkimming.cc.

References funct::abs(), TransientTrackBuilder::build(), reco::Muon::CutBasedIdTight, CachingVertex< N >::degreesOfFreedom(), reco::deltaR2(), PV3DBase< T, PVType, FrameType >::eta(), findTrackInVertices(), edm::Event::get(), edm::EventSetup::getData(), getECALIsolation(), getTrackIsolation(), reco::TransientTrack::impactPointTSCP(), 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, PV3DBase< T, PVType, FrameType >::phi(), CachingVertex< N >::position(), funct::pow(), primaryVerticesToken_, reco::TrackBase::qualityByName(), recoMuonToken_, mathSSE::sqrt(), standaloneMuonToken_, CachingVertex< N >::totalChiSquared(), HiIsolationCommonParameters_cff::track, trackCollectionToken_, transientTrackToken_, PerigeeTrajectoryParameters::transverseImpactParameter(), triggerResults, trigResultsToken_, KalmanVertexFitter::vertex(), generalV0Candidates_cfi::vertexFitter, electrons_cff::vertices, extraflags_cff::vtx, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::filter(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::setDataAccessor(), and Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::switchCenterView().

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));
189  if (trackIso > maxTrackIso_ || ecalIso > maxEcalIso_)
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 mag2() const
Definition: PV3DBase.h:66
const std::vector< std::string > muonPathsToPass_
TrajectoryStateClosestToPoint impactPointTSCP() const
const edm::EDGetTokenT< edm::TriggerResults > trigResultsToken_
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
reco::TransientTrack build(const reco::Track *p) const
T y() const
Definition: PV3DBase.h:63
const edm::EDGetTokenT< reco::VertexCollection > primaryVerticesToken_
bool getData(T &iHolder) const
Definition: EventSetup.h:111
const PerigeeTrajectoryParameters & perigeeParameters() const
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > transientTrackToken_
T sqrt(T t)
Definition: SSEVec.h:18
T z() const
Definition: PV3DBase.h:64
bool passTriggers(const edm::Event &iEvent, const edm::TriggerResults &results, const std::vector< std::string > &m_muonPathsToPass)
float totalChiSquared() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &tracks) const override
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:326
const edm::EDGetTokenT< reco::MuonCollection > recoMuonToken_
double getECALIsolation(const edm::Event &, const edm::EventSetup &, const reco::TransientTrack &track)
float degreesOfFreedom() const
static std::string const triggerResults
Definition: EdmProvDump.cc:45
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)
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:134
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:21
GlobalPoint position() const
const edm::EDGetTokenT< reco::TrackCollection > standaloneMuonToken_
T eta() const
Definition: PV3DBase.h:76
fixed size matrix
HLT enums.
bool isValid() const
const edm::EDGetTokenT< reco::TrackCollection > trackCollectionToken_
T x() const
Definition: PV3DBase.h:62
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
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 SoftLeptonByDistance_cfi::distance, mps_fire::i, training_settings::idx, edm::Ref< C, T, F >::key(), mps_fire::result, and extraflags_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  std::vector<unsigned int> thePVkeys;
294  thePVkeys.reserve(vtx.tracksSize());
295  for (unsigned int i = 0; i < vtx.tracksSize(); i++) {
296  thePVkeys.push_back(vtx.trackRefAt(i).key());
297  }
298 
299  auto result = std::find_if(
300  thePVkeys.begin(), thePVkeys.end(), [tkToMatch](const auto& tkRef) { return tkRef == tkToMatch.key(); });
301  if (result != thePVkeys.end()) {
302  foundtrack = true;
303  trackIndex = std::distance(thePVkeys.begin(), result);
304  vtxIndex = idx;
305  }
306  if (foundtrack)
307  break;
308  idx++;
309  }
310  return foundtrack;
311 }
key_type key() const
Accessor for product key.
Definition: Ref.h:263
double DisappearingMuonsSkimming::getECALIsolation ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const reco::TransientTrack track 
)
private

Definition at line 344 of file DisappearingMuonsSkimming.cc.

References edm::SortedCollection< T, SORT >::begin(), reco::deltaR2(), ecalIsoConesize_, edm::SortedCollection< T, SORT >::end(), PV3DBase< T, PVType, FrameType >::eta(), geometryToken_, edm::Event::getByToken(), edm::EventSetup::getData(), CaloSubdetectorGeometry::getGeometry(), CaloGeometry::getSubdetectorGeometry(), reco::TransientTrack::impactPointTSCP(), minEcalHitE_, TrajectoryStateClosestToPoint::momentum(), TrajectoryStateClosestToPoint::position(), reducedBarrelRecHitCollectionToken_, reducedEndcapRecHitCollectionToken_, genVertex_cff::t0, reco::TransientTrack::trajectoryStateClosestToPoint(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by filter().

346  {
349 
352 
353  const CaloGeometry& caloGeom = iSetup.getData(geometryToken_);
355  double eDR = 0;
356 
357  for (EcalRecHitCollection::const_iterator hit = rechitsEE->begin(); hit != rechitsEE->end(); hit++) {
358  const DetId id = (*hit).detid();
359  const GlobalPoint hitPos = caloGeom.getSubdetectorGeometry(id)->getGeometry(id)->getPosition();
360  //Check if hit and track trajectory ar in the same endcap (transient track projects both ways)
361  if ((hitPos.eta() * t0.momentum().eta()) < 0) {
362  continue;
363  }
365  math::XYZVector idPositionRoot(hitPos.x(), hitPos.y(), hitPos.z());
366  math::XYZVector trajRoot(traj.position().x(), traj.position().y(), traj.position().z());
367  if (deltaR2(idPositionRoot, trajRoot) < ecalIsoConesize_ * ecalIsoConesize_ && (*hit).energy() > minEcalHitE_) {
368  eDR += (*hit).energy();
369  }
370  }
371  for (EcalRecHitCollection::const_iterator hit = rechitsEB->begin(); hit != rechitsEB->end(); hit++) {
372  const DetId id = (*hit).detid();
373  const GlobalPoint hitPos = caloGeom.getSubdetectorGeometry(id)->getGeometry(id)->getPosition();
374  if ((hitPos.eta() * t0.momentum().eta()) < 0) {
375  continue;
376  }
378  math::XYZVector idPositionRoot(hitPos.x(), hitPos.y(), hitPos.z());
379  math::XYZVector trajRoot(traj.position().x(), traj.position().y(), traj.position().z());
380  if (deltaR2(idPositionRoot, trajRoot) < ecalIsoConesize_ * ecalIsoConesize_ && (*hit).energy() > minEcalHitE_) {
381  eDR += (*hit).energy();
382  }
383  }
384 
385  return eDR;
386 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:49
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
TrajectoryStateClosestToPoint impactPointTSCP() const
std::vector< EcalRecHit >::const_iterator const_iterator
T y() const
Definition: PV3DBase.h:63
bool getData(T &iHolder) const
Definition: EventSetup.h:111
const edm::EDGetTokenT< EcalRecHitCollection > reducedEndcapRecHitCollectionToken_
T z() const
Definition: PV3DBase.h:64
const_iterator end() const
Definition: DetId.h:18
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
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.
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
TrajectoryStateClosestToPoint trajectoryStateClosestToPoint(const GlobalPoint &point) const
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geometryToken_
T eta() const
Definition: PV3DBase.h:76
const edm::EDGetTokenT< EcalRecHitCollection > reducedBarrelRecHitCollectionToken_
T x() const
Definition: PV3DBase.h:62
const_iterator begin() const
double DisappearingMuonsSkimming::getTrackIsolation ( const reco::TrackRef tkToMatch,
const reco::VertexCollection vertices 
)
private

Definition at line 313 of file DisappearingMuonsSkimming.cc.

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

Referenced by filter().

314  {
315  unsigned int vtxindex;
316  unsigned int trackIndex;
317  bool foundtrack = this->findTrackInVertices(tkToMatch, vertices, vtxindex, trackIndex);
318 
319  LogDebug("DisappearingMuonsSkimming") << "getTrackIsolation vtx Index: " << vtxindex
320  << " track Index: " << trackIndex;
321 
322  if (!foundtrack) {
323  return -1.;
324  }
325 
326  reco::VertexRef primaryVtx(&vertices, vtxindex);
327 
328  double Isolation = 0;
329  for (unsigned int i = 0; i < primaryVtx->tracksSize(); i++) {
330  if (i == trackIndex)
331  continue;
332  reco::TrackBaseRef secondarytrack = primaryVtx->trackRefAt(i);
333  if (deltaR2(tkToMatch.get()->eta(), tkToMatch.get()->phi(), secondarytrack->eta(), secondarytrack->phi()) >
335  deltaR2(tkToMatch.get()->eta(), tkToMatch.get()->phi(), secondarytrack->eta(), secondarytrack->phi()) <
337  continue;
338  Isolation += secondarytrack->pt();
339  }
340 
341  return Isolation / tkToMatch.get()->pt();
342 }
#define LogDebug(id)
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:684
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:690
double pt() const
track transverse momentum
Definition: TrackBase.h:660
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:243
bool findTrackInVertices(const reco::TrackRef &tkToMatch, const reco::VertexCollection &vertices, unsigned int &vtxIndex, unsigned int &trackIndex)
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
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 edm::HLTGlobalStatus::accept(), mps_fire::i, dataset::name, edm::TriggerNames::size(), AlCaHLTBitMon_QueryRunRegistry::string, edm::TriggerNames::triggerName(), edm::Event::triggerNames(), and trigNames.

Referenced by filter().

260  {
261  bool passTriggers = false;
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 }
Strings::size_type size() const
Definition: TriggerNames.cc:31
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:45
static const char *const trigNames[]
Definition: EcalDumpRaw.cc:74
std::string const & triggerName(unsigned int index) const
Definition: TriggerNames.cc:22
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
Definition: Event.cc:256

Member Data Documentation

const double DisappearingMuonsSkimming::ecalIsoConesize_
private

Definition at line 92 of file DisappearingMuonsSkimming.h.

Referenced by DisappearingMuonsSkimming(), and getECALIsolation().

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

Definition at line 76 of file DisappearingMuonsSkimming.h.

Referenced by getECALIsolation().

const bool DisappearingMuonsSkimming::keepOffPeak_
private

Definition at line 100 of file DisappearingMuonsSkimming.h.

Referenced by DisappearingMuonsSkimming(), and filter().

const bool DisappearingMuonsSkimming::keepPartialRegion_
private

Definition at line 103 of file DisappearingMuonsSkimming.h.

Referenced by DisappearingMuonsSkimming(), and filter().

const bool DisappearingMuonsSkimming::keepSameSign_
private

Definition at line 101 of file DisappearingMuonsSkimming.h.

Referenced by DisappearingMuonsSkimming(), and filter().

const bool DisappearingMuonsSkimming::keepTotalRegion_
private

Definition at line 102 of file DisappearingMuonsSkimming.h.

Referenced by DisappearingMuonsSkimming(), and filter().

const double DisappearingMuonsSkimming::maxEcalIso_
private

Definition at line 95 of file DisappearingMuonsSkimming.h.

Referenced by DisappearingMuonsSkimming(), and filter().

const double DisappearingMuonsSkimming::maxInvMass_
private

Definition at line 89 of file DisappearingMuonsSkimming.h.

Referenced by DisappearingMuonsSkimming(), and filter().

const double DisappearingMuonsSkimming::maxLongDCA_
private

Definition at line 86 of file DisappearingMuonsSkimming.h.

Referenced by DisappearingMuonsSkimming(), and filter().

const double DisappearingMuonsSkimming::maxMuEta_
private

Definition at line 81 of file DisappearingMuonsSkimming.h.

Referenced by DisappearingMuonsSkimming(), and filter().

const double DisappearingMuonsSkimming::maxSigInvMass_
private

Definition at line 97 of file DisappearingMuonsSkimming.h.

Referenced by DisappearingMuonsSkimming(), and filter().

const double DisappearingMuonsSkimming::maxStandaloneDE_
private

Definition at line 99 of file DisappearingMuonsSkimming.h.

Referenced by DisappearingMuonsSkimming(), and filter().

const double DisappearingMuonsSkimming::maxTrackEta_
private

Definition at line 83 of file DisappearingMuonsSkimming.h.

Referenced by DisappearingMuonsSkimming(), and filter().

const double DisappearingMuonsSkimming::maxTrackIso_
private

Definition at line 94 of file DisappearingMuonsSkimming.h.

Referenced by DisappearingMuonsSkimming(), and filter().

const double DisappearingMuonsSkimming::maxTransDCA_
private

Definition at line 85 of file DisappearingMuonsSkimming.h.

Referenced by DisappearingMuonsSkimming(), and filter().

const double DisappearingMuonsSkimming::maxVtxChi_
private

Definition at line 87 of file DisappearingMuonsSkimming.h.

Referenced by DisappearingMuonsSkimming(), and filter().

const double DisappearingMuonsSkimming::minEcalHitE_
private

Definition at line 93 of file DisappearingMuonsSkimming.h.

Referenced by DisappearingMuonsSkimming(), and getECALIsolation().

const double DisappearingMuonsSkimming::minInvMass_
private

Definition at line 88 of file DisappearingMuonsSkimming.h.

Referenced by DisappearingMuonsSkimming().

const double DisappearingMuonsSkimming::minMuPt_
private

Definition at line 80 of file DisappearingMuonsSkimming.h.

Referenced by DisappearingMuonsSkimming(), and filter().

const double DisappearingMuonsSkimming::minSigInvMass_
private

Definition at line 96 of file DisappearingMuonsSkimming.h.

Referenced by DisappearingMuonsSkimming().

const double DisappearingMuonsSkimming::minStandaloneDr_
private

Definition at line 98 of file DisappearingMuonsSkimming.h.

Referenced by DisappearingMuonsSkimming(), and filter().

const double DisappearingMuonsSkimming::minTrackEta_
private

Definition at line 82 of file DisappearingMuonsSkimming.h.

Referenced by DisappearingMuonsSkimming(), and filter().

const double DisappearingMuonsSkimming::minTrackPt_
private

Definition at line 84 of file DisappearingMuonsSkimming.h.

Referenced by DisappearingMuonsSkimming(), and filter().

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

Definition at line 77 of file DisappearingMuonsSkimming.h.

Referenced by DisappearingMuonsSkimming(), and filter().

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

Definition at line 71 of file DisappearingMuonsSkimming.h.

Referenced by filter().

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

Definition at line 68 of file DisappearingMuonsSkimming.h.

Referenced by filter().

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

Definition at line 73 of file DisappearingMuonsSkimming.h.

Referenced by getECALIsolation().

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

Definition at line 72 of file DisappearingMuonsSkimming.h.

Referenced by getECALIsolation().

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

Definition at line 69 of file DisappearingMuonsSkimming.h.

Referenced by filter().

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

Definition at line 70 of file DisappearingMuonsSkimming.h.

Referenced by filter().

const double DisappearingMuonsSkimming::trackIsoConesize_
private

Definition at line 90 of file DisappearingMuonsSkimming.h.

Referenced by DisappearingMuonsSkimming(), and getTrackIsolation().

const double DisappearingMuonsSkimming::trackIsoInnerCone_
private

Definition at line 91 of file DisappearingMuonsSkimming.h.

Referenced by DisappearingMuonsSkimming(), and getTrackIsolation().

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

Definition at line 75 of file DisappearingMuonsSkimming.h.

Referenced by filter().

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

Definition at line 74 of file DisappearingMuonsSkimming.h.

Referenced by filter().