73 numCand_ =
new TH1F(
"numCandidates",
"Number of candidates found", 10, -0.5, 9.5);
74 numElectrons_ =
new TH1F(
"numElectrons",
"Number of Electrons found", 10, -0.5, 9.5);
75 numSuperClusters_ =
new TH1F(
"numSuperClusters",
"Number of Ecal SuperClusters", 50, 0, 50);
78 energySuperClusters_=
new TH1F(
"energySuperClusters",
"Super Cluster Energy - all ", 200 , 0, 2000.);
79 energySuperClustersEl_=
new TH1F(
"energySuperClustersEl",
"Super Cluster Energy - Electron Cands ", 200, 0., 2000.);
82 sizeSuperClusters_=
new TH1F(
"sizeSuperClusters",
"Super Cluster Size - all ", 20, 0, 19);
83 sizeSuperClustersEl_=
new TH1F(
"sizeSuperClustersEl",
"Super Cluster Size - Electron Cands ", 20, 0, 19);
85 emaxSuperClusters_=
new TH1F(
"emaxSuperClusters",
"Super Cluster Emax - all ", 200, 0, 2000.);
86 emaxSuperClustersEl_=
new TH1F(
"emaxSuperClustersEl",
"Super Cluster Emax - Electron Cands ", 200, 0, 2000.);
89 phiWidthSuperClustersEl_ =
new TH1F(
"phiWidthSuperClustersEl",
"Super Cluster Width - Electron Cands ", 20 , 0., 0.05 );
95 ptDiff =
new TH1F(
"ptDiff",
" ptDiff ", 20, -10.,10.);
96 pDiff =
new TH1F(
"pDiff",
" pDiff ", 100, -50.,50.);
99 pElectronFailed =
new TH1F(
"pElectronFailed",
" pElectronFailed ", 55, 0.,110.);
100 ptElectronFailed =
new TH1F(
"ptElectronFailed",
" ptElectronFailed ", 55, 0.,110.);
103 pElectronPassed =
new TH1F(
"pElectronPassed",
" pElectronPassed ", 55, 0.,110.);
104 ptElectronPassed =
new TH1F(
"ptElectronPassed",
" ptElectronPassed ", 55, 0.,110.);
115 eOverPFailed =
new TH1F(
"eOverPFailed",
" E over P - Failed ", 50, 0, 10.) ;
116 eOverPPassed =
new TH1F(
"eOverPPassed",
" E over P - Passed ", 50, 0, 10.) ;
121 numSiStereoHits_ =
new TH1F(
"numSiStereoHits",
"Number of Si StereoHits",100,0,1000);
122 numSiMonoHits_ =
new TH1F(
"numSiMonoHits",
"Number of Si MonoHits",100,0,1000);
123 numSiMatchedHits_ =
new TH1F(
"numSiMatchedHits",
"Number of Si MatchedHits",100,0,1000);
186 myTree_ =
new TTree(
"myTree",
"my first Tree example");
372 << clusterHandle->end()-clusterHandle->begin()
373 <<
" superClusters " ;
375 for (reco::SuperClusterCollection::const_iterator clusterIter = clusterHandle->begin();
376 clusterIter != clusterHandle->end();
378 double energy = clusterIter->energy();
380 std::ostringstream str;
382 str <<
" SuperCluster " << energy <<
" GeV, position "
383 << position <<
" cm" <<
"\n" ;
391 str <<
"About to loop over basicClusters" <<
"\n" ;
393 double emaxSuperCluster = 0. ;
395 double phi2bar = 0. ;
396 double eTotSuperCluster = 0. ;
401 basicClusterIter != clusterIter->clustersEnd() ;
402 ++basicClusterIter ){
406 str <<
" basicCluster Energy " << (*basicClusterIter)->energy()
407 <<
" Position " << (*basicClusterIter)->position()
409 <<
" Position phi " << (*basicClusterIter)->position().phi()
410 <<
" recHits " << (*basicClusterIter)->size()
413 double eCluster = (*basicClusterIter)->energy();
414 if(eCluster > emaxSuperCluster ){
415 emaxSuperCluster = eCluster ;
417 eTotSuperCluster += eCluster ;
418 double phiCluster = (*basicClusterIter)->position().phi() ;
419 phibar += eCluster * phiCluster ;
420 phi2bar += eCluster * phiCluster * phiCluster ;
427 phibar= phibar /eTotSuperCluster ;
428 phi2bar= phi2bar /eTotSuperCluster ;
429 double phiWidth = phi2bar - phibar*phibar ;
435 str <<
" SuperCluster stats " <<
"\n" ;
436 str <<
"phibar " << phibar
437 <<
" phi2bar " << phi2bar
438 <<
" eTotSuperCluster " << eTotSuperCluster
439 <<
" phiWidth " << phiWidth
446 str <<
" Done with this SuperCluster " << std::endl;
452 LogDebug(
"") <<
" End loop over superClusters ";
484 LogDebug(
"") <<
" Dumping Algo's guess of SiStripElectron Candidate Info " ;
485 int numberOfElectrons = 0;
487 LogDebug(
"") <<
" Number of SiStripElectrons " << siStripElectronHandle->size() ;
490 for (reco::SiStripElectronCollection::const_iterator electronIter = siStripElectronHandle->begin();
491 electronIter != siStripElectronHandle->end(); ++electronIter) {
494 LogDebug(
"") <<
"about to get stuff from electroncandidate "
495 << numberOfElectrons <<
"\n"
496 <<
"supercluster energy = "
497 << electronIter->superCluster()->energy() <<
"\n"
498 <<
"fit results are phi(r) = "
499 << electronIter->phiAtOrigin() <<
" + "
500 << electronIter->phiVsRSlope() <<
"*r" <<
"\n"
501 <<
" chi2 " << electronIter->chi2()
502 <<
" ndof " << electronIter->ndof() <<
"\n"
503 <<
" Pt " << electronIter->pt() <<
"\n"
505 << electronIter->p() <<
" "
506 << electronIter->px() <<
" "
507 << electronIter->py() <<
" "
508 << electronIter->pz() <<
"\n"
509 <<
"you get the idea..." ;
516 double emaxSuperCluster = 0. ;
518 double phi2bar = 0. ;
519 double eTotSuperCluster = 0. ;
522 basicClusterIter != electronIter->superCluster()->clustersEnd() ;
523 ++basicClusterIter ){
527 double eCluster = (*basicClusterIter)->energy();
528 if(eCluster > emaxSuperCluster ){
529 emaxSuperCluster = eCluster ;
531 eTotSuperCluster += eCluster ;
532 double phiCluster = (*basicClusterIter)->position().phi() ;
533 phibar += eCluster * phiCluster ;
534 phi2bar += eCluster * phiCluster * phiCluster ;
538 phibar=phibar/eTotSuperCluster ;
539 phi2bar=phi2bar/eTotSuperCluster ;
540 double phiWidth = phi2bar - phibar*phibar ;
554 numCand_->Fill(siStripElectronHandle->size());
562 LogDebug(
"")<<
" About to check Electrons" ;
572 bool* hasElectron_ =
new bool[siStripElectronHandle->end()- siStripElectronHandle->begin()] ;
573 for (
int icount = 0 ;
574 icount < siStripElectronHandle->end()- siStripElectronHandle->begin() ;
576 { hasElectron_[icount] =
false ;}
581 unsigned int* Electron_to_strippy =
new unsigned int[
electrons->end()-
electrons->begin()];
582 for (
int icount = 0 ;
584 { Electron_to_strippy[icount] = 0 ;}
586 unsigned int ecount=0 ;
587 for (reco::ElectronCollection::const_iterator electronIter =
electrons->begin();
588 electronIter !=
electrons->end(); ++electronIter ){
591 LogDebug(
"")<<
" Associating Electrons to Strippies " ;
592 LogDebug(
"")<<
" PT is " << electronIter->track()->pt() ;
595 uint32_t
id = (*electronIter->track()->recHitsBegin())->geographicalId().rawId();
596 LocalPoint pos = (*electronIter->track()->recHitsBegin())->localPosition();
598 unsigned int icount = 0 ;
599 LogDebug(
"") <<
" About to loop over Strippies " <<
" \n "
600 <<
" icount " << icount
601 <<
" max " << siStripElectronHandle->end()- siStripElectronHandle->begin() ;
603 for (reco::SiStripElectronCollection::const_iterator strippyiter = siStripElectronHandle->begin();
604 strippyiter != siStripElectronHandle->end(); ++strippyiter) {
606 bool hitInCommon =
false;
608 for (std::vector<SiStripRecHit2D>::const_iterator
609 hiter = strippyiter->rphiRecHits().begin();
610 hiter != strippyiter->rphiRecHits().end();
612 if (hiter->geographicalId().rawId() ==
id &&
613 (hiter->localPosition() - pos).
mag() < 1
e-10) {
619 for (std::vector<SiStripRecHit2D>::const_iterator
620 hiter = strippyiter->stereoRecHits().begin();
621 hiter != strippyiter->stereoRecHits().end();
623 if (hiter->geographicalId().rawId() ==
id &&
624 (hiter->localPosition() - pos).
mag() < 1
e-10) {
630 hasElectron_[icount] =
true ;
631 Electron_to_strippy[ecount]= icount ;
641 LogDebug(
"") <<
" Done looping over Electrons " ;
645 for (reco::SiStripElectronCollection::const_iterator strippyIter = siStripElectronHandle->begin(); strippyIter != siStripElectronHandle->end(); ++strippyIter) {
648 bool skipThis = !hasElectron_[
counter] ;
652 LogDebug(
"") <<
" SiStrip Failed Electron " <<
" \n " <<
653 " p " << strippyIter->p() <<
" \n " <<
654 " pt " << strippyIter->pt() <<
" \n " <<
655 " SuperClust size " << strippyIter->superCluster()->clustersSize() ;
660 LogDebug(
"") <<
" done filling Failed histos " ;
669 LogDebug(
"") <<
" SiStrip Passed Electron " <<
" \n " <<
670 " p " << strippyIter->p() <<
" \n " <<
671 " pt " << strippyIter->pt() <<
" \n " <<
672 " SuperClust size " << strippyIter->superCluster()->clustersSize() ;
676 LogDebug(
"") <<
" done filling passed histos " ;
688 LogDebug(
"")<<
"Dump info for all electrons ";
690 for (reco::ElectronCollection::const_iterator electronIter1 =
electrons->begin();
691 electronIter1 !=
electrons->end(); ++electronIter1 ){
694 unsigned int ecount1= electronIter1-
electrons->begin() ;
695 unsigned int stripCount1 = 0 ;
696 reco::SiStripElectronCollection::const_iterator strippyIter1 ;
697 for (reco::SiStripElectronCollection::const_iterator strippyIter = siStripElectronHandle->begin();
698 strippyIter != siStripElectronHandle->end(); ++strippyIter) {
699 if(Electron_to_strippy[ecount1]==stripCount1 ) {
700 strippyIter1 = strippyIter ;
706 std::ostringstream str;
709 str <<
" SiStripElect p , px, py, pz " << strippyIter1->p()
710 <<
" " << strippyIter1->px()
711 <<
" " << strippyIter1->py()
712 <<
" " << strippyIter1->pz()
713 <<
"\n " << std::endl ;
716 str <<
" Electron p px, py, pz, = " << tr1->p()
720 <<
"\n" << std::endl ;
723 double EClust1 = strippyIter1->superCluster()->energy() ;
724 double XClust1 = strippyIter1->superCluster()->x();
725 double YClust1 = strippyIter1->superCluster()->y();
726 double ZClust1 = strippyIter1->superCluster()->z();
728 double rho1 =
sqrt(XClust1*XClust1+YClust1*YClust1+ZClust1*ZClust1) ;
729 double costheta1 = ZClust1/rho1 ;
730 double sintheta1 =
sqrt(1-costheta1*costheta1);
731 if(ZClust1<0 ) { sintheta1 = - sintheta1 ; }
732 double cosphi1 = XClust1/
sqrt(XClust1*XClust1+YClust1*YClust1);
733 double sinphi1 = YClust1/
sqrt(XClust1*XClust1+YClust1*YClust1);
735 str <<
" Ecal for electron E, px, py, pz "
737 << EClust1*sintheta1*cosphi1 <<
" "
738 << EClust1*sintheta1*sinphi1 <<
" "
740 <<
"\n" << std::endl ;
745 LogDebug(
"")<<
"Done Dumping info for all electrons ";
753 edm::LogInfo(
"") <<
" Two electrons in this event " << std::endl;
754 for (reco::ElectronCollection::const_iterator electronIter1 =
electrons->begin();
755 electronIter1 !=
electrons->end()-1; ++electronIter1 ){
760 unsigned int ecount1= electronIter1-
electrons->begin() ;
762 unsigned int stripCount1 = 0 ;
763 reco::SiStripElectronCollection::const_iterator strippyIter1 ;
764 for (reco::SiStripElectronCollection::const_iterator strippyIter = siStripElectronHandle->begin(); strippyIter != siStripElectronHandle->end(); ++strippyIter) {
765 if(Electron_to_strippy[ecount1]==stripCount1 ) {
766 strippyIter1 = strippyIter ;
771 double EClust1 = strippyIter1->superCluster()->energy() ;
772 double XClust1 = strippyIter1->superCluster()->x();
773 double YClust1 = strippyIter1->superCluster()->y();
774 double ZClust1 = strippyIter1->superCluster()->z();
776 for (reco::ElectronCollection::const_iterator electronIter2 = electronIter1+1;
777 electronIter2 !=
electrons->end(); ++electronIter2 ){
781 unsigned int ecount2= electronIter2-
electrons->begin() ;
782 unsigned int stripCount2 = 0 ;
783 reco::SiStripElectronCollection::const_iterator strippyIter2 ;
784 for (reco::SiStripElectronCollection::const_iterator strippyIter = siStripElectronHandle->begin(); strippyIter != siStripElectronHandle->end(); ++strippyIter) {
785 if(Electron_to_strippy[ecount2]==stripCount2 ) {
786 strippyIter2 = strippyIter ;
793 double EClust2 = strippyIter2->superCluster()->energy() ;
794 double XClust2 = strippyIter2->superCluster()->x();
795 double YClust2 = strippyIter2->superCluster()->y();
796 double ZClust2 = strippyIter2->superCluster()->z();
803 <<
" p1x " << tr1->px()
804 <<
" p1y " << tr1->py()
805 <<
" p1z " << tr1->pz()
810 <<
" p2x " << tr2->px()
811 <<
" p2y " << tr2->py()
812 <<
" p2z " << tr2->pz()
817 double Zpx = tr1->px()+tr2->px() ;
818 double Zpy = tr1->py()+tr2->py() ;
819 double Zpz = tr1->pz()+tr2->pz() ;
822 sqrt(Ze*Ze-Zpx*Zpx-Zpy*Zpy-Zpz*Zpz) << std::endl ;
825 double rho1 =
sqrt(XClust1*XClust1+YClust1*YClust1+ZClust1*ZClust1) ;
826 double costheta1 = ZClust1/rho1 ;
827 double sintheta1 =
sqrt(1-costheta1*costheta1);
828 if(ZClust1<0 ) { sintheta1 = - sintheta1 ; }
829 double cosphi1 = XClust1/
sqrt(XClust1*XClust1+YClust1*YClust1);
830 double sinphi1 = YClust1/
sqrt(XClust1*XClust1+YClust1*YClust1);
832 double rho2 =
sqrt(XClust2*XClust2+YClust2*YClust2+ZClust2*ZClust2) ;
833 double costheta2 = ZClust2/rho2 ;
834 double sintheta2 =
sqrt(1-costheta2*costheta2);
835 if(ZClust2<0 ) { sintheta2 = - sintheta2 ; }
836 double cosphi2 = XClust2/
sqrt(XClust2*XClust2+YClust2*YClust2);
837 double sinphi2 = YClust2/
sqrt(XClust2*XClust2+YClust2*YClust2);
839 edm::LogInfo(
"") <<
"Energy of supercluster for 1st electron "
841 << EClust1*sintheta1*cosphi1 <<
" "
842 << EClust1*sintheta1*sinphi1 <<
" "
843 << EClust1*costheta1 <<
" "
846 edm::LogInfo(
"") <<
"Energy of supercluster for 2nd electron "
848 << EClust2*sintheta2*cosphi2 <<
" "
849 << EClust2*sintheta2*sinphi2 <<
" "
850 << EClust2*costheta2 <<
" "
855 double Zgpx = EClust1*sintheta1*cosphi1+EClust2*sintheta2*cosphi2 ;
856 double Zgpy = EClust1*sintheta1*sinphi1+EClust2*sintheta2*sinphi2 ;
857 double Zgpz = EClust1*costheta1+EClust2*costheta2 ;
858 double ZgE = EClust1+EClust2 ;
861 sqrt(ZgE*ZgE-Zgpx*Zgpx-Zgpy*Zgpy-Zgpz*Zgpz) << std::endl ;
868 delete[] hasElectron_;
869 delete[] Electron_to_strippy;
874 LogDebug(
"") <<
" About to dump tracker info " ;
892 for (reco::SuperClusterCollection::const_iterator clusterIter = clusterHandle->begin();
893 clusterIter != clusterHandle->end();
895 double energy = clusterIter->energy();
913 LogDebug(
"") <<
" Looping over stereo hits " ;
932 Int_t siLayerNum = 0 ;
934 string siDetName =
"" ;
937 siLayerNum = tTopo->tibLayer(
id);
941 siLayerNum = tTopo->tobLayer(
id);
968 const std::vector<uint8_t> amplitudes=clust->amplitudes();
969 for(
size_t i = 0 ;
i<amplitudes.size();
i++ ){
970 Signal +=amplitudes[
i] ;
1021 LogDebug(
"") <<
" Looping over Mono Hits " ;
1040 Int_t siLayerNum = 0 ;
1041 Int_t siDetNum = 0 ;
1042 string siDetName =
"" ;
1045 siLayerNum = tTopo->tibLayer(
id);
1049 siLayerNum = tTopo->tobLayer(
id);
1066 siDetName =
"NULL" ;
1072 int StripCount = 0 ;
1076 const std::vector<uint8_t> amplitudes=clust->amplitudes();
1077 for(
size_t i = 0 ;
i<amplitudes.size();
i++ ){
1078 Signal +=amplitudes[
i] ;
1134 LogDebug(
"") <<
" Loop over Matched Hits " ;
1150 Int_t siLayerNum = 0 ;
1151 Int_t siDetNum = 0 ;
1152 string siDetName =
"" ;
1154 siLayerNum = tTopo->tibLayer(
id);
1158 siLayerNum = tTopo->tobLayer(
id);
1174 siDetName =
"NULL" ;
1179 int StripCount = 0 ;
1256 LogDebug(
"") <<
"Entering endJob " ;
1291 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]
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_
Abs< T >::type abs(const T &t)
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)
std::string electronProducer_
std::string electronCollection_
static std::atomic< unsigned int > counter
static int position[264][3]
int MatchedHitWidth_[1000]
TH1F * phiWidthSuperClustersEl_
float MatchedHitSigX_[1000]
float MatchedHitCorr_[1000]
volatile std::atomic< bool > shutdown_flag false
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]