20 #include "Math/VectorUtil.h" 38 standaloneMuonToken_(consumes<
reco::
TrackCollection>(iConfig.getParameter<
edm::InputTag>(
"StandaloneTracks"))),
40 primaryVerticesToken_(consumes<
reco::
VertexCollection>(iConfig.getParameter<
edm::InputTag>(
"primaryVertices"))),
41 reducedEndcapRecHitCollectionToken_(
43 reducedBarrelRecHitCollectionToken_(
45 trigResultsToken_(consumes<
edm::TriggerResults>(iConfig.getParameter<
edm::InputTag>(
"TriggerResultsTag"))),
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")),
63 minEcalHitE_(iConfig.getParameter<
double>(
"minEcalHitE")),
64 maxTrackIso_(iConfig.getParameter<
double>(
"maxTrackIso")),
65 maxEcalIso_(iConfig.getParameter<
double>(
"maxEcalIso")),
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;
200 if (!staTracks.empty()) {
201 for (
const auto& staTrack : staTracks) {
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) {
263 for (
size_t i = 0;
i < trigNames.
size(); ++
i) {
265 for (
auto& pathName : m_muonPathsToPass) {
266 if ((name.find(pathName) != std::string::npos)) {
267 if (triggerResults.
accept(
i)) {
279 unsigned int& vtxIndex,
280 unsigned int& trackIndex) {
285 bool foundtrack{
false};
286 unsigned int idx = 0;
287 for (
const auto&
vtx : vertices) {
288 if (!
vtx.isValid()) {
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());
299 auto result = std::find_if(
300 thePVkeys.begin(), thePVkeys.end(), [tkToMatch](
const auto& tkRef) {
return tkRef == tkToMatch.
key(); });
301 if (
result != thePVkeys.end()) {
315 unsigned int vtxindex;
316 unsigned int trackIndex;
319 LogDebug(
"DisappearingMuonsSkimming") <<
"getTrackIsolation vtx Index: " << vtxindex
320 <<
" track Index: " << trackIndex;
328 double Isolation = 0;
329 for (
unsigned int i = 0;
i < primaryVtx->tracksSize();
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()) <
338 Isolation += secondarytrack->
pt();
341 return Isolation / tkToMatch.
get()->pt();
358 const DetId id = (*hit).detid();
368 eDR += (*hit).energy();
372 const DetId id = (*hit).detid();
381 eDR += (*hit).energy();
398 desc.
add<std::vector<std::string>>(
"muonPathsToPass",
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);
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
GlobalPoint position() const
const double minEcalHitE_
const double minStandaloneDr_
const std::vector< std::string > muonPathsToPass_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
TrajectoryStateClosestToPoint impactPointTSCP() const
const double maxStandaloneDE_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const edm::EDGetTokenT< edm::TriggerResults > trigResultsToken_
bool accept() const
Has at least one path accepted the event?
Geom::Phi< T > phi() const
Global3DPoint GlobalPoint
std::vector< Track > TrackCollection
collection of Tracks
std::vector< EcalRecHit >::const_iterator const_iterator
reco::TransientTrack build(const reco::Track *p) const
double phi() const
azimuthal angle of momentum vector
std::vector< Vertex > VertexCollection
collection of Vertex objects
Strings::size_type size() const
key_type key() const
Accessor for product key.
const edm::EDGetTokenT< reco::VertexCollection > primaryVerticesToken_
std::vector< Muon > MuonCollection
collection of Muon objects
const double ecalIsoConesize_
bool getData(T &iHolder) const
double longitudinalImpactParameter() const
#define DEFINE_FWK_MODULE(type)
double eta() const
pseudorapidity of momentum vector
const PerigeeTrajectoryParameters & perigeeParameters() const
const double trackIsoInnerCone_
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > transientTrackToken_
double pt() const
track transverse momentum
const edm::EDGetTokenT< EcalRecHitCollection > reducedEndcapRecHitCollectionToken_
double transverseImpactParameter() const
const double minTrackEta_
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)
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &tracks) const override
bool get(ProductID const &oid, Handle< PROD > &result) const
const edm::EDGetTokenT< reco::MuonCollection > recoMuonToken_
double getECALIsolation(const edm::Event &, const edm::EventSetup &, const reco::TransientTrack &track)
float degreesOfFreedom() const
T const * get() const
Returns C++ pointer to the item.
static std::string const triggerResults
ParameterDescriptionBase * add(U const &iLabel, T const &value)
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)
bool filter(edm::Event &, const edm::EventSetup &) override
const_iterator end() const
static const char *const trigNames[]
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
static TrackQuality qualityByName(const std::string &name)
const bool keepTotalRegion_
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
std::string const & triggerName(unsigned int index) const
TrajectoryStateClosestToPoint trajectoryStateClosestToPoint(const GlobalPoint &point) const
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
const double maxTrackIso_
const double maxSigInvMass_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geometryToken_
GlobalPoint position() const
const edm::EDGetTokenT< reco::TrackCollection > standaloneMuonToken_
const double minSigInvMass_
const double maxTrackEta_
const double trackIsoConesize_
const edm::EDGetTokenT< EcalRecHitCollection > reducedBarrelRecHitCollectionToken_
const edm::EDGetTokenT< reco::TrackCollection > trackCollectionToken_
DisappearingMuonsSkimming(const edm::ParameterSet &)
const double maxTransDCA_
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
Power< A, B >::type pow(const A &a, const B &b)
GlobalVector momentum() const
const_iterator begin() const