71 numCand_ =
new TH1F(
"numCandidates",
"Number of candidates found", 10, -0.5, 9.5);
72 numElectrons_ =
new TH1F(
"numElectrons",
"Number of Electrons found", 10, -0.5, 9.5);
73 numSuperClusters_ =
new TH1F(
"numSuperClusters",
"Number of Ecal SuperClusters", 50, 0, 50);
75 energySuperClusters_ =
new TH1F(
"energySuperClusters",
"Super Cluster Energy - all ", 200, 0, 2000.);
76 energySuperClustersEl_ =
new TH1F(
"energySuperClustersEl",
"Super Cluster Energy - Electron Cands ", 200, 0., 2000.);
78 sizeSuperClusters_ =
new TH1F(
"sizeSuperClusters",
"Super Cluster Size - all ", 20, 0, 19);
79 sizeSuperClustersEl_ =
new TH1F(
"sizeSuperClustersEl",
"Super Cluster Size - Electron Cands ", 20, 0, 19);
81 emaxSuperClusters_ =
new TH1F(
"emaxSuperClusters",
"Super Cluster Emax - all ", 200, 0, 2000.);
82 emaxSuperClustersEl_ =
new TH1F(
"emaxSuperClustersEl",
"Super Cluster Emax - Electron Cands ", 200, 0, 2000.);
85 phiWidthSuperClustersEl_ =
new TH1F(
"phiWidthSuperClustersEl",
"Super Cluster Width - Electron Cands ", 20, 0., 0.05);
87 ptDiff =
new TH1F(
"ptDiff",
" ptDiff ", 20, -10., 10.);
88 pDiff =
new TH1F(
"pDiff",
" pDiff ", 100, -50., 50.);
90 pElectronFailed =
new TH1F(
"pElectronFailed",
" pElectronFailed ", 55, 0., 110.);
91 ptElectronFailed =
new TH1F(
"ptElectronFailed",
" ptElectronFailed ", 55, 0., 110.);
93 pElectronPassed =
new TH1F(
"pElectronPassed",
" pElectronPassed ", 55, 0., 110.);
94 ptElectronPassed =
new TH1F(
"ptElectronPassed",
" ptElectronPassed ", 55, 0., 110.);
102 eOverPFailed =
new TH1F(
"eOverPFailed",
" E over P - Failed ", 50, 0, 10.);
103 eOverPPassed =
new TH1F(
"eOverPPassed",
" E over P - Passed ", 50, 0, 10.);
105 numSiStereoHits_ =
new TH1F(
"numSiStereoHits",
"Number of Si StereoHits", 100, 0, 1000);
106 numSiMonoHits_ =
new TH1F(
"numSiMonoHits",
"Number of Si MonoHits", 100, 0, 1000);
107 numSiMatchedHits_ =
new TH1F(
"numSiMatchedHits",
"Number of Si MatchedHits", 100, 0, 1000);
162 myTree_ =
new TTree(
"myTree",
"my first Tree example");
336 LogDebug(
"") <<
" Start loop over " << clusterHandle->end() - clusterHandle->begin() <<
" superClusters ";
338 for (reco::SuperClusterCollection::const_iterator clusterIter = clusterHandle->begin();
339 clusterIter != clusterHandle->end();
341 double energy = clusterIter->energy();
343 std::ostringstream
str;
354 str <<
"About to loop over basicClusters"
357 double emaxSuperCluster = 0.;
360 double eTotSuperCluster = 0.;
363 basicClusterIter != clusterIter->clustersEnd();
364 ++basicClusterIter) {
367 str <<
" basicCluster Energy " << (*basicClusterIter)->energy() <<
" Position " << (*basicClusterIter)->position()
369 <<
" Position phi " << (*basicClusterIter)->position().phi() <<
" recHits "
370 << (*basicClusterIter)->size() <<
" \n";
372 double eCluster = (*basicClusterIter)->energy();
373 if (eCluster > emaxSuperCluster) {
374 emaxSuperCluster = eCluster;
376 eTotSuperCluster += eCluster;
377 double phiCluster = (*basicClusterIter)->position().phi();
378 phibar += eCluster * phiCluster;
379 phi2bar += eCluster * phiCluster * phiCluster;
383 phibar = phibar / eTotSuperCluster;
384 phi2bar = phi2bar / eTotSuperCluster;
385 double phiWidth = phi2bar - phibar * phibar;
391 str <<
" SuperCluster stats "
393 str <<
"phibar " << phibar <<
" phi2bar " << phi2bar <<
" eTotSuperCluster " << eTotSuperCluster <<
" phiWidth "
394 << phiWidth << std::endl;
400 str <<
" Done with this SuperCluster " << std::endl;
406 LogDebug(
"") <<
" End loop over superClusters ";
431 LogDebug(
"") <<
" Dumping Algo's guess of SiStripElectron Candidate Info ";
432 int numberOfElectrons = 0;
434 LogDebug(
"") <<
" Number of SiStripElectrons " << siStripElectronHandle->size();
436 for (reco::SiStripElectronCollection::const_iterator electronIter = siStripElectronHandle->begin();
437 electronIter != siStripElectronHandle->end();
439 LogDebug(
"") <<
"about to get stuff from electroncandidate " << numberOfElectrons <<
"\n"
440 <<
"supercluster energy = " << electronIter->superCluster()->energy() <<
"\n"
441 <<
"fit results are phi(r) = " << electronIter->phiAtOrigin() <<
" + " << electronIter->phiVsRSlope()
444 <<
" chi2 " << electronIter->chi2() <<
" ndof " << electronIter->ndof() <<
"\n"
445 <<
" Pt " << electronIter->pt() <<
"\n"
446 <<
"P, Px, Py, Pz " << electronIter->p() <<
" " << electronIter->px() <<
" " << electronIter->py()
447 <<
" " << electronIter->pz() <<
"\n"
448 <<
"you get the idea...";
455 double emaxSuperCluster = 0.;
458 double eTotSuperCluster = 0.;
461 basicClusterIter != electronIter->superCluster()->clustersEnd();
462 ++basicClusterIter) {
465 double eCluster = (*basicClusterIter)->energy();
466 if (eCluster > emaxSuperCluster) {
467 emaxSuperCluster = eCluster;
469 eTotSuperCluster += eCluster;
470 double phiCluster = (*basicClusterIter)->position().phi();
471 phibar += eCluster * phiCluster;
472 phi2bar += eCluster * phiCluster * phiCluster;
475 phibar = phibar / eTotSuperCluster;
476 phi2bar = phi2bar / eTotSuperCluster;
477 double phiWidth = phi2bar - phibar * phibar;
491 numCand_->Fill(siStripElectronHandle->size());
497 LogDebug(
"") <<
" About to check Electrons";
507 bool* hasElectron_ =
new bool[siStripElectronHandle->end() - siStripElectronHandle->begin()];
508 for (
int icount = 0; icount < siStripElectronHandle->end() - siStripElectronHandle->begin(); ++icount) {
509 hasElectron_[icount] =
false;
515 unsigned int* Electron_to_strippy =
new unsigned int[
electrons->end() -
electrons->begin()];
517 Electron_to_strippy[icount] = 0;
520 unsigned int ecount = 0;
521 for (reco::ElectronCollection::const_iterator electronIter =
electrons->begin(); electronIter !=
electrons->end();
523 LogDebug(
"") <<
" Associating Electrons to Strippies ";
524 LogDebug(
"") <<
" PT is " << electronIter->track()->pt();
527 uint32_t
id = (*electronIter->track()->recHitsBegin())->geographicalId().rawId();
528 LocalPoint pos = (*electronIter->track()->recHitsBegin())->localPosition();
530 unsigned int icount = 0;
531 LogDebug(
"") <<
" About to loop over Strippies "
533 <<
" icount " << icount <<
" max " << siStripElectronHandle->end() - siStripElectronHandle->begin();
535 for (reco::SiStripElectronCollection::const_iterator strippyiter = siStripElectronHandle->begin();
536 strippyiter != siStripElectronHandle->end();
538 bool hitInCommon =
false;
540 for (std::vector<SiStripRecHit2D>::const_iterator hiter = strippyiter->rphiRecHits().begin();
541 hiter != strippyiter->rphiRecHits().end();
543 if (hiter->geographicalId().rawId() ==
id && (hiter->localPosition() -
pos).
mag() < 1
e-10) {
549 for (std::vector<SiStripRecHit2D>::const_iterator hiter = strippyiter->stereoRecHits().begin();
550 hiter != strippyiter->stereoRecHits().end();
552 if (hiter->geographicalId().rawId() ==
id && (hiter->localPosition() -
pos).
mag() < 1
e-10) {
558 hasElectron_[icount] =
true;
559 Electron_to_strippy[ecount] = icount;
568 LogDebug(
"") <<
" Done looping over Electrons ";
571 for (reco::SiStripElectronCollection::const_iterator strippyIter = siStripElectronHandle->begin();
572 strippyIter != siStripElectronHandle->end();
578 LogDebug(
"") <<
" SiStrip Failed Electron "
580 <<
" p " << strippyIter->p() <<
" \n "
581 <<
" pt " << strippyIter->pt() <<
" \n "
582 <<
" SuperClust size " << strippyIter->superCluster()->clustersSize();
587 LogDebug(
"") <<
" done filling Failed histos ";
596 LogDebug(
"") <<
" SiStrip Passed Electron "
598 <<
" p " << strippyIter->p() <<
" \n "
599 <<
" pt " << strippyIter->pt() <<
" \n "
600 <<
" SuperClust size " << strippyIter->superCluster()->clustersSize();
604 LogDebug(
"") <<
" done filling passed histos ";
616 LogDebug(
"") <<
"Dump info for all electrons ";
618 for (reco::ElectronCollection::const_iterator electronIter1 =
electrons->begin(); electronIter1 !=
electrons->end();
622 unsigned int ecount1 = electronIter1 -
electrons->begin();
623 unsigned int stripCount1 = 0;
624 reco::SiStripElectronCollection::const_iterator strippyIter1;
625 for (reco::SiStripElectronCollection::const_iterator strippyIter = siStripElectronHandle->begin();
626 strippyIter != siStripElectronHandle->end();
628 if (Electron_to_strippy[ecount1] == stripCount1) {
629 strippyIter1 = strippyIter;
636 std::ostringstream
str;
638 str <<
" SiStripElect p , px, py, pz " << strippyIter1->p() <<
" " << strippyIter1->px() <<
" "
639 << strippyIter1->py() <<
" " << strippyIter1->pz() <<
"\n " << std::endl;
641 str <<
" Electron p px, py, pz, = " << tr1->p() <<
" " << tr1->px() <<
" " << tr1->py() <<
" " << tr1->pz()
645 double EClust1 = strippyIter1->superCluster()->energy();
646 double XClust1 = strippyIter1->superCluster()->x();
647 double YClust1 = strippyIter1->superCluster()->y();
648 double ZClust1 = strippyIter1->superCluster()->z();
650 double rho1 =
sqrt(XClust1 * XClust1 + YClust1 * YClust1 + ZClust1 * ZClust1);
651 double costheta1 = ZClust1 / rho1;
652 double sintheta1 =
sqrt(1 - costheta1 * costheta1);
654 sintheta1 = -sintheta1;
656 double cosphi1 = XClust1 /
sqrt(XClust1 * XClust1 + YClust1 * YClust1);
657 double sinphi1 = YClust1 /
sqrt(XClust1 * XClust1 + YClust1 * YClust1);
659 str <<
" Ecal for electron E, px, py, pz " << EClust1 <<
" " << EClust1 * sintheta1 * cosphi1 <<
" "
660 << EClust1 * sintheta1 * sinphi1 <<
" " << EClust1 * costheta1 <<
"\n"
666 LogDebug(
"") <<
"Done Dumping info for all electrons ";
674 edm::LogInfo(
"") <<
" Two electrons in this event " << std::endl;
675 for (reco::ElectronCollection::const_iterator electronIter1 =
electrons->begin();
682 unsigned int ecount1 = electronIter1 -
electrons->begin();
684 unsigned int stripCount1 = 0;
685 reco::SiStripElectronCollection::const_iterator strippyIter1;
686 for (reco::SiStripElectronCollection::const_iterator strippyIter = siStripElectronHandle->begin();
687 strippyIter != siStripElectronHandle->end();
689 if (Electron_to_strippy[ecount1] == stripCount1) {
690 strippyIter1 = strippyIter;
696 double EClust1 = strippyIter1->superCluster()->energy();
697 double XClust1 = strippyIter1->superCluster()->x();
698 double YClust1 = strippyIter1->superCluster()->y();
699 double ZClust1 = strippyIter1->superCluster()->z();
701 for (reco::ElectronCollection::const_iterator electronIter2 = electronIter1 + 1;
706 unsigned int ecount2 = electronIter2 -
electrons->begin();
707 unsigned int stripCount2 = 0;
708 reco::SiStripElectronCollection::const_iterator strippyIter2;
709 for (reco::SiStripElectronCollection::const_iterator strippyIter = siStripElectronHandle->begin();
710 strippyIter != siStripElectronHandle->end();
712 if (Electron_to_strippy[ecount2] == stripCount2) {
713 strippyIter2 = strippyIter;
719 double EClust2 = strippyIter2->superCluster()->energy();
720 double XClust2 = strippyIter2->superCluster()->x();
721 double YClust2 = strippyIter2->superCluster()->y();
722 double ZClust2 = strippyIter2->superCluster()->z();
726 edm::LogInfo(
"") <<
" Electron p1 = " << tr1->p() <<
" p1x " << tr1->px() <<
" p1y " << tr1->py() <<
" p1z "
727 << tr1->pz() << std::endl;
729 edm::LogInfo(
"") <<
" Electron p2 = " << tr2->p() <<
" p2x " << tr2->px() <<
" p2y " << tr2->py() <<
" p2z "
730 << tr2->pz() << std::endl;
733 double Zpx = tr1->px() + tr2->px();
734 double Zpy = tr1->py() + tr2->py();
735 double Zpz = tr1->pz() + tr2->pz();
737 edm::LogInfo(
"") <<
" Z mass " <<
sqrt(Ze * Ze - Zpx * Zpx - Zpy * Zpy - Zpz * Zpz) << std::endl;
740 double rho1 =
sqrt(XClust1 * XClust1 + YClust1 * YClust1 + ZClust1 * ZClust1);
741 double costheta1 = ZClust1 / rho1;
742 double sintheta1 =
sqrt(1 - costheta1 * costheta1);
744 sintheta1 = -sintheta1;
746 double cosphi1 = XClust1 /
sqrt(XClust1 * XClust1 + YClust1 * YClust1);
747 double sinphi1 = YClust1 /
sqrt(XClust1 * XClust1 + YClust1 * YClust1);
749 double rho2 =
sqrt(XClust2 * XClust2 + YClust2 * YClust2 + ZClust2 * ZClust2);
750 double costheta2 = ZClust2 / rho2;
751 double sintheta2 =
sqrt(1 - costheta2 * costheta2);
753 sintheta2 = -sintheta2;
755 double cosphi2 = XClust2 /
sqrt(XClust2 * XClust2 + YClust2 * YClust2);
756 double sinphi2 = YClust2 /
sqrt(XClust2 * XClust2 + YClust2 * YClust2);
758 edm::LogInfo(
"") <<
"Energy of supercluster for 1st electron " << EClust1 <<
" "
759 << EClust1 * sintheta1 * cosphi1 <<
" " << EClust1 * sintheta1 * sinphi1 <<
" "
760 << EClust1 * costheta1 <<
" " << std::endl;
762 edm::LogInfo(
"") <<
"Energy of supercluster for 2nd electron " << EClust2 <<
" "
763 << EClust2 * sintheta2 * cosphi2 <<
" " << EClust2 * sintheta2 * sinphi2 <<
" "
764 << EClust2 * costheta2 <<
" " << std::endl;
767 double Zgpx = EClust1 * sintheta1 * cosphi1 + EClust2 * sintheta2 * cosphi2;
768 double Zgpy = EClust1 * sintheta1 * sinphi1 + EClust2 * sintheta2 * sinphi2;
769 double Zgpz = EClust1 * costheta1 + EClust2 * costheta2;
770 double ZgE = EClust1 + EClust2;
772 edm::LogInfo(
"") <<
" Z mass from ECAL " <<
sqrt(ZgE * ZgE - Zgpx * Zgpx - Zgpy * Zgpy - Zgpz * Zgpz)
779 delete[] hasElectron_;
780 delete[] Electron_to_strippy;
785 LogDebug(
"") <<
" About to dump tracker info ";
803 for (reco::SuperClusterCollection::const_iterator clusterIter = clusterHandle->begin();
804 clusterIter != clusterHandle->end();
806 double energy = clusterIter->energy();
822 LogDebug(
"") <<
" Looping over stereo hits ";
827 hitend = stereoHitsHandle->
data().end();
842 Int_t siLayerNum = 0;
844 string siDetName =
"";
878 const auto& amplitudes = clust->amplitudes();
879 for (
size_t i = 0;
i < amplitudes.size();
i++) {
930 LogDebug(
"") <<
" Looping over Mono Hits ";
934 hitend = rphiHitsHandle->
data().end();
950 Int_t siLayerNum = 0;
952 string siDetName =
"";
986 const auto& amplitudes = clust->amplitudes();
987 for (
size_t i = 0;
i < amplitudes.size();
i++) {
1042 LogDebug(
"") <<
" Loop over Matched Hits ";
1047 hitend = matchedHitsHandle->
data().end();
1060 Int_t siLayerNum = 0;
1062 string siDetName =
"";
1154 LogDebug(
"") <<
"Entering endJob ";
1188 LogDebug(
"") <<
" Writing out ntuple is disabled for now ";