74 numCand_ =
new TH1F(
"numCandidates",
"Number of candidates found", 10, -0.5, 9.5);
75 numElectrons_ =
new TH1F(
"numElectrons",
"Number of Electrons found", 10, -0.5, 9.5);
76 numSuperClusters_ =
new TH1F(
"numSuperClusters",
"Number of Ecal SuperClusters", 50, 0, 50);
79 energySuperClusters_=
new TH1F(
"energySuperClusters",
"Super Cluster Energy - all ", 200 , 0, 2000.);
80 energySuperClustersEl_=
new TH1F(
"energySuperClustersEl",
"Super Cluster Energy - Electron Cands ", 200, 0., 2000.);
83 sizeSuperClusters_=
new TH1F(
"sizeSuperClusters",
"Super Cluster Size - all ", 20, 0, 19);
84 sizeSuperClustersEl_=
new TH1F(
"sizeSuperClustersEl",
"Super Cluster Size - Electron Cands ", 20, 0, 19);
86 emaxSuperClusters_=
new TH1F(
"emaxSuperClusters",
"Super Cluster Emax - all ", 200, 0, 2000.);
87 emaxSuperClustersEl_=
new TH1F(
"emaxSuperClustersEl",
"Super Cluster Emax - Electron Cands ", 200, 0, 2000.);
90 phiWidthSuperClustersEl_ =
new TH1F(
"phiWidthSuperClustersEl",
"Super Cluster Width - Electron Cands ", 20 , 0., 0.05 );
96 ptDiff =
new TH1F(
"ptDiff",
" ptDiff ", 20, -10.,10.);
97 pDiff =
new TH1F(
"pDiff",
" pDiff ", 100, -50.,50.);
100 pElectronFailed =
new TH1F(
"pElectronFailed",
" pElectronFailed ", 55, 0.,110.);
101 ptElectronFailed =
new TH1F(
"ptElectronFailed",
" ptElectronFailed ", 55, 0.,110.);
104 pElectronPassed =
new TH1F(
"pElectronPassed",
" pElectronPassed ", 55, 0.,110.);
105 ptElectronPassed =
new TH1F(
"ptElectronPassed",
" ptElectronPassed ", 55, 0.,110.);
116 eOverPFailed =
new TH1F(
"eOverPFailed",
" E over P - Failed ", 50, 0, 10.) ;
117 eOverPPassed =
new TH1F(
"eOverPPassed",
" E over P - Passed ", 50, 0, 10.) ;
122 numSiStereoHits_ =
new TH1F(
"numSiStereoHits",
"Number of Si StereoHits",100,0,1000);
123 numSiMonoHits_ =
new TH1F(
"numSiMonoHits",
"Number of Si MonoHits",100,0,1000);
124 numSiMatchedHits_ =
new TH1F(
"numSiMatchedHits",
"Number of Si MatchedHits",100,0,1000);
187 myTree_ =
new TTree(
"myTree",
"my first Tree example");
373 << clusterHandle->end()-clusterHandle->begin()
374 <<
" superClusters " ;
376 for (reco::SuperClusterCollection::const_iterator clusterIter = clusterHandle->begin();
377 clusterIter != clusterHandle->end();
379 double energy = clusterIter->energy();
381 std::ostringstream str;
383 str <<
" SuperCluster " << energy <<
" GeV, position "
384 << position <<
" cm" <<
"\n" ;
392 str <<
"About to loop over basicClusters" <<
"\n" ;
394 double emaxSuperCluster = 0. ;
396 double phi2bar = 0. ;
397 double eTotSuperCluster = 0. ;
402 basicClusterIter != clusterIter->clustersEnd() ;
403 ++basicClusterIter ){
407 str <<
" basicCluster Energy " << (*basicClusterIter)->energy()
408 <<
" Position " << (*basicClusterIter)->position()
410 <<
" Position phi " << (*basicClusterIter)->position().phi()
411 <<
" recHits " << (*basicClusterIter)->size()
414 double eCluster = (*basicClusterIter)->energy();
415 if(eCluster > emaxSuperCluster ){
416 emaxSuperCluster = eCluster ;
418 eTotSuperCluster += eCluster ;
419 double phiCluster = (*basicClusterIter)->position().phi() ;
420 phibar += eCluster * phiCluster ;
421 phi2bar += eCluster * phiCluster * phiCluster ;
428 phibar= phibar /eTotSuperCluster ;
429 phi2bar= phi2bar /eTotSuperCluster ;
430 double phiWidth = phi2bar - phibar*phibar ;
436 str <<
" SuperCluster stats " <<
"\n" ;
437 str <<
"phibar " << phibar
438 <<
" phi2bar " << phi2bar
439 <<
" eTotSuperCluster " << eTotSuperCluster
440 <<
" phiWidth " << phiWidth
447 str <<
" Done with this SuperCluster " << std::endl;
453 LogDebug(
"") <<
" End loop over superClusters ";
485 LogDebug(
"") <<
" Dumping Algo's guess of SiStripElectron Candidate Info " ;
486 int numberOfElectrons = 0;
488 LogDebug(
"") <<
" Number of SiStripElectrons " << siStripElectronHandle->size() ;
491 for (reco::SiStripElectronCollection::const_iterator electronIter = siStripElectronHandle->begin();
492 electronIter != siStripElectronHandle->end(); ++electronIter) {
495 LogDebug(
"") <<
"about to get stuff from electroncandidate "
496 << numberOfElectrons <<
"\n"
497 <<
"supercluster energy = "
498 << electronIter->superCluster()->energy() <<
"\n"
499 <<
"fit results are phi(r) = "
500 << electronIter->phiAtOrigin() <<
" + "
501 << electronIter->phiVsRSlope() <<
"*r" <<
"\n"
502 <<
" chi2 " << electronIter->chi2()
503 <<
" ndof " << electronIter->ndof() <<
"\n"
504 <<
" Pt " << electronIter->pt() <<
"\n"
506 << electronIter->p() <<
" "
507 << electronIter->px() <<
" "
508 << electronIter->py() <<
" "
509 << electronIter->pz() <<
"\n"
510 <<
"you get the idea..." ;
517 double emaxSuperCluster = 0. ;
519 double phi2bar = 0. ;
520 double eTotSuperCluster = 0. ;
523 basicClusterIter != electronIter->superCluster()->clustersEnd() ;
524 ++basicClusterIter ){
528 double eCluster = (*basicClusterIter)->energy();
529 if(eCluster > emaxSuperCluster ){
530 emaxSuperCluster = eCluster ;
532 eTotSuperCluster += eCluster ;
533 double phiCluster = (*basicClusterIter)->position().phi() ;
534 phibar += eCluster * phiCluster ;
535 phi2bar += eCluster * phiCluster * phiCluster ;
539 phibar=phibar/eTotSuperCluster ;
540 phi2bar=phi2bar/eTotSuperCluster ;
541 double phiWidth = phi2bar - phibar*phibar ;
555 numCand_->Fill(siStripElectronHandle->size());
563 LogDebug(
"")<<
" About to check Electrons" ;
573 bool* hasElectron_ =
new bool[siStripElectronHandle->end()- siStripElectronHandle->begin()] ;
574 for (
int icount = 0 ;
575 icount < siStripElectronHandle->end()- siStripElectronHandle->begin() ;
577 { hasElectron_[icount] =
false ;}
582 unsigned int* Electron_to_strippy =
new unsigned int[
electrons->end()-
electrons->begin()];
583 for (
int icount = 0 ;
585 { Electron_to_strippy[icount] = 0 ;}
587 unsigned int ecount=0 ;
588 for (reco::ElectronCollection::const_iterator electronIter =
electrons->begin();
589 electronIter !=
electrons->end(); ++electronIter ){
592 LogDebug(
"")<<
" Associating Electrons to Strippies " ;
593 LogDebug(
"")<<
" PT is " << electronIter->track()->pt() ;
596 uint32_t
id = (*electronIter->track()->recHitsBegin())->geographicalId().rawId();
597 LocalPoint pos = (*electronIter->track()->recHitsBegin())->localPosition();
599 unsigned int icount = 0 ;
600 LogDebug(
"") <<
" About to loop over Strippies " <<
" \n "
601 <<
" icount " << icount
602 <<
" max " << siStripElectronHandle->end()- siStripElectronHandle->begin() ;
604 for (reco::SiStripElectronCollection::const_iterator strippyiter = siStripElectronHandle->begin();
605 strippyiter != siStripElectronHandle->end(); ++strippyiter) {
607 bool hitInCommon =
false;
609 for (std::vector<SiStripRecHit2D>::const_iterator
610 hiter = strippyiter->rphiRecHits().begin();
611 hiter != strippyiter->rphiRecHits().end();
613 if (hiter->geographicalId().rawId() ==
id &&
614 (hiter->localPosition() -
pos).
mag() < 1
e-10) {
620 for (std::vector<SiStripRecHit2D>::const_iterator
621 hiter = strippyiter->stereoRecHits().begin();
622 hiter != strippyiter->stereoRecHits().end();
624 if (hiter->geographicalId().rawId() ==
id &&
625 (hiter->localPosition() -
pos).
mag() < 1
e-10) {
631 hasElectron_[icount] =
true ;
632 Electron_to_strippy[ecount]= icount ;
642 LogDebug(
"") <<
" Done looping over Electrons " ;
645 unsigned int counter = 0 ;
646 for (reco::SiStripElectronCollection::const_iterator strippyIter = siStripElectronHandle->begin(); strippyIter != siStripElectronHandle->end(); ++strippyIter) {
649 bool skipThis = !hasElectron_[counter] ;
653 LogDebug(
"") <<
" SiStrip Failed Electron " <<
" \n " <<
654 " p " << strippyIter->p() <<
" \n " <<
655 " pt " << strippyIter->pt() <<
" \n " <<
656 " SuperClust size " << strippyIter->superCluster()->clustersSize() ;
661 LogDebug(
"") <<
" done filling Failed histos " ;
670 LogDebug(
"") <<
" SiStrip Passed Electron " <<
" \n " <<
671 " p " << strippyIter->p() <<
" \n " <<
672 " pt " << strippyIter->pt() <<
" \n " <<
673 " SuperClust size " << strippyIter->superCluster()->clustersSize() ;
677 LogDebug(
"") <<
" done filling passed histos " ;
689 LogDebug(
"")<<
"Dump info for all electrons ";
691 for (reco::ElectronCollection::const_iterator electronIter1 =
electrons->begin();
692 electronIter1 !=
electrons->end(); ++electronIter1 ){
695 unsigned int ecount1= electronIter1-
electrons->begin() ;
696 unsigned int stripCount1 = 0 ;
697 reco::SiStripElectronCollection::const_iterator strippyIter1 ;
698 for (reco::SiStripElectronCollection::const_iterator strippyIter = siStripElectronHandle->begin();
699 strippyIter != siStripElectronHandle->end(); ++strippyIter) {
700 if(Electron_to_strippy[ecount1]==stripCount1 ) {
701 strippyIter1 = strippyIter ;
707 std::ostringstream str;
710 str <<
" SiStripElect p , px, py, pz " << strippyIter1->p()
711 <<
" " << strippyIter1->px()
712 <<
" " << strippyIter1->py()
713 <<
" " << strippyIter1->pz()
714 <<
"\n " << std::endl ;
717 str <<
" Electron p px, py, pz, = " << tr1->p()
721 <<
"\n" << std::endl ;
724 double EClust1 = strippyIter1->superCluster()->energy() ;
725 double XClust1 = strippyIter1->superCluster()->x();
726 double YClust1 = strippyIter1->superCluster()->y();
727 double ZClust1 = strippyIter1->superCluster()->z();
729 double rho1 =
sqrt(XClust1*XClust1+YClust1*YClust1+ZClust1*ZClust1) ;
730 double costheta1 = ZClust1/rho1 ;
731 double sintheta1 =
sqrt(1-costheta1*costheta1);
732 if(ZClust1<0 ) { sintheta1 = - sintheta1 ; }
733 double cosphi1 = XClust1/
sqrt(XClust1*XClust1+YClust1*YClust1);
734 double sinphi1 = YClust1/
sqrt(XClust1*XClust1+YClust1*YClust1);
736 str <<
" Ecal for electron E, px, py, pz "
738 << EClust1*sintheta1*cosphi1 <<
" "
739 << EClust1*sintheta1*sinphi1 <<
" "
741 <<
"\n" << std::endl ;
746 LogDebug(
"")<<
"Done Dumping info for all electrons ";
754 edm::LogInfo(
"") <<
" Two electrons in this event " << std::endl;
755 for (reco::ElectronCollection::const_iterator electronIter1 =
electrons->begin();
756 electronIter1 !=
electrons->end()-1; ++electronIter1 ){
761 unsigned int ecount1= electronIter1-
electrons->begin() ;
763 unsigned int stripCount1 = 0 ;
764 reco::SiStripElectronCollection::const_iterator strippyIter1 ;
765 for (reco::SiStripElectronCollection::const_iterator strippyIter = siStripElectronHandle->begin(); strippyIter != siStripElectronHandle->end(); ++strippyIter) {
766 if(Electron_to_strippy[ecount1]==stripCount1 ) {
767 strippyIter1 = strippyIter ;
772 double EClust1 = strippyIter1->superCluster()->energy() ;
773 double XClust1 = strippyIter1->superCluster()->x();
774 double YClust1 = strippyIter1->superCluster()->y();
775 double ZClust1 = strippyIter1->superCluster()->z();
777 for (reco::ElectronCollection::const_iterator electronIter2 = electronIter1+1;
778 electronIter2 !=
electrons->end(); ++electronIter2 ){
782 unsigned int ecount2= electronIter2-
electrons->begin() ;
783 unsigned int stripCount2 = 0 ;
784 reco::SiStripElectronCollection::const_iterator strippyIter2 ;
785 for (reco::SiStripElectronCollection::const_iterator strippyIter = siStripElectronHandle->begin(); strippyIter != siStripElectronHandle->end(); ++strippyIter) {
786 if(Electron_to_strippy[ecount2]==stripCount2 ) {
787 strippyIter2 = strippyIter ;
794 double EClust2 = strippyIter2->superCluster()->energy() ;
795 double XClust2 = strippyIter2->superCluster()->x();
796 double YClust2 = strippyIter2->superCluster()->y();
797 double ZClust2 = strippyIter2->superCluster()->z();
804 <<
" p1x " << tr1->px()
805 <<
" p1y " << tr1->py()
806 <<
" p1z " << tr1->pz()
811 <<
" p2x " << tr2->px()
812 <<
" p2y " << tr2->py()
813 <<
" p2z " << tr2->pz()
818 double Zpx = tr1->px()+tr2->px() ;
819 double Zpy = tr1->py()+tr2->py() ;
820 double Zpz = tr1->pz()+tr2->pz() ;
823 sqrt(Ze*Ze-Zpx*Zpx-Zpy*Zpy-Zpz*Zpz) << std::endl ;
826 double rho1 =
sqrt(XClust1*XClust1+YClust1*YClust1+ZClust1*ZClust1) ;
827 double costheta1 = ZClust1/rho1 ;
828 double sintheta1 =
sqrt(1-costheta1*costheta1);
829 if(ZClust1<0 ) { sintheta1 = - sintheta1 ; }
830 double cosphi1 = XClust1/
sqrt(XClust1*XClust1+YClust1*YClust1);
831 double sinphi1 = YClust1/
sqrt(XClust1*XClust1+YClust1*YClust1);
833 double rho2 =
sqrt(XClust2*XClust2+YClust2*YClust2+ZClust2*ZClust2) ;
834 double costheta2 = ZClust2/rho2 ;
835 double sintheta2 =
sqrt(1-costheta2*costheta2);
836 if(ZClust2<0 ) { sintheta2 = - sintheta2 ; }
837 double cosphi2 = XClust2/
sqrt(XClust2*XClust2+YClust2*YClust2);
838 double sinphi2 = YClust2/
sqrt(XClust2*XClust2+YClust2*YClust2);
840 edm::LogInfo(
"") <<
"Energy of supercluster for 1st electron "
842 << EClust1*sintheta1*cosphi1 <<
" "
843 << EClust1*sintheta1*sinphi1 <<
" "
844 << EClust1*costheta1 <<
" "
847 edm::LogInfo(
"") <<
"Energy of supercluster for 2nd electron "
849 << EClust2*sintheta2*cosphi2 <<
" "
850 << EClust2*sintheta2*sinphi2 <<
" "
851 << EClust2*costheta2 <<
" "
856 double Zgpx = EClust1*sintheta1*cosphi1+EClust2*sintheta2*cosphi2 ;
857 double Zgpy = EClust1*sintheta1*sinphi1+EClust2*sintheta2*sinphi2 ;
858 double Zgpz = EClust1*costheta1+EClust2*costheta2 ;
859 double ZgE = EClust1+EClust2 ;
862 sqrt(ZgE*ZgE-Zgpx*Zgpx-Zgpy*Zgpy-Zgpz*Zgpz) << std::endl ;
869 delete[] hasElectron_;
870 delete[] Electron_to_strippy;
875 LogDebug(
"") <<
" About to dump tracker info " ;
893 for (reco::SuperClusterCollection::const_iterator clusterIter = clusterHandle->begin();
894 clusterIter != clusterHandle->end();
896 double energy = clusterIter->energy();
914 LogDebug(
"") <<
" Looping over stereo hits " ;
927 SiStripRecHit2D
const rechit = *
hit ;
929 LocalError myerror = rechit.localPositionError();
933 Int_t siLayerNum = 0 ;
935 string siDetName =
"" ;
938 siLayerNum = tTopo->tibLayer(
id);
942 siLayerNum = tTopo->tobLayer(
id);
962 const SiStripRecHit2D::ClusterRef & clust=rechit.cluster();
966 if(clust.isNonnull()) {
969 const std::vector<uint8_t> amplitudes=clust->amplitudes();
970 for(
size_t i = 0 ;
i<amplitudes.size();
i++ ){
971 Signal +=amplitudes[
i] ;
1022 LogDebug(
"") <<
" Looping over Mono Hits " ;
1035 SiStripRecHit2D
const rechit = *
hit ;
1037 LocalError myerror = rechit.localPositionError();
1041 Int_t siLayerNum = 0 ;
1042 Int_t siDetNum = 0 ;
1043 string siDetName =
"" ;
1046 siLayerNum = tTopo->tibLayer(
id);
1050 siLayerNum = tTopo->tobLayer(
id);
1067 siDetName =
"NULL" ;
1070 const SiStripRecHit2D::ClusterRef & clust=rechit.cluster();
1073 int StripCount = 0 ;
1074 if(clust.isNonnull()) {
1077 const std::vector<uint8_t> amplitudes=clust->amplitudes();
1078 for(
size_t i = 0 ;
i<amplitudes.size();
i++ ){
1079 Signal +=amplitudes[
i] ;
1135 LogDebug(
"") <<
" Loop over Matched Hits " ;
1145 SiStripMatchedRecHit2D
const rechit = *
hit ;
1147 LocalError myerror = rechit.localPositionError();
1151 Int_t siLayerNum = 0 ;
1152 Int_t siDetNum = 0 ;
1153 string siDetName =
"" ;
1155 siLayerNum = tTopo->tibLayer(
id);
1159 siLayerNum = tTopo->tobLayer(
id);
1175 siDetName =
"NULL" ;
1180 int StripCount = 0 ;
1257 LogDebug(
"") <<
"Entering endJob " ;
1292 LogDebug(
"") <<
" Writing out ntuple is disabled for now " ;
float MatchedHitSignal_[myMaxHits]
float MonoHitZ_[myMaxHits]
TH1F * sizeSuperClustersEl_
T getParameter(std::string const &) const
std::string superClusterCollection_
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
float MatchedHitNoise_[myMaxHits]
float YShower_[myMaxHits]
int MonoLayer_[myMaxHits]
float MatchedHitZ_[myMaxHits]
TH1F * emaxSuperClusters_
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
SiStripElectronAnalyzer(const edm::ParameterSet &)
std::string siElectronCollection_
Geom::Phi< T > phi() const
int MonoDetector_[myMaxHits]
virtual void initNtuple(void)
int MatchedLayer_[myMaxHits]
TH1F * energySuperClustersEl_
static int position[TOTALCHAMBERS][3]
float MatchedHitSigX_[myMaxHits]
TH1F * sizeSuperClustersPassed
float MatchedHitY_[myMaxHits]
Geom::Theta< T > theta() const
~SiStripElectronAnalyzer()
float MonoHitTheta_[myMaxHits]
float MonoHitSignal_[myMaxHits]
std::string eBRecHitProducer_
float MatchedHitCorr_[myMaxHits]
float StereoHitSigY_[myMaxHits]
TH1F * energySuperClusters_
int StereoDetector_[myMaxHits]
float StereoHitSigX_[myMaxHits]
std::string mctruthCollection_
float XShower_[myMaxHits]
float StereoHitNoise_[myMaxHits]
TH1F * emaxSuperClustersEl_
int MatchedDetector_[myMaxHits]
std::string superClusterProducer_
int MonoHitWidth_[myMaxHits]
float MatchedHitR_[myMaxHits]
std::string eBRecHitCollection_
float StereoHitY_[myMaxHits]
float StereoHitPhi_[myMaxHits]
float StereoHitSignal_[myMaxHits]
std::string mctruthProducer_
std::string siMatchedHitCollection_
int StereoHitWidth_[myMaxHits]
float MonoHitCorr_[myMaxHits]
float MonoHitSigX_[myMaxHits]
float EShower_[myMaxHits]
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
float MonoHitSigY_[myMaxHits]
float MonoHitPhi_[myMaxHits]
float StereoHitCorr_[myMaxHits]
TH1F * sizeSuperClusters_
std::string siRphiHitCollection_
std::string siStereoHitCollection_
TH1F * phiWidthSuperClusters_
TH1F * sizeSuperClustersFailed
XYZPointD XYZPoint
point in space with cartesian internal representation
float StereoHitTheta_[myMaxHits]
TH1F * energySuperClustersFailed
float MatchedHitX_[myMaxHits]
int MatchedHitWidth_[myMaxHits]
virtual void endJob(void)
float ZShower_[myMaxHits]
float MonoHitY_[myMaxHits]
float MatchedHitPhi_[myMaxHits]
float StereoHitR_[myMaxHits]
std::string electronProducer_
float MonoHitNoise_[myMaxHits]
std::string electronCollection_
float MatchedHitSigY_[myMaxHits]
float MonoHitX_[myMaxHits]
float StereoHitZ_[myMaxHits]
TH1F * phiWidthSuperClustersEl_
float MonoHitR_[myMaxHits]
int StereoLayer_[myMaxHits]
virtual void analyze(const edm::Event &, const edm::EventSetup &)
std::string siHitProducer_
Power< A, B >::type pow(const A &a, const B &b)
std::string siElectronProducer_
float MatchedHitTheta_[myMaxHits]
TH1F * energySuperClustersPassed
float StereoHitX_[myMaxHits]