44 virtual void endJob();
56 double ptminMinus_, ptmaxMinus_, etaminMinus_, etamaxMinus_, isomax_;
58 double etamax_,
ptmin_, massMin_, massMax_, isoMax_;
163 using namespace reco;
170 zMuMu_(pset.getParameter<
InputTag>(
"zMuMu")),
171 zMuMuMatchMap_(pset.getParameter<
InputTag>(
"zMuMuMatchMap")),
172 zMuTrack_(pset.getParameter<
InputTag>(
"zMuTrack")),
173 zMuTrackMatchMap_(pset.getParameter<
InputTag>(
"zMuTrackMatchMap")),
174 zMuStandAlone_(pset.getParameter<
InputTag>(
"zMuStandAlone")),
175 zMuStandAloneMatchMap_(pset.getParameter<
InputTag>(
"zMuStandAloneMatchMap")),
176 muons_(pset.getParameter<
InputTag>(
"muons")),
177 muonMatchMap_(pset.getParameter<
InputTag>(
"muonMatchMap")),
178 muonIso_(pset.getParameter<
InputTag>(
"muonIso")),
180 trackIso_(pset.getParameter<
InputTag>(
"trackIso")),
181 genParticles_(pset.getParameter<
InputTag>(
"genParticles" ) ),
183 noCut_(pset.getParameter<bool>(
"noCut")),
185 zMassMin_(pset.getUntrackedParameter<double>(
"zMassMin")),
186 zMassMax_(pset.getUntrackedParameter<double>(
"zMassMax")),
187 ptminPlus_(pset.getUntrackedParameter<double>(
"ptminPlus")),
188 ptmaxPlus_(pset.getUntrackedParameter<double>(
"ptmaxPlus")),
189 etaminPlus_(pset.getUntrackedParameter<double>(
"etaminPlus")),
190 etamaxPlus_(pset.getUntrackedParameter<double>(
"etamaxPlus")),
191 ptminMinus_(pset.getUntrackedParameter<double>(
"ptminMinus")),
192 ptmaxMinus_(pset.getUntrackedParameter<double>(
"ptmaxMinus")),
193 etaminMinus_(pset.getUntrackedParameter<double>(
"etaminMinus")),
194 etamaxMinus_(pset.getUntrackedParameter<double>(
"etamaxMinus")),
195 isomax_(pset.getUntrackedParameter<double>(
"isomax")) {
238 h_DPtGlobalGenvsPtGen = fs->
make<TH2D>(
"h_DPtGlobalGenovePtvsPtGen",
"Pt global - Pt Gen over Pt vs Pt gen",50,0.,100.,100,-.5,.5);
280 h_DRSta_ZMuMuTagged = fs->
make<TH1D>(
"DRTrackSta_ZMuMuTagged_staSelected",
"DR track-sta sta selected (global-global)",100, 0., 5.);
358 event.getByLabel(
zMuMu_, zMuMu);
361 event.getByLabel(
muons_, muons);
363 event.getByLabel(
tracks_, tracks);
378 int n_globalMuon_perEvent=0;
379 int n_staOnlyMuon_perEvent=0;
380 int n_trackerOnlyMuon_perEvent=0;
381 int n_trackerStaOnlyMuon_perEvent=0;
382 int n_globalMuon_perEvent_MCmatch=0;
383 int n_staOnlyMuon_perEvent_MCmatch=0;
384 int n_trackerOnlyMuon_perEvent_MCmatch=0;
385 int n_trackerStaOnlyMuon_perEvent_MCmatch=0;
387 for(
unsigned int j = 0;
j < muons->size() ; ++
j) {
396 if (muCandRef->
isGlobalMuon()==1) n_globalMuon_perEvent++;
401 if (muonMatch.isNonnull()) {
402 if (muCandRef->
isGlobalMuon()==1) n_globalMuon_perEvent_MCmatch++;
406 double productCharge = muCandRef->
charge() * muonMatch->charge();
444 if (zMuMu->size() > 0 ) {
446 event.getByLabel(
muonIso_, muonIso);
448 float muGenplus_pt = 0, muGenminus_pt = 0, muGenplus_eta = 100, muGenminus_eta = 100;
449 for(
unsigned int i = 0;
i < zMuMu->size(); ++
i) {
453 bool isMCMatched =
false;
456 if(zMuMuMatch->pdgId() == 23 && zMuMuMatch->status()==3 && zMuMuMatch->numberOfDaughters() == 3) {
458 const Candidate * dauGen0 = zMuMuMatch->daughter(0);
459 const Candidate * dauGen1 = zMuMuMatch->daughter(1);
460 const Candidate * dauGen2 = zMuMuMatch->daughter(2);
469 pZ = muplusp4 + muminusp4;
490 double massGlobalSta = (pg1+ps2).
mass();
491 double massStaGlobal = (ps1+pg2).
mass();
493 double massGlobalTracker = (pg1+ptrk2).
mass();
494 double massTrackerGlobal = (ptrk1+pg2).
mass();
495 double etaGlobal1 = a1->eta();
496 double etaGlobal2 = a2->eta();
497 double etaSta1 = as1->eta();
498 double etaSta2 = as2->eta();
499 double etaTracker1 = at1->eta();
500 double etaTracker2 = at2->eta();
503 double phiSta1 = as1->phi();
504 double phiSta2 = as2->phi();
505 double phiTracker1 = at1->phi();
506 double phiTracker2 = at2->phi();
507 double ptGlobal1 = a1->pt();
508 double ptGlobal2 = a2->pt();
509 double ptSta1 = as1->pt();
510 double ptSta2 = as2->pt();
511 double ptTracker1 = at1->pt();
512 double ptTracker2 = at2->pt();
513 double chargeGlobal1 = a1->charge();
514 double chargeGlobal2 = a2->charge();
515 double chargeSta1 = as1->charge();
516 double chargeSta2 = as2->charge();
517 double chargeTracker1 = at1->charge();
518 double chargeTracker2 = at2->charge();
519 double DR1 =
deltaR(etaSta1, phiSta1, etaTracker1, phiTracker1);
520 double DR2 =
deltaR(etaSta2, phiSta2, etaTracker2, phiTracker2);
522 if (chargeGlobal1 == chargeGlobal2) {
537 bool massCut =
false;
545 if (ptGlobal1>
ptmin_ && ptTracker2>
ptmin_) ptCut =
true;
546 if (massGlobalTracker>
massMin_ && massGlobalTracker<
massMax_) massCut =
true;
554 if (etaCut && ptCut && massCut) {
556 if (chargeSta1 == chargeTracker1 && chargeTracker1 != chargeTracker2) {
565 double etaGen, ptGen;
566 if (chargeGlobal1==1) {
567 etaGen = muGenplus_eta;
568 ptGen = muGenplus_pt;
570 etaGen = muGenminus_eta;
571 ptGen = muGenminus_pt;
588 if (chargeSta2 == chargeTracker2) {
596 if (chargeSta2 != chargeTracker2) {
613 if (ptGlobal2>
ptmin_ && ptTracker1>
ptmin_) ptCut =
true;
614 if (massTrackerGlobal>
massMin_ && massTrackerGlobal<
massMax_) massCut =
true;
622 if (etaCut && ptCut && massCut) {
624 if (chargeSta2 == chargeTracker2 && chargeTracker1 != chargeTracker2) {
634 double etaGen, ptGen;
635 if (chargeGlobal2==1) {
636 etaGen = muGenplus_eta;
637 ptGen = muGenplus_pt;
639 etaGen = muGenminus_eta;
640 ptGen = muGenminus_pt;
657 if (chargeSta1 == chargeTracker1) {
665 if (chargeSta1 != chargeTracker1) {
696 if (etaCut && ptCut && massCut) {
698 if (chargeSta1 == chargeTracker1 && chargeTracker1 != chargeSta2) {
706 if (chargeSta2 == chargeTracker2) {
710 if (chargeSta2 != chargeTracker2) {
737 if (etaCut && ptCut && massCut) {
739 if (chargeSta2 == chargeTracker2 && chargeTracker2 != chargeSta1) {
747 if (chargeSta1 == chargeTracker1) {
751 if (chargeSta1 != chargeTracker1) {
770 int taggedZ_index = -1;
771 int taggedMuon_index = -1;
772 int n_ZMuTrackTagged_inEvent = 0;
773 if (zMuTrack->size() > 0 && zMuMu->size()==0) {
775 for(
unsigned int i = 0;
i < zMuTrack->size(); ++
i) {
776 const Candidate & zMuTrackCand = (*zMuTrack)[
i];
778 GenParticleRef zMuTrackMatch = (*zMuTrackMatchMap)[zMuTrackCandRef];
784 double m = zMuTrackCand.
mass();
791 double ZtrackerDaughterCharge = ztrackerDaughter->
charge();
792 double ZtrackerDaughterPt = ztrackerDaughter->
pt();
793 double ZtrackerDaughterEta = ztrackerDaughter->
eta();
794 double ZtrackerDaughterPhi = ztrackerDaughter->
phi();
795 double ZglobalDaughterPt = zglobalDaughter->
pt();
796 double ZglobalDaughterEta = zglobalDaughter->
eta();
797 double ZglobalDaughter_StaComponentCharge = zglobalDaughter_StaComponentRef->charge();
798 double ZglobalDaughter_TrackComponentCharge = zglobalDaughter_TrackComponentRef->charge();
808 bool massCut =
false;
810 if (ZglobalDaughterPt>
ptmin_ && ZtrackerDaughterPt>
ptmin_) ptCut =
true;
818 if (etaCut && ptCut && massCut && ZglobalDaughter_StaComponentCharge == ZglobalDaughter_TrackComponentCharge &&
819 ZglobalDaughter_TrackComponentCharge != ZtrackerDaughterCharge) {
820 n_ZMuTrackTagged_inEvent++;
825 for(
unsigned int j = 0;
j < muons->size() ; ++
j) {
832 double muEta = muCandRef->
eta();
833 double muPhi = muCandRef->
phi();
835 double DRmuSta_trackOfZ =
deltaR(muEta, muPhi, ZtrackerDaughterEta, ZtrackerDaughterPhi);
836 if (DRmuSta_trackOfZ == 0) {
838 taggedMuon_index =
j;
848 if (n_ZMuTrackTagged_inEvent>0) {
850 if (taggedZ_index==-1) {
854 const Candidate & zMuTrackCand = (*zMuTrack)[taggedZ_index];
856 double m = zMuTrackCand.
mass();
863 double ZtrackerDaughterCharge = ztrackerDaughter->
charge();
864 double ZtrackerDaughterPt = ztrackerDaughter->
pt();
865 double ZtrackerDaughterEta = ztrackerDaughter->
eta();
866 double ZtrackerDaughterPhi = ztrackerDaughter->
phi();
869 const Candidate & muCand = (*muons)[taggedMuon_index];
873 double muEta = muStaComponentRef->eta();
874 double muPhi = muStaComponentRef->phi();
875 double muCharge = muStaComponentRef->charge();
877 double DRmuSta_trackOfZ =
deltaR(muEta, muPhi, ZtrackerDaughterEta, ZtrackerDaughterPhi);
887 if (muCharge != ZtrackerDaughterCharge) {
906 bool isZMuStaMatched=
false;
909 taggedMuon_index = -1;
910 int n_ZMuStaTagged_inEvent = 0;
911 if (zMuStandAlone->size() > 0) {
913 for(
unsigned int i = 0;
i < zMuStandAlone->size(); ++
i) {
914 const Candidate & zMuStaCand = (*zMuStandAlone)[
i];
917 GenParticleRef zMuStaMatch = (*zMuStandAloneMatchMap)[zMuStaCandRef];
920 isZMuStaMatched =
true;
923 double m = zMuStaCand.
mass();
930 zglobalDaughter = zstandaloneDaughter;
931 zstandaloneDaughter = buffer;
943 double ZglobalDaughterPt = zglobalDaughter->
pt();
944 double ZglobalDaughterEta = zglobalDaughter->
eta();
946 double ZstaDaughter_StaComponentCharge = zstaDaughter_StaComponentRef->charge();
947 double ZstaDaughter_StaComponentPt = zstaDaughter_StaComponentRef->pt();
948 double ZstaDaughter_StaComponentEta = zstaDaughter_StaComponentRef->eta();
949 double ZstaDaughter_StaComponentPhi = zstaDaughter_StaComponentRef->phi();
950 double ZstaDaughter_TrackComponentCharge = zstaDaughter_TrackComponentRef->charge();
952 double ZglobalDaughter_StaComponentCharge = zglobalDaughter_StaComponentRef->charge();
953 double ZglobalDaughter_TrackComponentCharge = zglobalDaughter_TrackComponentRef->charge();
959 bool massCut =
false;
960 if (
abs(ZglobalDaughterEta)<
etamax_ &&
abs(ZstaDaughter_StaComponentEta)<
etamax_) etaCut =
true;
961 if (ZglobalDaughterPt>
ptmin_ && ZstaDaughter_StaComponentPt>
ptmin_) ptCut =
true;
969 if (etaCut && ptCut && massCut && ZglobalDaughter_StaComponentCharge == ZglobalDaughter_TrackComponentCharge &&
970 ZglobalDaughter_StaComponentCharge != ZstaDaughter_StaComponentCharge) {
971 n_ZMuStaTagged_inEvent++;
983 if (ZstaDaughter_StaComponentCharge != ZstaDaughter_TrackComponentCharge) {
997 if (n_ZMuStaTagged_inEvent==0) {
1008 int partId0 = dauGen0->
pdgId();
1009 int partId1 = dauGen1->
pdgId();
1010 int partId2 = dauGen2->
pdgId();
1011 bool muplusFound=
false;
1012 bool muminusFound=
false;
1014 if (partId0==13 || partId1==13 || partId2==13) muminusFound=
true;
1015 if (partId0==-13 || partId1==-13 || partId2==-13) muplusFound=
true;
1016 if (partId0==23 || partId1==23 || partId2==23) ZFound=
true;
1017 return muplusFound*muminusFound*ZFound;
1022 int partId0 = dauGen0->
pdgId();
1023 int partId1 = dauGen1->
pdgId();
1024 int partId2 = dauGen2->
pdgId();
1026 if (partId0 == ipart) {
1029 if(dauMuGen->
pdgId() == ipart && dauMuGen->
status() ==1) {
1030 ptpart = dauMuGen->
pt();
1034 if (partId1 == ipart) {
1037 if(dauMuGen->
pdgId() == ipart && dauMuGen->
status() ==1) {
1038 ptpart = dauMuGen->
pt();
1042 if (partId2 == ipart) {
1046 ptpart = dauMuGen->
pt();
1055 int partId0 = dauGen0->
pdgId();
1056 int partId1 = dauGen1->
pdgId();
1057 int partId2 = dauGen2->
pdgId();
1059 if (partId0 == ipart) {
1062 if(dauMuGen->
pdgId() == ipart && dauMuGen->
status() ==1) {
1063 etapart = dauMuGen->
eta();
1067 if (partId1 == ipart) {
1070 if(dauMuGen->
pdgId() == ipart && dauMuGen->
status() ==1) {
1071 etapart = dauMuGen->
eta();
1075 if (partId2 == ipart) {
1079 etapart = dauMuGen->
eta();
1088 int partId0 = dauGen0->
pdgId();
1089 int partId1 = dauGen1->
pdgId();
1090 int partId2 = dauGen2->
pdgId();
1092 if (partId0 == ipart) {
1095 if(dauMuGen->
pdgId() == ipart && dauMuGen->
status() ==1) {
1096 phipart = dauMuGen->
phi();
1100 if (partId1 == ipart) {
1103 if(dauMuGen->
pdgId() == ipart && dauMuGen->
status() ==1) {
1104 phipart = dauMuGen->
phi();
1108 if (partId2 == ipart) {
1112 phipart = dauMuGen->
phi();
1121 int partId0 = dauGen0->
pdgId();
1122 int partId1 = dauGen1->
pdgId();
1123 int partId2 = dauGen2->
pdgId();
1125 if (partId0 == ipart) {
1128 if(dauMuGen->
pdgId() == ipart && dauMuGen->
status() ==1) {
1129 p4part = dauMuGen->
p4();
1133 if (partId1 == ipart) {
1136 if(dauMuGen->
pdgId() == ipart && dauMuGen->
status() ==1) {
1137 p4part = dauMuGen->
p4();
1141 if (partId2 == ipart) {
1145 p4part = dauMuGen->
p4();
1156 cout <<
"------------------------------------ Counters --------------------------------" << endl;
1162 cout <<
"------------------------------------ Counters for standAlone charge mis-id studies --------------------------------" << endl;
1171 cout <<
"------------------------------------ Counters for Track charge mis-id studies --------------------------------" << endl;
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
virtual double pt() const =0
transverse momentum
#define DEFINE_FWK_MODULE(type)
virtual double mass() const =0
mass
virtual int status() const =0
status word
stand alone muon component tag
virtual TrackRef track() const
reference to a Track
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
bool isNonnull() const
Checks for non-null.
virtual size_type numberOfDaughters() const =0
number of daughters
edm::ValueMap< float > IsolationCollection
virtual bool isStandAloneMuon() const =0
virtual int charge() const =0
electric charge
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
double deltaR(double eta1, double eta2, double phi1, double phi2)
virtual int pdgId() const =0
PDG identifier.
conbined muon component tag
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
T get() const
get a component
T * make() const
make new ROOT object
const reco::PFCandidateRefVector & tracks_
virtual bool isTrackerMuon() const =0
math::XYZTLorentzVector LorentzVector
Lorentz vector.
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
tuple zMuMu
zMuMu vector of PSet is common to all categories except zMuTrk category
virtual double phi() const =0
momentum azimuthal angle
virtual double eta() const =0
momentum pseudorapidity
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
virtual bool isGlobalMuon() const =0
virtual const CandidateBaseRef & masterClone() const =0
virtual TrackRef standAloneMuon() const
reference to a stand-alone muon Track