45 : inputMuonCollections_(iConfig.getParameter<
std::
vector<
edm::
InputTag> >(
"InputMuonCollections")),
46 inputTrackCollections_(iConfig.getParameter<
std::
vector<
edm::
InputTag> >(
"InputTrackCollections")),
47 inputCosmicMuonCollection_(iConfig.getParameter<
edm::
InputTag>(
"InputCosmicMuonCollection")),
48 inputVertexCollection_(iConfig.getParameter<
edm::
InputTag>(
"InputVertexCollection")) {
103 const std::string theCategory =
"MuonCosmicCompatibilityFiller";
128 float offTimeNegMult, offTimePosMult, offTimeNeg, offTimePos;
145 if (
muon.isTimeValid()) {
148 float positiveTime = 0;
149 if (
muon.time().timeAtIpInOut < offTimeNegMult ||
muon.time().timeAtIpInOut > offTimePosMult)
151 if (
muon.time().timeAtIpInOut > 0.)
152 positiveTime =
muon.time().timeAtIpInOut;
161 if (outertrack->phi() > 0)
169 for (reco::MuonCollection::const_iterator iMuon = muonHandle->begin(); iMuon != muonHandle->end();
171 if (!iMuon->isGlobalMuon())
175 if (
muon.isTimeValid()) {
177 if (checkedTrack->phi() < 0 && isUp) {
181 }
else if (checkedTrack->phi() > 0 && !isUp) {
194 if (
muon.time().timeAtIpInOut < offTimeNeg ||
muon.time().timeAtIpInOut > offTimePos)
215 if (
muon.isGlobalMuon())
217 else if (
muon.isTrackerMuon())
219 else if (
muon.isStandAloneMuon() ||
muon.isRPCMuon() ||
muon.isGEMMuon() ||
muon.isME0Muon())
222 for (
unsigned int iColl = 0; iColl <
trackTokens_.size(); ++iColl) {
237 unsigned int nGlb = 0;
243 for (reco::MuonCollection::const_iterator iMuon = muonHandle->begin(); iMuon != muonHandle->end(); ++iMuon) {
244 if (!iMuon->isGlobalMuon())
266 bool overlappingMuon =
false;
267 if (!
muon.isGlobalMuon())
279 RefVtx.SetXYZ(0, 0, 0);
284 for (reco::VertexCollection::const_iterator it =
vertices.begin(); it !=
vertices.end(); ++it) {
285 RefVtx = it->position();
289 for (reco::MuonCollection::const_iterator cosmicMuon = muonHandle->begin(); cosmicMuon != muonHandle->end();
291 if (cosmicMuon->innerTrack() ==
muon.innerTrack() || cosmicMuon->outerTrack() ==
muon.outerTrack())
298 int RecHitsMuon = outertrack->numberOfValidHits();
322 if ((*trkhit)->isValid()) {
325 if ((*coshit)->isValid()) {
326 if ((*trkhit)->geographicalId() == (*coshit)->geographicalId()) {
327 if (((*trkhit)->localPosition() - (*coshit)->localPosition()).
mag() < 10
e-5)
338 if (RecHitsMuon != 0)
339 fraction = shared / (double)RecHitsMuon;
341 overlappingMuon =
true;
347 return overlappingMuon;
356 float maxdxyMult, maxdzMult, maxdxy, maxdz;
374 if (
muon.isGlobalMuon())
376 else if (
muon.isTrackerMuon() ||
muon.isRPCMuon())
378 else if (
muon.isStandAloneMuon())
381 bool multipleMu =
false;
386 RefVtx.SetXYZ(0, 0, 0);
391 for (reco::VertexCollection::const_iterator it =
vertices.begin(); it !=
vertices.end(); ++it) {
392 RefVtx = it->position();
394 if (
track.isNonnull()) {
398 if (fabs((*track).dxy(RefVtx)) < maxdxyMult || fabs((*track).dz(RefVtx)) < maxdzMult) {
408 if (fabs((*track).dxy(RefVtx)) < maxdxy || fabs((*track).dz(RefVtx)) < maxdz) {
420 if (
result == 0 && multipleMu) {
432 for (reco::MuonCollection::const_iterator
muons = muonHandle->begin();
muons != muonHandle->end(); ++
muons) {
433 if (!
muons->isGlobalMuon())
436 if (
muons->innerTrack() ==
muon.innerTrack() &&
muons->outerTrack() ==
muon.outerTrack())
440 if (
muons->isGlobalMuon())
442 if (fabs((*tracks).dxy(RefVtx)) >
hIpTrdxy_)
464 bool checkVertex)
const {
469 if (
muon.isGlobalMuon()) {
480 if (checkVertex && cosmicVertex == 0)
488 double weight_btob = 2.0;
489 double weight_ip = 2.0;
490 double weight_time = 1.0;
491 double weight_overlap = 0.5;
497 if (backToback >= 1) {
499 result += weight_btob * 2.;
504 result -= weight_btob * 0.5;
512 result += weight_ip * 2.0;
513 if (backToback == 0) {
515 if (tightTime == 0) {
516 if (looseTime == 0 && !isOverlapping)
517 result -= weight_ip * 1.0;
520 }
else if (tightIp >= 2) {
524 result -= weight_ip * 1.0;
531 if (backToback >= 1) {
533 result += weight_time * tightTime;
534 else if (looseIp == 0)
535 result += weight_time * 0.25;
538 if (backToback >= 1 && tightIp == 0)
539 result += weight_time * 0.25;
544 if (backToback == 0 && isOverlapping) {
546 if (tightIp == 0 && tightTime >= 1) {
547 result += weight_overlap * 1.0;
578 for (reco::VertexCollection::const_iterator it =
vertices.begin(); it !=
vertices.end(); ++it) {
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
float combinedCosmicID(const edm::Event &, const edm::EventSetup &iSetup, const reco::Muon &, bool CheckMuonID, bool checkVertex) const
combined cosmic-likeness: 0 == not cosmic-like
T getParameter(std::string const &) const
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
get the tracking geometry
reco::TrackRef findOppositeTrack(const edm::Handle< reco::TrackCollection > &collection, const reco::Track &muon, double angleMatch=0.01, double momentumMatch=0.05)
edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > geometryToken_
bool isOverlappingMuon(const edm::Event &, const edm::EventSetup &iSetup, const reco::Muon &) const
returns cosmic-likeness based on overlap with traversing cosmic muon (only muon/STA hits are used) ...
T const * product() const
std::vector< Track > TrackCollection
collection of Tracks
bool isNonnull() const
Checks for non-null.
std::vector< edm::EDGetTokenT< reco::TrackCollection > > trackTokens_
std::vector< Vertex > VertexCollection
collection of Vertex objects
double offTimeNegLooseMult_
std::vector< Muon > MuonCollection
collection of Muon objects
float backToBackCompatibility
cosmic-likeness based on presence of a track in opp side: 0 == no matching opp tracks ...
double offTimePosTightMult_
edm::EDGetTokenT< reco::MuonCollection > cosmicToken_
double offTimeNegTightMult_
std::vector< edm::EDGetTokenT< reco::MuonCollection > > muonTokens_
float segmentCompatibility(const reco::Muon &muon, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
unsigned int nMuons(const edm::Event &) const
get number of muons in the vent
edm::InputTag inputVertexCollection_
reco::MuonCosmicCompatibility fillCompatibility(const reco::Muon &muon, edm::Event &, const edm::EventSetup &)
fill cosmic compatibility variables
unsigned int pvMatches(const edm::Event &, const reco::Muon &, bool) const
return cosmic-likeness based on the 2D impact parameters (dxy, dz wrt to PV). 0 == cosmic-like ...
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
float timeCompatibility
cosmic-likeness based on time: 0 == prompt-like
int numberOfMatches(ArbitrationType type=SegmentAndTrackArbitration) const
get number of chambers with matched segments
bool checkMuonID(const reco::Muon &) const
tag a muon as cosmic based on the muonID information
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
XYZPointD XYZPoint
point in space with cartesian internal representation
unsigned int backToBack2LegCosmic(const edm::Event &, const reco::Muon &) const
return cosmic-likeness based on presence of a track in opp side: 0 == no matching opp tracks ...
unsigned int eventActivity(const edm::Event &, const reco::Muon &) const
returns cosmic-likeness based on the event activity information: tracker track multiplicity and verte...
edm::EDGetTokenT< reco::VertexCollection > vertexToken_
MuonCosmicCompatibilityFiller(const edm::ParameterSet &, edm::ConsumesCollector &)
std::vector< edm::InputTag > inputTrackCollections_
~MuonCosmicCompatibilityFiller()
edm::InputTag inputCosmicMuonCollection_
bool checkMuonSegments(const reco::Muon &muon) const
tag a muon as cosmic based on segment compatibility and the number of segment matches ...
std::vector< edm::InputTag > inputMuonCollections_
float cosmicCompatibility
combined cosmic-likeness: 0 == not cosmic-like
float muonTiming(const edm::Event &iEvent, const reco::Muon &muon, bool isLoose) const
check muon time (DT and CSC) information: 0 == prompt-like
float overlapCompatibility
cosmic-likeness based on overlap with traversing cosmic muon (only muon/STA hits are used) ...
double offTimePosLooseMult_
float ipCompatibility
cosmic-likeness based on the 2D impact parameters (dxy, dz wrt to PV). 0 == cosmic-like ...
float vertexCompatibility
cosmic-likeness based on the event activity information: tracker track multiplicity and vertex qualit...