14 #include <TGraphErrors.h>
21 #include <CLHEP/Vector/LorentzVector.h>
69 std::cout <<
"[ZeeCalibration] Starting the ctor" << std::endl;
102 myTree =
new TTree(
"myTree",
"myTree");
142 findingRecord<EcalIntercalibConstantsRcd>();
144 for (
int i = 0;
i < 50;
i++) {
152 std::cout <<
"[ZeeCalibration] Done with the ctor" << std::endl;
165 std::cout <<
"@SUB=ZeeCalibration::produceEcalIntercalibConstants" << std::endl;
209 std::cout <<
"Writing histos..." << std::endl;
238 for (
unsigned int i = 0;
i < 25;
i++) {
273 Double_t
mean[25] = {0.};
274 Double_t
num[25] = {0.};
275 Double_t meanErr[25] = {0.};
276 Float_t
rms[25] = {0.};
277 Float_t tempRms[10][25];
279 for (
int ia = 0; ia < 10; ia++) {
280 for (
int ib = 0;
ib < 25;
ib++) {
281 tempRms[ia][
ib] = 0.;
289 bool isNearCrack =
false;
300 if ((
k + 1) % 5 != 0) {
344 if (
k >= 170 &&
k <= 204) {
361 else if (
flag == 4) {
380 if (
k >= 205 &&
k <= 208) {
422 for (
int ic = 0; ic < 17; ic++) {
425 meanErr[ic] = 1. /
sqrt(meanErr[ic]);
429 for (
int ic = 0; ic < 25; ic++) {
430 for (
int id = 0;
id < 10;
id++) {
431 if (tempRms[
id][ic] > 0.) {
441 Double_t xtalEta[25] = {1.4425, 1.3567, 1.2711, 1.1855, 1.10, 1.01, 0.92, 0.83, 0.7468,
442 0.6612, 0.5756, 0.4897, 0.3985, 0.3117, 0.2250, 0.1384, 0.0487, 1.546,
443 1.651, 1.771, 1.908, 2.071, 2.267, 2.516, 2.8};
445 Double_t
zero[25] = {0.026};
447 for (
int j = 0;
j < 25;
j++)
454 px->SetXTitle(
"Eta channel");
455 px->SetYTitle(
"recalibCoeff");
475 double weightSumMeanBarrel = 0.;
476 double weightSumMeanEndcap = 0.;
510 std::cout <<
"Weight sum mean on channels in Barrel is :" << weightSumMeanBarrel << std::endl;
511 std::cout <<
"Weight sum mean on channels in Endcap is :" << weightSumMeanEndcap << std::endl;
523 TGraphErrors* graph =
new TGraphErrors(25, xtalEta,
mean,
zero, meanErr);
527 double zero50[50] = {0.};
530 residualSigmaGraph->SetName(
"residualSigmaGraph");
531 residualSigmaGraph->Draw(
"APL");
532 residualSigmaGraph->Write();
534 TGraphErrors* coefficientDistanceAtIterationGraph =
536 coefficientDistanceAtIterationGraph->SetName(
"coefficientDistanceAtIterationGraph");
537 coefficientDistanceAtIterationGraph->Draw(
"APL");
538 coefficientDistanceAtIterationGraph->Write();
540 Float_t noError[250] = {0.};
542 Float_t ringInd[250];
543 for (
int i = 0;
i < 250;
i++)
546 TGraphErrors* graphCoeff =
548 graphCoeff->SetName(
"graphCoeff");
549 graphCoeff->Draw(
"APL");
582 std::cout <<
"[ZeeCalibration] Entering duringLoop" << std::endl;
599 std::cout <<
"[ZeeCalibration::beginOfJob] Histograms booked " << std::endl;
614 std::cout <<
"[ZeeCalibration::beginOfJob] Parsed EB miscal file" << std::endl;
622 std::cout <<
"[ZeeCalibration::beginOfJob] Parsed EE miscal file" << std::endl;
633 std::vector<DetId> ringIds;
646 for (
unsigned int iid = 0; iid < ringIds.size(); ++iid) {
647 float miscalib = *(miscalibMap->
get().
getMap().
find(ringIds[iid]));
658 ical = std::make_shared<EcalIntercalibConstants>();
663 std::vector<DetId> ringIds;
674 for (
unsigned int iid = 0; iid < ringIds.size(); ++iid) {
678 EBDetId myEBDetId(ringIds[iid]);
680 myEBDetId.
ieta() + 86,
686 EEDetId myEEDetId(ringIds[iid]);
687 if (myEEDetId.
zside() < 0)
693 if (myEEDetId.
zside() > 0)
711 for (
unsigned int iHLT = 0; iHLT < 200; ++iHLT) {
716 std::cout <<
"[ZeeCalibration::duringLoop] Done with initializing aHLTresults[] " << std::endl;
722 if (!hltTriggerResultHandle.
isValid()) {
731 std::cout <<
"[ZeeCalibration::duringLoop] Done with myZeePlots_->fillHLTInfo(hltTriggerResultHandle); "
748 std::cout <<
"[ZeeCalibration::duringLoop] End HLT section" << std::endl;
753 std::vector<HepMC::GenParticle*> mcEle;
755 float myGenZMass(-1);
769 std::cout <<
"[ZeeCalibration::duringLoop] Done with myZeePlots_->fillZMCInfo( & (*myGenEvent) ); " << std::endl;
772 for (HepMC::GenEvent::particle_const_iterator
p = myGenEvent->particles_begin();
p != myGenEvent->particles_end();
775 if ((*p)->pdg_id() == 23 && (*p)->status() == 2) {
776 myGenZMass = (*p)->momentum().m();
787 for (HepMC::GenEvent::particle_const_iterator
p = myGenEvent->particles_begin();
p != myGenEvent->particles_end();
789 if (
abs((*p)->pdg_id()) == 11) {
790 mcEle.push_back((*
p));
795 if (mcEle.size() == 2 && fabs(mcEle[0]->momentum().
eta()) < 2.4 && fabs(mcEle[1]->momentum().
eta()) < 2.4) {
798 if (fabs(mcEle[0]->momentum().
eta()) < 1.479 && fabs(mcEle[1]->momentum().
eta()) < 1.479)
801 if ((fabs(mcEle[0]->momentum().
eta()) > 1.479 && fabs(mcEle[1]->momentum().
eta()) < 1.479) ||
802 (fabs(mcEle[0]->momentum().
eta()) < 1.479 && fabs(mcEle[1]->momentum().
eta()) > 1.479))
805 if (fabs(mcEle[0]->momentum().eta()) > 1.479 && fabs(mcEle[1]->momentum().eta()) > 1.479)
815 std::cerr <<
"Error! can't get the product EBRecHitCollection " << std::endl;
824 std::cerr <<
"Error! can't get the product EERecHitCollection " << std::endl;
833 std::cerr <<
"Error! can't get the product SuperClusterCollection " << std::endl;
839 for (reco::SuperClusterCollection::const_iterator scIt =
scCollection->begin(); scIt !=
scCollection->end(); scIt++) {
840 std::cout << scIt->energy() << std::endl;
849 std::cerr <<
"Error! can't get the product IslandSuperClusterCollection " << std::endl;
854 std::cout <<
"scCollection->size()" << scIslandCollection->size() << std::endl;
857 if ((
scCollection->size() + scIslandCollection->size()) < 2)
865 std::cerr <<
"Error! can't get the product ElectronCollection " << std::endl;
881 if (!
hits && !ehits) {
887 std::cout <<
"hits->size() == 0" << std::endl;
892 std::cout <<
"!electronCollection" << std::endl;
897 std::cout <<
"electronCollection->size() == 0" << std::endl;
912 std::cout <<
" Starting with myZeePlots_->fillEleInfo(electronCollection); " << std::endl;
919 std::cout <<
" Done with myZeePlots_->fillEleInfo(electronCollection); " << std::endl;
925 std::vector<calib::CalibElectron> calibElectrons;
932 std::cout << calibElectrons.back().getRecoElectron()->superCluster()->energy() <<
" "
933 << calibElectrons.back().getRecoElectron()->energy() << std::endl;
941 std::cout <<
"Filled histos" << std::endl;
945 std::vector<std::pair<calib::CalibElectron*, calib::CalibElectron*> > zeeCandidates;
949 double DeltaMinvMin(5000.);
951 if (calibElectrons.size() < 2)
954 for (
unsigned int e_it = 0; e_it != calibElectrons.size() - 1; e_it++) {
955 for (
unsigned int p_it = e_it + 1; p_it != calibElectrons.size(); p_it++) {
957 std::cout << e_it <<
" " << calibElectrons[e_it].getRecoElectron()->charge() <<
" " << p_it <<
" "
958 << calibElectrons[p_it].getRecoElectron()->charge() << std::endl;
960 if (calibElectrons[e_it].getRecoElectron()->
charge() * calibElectrons[p_it].getRecoElectron()->
charge() != -1)
964 std::pair<calib::CalibElectron*, calib::CalibElectron*>(&(calibElectrons[e_it]), &(calibElectrons[p_it])));
970 std::cout <<
"#######################mass " <<
mass << std::endl;
973 zeeCandidates.push_back(
974 std::pair<calib::CalibElectron*, calib::CalibElectron*>(&(calibElectrons[e_it]), &(calibElectrons[p_it])));
975 double DeltaMinv = fabs(
mass -
MZ);
977 if (DeltaMinv < DeltaMinvMin) {
978 DeltaMinvMin = DeltaMinv;
979 myBestZ = zeeCandidates.size() - 1;
990 if (zeeCandidates.empty() || myBestZ == -1)
997 std::cout <<
"Found ZCandidates " << myBestZ << std::endl;
1004 int class1 = zeeCandidates[myBestZ].first->getRecoElectron()->classification();
1005 int class2 = zeeCandidates[myBestZ].second->getRecoElectron()->classification();
1034 if (class1 == 10 || class1 == 20)
1036 if (class1 == 110 || class1 == 120)
1038 if (class1 >= 30 && class1 <= 34)
1040 if (class1 >= 130 && class1 <= 134)
1051 if (class2 == 10 || class2 == 20)
1053 if (class2 == 110 || class2 == 120)
1055 if (class2 >= 30 && class2 <= 34)
1057 if (class2 >= 130 && class2 <= 134)
1068 DetId firstElehottestDetId =
1070 zeeCandidates[myBestZ].
first->getRecoElectron()->superCluster()->seed()->hitsAndFractions(),
hits, ehits)
1072 DetId secondElehottestDetId =
1074 zeeCandidates[myBestZ].
second->getRecoElectron()->superCluster()->seed()->hitsAndFractions(),
hits, ehits)
1077 bool firstElectronIsOnModuleBorder(
false);
1078 bool secondElectronIsOnModuleBorder(
false);
1093 if (secondElehottestDetId.subdetId() ==
EcalBarrel)
1098 if (secondElehottestDetId.subdetId() ==
EcalBarrel && !secondElectronIsOnModuleBorder)
1103 if (firstElehottestDetId.
subdetId() ==
EcalBarrel && firstElectronIsOnModuleBorder) {
1110 if (secondElehottestDetId.subdetId() ==
EcalBarrel && secondElectronIsOnModuleBorder) {
1119 if (class1 < 100 && class2 < 100) {
1121 if (class1 == 0 && class2 == 0)
1123 if (class1 < 21 && class2 < 21)
1125 if (class1 < 21 || class2 < 21)
1129 if (class1 >= 100 && class2 >= 100) {
1131 if (class1 == 100 && class2 == 100)
1133 if (class1 < 121 && class2 < 121)
1135 if (class1 < 121 || class2 < 121)
1139 if ((class1 < 100 && class2 >= 100) || (class2 < 100 && class1 >= 100)) {
1141 if ((class1 == 0 && class2 == 100) || (class2 == 0 && class1 == 100))
1143 if ((class1 < 21 && class2 < 121) || (class2 < 21 && class1 < 121))
1145 if (class2 < 21 || class1 < 21 || class2 < 121 || class1 < 121)
1156 bool selectionBool =
false;
1161 float theta1 = 2. * atan(
exp(-zeeCandidates[myBestZ].
first->getRecoElectron()->superCluster()->eta()));
1162 bool ET_1 = ((zeeCandidates[myBestZ].first->getRecoElectron()->superCluster()->energy() *
sin(theta1)) > 20.);
1164 float theta2 = 2. * atan(
exp(-zeeCandidates[myBestZ].
second->getRecoElectron()->superCluster()->eta()));
1165 bool ET_2 = ((zeeCandidates[myBestZ].second->getRecoElectron()->superCluster()->energy() *
sin(theta2)) > 20.);
1167 bool HoE_1 = (zeeCandidates[myBestZ].first->getRecoElectron()->hadronicOverEm() < 0.115);
1168 bool HoE_2 = (zeeCandidates[myBestZ].second->getRecoElectron()->hadronicOverEm() < 0.115);
1170 bool DeltaPhiIn_1 = (zeeCandidates[myBestZ].first->getRecoElectron()->deltaPhiSuperClusterTrackAtVtx() < 0.090);
1171 bool DeltaPhiIn_2 = (zeeCandidates[myBestZ].second->getRecoElectron()->deltaPhiSuperClusterTrackAtVtx() < 0.090);
1173 bool DeltaEtaIn_1 = (zeeCandidates[myBestZ].first->getRecoElectron()->deltaEtaSuperClusterTrackAtVtx() < 0.0090);
1174 bool DeltaEtaIn_2 = (zeeCandidates[myBestZ].second->getRecoElectron()->deltaEtaSuperClusterTrackAtVtx() < 0.0090);
1178 if (!(invMassBool && ET_1 && ET_2 && HoE_1 && HoE_2 && DeltaPhiIn_1 && DeltaPhiIn_2 && DeltaEtaIn_1 && DeltaEtaIn_2))
1186 int c1st = zeeCandidates[myBestZ].first->getRecoElectron()->classification();
1187 int c2nd = zeeCandidates[myBestZ].second->getRecoElectron()->classification();
1189 selectionBool = (myBestZ != -1 && c1st != 40 && c1st != 40 && c2nd != 40 && c2nd != 140);
1195 (myBestZ != -1 && (c1st == 0 || c1st == 10 || c1st == 20 || c1st == 100 || c1st == 110 || c1st == 120) &&
1196 (c2nd == 0 || c2nd == 10 || c2nd == 20 || c2nd == 100 || c2nd == 110 || c2nd == 120));
1200 selectionBool = (myBestZ != -1 && (c1st == 0 || c1st == 100) && (c2nd == 0 || c2nd == 100));
1203 selectionBool = (myBestZ != -1 && ((c1st >= 30 && c1st <= 34) || ((c1st >= 130 && c1st <= 134))) &&
1204 ((c2nd >= 30 && c2nd <= 34) || ((c2nd >= 130 && c2nd <= 134)))
1211 selectionBool = (myBestZ != -1 && (
1213 ((c1st == 0 || c1st == 10 || c1st == 20) && c2nd >= 100 && c2nd != 140)
1217 ((c2nd == 0 || c2nd == 10 || c2nd == 20) && c1st >= 100 && c1st != 140)
1224 selectionBool = (myBestZ != -1 && c1st >= 100 && c2nd >= 100 && c1st != 140 && c2nd != 140);
1229 selectionBool = (myBestZ != -1 && c1st < 100 && c2nd < 100 && c1st != 40 && c2nd != 40);
1234 selectionBool = (myBestZ != -1 && !(c1st < 100 && c2nd >= 100) && !(c1st >= 100 && c2nd < 100));
1236 float ele1EnergyCorrection(1.);
1237 float ele2EnergyCorrection(1.);
1244 if (invMassBool && selectionBool) {
1252 zeeCandidates[myBestZ], ele1EnergyCorrection, ele2EnergyCorrection) -
1260 std::map<HepMC::GenParticle*, const reco::GsfElectron*> myMCmap;
1262 std::vector<const reco::GsfElectron*> dauElectronCollection;
1264 dauElectronCollection.push_back(zeeCandidates[myBestZ].
first->getRecoElectron());
1265 dauElectronCollection.push_back(zeeCandidates[myBestZ].
second->getRecoElectron());
1267 fillMCmap(&dauElectronCollection, mcEle, myMCmap);
1274 zeeCandidates[myBestZ].
second,
1275 MZ *
sqrt(ele1EnergyCorrection * ele2EnergyCorrection));
1280 zeeCandidates[myBestZ], ele1EnergyCorrection, ele2EnergyCorrection));
1282 int c1st = zeeCandidates[myBestZ].first->getRecoElectron()->classification();
1283 int c2nd = zeeCandidates[myBestZ].second->getRecoElectron()->classification();
1284 if (c1st < 100 && c2nd < 100)
1286 zeeCandidates[myBestZ], ele1EnergyCorrection, ele2EnergyCorrection));
1288 if (c1st >= 100 && c2nd >= 100)
1290 zeeCandidates[myBestZ], ele1EnergyCorrection, ele2EnergyCorrection));
1293 zeeCandidates[myBestZ], ele1EnergyCorrection, ele2EnergyCorrection);
1296 zeeCandidates[myBestZ], ele1EnergyCorrection, ele2EnergyCorrection) -
1305 std::cout <<
"Added event to algorithm" << std::endl;
1314 std::cout <<
"[ZeeCalibration] Starting loop number " << iLoop << std::endl;
1323 std::cout <<
"[ZeeCalibration] exiting from startingNewLoop" << std::endl;
1344 std::cout <<
"[ZeeCalibration] Ending loop " << iLoop << std::endl;
1355 std::cout <<
"Optimized coefficients " << optimizedCoefficients.size() << std::endl;
1361 for (
unsigned int ieta = 0;
ieta < optimizedCoefficients.size();
ieta++) {
1374 std::cout <<
"size " << optimizedCoefficients.size() << std::endl;
1376 for (
unsigned int ieta = 0;
ieta < optimizedCoefficients.size();
ieta++) {
1387 std::vector<DetId> ringIds;
1398 for (
unsigned int iid = 0; iid < ringIds.size(); ++iid) {
1400 EBDetId myEBDetId(ringIds[iid]);
1402 myEBDetId.
ieta() + 86,
1408 EEDetId myEEDetId(ringIds[iid]);
1409 if (myEEDetId.
zside() < 0)
1415 if (myEEDetId.
zside() > 0)
1422 ical->setValue(ringIds[iid], *(
ical->getMap().find(ringIds[iid])) * optimizedCoefficients[
ieta]);
1452 double parResidual[3];
1453 double errparResidual[3];
1465 std::cout <<
"Fit on residuals, sigma is " << parResidual[2] <<
" +/- " << errparResidual[2] << std::endl;
1501 new TH1F(
"h1_eventsBeforeBorderSelection",
"h1_eventsBeforeBorderSelection", 5, 0, 5);
1504 h1_seedOverSC_ =
new TH1F(
"h1_seedOverSC",
"h1_seedOverSC", 400, 0., 2.);
1509 new TH1F(
"h1_borderElectronClassification",
"h1_borderElectronClassification", 55, -5, 50);
1512 h2_fEtaBarrelGood_ =
new TH2F(
"fEtaBarrelGood",
"fEtaBarrelGood", 800, -4., 4., 800, 0.8, 1.2);
1516 h2_fEtaBarrelBad_ =
new TH2F(
"fEtaBarrelBad",
"fEtaBarrelBad", 800, -4., 4., 800, 0.8, 1.2);
1520 h2_fEtaEndcapGood_ =
new TH2F(
"fEtaEndcapGood",
"fEtaEndcapGood", 800, -4., 4., 800, 0.8, 1.2);
1524 h2_fEtaEndcapBad_ =
new TH2F(
"fEtaEndcapBad",
"fEtaEndcapBad", 800, -4., 4., 800, 0.8, 1.2);
1528 for (
int i = 0;
i < 2;
i++) {
1545 new TH2F(
"h2_xtalMiscalibCoeffBarrel",
"h2_xtalMiscalibCoeffBarrel", 171, -85, 85, 360, 0, 360);
1547 new TH2F(
"h2_xtalMiscalibCoeffEndcapMinus",
"h2_xtalMiscalibCoeffEndcapMinus", 100, 0, 100, 100, 0, 100);
1549 new TH2F(
"h2_xtalMiscalibCoeffEndcapPlus",
"h2_xtalMiscalibCoeffEndcapPlus", 100, 0, 100, 100, 0, 100);
1557 for (
int i = 0;
i < 25;
i++) {
1575 sprintf(
histoName,
"h_ESCcorrEtrueVsEta_%d",
i);
1585 sprintf(
histoName,
"h2_xtalRecalibCoeffBarrel_%d",
i);
1591 sprintf(
histoName,
"h2_xtalRecalibCoeffEndcapMinus_%d",
i);
1596 sprintf(
histoName,
"h2_xtalRecalibCoeffEndcapPlus_%d",
i);
1621 h1_zMassResol_ =
new TH1F(
"zMassResol",
"zMassResol", 200, -50., 50.);
1625 h1_eleEtaResol_ =
new TH1F(
"eleEtaResol",
"eleEtaResol", 100, -0.01, 0.01);
1641 h1_elePhiResol_ =
new TH1F(
"elePhiResol",
"elePhiResol", 100, -0.01, 0.01);
1645 h1_zEtaResol_ =
new TH1F(
"zEtaResol",
"zEtaResol", 200, -1., 1.);
1649 h1_zPhiResol_ =
new TH1F(
"zPhiResol",
"zPhiResol", 200, -1., 1.);
1653 h1_nEleReco_ =
new TH1F(
"nEleReco",
"Number of reco electrons", 10, -0.5, 10.5);
1666 h1_occupancy_ =
new TH1F(
"occupancy",
"occupancy", 1000, 0, 10000);
1675 h1_eleClasses_ =
new TH1F(
"eleClasses",
"eleClasses", 301, -1, 300);
1687 h1_ZCandMult_ =
new TH1F(
"ZCandMult",
"Multiplicity of Z candidates in one event", 10, -0.5, 10.5);
1690 h1_reco_ZMass_ =
new TH1F(
"reco_ZMass",
"Inv. mass of 2 reco Electrons", 200, 0., 150.);
1694 h1_reco_ZMassCorr_ =
new TH1F(
"reco_ZMassCorr",
"Inv. mass of 2 corrected reco Electrons", 200, 0., 150.);
1698 h1_reco_ZMassCorrBB_ =
new TH1F(
"reco_ZMassCorrBB",
"Inv. mass of 2 corrected reco Electrons", 200, 0., 150.);
1702 h1_reco_ZMassCorrEE_ =
new TH1F(
"reco_ZMassCorrEE",
"Inv. mass of 2 corrected reco Electrons", 200, 0., 150.);
1708 h2_coeffVsEta_ =
new TH2F(
"h2_calibCoeffVsEta",
"h2_calibCoeffVsEta", 249, -124, 125, 200, 0., 2.);
1713 new TH2F(
"h2_calibCoeffVsEtaGrouped",
"h2_calibCoeffVsEtaGrouped", 200, 0., 3., 200, 0.6, 1.4);
1717 h2_zMassVsLoop_ =
new TH2F(
"h2_zMassVsLoop",
"h2_zMassVsLoop", 1000, 0, 40, 90, 80., 95.);
1719 h2_zMassDiffVsLoop_ =
new TH2F(
"h2_zMassDiffVsLoop",
"h2_zMassDiffVsLoop", 1000, 0, 40, 100, -1., 1.);
1723 h2_zWidthVsLoop_ =
new TH2F(
"h2_zWidthVsLoop",
"h2_zWidthVsLoop", 1000, 0, 40, 100, 0., 10.);
1725 h2_coeffVsLoop_ =
new TH2F(
"h2_coeffVsLoop",
"h2_coeffVsLoop", 1000, 0, 40, 100, 0., 2.);
1727 h2_residualSigma_ =
new TH2F(
"h2_residualSigma",
"h2_residualSigma", 1000, 0, 40, 100, 0., .5);
1729 h2_miscalRecal_ =
new TH2F(
"h2_miscalRecal",
"h2_miscalRecal", 500, 0., 2., 500, 0., 2.);
1733 h2_miscalRecalEB_ =
new TH2F(
"h2_miscalRecalEB",
"h2_miscalRecalEB", 500, 0., 2., 500, 0., 2.);
1737 h2_miscalRecalEE_ =
new TH2F(
"h2_miscalRecalEE",
"h2_miscalRecalEE", 500, 0., 2., 500, 0., 2.);
1741 h1_mc_ =
new TH1F(
"h1_residualMiscalib",
"h1_residualMiscalib", 200, -0.2, 0.2);
1742 h1_mcEB_ =
new TH1F(
"h1_residualMiscalibEB",
"h1_residualMiscalibEB", 200, -0.2, 0.2);
1743 h1_mcEE_ =
new TH1F(
"h1_residualMiscalibEE",
"h1_residualMiscalibEE", 200, -0.2, 0.2);
1745 for (
int i = 0;
i < 25;
i++) {
1764 sprintf(
histoName,
"h1_residualMiscalibParz_%d",
i);
1766 sprintf(
histoName,
"h1_residualMiscalibEBParz_%d",
i);
1768 sprintf(
histoName,
"h1_residualMiscalibEEParz_%d",
i);
1774 float p0 = 1.00153e+00;
1775 float p1 = 3.29331e-02;
1776 float p2 = 1.21187e-03;
1778 double x = (double)fabs(scEta);
1780 return 1. / (p0 +
p1 *
x *
x +
p2 *
x *
x *
x *
x);
1786 float p0 = 1.06819e+00;
1787 float p1 = -1.53189e-02;
1788 float p2 = 4.01707e-04;
1790 double x = (double)fabs(scEta);
1792 return 1. / (p0 +
p1 *
x *
x +
p2 *
x *
x *
x *
x);
1796 float p0 = 1.17382e+00;
1797 float p1 = -6.52319e-02;
1798 float p2 = 6.26108e-03;
1800 double x = (double)fabs(scEta);
1802 return 1. / (p0 +
p1 *
x *
x +
p2 *
x *
x *
x *
x);
1806 float p0 = 9.99782e-01;
1807 float p1 = 1.26983e-02;
1808 float p2 = 2.16344e-03;
1810 double x = (double)fabs(scEta);
1812 return 1. / (p0 +
p1 *
x *
x +
p2 *
x *
x *
x *
x);
1818 const std::vector<HepMC::GenParticle*>& mcEle,
1819 std::map<HepMC::GenParticle*, const reco::GsfElectron*>& myMCmap) {
1820 for (
unsigned int i = 0;
i < mcEle.size();
i++) {
1824 float dr =
EvalDR(mcEle[
i]->momentum().pseudoRapidity(),
1826 mcEle[
i]->momentum().
phi(),
1829 myMatchEle = (*electronCollection)[
j];
1833 myMCmap.insert(std::pair<HepMC::GenParticle*, const reco::GsfElectron*>(mcEle[
i], myMatchEle));
1846 float DEta = Eta - Eta_ref;
1857 return (
Phi - Phi_ref);
1861 std::map<HepMC::GenParticle*, const reco::GsfElectron*>& associationMap) {
1862 for (
unsigned int i = 0;
i < mcEle.size();
i++) {
1863 h_eleEffEta_[0]->Fill(fabs(mcEle[
i]->momentum().pseudoRapidity()));
1867 std::map<HepMC::GenParticle*, const reco::GsfElectron*>::const_iterator mIter = associationMap.find(mcEle[
i]);
1868 if (mIter == associationMap.end())
1871 if ((*mIter).second) {
1874 h_eleEffEta_[1]->Fill(fabs(mcEle[
i]->momentum().pseudoRapidity()));
1904 if (
k >= 0 &&
k <= 84)
1907 if (
k >= 85 &&
k <= 169)
1910 if (
k >= 170 &&
k <= 208)
1913 if (
k >= 209 &&
k <= 247)
1919 if (
k >= 0 &&
k <= 71)
1922 if (
k >= 72 &&
k <= 143)
1932 if (
c == 0 ||
c == 10 ||
c == 20)
1935 if (
c == 100 ||
c == 110 ||
c == 120)
1938 if (
c == 30 ||
c == 31 ||
c == 32 ||
c == 33 ||
c == 34)
1941 if (
c == 130 ||
c == 131 ||
c == 132 ||
c == 133 ||
c == 134)
1953 std::pair<DetId, double> myPair(
DetId(0), -9999.);
1955 for (
std::vector<std::pair<DetId, float> >::const_iterator idIt = mySCRecHits.begin(); idIt != mySCRecHits.end();
1958 hottestRecHit = &(*(ebhits->
find((*idIt).first)));
1960 if (hottestRecHit == &(*(ebhits->
end()))) {
1961 std::cout <<
"@@@@@@@@@@@@@@@@@@@@@@@@@@@ NO RECHIT FOUND SHOULD NEVER HAPPEN" << std::endl;
1964 }
else if (idIt->first.subdetId() ==
EcalEndcap) {
1965 hottestRecHit = &(*(eehits->
find((*idIt).first)));
1966 if (hottestRecHit == &(*(eehits->
end()))) {
1967 std::cout <<
"@@@@@@@@@@@@@@@@@@@@@@@@@@@ NO RECHIT FOUND SHOULD NEVER HAPPEN" << std::endl;
1977 myPair.first = hottestRecHit->
id();
1999 for (
int i = 0;
i < 19;
i++) {
2010 for (
int i = 0;
i <
size;
i++) {
2013 bool isNearCrack =
false;
2025 dist +=
pow(v1[
i] - v2[
i], 2);
2074 for (
int i = 0;
i < 2;
i++) {
2112 std::cout <<
"[ CHECK ON BARREL ELECTRON NUMBER ]"
2115 std::cout <<
"[ EFFICIENCY OF THE BORDER SELECTION ]"
2118 std::cout <<
"[ EFFICIENCY OF THE GOLDEN SELECTION ] BARREL: "
2122 std::cout <<
"[ EFFICIENCY OF THE SILVER SELECTION ] BARREL: "
2126 std::cout <<
"[ EFFICIENCY OF THE SHOWER SELECTION ] BARREL: "
2130 std::cout <<
"[ EFFICIENCY OF THE CRACK SELECTION ] BARREL: "
2134 std::ofstream
fout(
"ZeeStatistics.txt");
2137 std::cout <<
"Cannot open output file.\n";
2140 fout <<
"ZeeStatistics" << std::endl;
2142 fout <<
"##########################RECO#########################" << std::endl;
2143 fout <<
"##################Zee with Barrel-Barrel electrons: " <<
BBZN << std::endl;
2147 fout <<
"##################Zee with Barrel-Endcap electrons: " <<
EBZN << std::endl;
2150 fout <<
"##################Zee with Endcap-Endcap electrons: " <<
EEZN << std::endl;
2154 fout <<
"\n" << std::endl;
2156 fout <<
"##########################GEN#########################" << std::endl;
2157 fout <<
"##################Zee with Barrel-Barrel electrons: " << (
float)
MCZBB /
NEVT << std::endl;
2158 fout <<
"##################Zee with Barrel-Endcap electrons: " << (
float)
MCZEB /
NEVT << std::endl;
2159 fout <<
"##################Zee with Endcap-Endcap electrons: " << (
float)
MCZEE /
NEVT << std::endl;