56 inputMuonCollections_(iConfig.getParameter<std::vector<edm::
InputTag> >(
"InputMuonCollections")),
57 inputTrackCollections_(iConfig.getParameter<std::vector<edm::
InputTag> >(
"InputTrackCollections")),
58 inputCosmicMuonCollection_(iConfig.getParameter<edm::
InputTag>(
"InputCosmicMuonCollection")),
59 inputVertexCollection_(iConfig.getParameter<edm::
InputTag>(
"InputVertexCollection")),
113 const std::string theCategory =
"MuonCosmicCompatibilityFiller";
119 float timeCompatibility =
muonTiming(iEvent, muon,
false);
122 float ipCompatibility =
pvMatches(iEvent,muon,
false);
124 float combinedCompatibility =
combinedCosmicID(iEvent,iSetup,muon,
false,
false);
143 float offTimeNegMult, offTimePosMult, offTimeNeg, offTimePos;
164 float positiveTime = 0;
170 if (!isLoose && result == 0 && positiveTime >
corrTimePos_) {
176 if( outertrack->phi() > 0 ) isUp =
true;
183 for ( reco::MuonCollection::const_iterator iMuon = muonHandle->begin(); iMuon != muonHandle->end(); ++iMuon ) {
184 if (!iMuon->isGlobalMuon())
continue;
190 if (checkedTrack->phi() < 0 && isUp) {
191 if (iMuon->time().timeAtIpInOut <
corrTimeNeg_) result = 1.0;
193 }
else if (checkedTrack->phi() > 0 && !isUp) {
195 if (iMuon->time().timeAtIpInOut <
corrTimeNeg_) result = 1.0;
210 if (!isLoose && result > 0) {
212 if (
pvMatches(iEvent, muon,
true) == 0) result *= 2.;
247 unsigned int nGlb = 0;
253 for ( reco::MuonCollection::const_iterator iMuon = muonHandle->begin(); iMuon != muonHandle->end(); ++iMuon ) {
254 if (!iMuon->isGlobalMuon())
continue;
276 bool overlappingMuon =
false;
289 RefVtx.SetXYZ(0, 0, 0);
294 for(reco::VertexCollection::const_iterator it=vertices.begin() ; it!=vertices.end() ; ++it) {
295 RefVtx = it->position();
300 for ( reco::MuonCollection::const_iterator cosmicMuon = muonHandle->begin();cosmicMuon != muonHandle->end(); ++cosmicMuon ) {
301 if ( cosmicMuon->innerTrack() == muon.
innerTrack() || cosmicMuon->outerTrack() == muon.
outerTrack())
return true;
307 if( outertrack->phi() > 0 ) isUp =
true;
310 int RecHitsMuon = outertrack->numberOfValidHits();
311 int RecHitsCosmicMuon = 0;
323 if( (*coshit)->isValid() ) {
324 DetId id((*coshit)->geographicalId());
325 double hity = trackingGeometry->idToDet(
id)->position().y();
326 if( hity > 0 ) nhitsUp++;
327 if( hity < 0 ) nhitsDown++;
329 if( isUp && hity > 0 ) RecHitsCosmicMuon++;
330 if( !isUp && hity < 0 ) RecHitsCosmicMuon++;
345 GlobalPoint muonRefVtx( outertrack->vx(), outertrack->vy(), outertrack->vz() );
346 GlobalPoint cosmicRefVtx( costrack->vx(), costrack->vy(), costrack->vz() );
351 for(
trackingRecHit_iterator trkhit = outertrack->recHitsBegin(); trkhit != outertrack->recHitsEnd(); trkhit++ ) {
352 if( (*trkhit)->isValid() ) {
354 if( (*coshit)->isValid() ) {
355 if( (*trkhit)->geographicalId() == (*coshit)->geographicalId() ) {
356 if( ((*trkhit)->localPosition() - (*coshit)->localPosition()).
mag()< 10
e-5 ) shared++;
366 double fraction = -1;
367 if( RecHitsMuon != 0 ) fraction = shared/(double)RecHitsMuon;
370 overlappingMuon =
true;
376 return overlappingMuon;
385 float maxdxyMult, maxdzMult, maxdxy, maxdz;
407 bool multipleMu =
false;
408 if (
nMuons(iEvent) > 1) multipleMu =
true;
411 RefVtx.SetXYZ(0, 0, 0);
416 for(reco::VertexCollection::const_iterator it=vertices.begin() ; it!=vertices.end() ; ++it){
417 RefVtx = it->position();
423 if ( fabs( (*track).dxy(RefVtx) ) < maxdxyMult || fabs( (*track).dz(RefVtx) ) < maxdzMult) {
427 if (!isLoose && fabs( (*track).dxy(RefVtx) ) >
largedxyMult_) result -= 1;
433 if (fabs( (*track).dxy(RefVtx) ) < maxdxy || fabs( (*track).dz(RefVtx) ) < maxdz) {
437 if (!isLoose && fabs( (*track).dxy(RefVtx) ) >
largedxy_) result -= 1;
445 if (result == 0 && multipleMu) {
457 for ( reco::MuonCollection::const_iterator
muons = muonHandle->begin();
muons != muonHandle->end(); ++
muons ) {
458 if (!
muons->isGlobalMuon())
continue;
463 if (
muons->isGlobalMuon()) tracks =
muons->innerTrack();
464 if (fabs((*tracks).dxy(RefVtx)) >
hIpTrdxy_)
continue;
466 if (vertices.begin() == vertices.end())
continue;
470 if (TMath::Prob(vertices.front().chi2(),(int)(vertices.front().ndof())) >
hIpTrvProb_) result = 1;
492 unsigned int looseIp =
pvMatches(iEvent, muon,
true);
493 unsigned int tightIp =
pvMatches(iEvent, muon,
false);
494 float looseTime =
muonTiming(iEvent, muon,
true);
495 float tightTime =
muonTiming(iEvent, muon,
false);
500 if (checkVertex && cosmicVertex == 0)
return 10.0;
507 double weight_btob = 2.0;
508 double weight_ip = 2.0;
509 double weight_time = 1.0;
510 double weight_overlap = 0.5;
516 if( backToback >= 1 ) {
518 result += weight_btob*2.;
522 if( backToback < 2 ) result -= weight_btob*0.5;
530 result += weight_ip*2.0;
531 if( backToback == 0 ) {
533 if( tightTime == 0 ) {
534 if( looseTime == 0 && !isOverlapping ) result -= weight_ip*1.0;
538 else if( tightIp >= 2 ) {
541 if( backToback >= 1 ) result -= weight_ip*1.0;
545 if( tightTime > 0 ) {
547 if( looseTime > 0 ) {
548 if( backToback >= 1 ) {
549 if( tightIp == 0 ) result += weight_time*tightTime;
550 else if( looseIp == 0 ) result += weight_time*0.25;
554 if( backToback >= 1 && tightIp == 0 ) result += weight_time*0.25;
559 if( backToback == 0 && isOverlapping ) {
561 if( tightIp == 0 && tightTime >= 1 ) {
562 result += weight_overlap*1.0;
587 if (!tracks.
failedToGet() && tracks->size() < 3)
return 0;
594 if (vertices.begin() == vertices.end())
return 0;
595 for(reco::VertexCollection::const_iterator it=vertices.begin() ; it!=vertices.end() ; ++it){
596 if ((TMath::Prob(it->chi2(),(int)it->ndof()) >
minvProb_) && (fabs(it->z()) <=
maxvertZ_) && (fabs(it->position().rho()) <=
maxvertRho_)) result++;
T getParameter(std::string const &) const
reco::TrackRef findOppositeTrack(const edm::Handle< reco::TrackCollection > &collection, const reco::Track &muon, double angleMatch=0.01, double momentumMatch=0.05)
virtual TrackRef innerTrack() const
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
bool isTrackerMuon() const
unsigned int nMuons(const edm::Event &) const
get number of muons in the vent
virtual TrackRef track() const
reference to a Track
bool isGlobalMuon() const
std::vector< Vertex > VertexCollection
collection of Vertex objects
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 ...
bool isStandAloneMuon() const
double offTimeNegLooseMult_
float combinedCosmicID(const edm::Event &, const edm::EventSetup &iSetup, const reco::Muon &, bool CheckMuonID, bool checkVertex) const
combined cosmic-likeness: 0 == not cosmic-like
MuonTime time() const
get timing information
float backToBackCompatibility
cosmic-likeness based on presence of a track in opp side: 0 == no matching opp tracks ...
bool isNonnull() const
Checks for non-null.
double offTimePosTightMult_
MuonServiceProxy * service_
double offTimeNegTightMult_
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 ...
float segmentCompatibility(const reco::Muon &muon, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
edm::InputTag inputVertexCollection_
reco::MuonCosmicCompatibility fillCompatibility(const reco::Muon &muon, edm::Event &, const edm::EventSetup &)
fill cosmic compatibility variables
unsigned int eventActivity(const edm::Event &, const reco::Muon &) const
returns cosmic-likeness based on the event activity information: tracker track multiplicity and verte...
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
virtual TrackRef outerTrack() const
reference to Track reconstructed in the muon detector only
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
int numberOfMatches(ArbitrationType type=SegmentAndTrackArbitration) const
get number of chambers with matched segments
float timeCompatibility
cosmic-likeness based on time: 0 == prompt-like
XYZPointD XYZPoint
point in space with cartesian internal representation
T const * product() const
MuonCosmicCompatibilityFiller(const edm::ParameterSet &)
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
get the tracking geometry
std::vector< edm::InputTag > inputTrackCollections_
float muonTiming(const edm::Event &iEvent, const reco::Muon &muon, bool isLoose) const
check muon time (DT and CSC) information: 0 == prompt-like
~MuonCosmicCompatibilityFiller()
bool checkMuonID(const reco::Muon &) const
tag a muon as cosmic based on the muonID information
edm::InputTag inputCosmicMuonCollection_
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) ...
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 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 ...
virtual TrackRef standAloneMuon() const
reference to a stand-alone muon Track
float vertexCompatibility
cosmic-likeness based on the event activity information: tracker track multiplicity and vertex qualit...