56 void endJob()
override;
68 double isocut_, etacut_, ptcut_,
ptSTAcut_, minZmass_, maxZmass_;
69 TH1D *h_zMuMu_numberOfCand, *h_zMuMu_numberOfCand_passed, *h_zMuMu_numberOfCand_ptpassed,
70 *h_zMuMu_numberOfCand_etapassed, *h_zMuMu_numberOfCand_masspassed, *h_zMuMu_numberOfCand_isopassed,
71 *h_zMuMu_numberOfCand_ptetapassed, *h_zMuMu_numberOfCand_ptetamasspassed, *h_zMuMu_mass_, *h_zMuSingleTrack_mass_,
72 *h_zMuSingleStandAlone_mass_, *h_zMuSingleStandAloneOverlap_mass_, *h_zMuMuMatched_mass_,
75 TH1D *h_zMuSta_numberOfCand, *h_zMuSta_numberOfCand_passed, *h_zMuSta_MCmatched_numberOfCand_passed,
76 *h_zMuSta_numberOfCand_notcontained, *h_zMuTrack_numberOfCand, *h_zMuTrack_numberOfCand_notcontained,
98 isocut_(
pset.getParameter<double>(
"isocut")),
99 etacut_(
pset.getParameter<double>(
"etacut")),
100 ptcut_(
pset.getParameter<double>(
"ptcut")),
101 ptSTAcut_(
pset.getParameter<double>(
"ptSTAcut")),
102 minZmass_(
pset.getParameter<double>(
"minZmass")),
103 maxZmass_(
pset.getParameter<double>(
"maxZmass")) {
107 fs->
make<TH1D>(
"ZMuMunumberOfCandpassed",
"number of ZMuMu cand selected", 10, -.5, 9.5);
109 fs->
make<TH1D>(
"ZMuMunumberOfCandptpassed",
"number of ZMuMu cand after pt cut selected", 10, -.5, 9.5);
111 fs->
make<TH1D>(
"ZMuMunumberOfCandetapassed",
"number of ZMuMu cand after eta cut selected", 10, -.5, 9.5);
113 fs->
make<TH1D>(
"ZMuMunumberOfCandmasspassed",
"number of ZMuMu cand after mass cut selected", 10, -.5, 9.5);
115 fs->
make<TH1D>(
"ZMuMunumberOfCandisopassed",
"number of ZMuMu cand after iso cut selected", 10, -.5, 9.5);
117 fs->
make<TH1D>(
"ZMuMunumberOfCandptetapassed",
"number of ZMuMu cand after pt & eta cut selected", 10, -.5, 9.5);
119 "ZMuMunumberOfCandptetamaspassed",
"number of ZMuMu cand after pt & eta & mass cut selected", 10, -.5, 9.5);
124 fs->
make<TH1D>(
"ZMuSingleStandAlonemass",
"ZMuSingleStandAlone mass(GeV)", 50, 0., 200.);
126 fs->
make<TH1D>(
"ZMuSingleStandAloneOverlapmass",
"ZMuSingleStandAloneOverlap mass(GeV)", 50, 0., 200.);
130 fs->
make<TH1D>(
"ZMuSingleTrackmassMatched",
"ZMuSingleTrackMatched mass(GeV)", 100, 0., 200.);
132 fs->
make<TH1D>(
"ZMuSingleStandAlonemassMatched",
"ZMuSingleStandAloneMatched mass(GeV)", 50, 0., 200.);
134 "ZMuSingleStandAloneOverlapmassMatched",
"ZMuSingleStandAloneMatched Overlap mass(GeV)", 50, 0., 200.);
137 fs->
make<TH1D>(
"ZMuStanumberOfCand",
"number of ZMuSta cand (if ZMuMu not selected)", 10, -.5, 9.5);
139 fs->
make<TH2D>(
"ZOneMuStaMass",
140 "inv. mass of ZMuSta1 vs ZMuSta2 when one ZMuSta has been found (if ZMuMu not selected)",
148 "ZMuStanumberOfCandnotcontained",
"number of independent ZMuSta cand (if ZMuMu not selected)", 10, -.5, 9.5);
150 "ZMuStanumberOfCandpassed",
"number of ZMuSta cand selected (if ZMuMu not selected)", 10, -.5, 9.5);
152 fs->
make<TH1D>(
"ZMuStaMCmatchedNumberOfCandpassed",
153 "number of ZMuSta MC matched cand selected (if ZMuMu not selected)",
158 fs->
make<TH1D>(
"ZMuTranumberOfCand",
"number of ZMuTrack cand (if ZMuMu and ZMuSTa not selected)", 10, -.5, 9.5);
160 fs->
make<TH1D>(
"ZMuTranumberOfCandnotcontaind",
161 "number of indeendent ZMuTrack cand (if ZMuMu and ZMuSTa not selected)",
166 "ZMuTranumberOfCandpassed",
"number of ZMuTrack cand selected (if ZMuMu and ZMuSta not selected)", 10, -.5, 9.5);
168 fs->
make<TH1D>(
"ZMuTraMCmacthedNumberOfCandpassed",
169 "number of ZMuTrack MC matched cand selected (if ZMuMu and ZMuSta not selected)",
187 fs->
mkdir(
"etaIntervals");
189 fs->
mkdir(
"phiIntervals");
191 fs->
mkdir(
"ptIntervals");
197 double range1 = range0 +
binEta;
199 sprintf(
a,
"zmumu_etaRange%d",
i);
200 sprintf(
b,
"zmumu mass eta Range %f to %f", range0, range1);
202 char asta[30], bsta[50];
203 sprintf(asta,
"zmusta_etaRange%d",
i);
204 sprintf(bsta,
"zmusta mass eta Range %f to %f", range0, range1);
205 hmusta_eta.push_back(etaDirectory.
make<TH1D>(asta, bsta, 50, 0., 200.));
206 char atk[30], btk[50];
207 sprintf(atk,
"zmutrack_etaRange%d",
i);
208 sprintf(btk,
"zmutrack mass eta Range %f to %f", range0, range1);
216 double range1 = range0 +
binPhi;
218 sprintf(
a,
"zmumu_phiRange%d",
i);
219 sprintf(
b,
"zmumu mass phi Range %f to %f", range0, range1);
221 char asta[30], bsta[50];
222 sprintf(asta,
"zmusta_phiRange%d",
i);
223 sprintf(bsta,
"zmusta mass phi Range %f to %f", range0, range1);
224 hmusta_phi.push_back(phiDirectory.
make<TH1D>(asta, bsta, 50, 0., 200.));
225 char atk[30], btk[50];
226 sprintf(atk,
"zmutrack_phiRange%d",
i);
227 sprintf(btk,
"zmutrack mass phi Range %f to %f", range0, range1);
235 double range1 = range0 +
binPt;
237 sprintf(
a,
"zmumu_ptRange%d",
i);
238 sprintf(
b,
"zmumu mass pt Range %f to %f", range0, range1);
240 char asta[30], bsta[50];
241 sprintf(asta,
"zmusta_ptRange%d",
i);
242 sprintf(bsta,
"zmusta mass pt Range %f to %f", range0, range1);
243 hmusta_pt.push_back(ptDirectory.
make<TH1D>(asta, bsta, 50, 0., 200.));
244 char atk[30], btk[50];
245 sprintf(atk,
"zmutrack_ptRange%d",
i);
246 sprintf(btk,
"zmutrack mass pt Range %f to %f", range0, range1);
247 hmutrack_pt.push_back(ptDirectory.
make<TH1D>(atk, btk, 100, 0., 200.));
259 unsigned int nZMuMu =
zMuMu->size();
260 unsigned int nZTrackMu = zMuTrack->
size();
261 unsigned int nZStandAloneMu = zMuStandAlone->
size();
264 cout <<
"++++++++++++++++++++++++++" << endl;
265 cout <<
"nZMuMu = " << nZMuMu << endl;
266 cout <<
"nZTrackMu = " << nZTrackMu << endl;
267 cout <<
"nZStandAloneMu = " << nZStandAloneMu << endl;
268 cout <<
"++++++++++++++++++++++++++" << endl;
272 int ZMuMu_passed = 0;
273 int ZMuMu_ptcut_counter = 0;
274 int ZMuMu_etacut_counter = 0;
275 int ZMuMu_masscut_counter = 0;
276 int ZMuMu_isocut_counter = 0;
277 int ZMuMu_ptetacut_counter = 0;
278 int ZMuMu_ptetamasscut_counter = 0;
279 int ZMuMu_allcut_counter = 0;
283 int ZMuTrack_passed = 0;
284 int ZMuTrack_notcontained = 0;
285 int ZMuTrack_MCmatched_passed = 0;
288 int ZMuStandalone_notcontained = 0;
289 int ZMuStandalone_passed = 0;
290 int ZMuStandalone_MCmatched_passed = 0;
303 if (nZStandAloneMu > 0) {
309 ProductID muIsoId = muIso->keyProduct().id();
312 ProductID trackIsoId = trackIso->keyProduct().id();
316 ProductID standAloneIsoId = standAloneIso->keyProduct().id();
320 for (
unsigned int i = 0;
i < nZMuMu;
i++) {
321 bool ptcutAccept =
false;
322 bool etacutAccept =
false;
323 bool masscutAccept =
false;
324 bool isocutAccept =
false;
330 const double iso1 = muIso->value(
lep1.key());
331 const double iso2 = muIso->value(
lep2.key());
333 double m = zmmCand.
mass();
341 masscutAccept =
true;
346 ZMuMu_ptcut_counter++;
348 ZMuMu_etacut_counter++;
350 ZMuMu_masscut_counter++;
352 ZMuMu_isocut_counter++;
356 if (ptcutAccept && etacutAccept) {
357 ZMuMu_ptetacut_counter++;
359 ZMuMu_ptetamasscut_counter++;
366 if (ptcutAccept && etacutAccept && masscutAccept && isocutAccept) {
367 ZMuMu_allcut_counter++;
372 bool statusBinEta =
false;
373 bool statusBinPhi =
false;
374 bool statusBinPt =
false;
376 double range1 = range0 +
binEta;
378 double range1phi = range0phi +
binPhi;
380 double range1pt = range0pt +
binPt;
382 if (
lep1->eta() >= range0 &&
lep1->eta() < range1) {
386 if (
lep2->eta() >= range0 &&
lep2->eta() < range1 && !statusBinEta) {
390 if (
lep1->phi() >= range0phi &&
lep1->phi() < range1phi) {
394 if (
lep2->phi() >= range0phi &&
lep2->phi() < range1phi && !statusBinPhi) {
398 if (
lep1->pt() >= range0pt &&
lep1->pt() < range1pt) {
402 if (
lep2->pt() >= range0pt &&
lep2->pt() < range1pt && !statusBinPt) {
408 if (m0 != zMuMuMap->
end()) {
423 ZMuMu_ptetamasscut_counter);
428 if (ZMuMu_passed == 0 && nZStandAloneMu > 0) {
430 for (
unsigned int j = 0;
j < nZStandAloneMu;
j++) {
431 const Candidate& zsmCand = (*zMuStandAlone)[
j];
433 for (
unsigned int i = 0;
i < nZMuMu;
i++) {
439 ZMuStandalone_notcontained++;
450 iso1 = muIso->value(
lep1.key());
451 else if (
id1 == standAloneIsoId)
452 iso1 = standAloneIso->value(
lep1.key());
455 iso2 = muIso->value(
lep2.key());
456 else if (
id2 == standAloneIsoId)
457 iso2 = standAloneIso->value(
lep2.key());
459 double ms = zsmCand.
mass();
463 ZMuStandalone_passed++;
467 double range1 = range0 +
binEta;
469 double range1phi = range0phi +
binPhi;
471 double range1pt = range0pt +
binPt;
475 if (
lep1->eta() >= range0 &&
lep1->eta() < range1)
477 if (
lep1->phi() >= range0phi &&
lep1->phi() < range1phi)
479 if (
lep1->pt() >= range0pt &&
lep1->pt() < range1pt)
483 if (
lep2->eta() >= range0 &&
lep2->eta() < range1)
485 if (
lep2->phi() >= range0phi &&
lep2->phi() < range1phi)
487 if (
lep2->pt() >= range0pt &&
lep2->pt() < range1pt)
492 if (m0 != zMuStandAloneMap->
end()) {
493 ZMuStandalone_MCmatched_passed++;
503 ZMuStandalone_passed);
505 ZMuStandalone_MCmatched_passed);
509 if (ZMuMu_passed == 0 && ZMuStandalone_passed == 0 && nZTrackMu > 0) {
510 for (
unsigned int j = 0;
j < nZTrackMu;
j++) {
513 for (
unsigned int i = 0;
i < nZMuMu;
i++) {
519 ZMuTrack_notcontained++;
530 iso1 = muIso->value(
lep1.key());
531 else if (
id1 == trackIsoId)
532 iso1 = trackIso->value(
lep1.key());
535 iso2 = muIso->value(
lep2.key());
536 else if (
id2 == trackIsoId)
537 iso2 = trackIso->value(
lep2.key());
539 double mt = ztmCand.
mass();
548 double range1 = range0 +
binEta;
550 double range1phi = range0phi +
binPhi;
552 double range1pt = range0pt +
binPt;
556 if (
lep1->eta() >= range0 &&
lep1->eta() < range1)
558 if (
lep1->phi() >= range0phi &&
lep1->phi() < range1phi)
560 if (
lep1->pt() >= range0pt &&
lep1->pt() < range1pt)
564 if (
lep2->eta() >= range0 &&
lep2->eta() < range1)
566 if (
lep2->phi() >= range0phi &&
lep2->phi() < range1phi)
568 if (
lep2->pt() >= range0pt &&
lep2->pt() < range1pt)
573 if (m0 != zMuTrackMap->
end()) {
574 ZMuTrack_MCmatched_passed++;
583 ZMuTrack_notcontained);
611 for (
unsigned int i = 0;
i < nd1; ++
i) {
639 for (
unsigned int i = 0;
i < nd2; ++
i) {
669 cout <<
"ZMuMuAnalyzer::isContained WARNING n.of daughters different " << nd1 <<
" " << nd2 << endl;
671 for (
unsigned int i = 0;
i < nd1;
i++) {
673 for (
unsigned int j = 0;
j < nd2;
675 if (((trackerTrack2[
i].
id() == trackerTrack1[
j].
id()) && (trackerTrack2[
i].
key() == trackerTrack1[
j].
key())) ||
676 ((trackerTrack2[
i].
id() == stAloneTrack1[
j].
id()) && (trackerTrack2[
i].
key() == stAloneTrack1[
j].
key()))) {
696 double Nzmmc_moreZ = Nzmmc - Nzmmc_0Z - Nzmmc_1Z;
699 double Nzmmc_passed_moreZ = Nzmmc - Nzmmc_passed_0Z - Nzmmc_passed_1Z;
712 double Nzmmc_ptpassed_moreZ = Nzmmc - Nzmmc_ptpassed_0Z - Nzmmc_ptpassed_1Z;
713 double Nzmmc_etapassed_moreZ = Nzmmc - Nzmmc_etapassed_0Z - Nzmmc_etapassed_1Z;
714 double Nzmmc_masspassed_moreZ = Nzmmc - Nzmmc_masspassed_0Z - Nzmmc_masspassed_1Z;
715 double Nzmmc_isopassed_moreZ = Nzmmc - Nzmmc_isopassed_0Z - Nzmmc_isopassed_1Z;
716 double Nzmmc_ptetapassed_moreZ = Nzmmc - Nzmmc_ptetapassed_0Z - Nzmmc_ptetapassed_1Z;
717 double Nzmmc_ptetamasspassed_moreZ = Nzmmc - Nzmmc_ptetamasspassed_0Z - Nzmmc_ptetamasspassed_1Z;
721 double Nzmsc_moreZ = Nzmsc - Nzmsc_0Z - Nzmsc_1Z;
724 double Nzmsc_notcontained_moreZ = Nzmsc - Nzmsc_notcontained_0Z - Nzmsc_notcontained_1Z;
727 double Nzmsc_passed_moreZ = Nzmsc - Nzmsc_passed_0Z - Nzmsc_passed_1Z;
730 double Nzmsc_MCmatched_passed_moreZ = Nzmsc - Nzmsc_MCmatched_passed_0Z - Nzmsc_MCmatched_passed_1Z;
734 double Nzmtc_moreZ = Nzmtc - Nzmtc_0Z - Nzmtc_1Z;
737 double Nzmtc_notcontained_moreZ = Nzmtc - Nzmtc_notcontained_0Z - Nzmtc_notcontained_1Z;
740 double Nzmtc_passed_moreZ = Nzmtc - Nzmtc_passed_0Z - Nzmtc_passed_1Z;
743 double Nzmtc_MCmatched_passed_moreZ = Nzmtc - Nzmtc_MCmatched_passed_0Z - Nzmtc_MCmatched_passed_1Z;
745 cout <<
"--------------- Statistics ----------------------------------------------------------" << endl;
746 cout <<
"n of ZMuMu entries ...................................................... " << Nzmmc << endl;
747 cout <<
"n of ZMuMu events with 0 cand ............................................. " << Nzmmc_0Z << endl;
748 cout <<
"n of ZMuMu events with 1 cand ............................................. " << Nzmmc_1Z << endl;
749 cout <<
"n of ZMuMu events with 2 or more cand ..................................... " << Nzmmc_moreZ << endl << endl;
751 cout <<
"n of ZMuMu events not selected by cuts .................................... " << Nzmmc_passed_0Z << endl;
752 cout <<
"n of ZMuMu events with 1 cand selected by cuts ............................ " << Nzmmc_passed_1Z << endl;
753 cout <<
"n of ZMuMu events with 2 or more cand elected by cuts ..................... " << Nzmmc_passed_moreZ << endl
756 cout <<
"n of ZMuMu events not selected by pt cut .................................. " << Nzmmc_ptpassed_0Z << endl;
757 cout <<
"n of ZMuMu events with 1 cand selected by pt cut .......................... " << Nzmmc_ptpassed_1Z << endl;
758 cout <<
"n of ZMuMu events with 2 or more cand elected by pt cut ................... " << Nzmmc_ptpassed_moreZ << endl
761 cout <<
"n of ZMuMu events not selected by eta cut ................................. " << Nzmmc_etapassed_0Z << endl;
762 cout <<
"n of ZMuMu events with 1 cand selected by eta cut ......................... " << Nzmmc_etapassed_1Z << endl;
763 cout <<
"n of ZMuMu events with 2 or more cand elected by eta cut .................. " << Nzmmc_etapassed_moreZ
767 cout <<
"n of ZMuMu events not selected by mass cut ................................ " << Nzmmc_masspassed_0Z << endl;
768 cout <<
"n of ZMuMu events with 1 cand selected by mass cut ........................ " << Nzmmc_masspassed_1Z << endl;
769 cout <<
"n of ZMuMu events with 2 or more cand elected by mass cut ................. " << Nzmmc_masspassed_moreZ
773 cout <<
"n of ZMuMu events not selected by iso cut ................................. " << Nzmmc_isopassed_0Z << endl;
774 cout <<
"n of ZMuMu events with 1 cand selected iso cut ............................ " << Nzmmc_isopassed_1Z << endl;
775 cout <<
"n of ZMuMu events with 2 or more cand elected iso cut ..................... " << Nzmmc_isopassed_moreZ
779 cout <<
"n of ZMuMu events not selected by pt and eta cut .......................... " << Nzmmc_ptetapassed_0Z
781 cout <<
"n of ZMuMu events with 1 cand selected by pt and eta cut .................. " << Nzmmc_ptetapassed_1Z
783 cout <<
"n of ZMuMu events with 2 or more cand elected by pt and eta cut ........... " << Nzmmc_ptetapassed_moreZ
787 cout <<
"n of ZMuMu events not selected by pt and eta and mass cut ................. " << Nzmmc_ptetamasspassed_0Z
789 cout <<
"n of ZMuMu events with 1 cand selected by pt and eta and mass cut ......... " << Nzmmc_ptetamasspassed_1Z
791 cout <<
"n of ZMuMu events with 2 or more cand elected by pt and eta and mass cut .. " << Nzmmc_ptetamasspassed_moreZ
795 cout <<
"................When No ZMuMu are selected.................................." << endl;
796 cout <<
"n of ZMuSta entries ....................................................... " << Nzmsc << endl;
797 cout <<
"n of ZMuSta events with 0 cand ............................................ " << Nzmsc_0Z << endl;
798 cout <<
"n of ZMuSta events with 1 cand ............................................ " << Nzmsc_1Z << endl;
799 cout <<
"n of ZMuSta events with 2 or more cand .................................... " << Nzmsc_moreZ << endl << endl;
801 cout <<
"n of ZMuSta not contained events with 0 cand .............................. " << Nzmsc_notcontained_0Z
803 cout <<
"n of ZMuSta events not contained with 1 cand .............................. " << Nzmsc_notcontained_1Z
805 cout <<
"n of ZMuSta events no contained with 2 or more cand ....................... " << Nzmsc_notcontained_moreZ
809 cout <<
"n of ZMuSta cand not selectd by cuts ...................................... " << Nzmsc_passed_0Z << endl;
810 cout <<
"n of ZMuSta events with 1 cand selected by cuts ........................... " << Nzmsc_passed_1Z << endl;
811 cout <<
"n of ZMuSta events with 2 or more cand selected by cuts ................... " << Nzmsc_passed_moreZ << endl
814 cout <<
"n of ZMuSta MCmatched cand not selectd by cuts ............................ " << Nzmsc_MCmatched_passed_0Z
816 cout <<
"n of ZMuSta MCmatched events with 1 cand selected by cuts ................. " << Nzmsc_MCmatched_passed_1Z
818 cout <<
"n of ZMuSta MCmatched events with 2 or more cand selected by cuts ......... " << Nzmsc_MCmatched_passed_moreZ
822 cout <<
"...............When no ZMuMu and ZMuSta are selcted........................." << endl;
823 cout <<
"n of ZMuTrack entries ................................................... " << Nzmtc << endl;
824 cout <<
"n of ZMuTrack events with 0 cand ..........................................." << Nzmtc_0Z << endl;
825 cout <<
"n of ZMuTrack events with 1 cand ..........................................." << Nzmtc_1Z << endl;
826 cout <<
"n of ZMuTrack events with 2 or more cand ..................................." << Nzmtc_moreZ << endl << endl;
828 cout <<
"n of ZMuTrack not contained events with 0 cand ............................ " << Nzmtc_notcontained_0Z
830 cout <<
"n of ZMuTrack events not contained with 1 cand ............................ " << Nzmtc_notcontained_1Z
832 cout <<
"n of ZMuTrack events no contained with 2 or more cand ..................... " << Nzmtc_notcontained_moreZ
836 cout <<
"n of ZMuTrack cand not selectd by cuts ....................................." << Nzmtc_passed_0Z << endl;
837 cout <<
"n of ZMuTrack events with 1 cand selected by cuts .........................." << Nzmtc_passed_1Z << endl;
838 cout <<
"n of ZMuTrack events with 2 or more cand selected by cuts .................." << Nzmtc_passed_moreZ << endl
841 cout <<
"n of ZMuTrack MCmatched cand not selectd by cuts .......................... " << Nzmtc_MCmatched_passed_0Z
843 cout <<
"n of ZMuTrcak MCmatched events with 1 cand selected by cuts ............... " << Nzmtc_MCmatched_passed_1Z
845 cout <<
"n of ZMuTrack MCmatched events with 2 or more cand selected by cuts ....... " << Nzmtc_MCmatched_passed_moreZ
848 cout <<
"------------------------------------------------------------------------------------------" << endl;
860 cout <<
"-- N SingleTrackMu = " << Nztm << endl;
861 cout <<
"-----N SinglStandAloneMu = " << Nzsm << endl;
862 cout <<
"-----N SingleStandAloneOverlapMu = " << Nzsnom << endl;
863 cout <<
"------- N MuMu = " << Nzmm << endl;
865 cout <<
"-- N SingleTrackMuMatched = " << NztmMatch << endl;
866 cout <<
"-----N SinglStandAloneMuMatched = " << NzsmMatch << endl;
867 cout <<
"-----N SingleStandAloneOverlapMuMatched = " << NzsnomMatch << endl;
868 cout <<
"------- N MuMu Matched = " << NzmmMatch << endl;