76 numCand_ =
new TH1F(
"numCandidates",
"Number of candidates found", 10, -0.5, 9.5);
77 numElectrons_ =
new TH1F(
"numElectrons",
"Number of Electrons found", 10, -0.5, 9.5);
78 numSuperClusters_ =
new TH1F(
"numSuperClusters",
"Number of Ecal SuperClusters", 50, 0, 50);
81 energySuperClusters_=
new TH1F(
"energySuperClusters",
"Super Cluster Energy - all ", 200 , 0, 2000.);
82 energySuperClustersEl_=
new TH1F(
"energySuperClustersEl",
"Super Cluster Energy - Electron Cands ", 200, 0., 2000.);
85 sizeSuperClusters_=
new TH1F(
"sizeSuperClusters",
"Super Cluster Size - all ", 20, 0, 19);
86 sizeSuperClustersEl_=
new TH1F(
"sizeSuperClustersEl",
"Super Cluster Size - Electron Cands ", 20, 0, 19);
88 emaxSuperClusters_=
new TH1F(
"emaxSuperClusters",
"Super Cluster Emax - all ", 200, 0, 2000.);
89 emaxSuperClustersEl_=
new TH1F(
"emaxSuperClustersEl",
"Super Cluster Emax - Electron Cands ", 200, 0, 2000.);
92 phiWidthSuperClustersEl_ =
new TH1F(
"phiWidthSuperClustersEl",
"Super Cluster Width - Electron Cands ", 20 , 0., 0.05 );
98 ptDiff =
new TH1F(
"ptDiff",
" ptDiff ", 20, -10.,10.);
99 pDiff =
new TH1F(
"pDiff",
" pDiff ", 100, -50.,50.);
102 pElectronFailed =
new TH1F(
"pElectronFailed",
" pElectronFailed ", 55, 0.,110.);
103 ptElectronFailed =
new TH1F(
"ptElectronFailed",
" ptElectronFailed ", 55, 0.,110.);
106 pElectronPassed =
new TH1F(
"pElectronPassed",
" pElectronPassed ", 55, 0.,110.);
107 ptElectronPassed =
new TH1F(
"ptElectronPassed",
" ptElectronPassed ", 55, 0.,110.);
118 eOverPFailed =
new TH1F(
"eOverPFailed",
" E over P - Failed ", 50, 0, 10.) ;
119 eOverPPassed =
new TH1F(
"eOverPPassed",
" E over P - Passed ", 50, 0, 10.) ;
124 numSiStereoHits_ =
new TH1F(
"numSiStereoHits",
"Number of Si StereoHits",100,0,1000);
125 numSiMonoHits_ =
new TH1F(
"numSiMonoHits",
"Number of Si MonoHits",100,0,1000);
126 numSiMatchedHits_ =
new TH1F(
"numSiMatchedHits",
"Number of Si MatchedHits",100,0,1000);
189 myTree_ =
new TTree(
"myTree",
"my first Tree example");
370 << clusterHandle->end()-clusterHandle->begin()
371 <<
" superClusters " ;
373 for (reco::SuperClusterCollection::const_iterator clusterIter = clusterHandle->begin();
374 clusterIter != clusterHandle->end();
376 double energy = clusterIter->energy();
378 std::ostringstream str;
380 str <<
" SuperCluster " << energy <<
" GeV, position "
381 << position <<
" cm" <<
"\n" ;
389 str <<
"About to loop over basicClusters" <<
"\n" ;
391 double emaxSuperCluster = 0. ;
393 double phi2bar = 0. ;
394 double eTotSuperCluster = 0. ;
399 basicClusterIter != clusterIter->clustersEnd() ;
400 ++basicClusterIter ){
404 str <<
" basicCluster Energy " << (*basicClusterIter)->energy()
405 <<
" Position " << (*basicClusterIter)->position()
407 <<
" Position phi " << (*basicClusterIter)->position().phi()
408 <<
" recHits " << (*basicClusterIter)->size()
411 double eCluster = (*basicClusterIter)->energy();
412 if(eCluster > emaxSuperCluster ){
413 emaxSuperCluster = eCluster ;
415 eTotSuperCluster += eCluster ;
416 double phiCluster = (*basicClusterIter)->position().phi() ;
417 phibar += eCluster * phiCluster ;
418 phi2bar += eCluster * phiCluster * phiCluster ;
425 phibar= phibar /eTotSuperCluster ;
426 phi2bar= phi2bar /eTotSuperCluster ;
427 double phiWidth = phi2bar - phibar*phibar ;
433 str <<
" SuperCluster stats " <<
"\n" ;
434 str <<
"phibar " << phibar
435 <<
" phi2bar " << phi2bar
436 <<
" eTotSuperCluster " << eTotSuperCluster
437 <<
" phiWidth " << phiWidth
444 str <<
" Done with this SuperCluster " << std::endl;
450 LogDebug(
"") <<
" End loop over superClusters ";
482 LogDebug(
"") <<
" Dumping Algo's guess of SiStripElectron Candidate Info " ;
483 int numberOfElectrons = 0;
485 LogDebug(
"") <<
" Number of SiStripElectrons " << siStripElectronHandle->size() ;
488 for (reco::SiStripElectronCollection::const_iterator electronIter = siStripElectronHandle->begin();
489 electronIter != siStripElectronHandle->end(); ++electronIter) {
492 LogDebug(
"") <<
"about to get stuff from electroncandidate "
493 << numberOfElectrons <<
"\n"
494 <<
"supercluster energy = "
495 << electronIter->superCluster()->energy() <<
"\n"
496 <<
"fit results are phi(r) = "
497 << electronIter->phiAtOrigin() <<
" + "
498 << electronIter->phiVsRSlope() <<
"*r" <<
"\n"
499 <<
" chi2 " << electronIter->chi2()
500 <<
" ndof " << electronIter->ndof() <<
"\n"
501 <<
" Pt " << electronIter->pt() <<
"\n"
503 << electronIter->p() <<
" "
504 << electronIter->px() <<
" "
505 << electronIter->py() <<
" "
506 << electronIter->pz() <<
"\n"
507 <<
"you get the idea..." ;
514 double emaxSuperCluster = 0. ;
516 double phi2bar = 0. ;
517 double eTotSuperCluster = 0. ;
520 basicClusterIter != electronIter->superCluster()->clustersEnd() ;
521 ++basicClusterIter ){
525 double eCluster = (*basicClusterIter)->energy();
526 if(eCluster > emaxSuperCluster ){
527 emaxSuperCluster = eCluster ;
529 eTotSuperCluster += eCluster ;
530 double phiCluster = (*basicClusterIter)->position().phi() ;
531 phibar += eCluster * phiCluster ;
532 phi2bar += eCluster * phiCluster * phiCluster ;
536 phibar=phibar/eTotSuperCluster ;
537 phi2bar=phi2bar/eTotSuperCluster ;
538 double phiWidth = phi2bar - phibar*phibar ;
552 numCand_->Fill(siStripElectronHandle->size());
560 LogDebug(
"")<<
" About to check Electrons" ;
570 bool* hasElectron_ =
new bool[siStripElectronHandle->end()- siStripElectronHandle->begin()] ;
571 for (
int icount = 0 ;
572 icount < siStripElectronHandle->end()- siStripElectronHandle->begin() ;
574 { hasElectron_[icount] =
false ;}
579 unsigned int* Electron_to_strippy =
new unsigned int[
electrons->end()-
electrons->begin()];
580 for (
int icount = 0 ;
582 { Electron_to_strippy[icount] = 0 ;}
584 unsigned int ecount=0 ;
585 for (reco::ElectronCollection::const_iterator electronIter =
electrons->begin();
586 electronIter !=
electrons->end(); ++electronIter ){
589 LogDebug(
"")<<
" Associating Electrons to Strippies " ;
590 LogDebug(
"")<<
" PT is " << electronIter->track()->pt() ;
593 uint32_t
id = (*electronIter->track()->recHitsBegin())->geographicalId().rawId();
594 LocalPoint pos = (*electronIter->track()->recHitsBegin())->localPosition();
596 unsigned int icount = 0 ;
597 LogDebug(
"") <<
" About to loop over Strippies " <<
" \n "
598 <<
" icount " << icount
599 <<
" max " << siStripElectronHandle->end()- siStripElectronHandle->begin() ;
601 for (reco::SiStripElectronCollection::const_iterator strippyiter = siStripElectronHandle->begin();
602 strippyiter != siStripElectronHandle->end(); ++strippyiter) {
604 bool hitInCommon =
false;
606 for (std::vector<SiStripRecHit2D>::const_iterator
607 hiter = strippyiter->rphiRecHits().begin();
608 hiter != strippyiter->rphiRecHits().end();
610 if (hiter->geographicalId().rawId() ==
id &&
611 (hiter->localPosition() -
pos).
mag() < 1
e-10) {
617 for (std::vector<SiStripRecHit2D>::const_iterator
618 hiter = strippyiter->stereoRecHits().begin();
619 hiter != strippyiter->stereoRecHits().end();
621 if (hiter->geographicalId().rawId() ==
id &&
622 (hiter->localPosition() -
pos).
mag() < 1
e-10) {
628 hasElectron_[icount] =
true ;
629 Electron_to_strippy[ecount]= icount ;
639 LogDebug(
"") <<
" Done looping over Electrons " ;
642 unsigned int counter = 0 ;
643 for (reco::SiStripElectronCollection::const_iterator strippyIter = siStripElectronHandle->begin(); strippyIter != siStripElectronHandle->end(); ++strippyIter) {
646 bool skipThis = !hasElectron_[counter] ;
650 LogDebug(
"") <<
" SiStrip Failed Electron " <<
" \n " <<
651 " p " << strippyIter->p() <<
" \n " <<
652 " pt " << strippyIter->pt() <<
" \n " <<
653 " SuperClust size " << strippyIter->superCluster()->clustersSize() ;
658 LogDebug(
"") <<
" done filling Failed histos " ;
667 LogDebug(
"") <<
" SiStrip Passed Electron " <<
" \n " <<
668 " p " << strippyIter->p() <<
" \n " <<
669 " pt " << strippyIter->pt() <<
" \n " <<
670 " SuperClust size " << strippyIter->superCluster()->clustersSize() ;
674 LogDebug(
"") <<
" done filling passed histos " ;
686 LogDebug(
"")<<
"Dump info for all electrons ";
688 for (reco::ElectronCollection::const_iterator electronIter1 =
electrons->begin();
689 electronIter1 !=
electrons->end(); ++electronIter1 ){
692 unsigned int ecount1= electronIter1-
electrons->begin() ;
693 unsigned int stripCount1 = 0 ;
694 reco::SiStripElectronCollection::const_iterator strippyIter1 ;
695 for (reco::SiStripElectronCollection::const_iterator strippyIter = siStripElectronHandle->begin();
696 strippyIter != siStripElectronHandle->end(); ++strippyIter) {
697 if(Electron_to_strippy[ecount1]==stripCount1 ) {
698 strippyIter1 = strippyIter ;
704 std::ostringstream str;
707 str <<
" SiStripElect p , px, py, pz " << strippyIter1->p()
708 <<
" " << strippyIter1->px()
709 <<
" " << strippyIter1->py()
710 <<
" " << strippyIter1->pz()
711 <<
"\n " << std::endl ;
714 str <<
" Electron p px, py, pz, = " << tr1->p()
718 <<
"\n" << std::endl ;
721 double EClust1 = strippyIter1->superCluster()->energy() ;
722 double XClust1 = strippyIter1->superCluster()->x();
723 double YClust1 = strippyIter1->superCluster()->y();
724 double ZClust1 = strippyIter1->superCluster()->z();
726 double rho1 =
sqrt(XClust1*XClust1+YClust1*YClust1+ZClust1*ZClust1) ;
727 double costheta1 = ZClust1/rho1 ;
728 double sintheta1 =
sqrt(1-costheta1*costheta1);
729 if(ZClust1<0 ) { sintheta1 = - sintheta1 ; }
730 double cosphi1 = XClust1/
sqrt(XClust1*XClust1+YClust1*YClust1);
731 double sinphi1 = YClust1/
sqrt(XClust1*XClust1+YClust1*YClust1);
733 str <<
" Ecal for electron E, px, py, pz "
735 << EClust1*sintheta1*cosphi1 <<
" "
736 << EClust1*sintheta1*sinphi1 <<
" "
738 <<
"\n" << std::endl ;
743 LogDebug(
"")<<
"Done Dumping info for all electrons ";
751 edm::LogInfo(
"") <<
" Two electrons in this event " << std::endl;
752 for (reco::ElectronCollection::const_iterator electronIter1 =
electrons->begin();
753 electronIter1 !=
electrons->end()-1; ++electronIter1 ){
758 unsigned int ecount1= electronIter1-
electrons->begin() ;
760 unsigned int stripCount1 = 0 ;
761 reco::SiStripElectronCollection::const_iterator strippyIter1 ;
762 for (reco::SiStripElectronCollection::const_iterator strippyIter = siStripElectronHandle->begin(); strippyIter != siStripElectronHandle->end(); ++strippyIter) {
763 if(Electron_to_strippy[ecount1]==stripCount1 ) {
764 strippyIter1 = strippyIter ;
769 double EClust1 = strippyIter1->superCluster()->energy() ;
770 double XClust1 = strippyIter1->superCluster()->x();
771 double YClust1 = strippyIter1->superCluster()->y();
772 double ZClust1 = strippyIter1->superCluster()->z();
774 for (reco::ElectronCollection::const_iterator electronIter2 = electronIter1+1;
775 electronIter2 !=
electrons->end(); ++electronIter2 ){
779 unsigned int ecount2= electronIter2-
electrons->begin() ;
780 unsigned int stripCount2 = 0 ;
781 reco::SiStripElectronCollection::const_iterator strippyIter2 ;
782 for (reco::SiStripElectronCollection::const_iterator strippyIter = siStripElectronHandle->begin(); strippyIter != siStripElectronHandle->end(); ++strippyIter) {
783 if(Electron_to_strippy[ecount2]==stripCount2 ) {
784 strippyIter2 = strippyIter ;
791 double EClust2 = strippyIter2->superCluster()->energy() ;
792 double XClust2 = strippyIter2->superCluster()->x();
793 double YClust2 = strippyIter2->superCluster()->y();
794 double ZClust2 = strippyIter2->superCluster()->z();
801 <<
" p1x " << tr1->px()
802 <<
" p1y " << tr1->py()
803 <<
" p1z " << tr1->pz()
808 <<
" p2x " << tr2->px()
809 <<
" p2y " << tr2->py()
810 <<
" p2z " << tr2->pz()
815 double Zpx = tr1->px()+tr2->px() ;
816 double Zpy = tr1->py()+tr2->py() ;
817 double Zpz = tr1->pz()+tr2->pz() ;
820 sqrt(Ze*Ze-Zpx*Zpx-Zpy*Zpy-Zpz*Zpz) << std::endl ;
823 double rho1 =
sqrt(XClust1*XClust1+YClust1*YClust1+ZClust1*ZClust1) ;
824 double costheta1 = ZClust1/rho1 ;
825 double sintheta1 =
sqrt(1-costheta1*costheta1);
826 if(ZClust1<0 ) { sintheta1 = - sintheta1 ; }
827 double cosphi1 = XClust1/
sqrt(XClust1*XClust1+YClust1*YClust1);
828 double sinphi1 = YClust1/
sqrt(XClust1*XClust1+YClust1*YClust1);
830 double rho2 =
sqrt(XClust2*XClust2+YClust2*YClust2+ZClust2*ZClust2) ;
831 double costheta2 = ZClust2/rho2 ;
832 double sintheta2 =
sqrt(1-costheta2*costheta2);
833 if(ZClust2<0 ) { sintheta2 = - sintheta2 ; }
834 double cosphi2 = XClust2/
sqrt(XClust2*XClust2+YClust2*YClust2);
835 double sinphi2 = YClust2/
sqrt(XClust2*XClust2+YClust2*YClust2);
837 edm::LogInfo(
"") <<
"Energy of supercluster for 1st electron "
839 << EClust1*sintheta1*cosphi1 <<
" "
840 << EClust1*sintheta1*sinphi1 <<
" "
841 << EClust1*costheta1 <<
" "
844 edm::LogInfo(
"") <<
"Energy of supercluster for 2nd electron "
846 << EClust2*sintheta2*cosphi2 <<
" "
847 << EClust2*sintheta2*sinphi2 <<
" "
848 << EClust2*costheta2 <<
" "
853 double Zgpx = EClust1*sintheta1*cosphi1+EClust2*sintheta2*cosphi2 ;
854 double Zgpy = EClust1*sintheta1*sinphi1+EClust2*sintheta2*sinphi2 ;
855 double Zgpz = EClust1*costheta1+EClust2*costheta2 ;
856 double ZgE = EClust1+EClust2 ;
859 sqrt(ZgE*ZgE-Zgpx*Zgpx-Zgpy*Zgpy-Zgpz*Zgpz) << std::endl ;
866 delete[] hasElectron_;
867 delete[] Electron_to_strippy;
872 LogDebug(
"") <<
" About to dump tracker info " ;
890 for (reco::SuperClusterCollection::const_iterator clusterIter = clusterHandle->begin();
891 clusterIter != clusterHandle->end();
893 double energy = clusterIter->energy();
911 LogDebug(
"") <<
" Looping over stereo hits " ;
930 Int_t siLayerNum = 0 ;
932 string siDetName =
"" ;
966 const std::vector<uint8_t> amplitudes=clust->amplitudes();
967 for(
size_t i = 0 ;
i<amplitudes.size();
i++ ){
968 Signal +=amplitudes[
i] ;
1019 LogDebug(
"") <<
" Looping over Mono Hits " ;
1038 Int_t siLayerNum = 0 ;
1039 Int_t siDetNum = 0 ;
1040 string siDetName =
"" ;
1064 siDetName =
"NULL" ;
1070 int StripCount = 0 ;
1074 const std::vector<uint8_t> amplitudes=clust->amplitudes();
1075 for(
size_t i = 0 ;
i<amplitudes.size();
i++ ){
1076 Signal +=amplitudes[
i] ;
1132 LogDebug(
"") <<
" Loop over Matched Hits " ;
1148 Int_t siLayerNum = 0 ;
1149 Int_t siDetNum = 0 ;
1150 string siDetName =
"" ;
1172 siDetName =
"NULL" ;
1177 int StripCount = 0 ;
1254 LogDebug(
"") <<
"Entering endJob " ;
1289 LogDebug(
"") <<
" Writing out ntuple is disabled for now " ;
TH1F * sizeSuperClustersEl_
float MatchedHitTheta_[1000]
T getParameter(std::string const &) const
std::string superClusterCollection_
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
float StereoHitSigX_[1000]
unsigned int layer() const
layer id
TH1F * emaxSuperClusters_
float MonoHitTheta_[1000]
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
float MatchedHitSigY_[1000]
SiStripElectronAnalyzer(const edm::ParameterSet &)
int StereoDetector_[1000]
std::string siElectronCollection_
Geom::Phi< T > phi() const
virtual void initNtuple(void)
int MatchedDetector_[1000]
TH1F * energySuperClustersEl_
float MonoHitSignal_[1000]
TH1F * sizeSuperClustersPassed
Geom::Theta< T > theta() const
~SiStripElectronAnalyzer()
bool isNonnull() const
Checks for non-null.
std::string eBRecHitProducer_
virtual LocalError localPositionError() const
float StereoHitSignal_[1000]
TH1F * energySuperClusters_
std::string mctruthCollection_
TH1F * emaxSuperClustersEl_
std::string superClusterProducer_
std::string eBRecHitCollection_
float StereoHitNoise_[1000]
ClusterRef cluster() const
std::string mctruthProducer_
std::string siMatchedHitCollection_
float StereoHitSigY_[1000]
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
TH1F * sizeSuperClusters_
std::string siRphiHitCollection_
float StereoHitTheta_[1000]
std::string siStereoHitCollection_
TH1F * phiWidthSuperClusters_
TH1F * sizeSuperClustersFailed
int StereoHitWidth_[1000]
XYZPointD XYZPoint
point in space with cartesian internal representation
float MatchedHitNoise_[1000]
float MonoHitNoise_[1000]
float MatchedHitSignal_[1000]
TH1F * energySuperClustersFailed
float StereoHitCorr_[1000]
virtual void endJob(void)
unsigned int layer() const
layer id
std::string electronProducer_
std::string electronCollection_
static int position[264][3]
int MatchedHitWidth_[1000]
TH1F * phiWidthSuperClustersEl_
float MatchedHitSigX_[1000]
float MatchedHitCorr_[1000]
virtual void analyze(const edm::Event &, const edm::EventSetup &)
float StereoHitPhi_[1000]
std::string siHitProducer_
Power< A, B >::type pow(const A &a, const B &b)
std::string siElectronProducer_
TH1F * energySuperClustersPassed
float MatchedHitPhi_[1000]