![]() |
![]() |
#include <ggPFPhotons.h>
Definition at line 17 of file ggPFPhotons.h.
ggPFPhotons::ggPFPhotons | ( | reco::Photon | phot, |
edm::Handle< reco::PhotonCollection > & | pfPhotons, | ||
edm::Handle< reco::GsfElectronCollection > & | pfElectrons, | ||
edm::Handle< PFCandidateCollection > & | pfCandidates, | ||
edm::Handle< EcalRecHitCollection > & | EBReducedRecHits, | ||
edm::Handle< EcalRecHitCollection > & | EEReducedRecHits, | ||
edm::Handle< EcalRecHitCollection > & | ESRecHits, | ||
const CaloSubdetectorGeometry * | geomBar, | ||
const CaloSubdetectorGeometry * | geomEnd, | ||
edm::Handle< BeamSpot > & | beamSpotHandle | ||
) | [explicit] |
Definition at line 8 of file ggPFPhotons.cc.
References abs, deltaR(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, isPFEle_, matchedPhot_, matchPFReco_, PFElectron_, PFPhoton_, pfPhotons_, and reco::Photon::superCluster().
: matchedPhot_(phot), pfPhotons_(pfPhotons), EBReducedRecHits_(EBReducedRecHits), EEReducedRecHits_(EEReducedRecHits), ESRecHits_(ESRecHits), geomBar_(geomBar), geomEnd_(geomEnd), beamSpotHandle_(beamSpotHandle), matchPFReco_(false), isPFEle_(false), EleVeto_(false), isConv_(false), hasSLConv_(false) { //do Matching: //std::cout<<"HERE IN NEW CLASS "<<std::endl; reco::PhotonCollection::const_iterator pfphot=pfPhotons_->begin(); for(;pfphot!=pfPhotons_->end();++pfphot){ if(pfphot->superCluster()==matchedPhot_.superCluster()){ PFPhoton_= *(pfphot); matchPFReco_=true; break; } } reco::GsfElectronCollection::const_iterator pfele=pfElectrons->begin(); for(;pfele!=pfElectrons->end();++pfele){ if(pfele->superCluster().isNull())continue; if(pfele->superCluster()==matchedPhot_.superCluster()){ if(pfele->pflowSuperCluster().isNull())continue; PFElectron_= *(pfele); matchPFReco_=true; isPFEle_=true; break; } for(PFCandidateCollection::const_iterator pfParticle =pfCandidates->begin(); pfParticle!=pfCandidates->end(); pfParticle++){ if(abs(pfParticle->pdgId())!=11)continue; if(pfParticle->superClusterRef().isNull())continue; double dR=deltaR(pfParticle->superClusterRef()->eta(), pfParticle->superClusterRef()->phi(), matchedPhot_.superCluster()->eta(), matchedPhot_.superCluster()->phi()); if(pfele->superCluster()==pfParticle->superClusterRef() &&dR<0.1){ PFElectron_= *(pfele); matchPFReco_=true; isPFEle_=true; break; } } } }
ggPFPhotons::~ggPFPhotons | ( | ) | [virtual] |
Definition at line 75 of file ggPFPhotons.cc.
{;}
std::pair< double, double > ggPFPhotons::CalcRMS | ( | vector< reco::CaloCluster > | PFClust, |
reco::Photon | PFPhoton | ||
) |
Definition at line 198 of file ggPFPhotons.cc.
References trackerHits::c, funct::cos(), relval_parameters_module::energy, eta(), reco::LeafCandidate::eta(), reco::LeafCandidate::phi(), phi, and mathSSE::sqrt().
Referenced by fillPFClusters(), and recoPhotonClusterLink().
{ double delPhi2=0; double delPhiSum=0; double delEta2=0; double delEtaSum=0; double ClusSum=0; float PFPhoPhi=PFPhoton.phi(); float PFPhoEta=PFPhoton.eta(); float PFClusPhiRMS=0; float PFClusEtaRMS=0; std::pair<double, double> RMS; for(unsigned int c=0; c<PFClust.size(); ++c){ delPhi2=(acos(cos(PFPhoPhi-PFClust[c].phi()))* acos(cos(PFPhoPhi-PFClust[c].phi())) )+delPhi2; delPhiSum=delPhiSum+ acos(cos(PFPhoPhi-PFClust[c].phi()))*PFClust[c].energy(); delEta2=(PFPhoEta-PFClust[c].eta())*(PFPhoEta-PFClust[c].eta()) *PFClust[c].energy() + delEta2; delEtaSum=delEtaSum+((PFPhoEta-PFClust[c].eta())*PFClust[c].energy()); ClusSum=ClusSum+PFClust[c].energy(); } double meandPhi=delPhiSum/ClusSum; PFClusPhiRMS=sqrt(fabs(delPhi2/ClusSum - (meandPhi*meandPhi))); double meandEta=delEtaSum/ClusSum; PFClusEtaRMS=sqrt(fabs(delEta2/ClusSum - (meandEta*meandEta))); RMS.first=PFClusEtaRMS; RMS.second=PFClusPhiRMS; return RMS; }
bool ggPFPhotons::EleVeto | ( | ) | [inline] |
Definition at line 39 of file ggPFPhotons.h.
{return EleVeto_;}
void ggPFPhotons::fillPFClusters | ( | ) |
Definition at line 100 of file ggPFPhotons.cc.
References CalcRMS(), SiPixelRawToDigiRegional_cfi::deltaPhi, dEtaLowestC_, dPhiLowestC_, EBReducedRecHits_, EEReducedRecHits_, EinMustache_, relval_parameters_module::energy, ESRecHits_, reco::LeafCandidate::eta(), geomBar_, geomEnd_, ggPFClusters::getPFClusters(), ggPFESClusters::getPFESClusters(), ggPFClusters::getPFSuperclusterOverlap(), i, getHLTprescales::index, isPFEle_, matchedPhot_, MustacheEOut_, MustacheEtOut_, PFClPhiRMS_, PFClPhiRMSMust_, PFClusters_, PFElectron_, PFLowClusE_, reco::GsfElectron::pflowSuperCluster(), PFPhoton_, PFPreShower1_, PFPreShower2_, PFPS1(), PFPS2(), PFSCFootprintClusters_, reco::Photon::pfSuperCluster(), reco::LeafCandidate::phi(), phi, position, funct::sin(), reco::Photon::superCluster(), and theta().
Referenced by ggPFPhotonAnalyzer::analyze().
{ //PFClusterCollection object with appropriate variables: ggPFClusters PFClusterCollection(EBReducedRecHits_, EEReducedRecHits_, geomBar_, geomEnd_); //if(isPFEle_)cout<<"PFElectron "<<endl; //else cout<<"PFPHoton "<<endl; //fill PFClusters if(isPFEle_)PFClusters_=PFClusterCollection.getPFClusters(*(PFElectron_.pflowSuperCluster())); else PFClusters_=PFClusterCollection.getPFClusters(*(PFPhoton_.pfSuperCluster())); //fill PFClusters with Cluster energy from Rechits inside SC PFSCFootprintClusters_.clear(); for(unsigned int i=0; i<PFClusters_.size(); ++i){ float SCFootPrintE=PFClusterCollection.getPFSuperclusterOverlap(PFClusters_[i],matchedPhot_); CaloCluster calo(SCFootPrintE, PFClusters_[i].position()); PFSCFootprintClusters_.push_back(calo); } //Mustache Variables: Mustache Must; std::vector<unsigned int> insideMust; std::vector<unsigned int> outsideMust; Must.MustacheClust(PFClusters_, insideMust, outsideMust); //Must.MustacheID(PFClusters_, insideMust, outsideMust); // cout<<"Inside "<<insideMust.size()<<", Total"<<PFClusters_.size()<<endl; //sum MustacheEnergy and order clusters by Energy: std::multimap<float, unsigned int>OrderedClust; float MustacheE=0; for(unsigned int i=0; i<insideMust.size(); ++i){ unsigned int index=insideMust[i]; OrderedClust.insert(make_pair(PFClusters_[index].energy(), index)); MustacheE=MustacheE+PFSCFootprintClusters_[index].energy(); } float MustacheEOut=0; float MustacheEtOut=0; for(unsigned int i=0; i<outsideMust.size(); ++i){ unsigned int index=outsideMust[i]; MustacheEOut=MustacheEOut+PFClusters_[index].energy(); MustacheEtOut=MustacheEtOut+PFClusters_[index].energy()*sin(PFClusters_[index].position().theta()); } MustacheEOut_=MustacheEOut; MustacheEtOut_=MustacheEtOut; EinMustache_=MustacheE; //find lowest energy Cluster std::multimap<float, unsigned int>::iterator it; it=OrderedClust.begin(); unsigned int lowEindex=(*it).second; PFLowClusE_=PFSCFootprintClusters_[lowEindex].energy(); //dEta and dPhi to this Cluster: dEtaLowestC_=PFSCFootprintClusters_[lowEindex].eta()-PFPhoton_.eta(); dPhiLowestC_=deltaPhi(PFSCFootprintClusters_[lowEindex].phi(),PFPhoton_.phi()); //RMS Of All PFClusters inside SuperCluster: std::pair<double, double> RMS=CalcRMS(PFSCFootprintClusters_, PFPhoton_); PFClPhiRMS_=RMS.second; std::vector<CaloCluster>MustacheNLClust; for(it=OrderedClust.begin(); it!=OrderedClust.end(); ++it){ unsigned int index=(*it).second; if(index==lowEindex)continue; //skip lowest cluster which could be from PU MustacheNLClust.push_back(PFSCFootprintClusters_[index]); } if(insideMust.size()>3){ std::pair<double, double> RMSMust=CalcRMS(MustacheNLClust, PFPhoton_); PFClPhiRMSMust_=RMSMust.second; } if(insideMust.size()==2){ MustacheNLClust.push_back(PFSCFootprintClusters_[lowEindex]); std::pair<double, double> RMSMust=CalcRMS(MustacheNLClust, PFPhoton_); PFClPhiRMSMust_=RMSMust.second; } if(insideMust.size()==1){ PFClPhiRMSMust_=matchedPhot_.superCluster()->phiWidth(); PFClPhiRMS_=PFClPhiRMSMust_; } //fill ES Clusters ggPFESClusters PFPSClusterCollection(ESRecHits_, geomEnd_); vector<reco::PreshowerCluster>PFPS; if(isPFEle_)PFPS=PFPSClusterCollection.getPFESClusters(*((PFElectron_.pflowSuperCluster()))); else PFPS=PFPSClusterCollection.getPFESClusters(*(PFPhoton_.pfSuperCluster())); float PFPS1=0; float PFPS2=0; for(unsigned int i=0; i<PFPS.size(); ++i){ if(PFPS[i].plane()==1)PFPS1=PFPS1+PFPS[i].energy(); if(PFPS[i].plane()==2)PFPS2=PFPS2+PFPS[i].energy(); } PFPreShower1_=PFPS1; PFPreShower2_=PFPS2; }
double ggPFPhotons::getPFPhoECorr | ( | std::vector< reco::CaloCluster > | PFClusters, |
const GBRForest * | ReaderLCEB, | ||
const GBRForest * | ReaderLCEE | ||
) |
Definition at line 226 of file ggPFPhotons.cc.
References beamSpotHandle_, EBReducedRecHits_, EEReducedRecHits_, geomBar_, geomEnd_, ggPFClusters::getPFClusters(), i, getHLTprescales::index, isPFEle_, ggPFClusters::LocalEnergyCorrection(), PFClusters_, PFElectron_, reco::GsfElectron::pflowSuperCluster(), PFPhoLocallyCorrE_, PFPhoton_, and reco::Photon::pfSuperCluster().
Referenced by ggPFPhotonAnalyzer::analyze().
{ TVector3 bs(beamSpotHandle_->position().x(),beamSpotHandle_->position().y(), beamSpotHandle_->position().z()); float beamspotZ=bs.Z(); //PFClusterCollection object with appropriate variables: ggPFClusters PFClusterCollection(EBReducedRecHits_, EEReducedRecHits_, geomBar_, geomEnd_); //fill PFClusters PFClusters_.clear(); if(isPFEle_)PFClusters_=PFClusterCollection.getPFClusters(*(PFElectron_.pflowSuperCluster())); else PFClusters_=PFClusterCollection.getPFClusters(*(PFPhoton_.pfSuperCluster())); Mustache Must; std::vector<unsigned int> insideMust; std::vector<unsigned int> outsideMust; Must.MustacheClust(PFClusters_, insideMust, outsideMust); float ECorr=0; for(unsigned int i=0; i<insideMust.size();++i){ unsigned int index=insideMust[i]; ECorr=ECorr+PFClusterCollection.LocalEnergyCorrection(ReaderLCEB, ReaderLCEE, PFClusters_[index], beamspotZ); } PFPhoLocallyCorrE_=ECorr; return PFPhoLocallyCorrE_; }
bool ggPFPhotons::hasSLConv | ( | ) | [inline] |
Definition at line 37 of file ggPFPhotons.h.
Referenced by ggPFPhotonAnalyzer::analyze().
{return hasSLConv_;}
bool ggPFPhotons::isConv | ( | ) | [inline] |
Definition at line 36 of file ggPFPhotons.h.
Referenced by ggPFPhotonAnalyzer::analyze().
{ return isConv_;}
bool ggPFPhotons::isPFEle | ( | ) | [inline] |
Definition at line 38 of file ggPFPhotons.h.
{return isPFEle_;}
bool ggPFPhotons::MatchPFReco | ( | ) | [inline] |
Definition at line 35 of file ggPFPhotons.h.
Referenced by ggPFPhotonAnalyzer::analyze().
{ return matchPFReco_;}
float ggPFPhotons::MustE | ( | ) | [inline] |
Definition at line 42 of file ggPFPhotons.h.
Referenced by ggPFPhotonAnalyzer::analyze().
{return EinMustache_;}
float ggPFPhotons::MustEOut | ( | ) | [inline] |
Definition at line 43 of file ggPFPhotons.h.
Referenced by ggPFPhotonAnalyzer::analyze().
{return MustacheEOut_;}
float ggPFPhotons::MustEtOut | ( | ) | [inline] |
Definition at line 44 of file ggPFPhotons.h.
{return MustacheEtOut_;}
double ggPFPhotons::PFClusRMSMust | ( | ) | [inline] |
Definition at line 49 of file ggPFPhotons.h.
Referenced by ggPFPhotonAnalyzer::analyze().
{return PFClPhiRMSMust_;}
double ggPFPhotons::PFClusRMSTot | ( | ) | [inline] |
Definition at line 48 of file ggPFPhotons.h.
Referenced by ggPFPhotonAnalyzer::analyze().
{return PFClPhiRMS_;}
std::vector<reco::CaloCluster> ggPFPhotons::PFClusters | ( | ) | [inline] |
Definition at line 50 of file ggPFPhotons.h.
Referenced by ggPFPhotonAnalyzer::analyze(), and recoPhotonClusterLink().
{return PFClusters_;}
std::vector<reco::CaloCluster> ggPFPhotons::PFClustersSCFP | ( | ) | [inline] |
Definition at line 51 of file ggPFPhotons.h.
{return PFSCFootprintClusters_;}//Electron Veto:
double ggPFPhotons::PFdEta | ( | ) | [inline] |
Definition at line 46 of file ggPFPhotons.h.
Referenced by ggPFPhotonAnalyzer::analyze().
{return dEtaLowestC_;}
double ggPFPhotons::PFdPhi | ( | ) | [inline] |
Definition at line 47 of file ggPFPhotons.h.
Referenced by ggPFPhotonAnalyzer::analyze().
{return dPhiLowestC_;}
bool ggPFPhotons::PFElectronVeto | ( | edm::Handle< reco::ConversionCollection > & | convH, |
edm::Handle< reco::GsfElectronCollection > & | gsfElectronsHandle | ||
) |
Definition at line 77 of file ggPFPhotons.cc.
References beamSpotHandle_, ConversionTools::hasMatchedPromptElectron(), isPFEle_, PFElectron_, and reco::GsfElectron::superCluster().
{ bool isprompt=false; if(!isPFEle_)return isprompt; isprompt= ConversionTools::hasMatchedPromptElectron(PFElectron_.superCluster(), gsfElectronsHandle, convH, beamSpotHandle_->position()); return isprompt; }
float ggPFPhotons::PFLowE | ( | ) | [inline] |
Definition at line 45 of file ggPFPhotons.h.
Referenced by ggPFPhotonAnalyzer::analyze().
{return PFLowClusE_;}
float ggPFPhotons::PFPS1 | ( | ) | [inline] |
Definition at line 40 of file ggPFPhotons.h.
Referenced by ggPFPhotonAnalyzer::analyze(), and fillPFClusters().
{return PFPreShower1_;}
float ggPFPhotons::PFPS2 | ( | ) | [inline] |
Definition at line 41 of file ggPFPhotons.h.
Referenced by ggPFPhotonAnalyzer::analyze(), and fillPFClusters().
{return PFPreShower2_;}
void ggPFPhotons::PhotonPFCandMatch | ( | reco::SuperCluster | sc, |
std::vector< reco::PFCandidatePtr > & | insideBox, | ||
edm::Handle< PFCandidateCollection > & | pfCandidates, | ||
vector< reco::CaloCluster > & | PFClust, | ||
std::vector< DetId > & | MatchedRH | ||
) |
Definition at line 530 of file ggPFPhotons.cc.
References abs, ggPFClusters::BasicClusterPFCandLink(), trackerHits::c, reco::SuperCluster::clustersBegin(), reco::SuperCluster::clustersEnd(), filterCSVwithJSON::copy, funct::cos(), deltaR(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, EBReducedRecHits_, EEReducedRecHits_, reco::tau::disc::Eta(), reco::CaloCluster::eta(), cropTnPTrees::frac, geomBar_, geomEnd_, i, getHLTprescales::index, reco::Photon::isEB(), reco::Photon::isEE(), matchedPhot_, benchmark_cfg::pdgId, colinearityKinematic::Phi, reco::CaloCluster::phi(), mathSSE::sqrt(), SuperClusterSize(), reco::CaloCluster::x(), x, reco::CaloCluster::y(), detailsBasic3DVector::y, reco::CaloCluster::z(), and z.
Referenced by ggPFPhotonAnalyzer::analyze().
{ std::vector<reco::PFCandidatePtr>ChgHad; std::vector<reco::PFCandidatePtr>PFPho; std::pair<double, double>scSize=SuperClusterSize(matchedPhot_); double etabound=scSize.first; double phibound=scSize.second; double dRbound=sqrt(etabound*etabound+phibound*phibound); double seedEta=sc.eta(); double seedPhi=sc.phi(); for(PFCandidateCollection::const_iterator pfParticle =pfCandidates->begin(); pfParticle!=pfCandidates->end(); pfParticle++){ if(pfParticle->pdgId()==130)continue; unsigned int index=pfParticle - pfCandidates->begin(); math::XYZVector photon_directionWrtVtx(sc.x() - pfParticle->vx(), sc.y() - pfParticle->vy(), sc.z() - pfParticle->vz()); seedEta= photon_directionWrtVtx.Eta(); seedPhi=photon_directionWrtVtx.Phi(); double dphi=acos(cos(seedPhi-pfParticle->momentum().Phi())); double deta=fabs(seedEta-pfParticle->momentum().Eta()); if(deta<etabound && dphi<phibound && matchedPhot_.isEB()){ reco::PFCandidatePtr pfRef(pfCandidates,index); insideBox.push_back(pfRef); //Fill PFCandidates in a box around SC if(pfParticle->pdgId()==22)PFPho.push_back(pfRef); if(abs(pfParticle->pdgId())==211)ChgHad.push_back(pfRef); } double dR=deltaR(seedEta,seedPhi, pfParticle->momentum().Eta(), pfParticle->momentum().Phi()); if(matchedPhot_.isEE() && dR<dRbound){ //if(dR<0.4){ reco::PFCandidatePtr pfRef(pfCandidates,index); insideBox.push_back(pfRef); //Fill PFCandidates in a box around SC if(pfParticle->pdgId()==22)PFPho.push_back(pfRef); if(abs(pfParticle->pdgId())==211)ChgHad.push_back(pfRef); } } ggPFClusters PFClusterCollection(EBReducedRecHits_, EEReducedRecHits_, geomBar_, geomEnd_); //Link PFCandidates to Basic Clusters std::vector<reco::PFCandidatePtr>copy=insideBox; PFClusterCollection.BasicClusterPFCandLink(sc, insideBox, MatchedRH); PFPho.clear(); ChgHad.clear(); for(unsigned int i=0; i<insideBox.size(); ++i){ if(insideBox[i]->pdgId()==22)PFPho.push_back(insideBox[i]); if(abs(insideBox[i]->pdgId())==211)ChgHad.push_back(insideBox[i]); } //finally compute frac of shared ECal Energy between PFPhotons and PFChgHad std::vector<unsigned int > orbitPho; std::vector<unsigned int > overlapChgHad; std::vector<float > fractionShared; for(unsigned int c=0; c<ChgHad.size(); ++c){ bool satPho=false; float frac=1.0; CaloCluster calo; float drmin=999; reco::CaloCluster_iterator cit=sc.clustersBegin(); math::XYZPointF positionvtx(ChgHad[c]->positionAtECALEntrance().x()-ChgHad[c]->vx(), ChgHad[c]->positionAtECALEntrance().y()-ChgHad[c]->vy(), ChgHad[c]->positionAtECALEntrance().z()-ChgHad[c]->vz()); for(; cit!=sc.clustersEnd(); ++cit){ float dR=deltaR((*cit)->eta(), (*cit)->phi(), positionvtx.eta(), positionvtx.phi()); if(dR<drmin){ calo.setPosition((*cit)->position()); drmin=dR; } } for(unsigned int ipho=0; ipho<PFPho.size(); ++ipho){ double deta=fabs(ChgHad[c]->positionAtECALEntrance().Eta()- PFPho[ipho]->positionAtECALEntrance().Eta()); double dphi=acos(cos(ChgHad[c]->positionAtECALEntrance().Phi()-PFPho[ipho]->positionAtECALEntrance().Phi())); if(deta<0.05 && dphi<0.07){ orbitPho.push_back(ipho); frac=ChgHad[c]->ecalEnergy()/(PFPho[ipho]->ecalEnergy()+ChgHad[c]->ecalEnergy()); fractionShared.push_back(frac); satPho=true; } } if(satPho){ calo.setEnergy(frac*ChgHad[c]->rawEcalEnergy()); } else{ calo.setEnergy(ChgHad[c]->rawEcalEnergy()); } PFClust.push_back(calo); //pushBack PFClusters from Charged Hadrons } for(unsigned int ipho=0; ipho<PFPho.size(); ++ipho){ CaloCluster calo; float frac=1.0; math::XYZPoint caloPos(PFPho[ipho]->positionAtECALEntrance().x(), PFPho[ipho]->positionAtECALEntrance().y(), PFPho[ipho]->positionAtECALEntrance().z()); calo.setPosition(caloPos); for(unsigned int i=0; i<orbitPho.size(); ++i){ if(ipho==orbitPho[i]){ frac=1-fractionShared[i]; break; } } calo.setEnergy(frac*PFPho[ipho]->rawEcalEnergy()); PFClust.push_back(calo);//PFClusters from PFPhotons } }
std::vector< reco::CaloCluster > ggPFPhotons::recoPhotonClusterLink | ( | reco::Photon | phot, |
edm::Handle< PFCandidateCollection > & | pfCandidates | ||
) |
Definition at line 250 of file ggPFPhotons.cc.
References CalcRMS(), funct::cos(), SiPixelRawToDigiRegional_cfi::deltaPhi, dEtaLowestC_, dPhiLowestC_, EinMustache_, relval_parameters_module::energy, reco::LeafCandidate::eta(), i, getHLTprescales::index, matchedPhot_, MustacheEOut_, MustacheEtOut_, PFClPhiRMS_, PFClPhiRMSMust_, PFClusters_, PFLowClusE_, PFPhoton_, PFPreShower1_, PFPreShower2_, reco::LeafCandidate::phi(), phi, position, funct::sin(), reco::Photon::superCluster(), SuperClusterSize(), and theta().
{ PFClusters_.clear(); //initialize variables: EinMustache_=0; MustacheEOut_=0; MustacheEtOut_=0; PFPreShower1_=0; PFPreShower2_=0; PFLowClusE_=0; dEtaLowestC_=0; dPhiLowestC_=0; PFClPhiRMS_=0; PFClPhiRMSMust_=0; //find SC boundaries from RecHits: std::pair<double,double>Boundary=SuperClusterSize(phot); double etabound=Boundary.first; double phibound=Boundary.second; double seedEta=phot.superCluster()->seed()->eta(); double seedPhi=phot.superCluster()->seed()->phi(); for (PFCandidateCollection::const_iterator pfParticle =pfCandidates->begin(); pfParticle!=pfCandidates->end(); pfParticle++){ if(pfParticle->pdgId()!=22) continue; //if photon //use a box about superCluster Width: float dphi=acos(cos(seedPhi-pfParticle->phi())); float deta=fabs(seedEta-pfParticle->eta()); PFPreShower1_=0; PFPreShower2_=0; if(deta<etabound && dphi<phibound){ //hard coded size for now but will make it more dynamic //based on SuperCluster Shape math::XYZPoint position(pfParticle->positionAtECALEntrance().X(), pfParticle->positionAtECALEntrance().Y(), pfParticle->positionAtECALEntrance().Z()) ; CaloCluster calo(pfParticle->rawEcalEnergy() ,position ); PFClusters_.push_back(calo); PFPreShower1_=PFPreShower1_+pfParticle->pS1Energy(); PFPreShower2_=PFPreShower2_+pfParticle->pS2Energy(); } } //Mustache Variables: if(PFClusters_.size()>0){ Mustache Must; std::vector<unsigned int> insideMust; std::vector<unsigned int> outsideMust; Must.MustacheClust(PFClusters_, insideMust, outsideMust); //sum MustacheEnergy and order clusters by Energy: std::multimap<float, unsigned int>OrderedClust; float MustacheE=0; for(unsigned int i=0; i<insideMust.size(); ++i){ unsigned int index=insideMust[i]; OrderedClust.insert(make_pair(PFClusters_[index].energy(), index)); MustacheE=MustacheE+PFClusters_[index].energy(); } float MustacheEOut=0; float MustacheEtOut=0; for(unsigned int i=0; i<outsideMust.size(); ++i){ unsigned int index=outsideMust[i]; MustacheEOut=MustacheEOut+PFClusters_[index].energy(); MustacheEtOut=MustacheEtOut+PFClusters_[index].energy()*sin(PFClusters_[index].position().theta()); } MustacheEOut_=MustacheEOut; MustacheEtOut_=MustacheEtOut; EinMustache_=MustacheE; //find lowest energy Cluster std::multimap<float, unsigned int>::iterator it; it=OrderedClust.begin(); unsigned int lowEindex=(*it).second; PFLowClusE_=PFClusters_[lowEindex].energy(); //dEta and dPhi to this Cluster: dEtaLowestC_=PFClusters_[lowEindex].eta()-PFPhoton_.eta(); dPhiLowestC_=deltaPhi(PFClusters_[lowEindex].phi(),PFPhoton_.phi()); //RMS Of All PFClusters inside SuperCluster: if(insideMust.size()==1){ PFLowClusE_=0; dEtaLowestC_=0; dPhiLowestC_=0; } std::pair<double, double> RMS=CalcRMS(PFClusters_, PFPhoton_); PFClPhiRMS_=RMS.second; std::vector<CaloCluster>MustacheNLClust; for(it=OrderedClust.begin(); it!=OrderedClust.end(); ++it){ unsigned int index=(*it).second; if(index==lowEindex)continue; //skip lowest cluster which could be from PU MustacheNLClust.push_back(PFClusters_[index]); } if(insideMust.size()>3){ std::pair<double, double> RMSMust=CalcRMS(MustacheNLClust, PFPhoton_); PFClPhiRMSMust_=RMSMust.second; } if(insideMust.size()==2){ MustacheNLClust.push_back(PFClusters_[lowEindex]); std::pair<double, double> RMSMust=CalcRMS(MustacheNLClust, PFPhoton_); PFClPhiRMSMust_=RMSMust.second; } if(insideMust.size()==1){ PFClPhiRMSMust_=matchedPhot_.superCluster()->phiWidth(); PFClPhiRMS_=PFClPhiRMSMust_; } } return PFClusters_; }
void ggPFPhotons::recoPhotonClusterLink | ( | reco::SuperCluster | sc, |
std::vector< reco::PFCandidatePtr > & | insideMust, | ||
std::vector< reco::PFCandidatePtr > & | outsideMust, | ||
edm::Handle< PFCandidateCollection > & | pfCandidates, | ||
double | etabound, | ||
double | phibound | ||
) | [static] |
Definition at line 416 of file ggPFPhotons.cc.
References funct::cos(), i, getHLTprescales::index, PFClusters(), position, and reco::SuperCluster::seed().
{ std::vector<reco::CaloCluster>PFClusters; std::vector<reco::PFCandidatePtr>PFCand; double seedEta=sc.seed()->eta(); double seedPhi=sc.seed()->phi(); for(PFCandidateCollection::const_iterator pfParticle =pfCandidates->begin(); pfParticle!=pfCandidates->end(); pfParticle++){ unsigned int index=pfParticle - pfCandidates->begin(); if(pfParticle->pdgId()!=22) continue; //if photon //use a box about superCluster Width: float dphi=acos(cos(seedPhi-pfParticle->phi())); float deta=fabs(seedEta-pfParticle->eta()); if(deta<etabound && dphi<phibound){ //hard coded size for now but will make it more dynamic //based on SuperCluster Shape math::XYZPoint position(pfParticle->positionAtECALEntrance().X(), pfParticle->positionAtECALEntrance().Y(), pfParticle->positionAtECALEntrance().Z()) ; CaloCluster calo(pfParticle->rawEcalEnergy() ,position ); PFClusters.push_back(calo); reco::PFCandidatePtr pfRef(pfCandidates,index); PFCand.push_back(pfRef); } } Mustache Must; std::vector<unsigned int> insideMustindex; std::vector<unsigned int> outsideMustindex; Must.MustacheClust(PFClusters, insideMustindex, outsideMustindex); for(unsigned int i=0; i<insideMustindex.size(); ++i){ unsigned int index=insideMustindex[i]; insideMust.push_back(PFCand[index]); } for(unsigned int i=0; i<outsideMustindex.size(); ++i){ unsigned int index=outsideMustindex[i]; outsideMust.push_back(PFCand[index]); } }
std::pair< float, float > ggPFPhotons::SLPoint | ( | ) |
Definition at line 85 of file ggPFPhotons.cc.
References beamSpotHandle_, ggPFTracks::gsfElectronProj(), hasSLConv_, ggPFTracks::isConv(), isConv_, isPFEle_, PFElectron_, PFPhoton_, and ggPFTracks::SLCombZVtx().
Referenced by ggPFPhotonAnalyzer::analyze().
{ ggPFTracks pfTks(beamSpotHandle_); std::pair<float, float> SLPoint(0,0); TVector3 bs(beamSpotHandle_->position().x(),beamSpotHandle_->position().y(), beamSpotHandle_->position().z()); if(isPFEle_){ isConv_=true; SLPoint=pfTks.gsfElectronProj(PFElectron_); return SLPoint; } SLPoint=pfTks.SLCombZVtx(PFPhoton_, hasSLConv_); isConv_=pfTks.isConv();//bool to flag if there are conv tracks return SLPoint; }
std::pair< double, double > ggPFPhotons::SuperClusterSize | ( | reco::Photon | phot | ) |
Definition at line 358 of file ggPFPhotons.cc.
References funct::cos(), deltaR(), dPhi(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, EBReducedRecHits_, EEReducedRecHits_, eta(), PV3DBase< T, PVType, FrameType >::eta(), geomBar_, geomEnd_, CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), i, reco::Photon::isEB(), step1_ZMM_7Tev::MaxEta, ecalTB2006H4_GenSimDigiReco_cfg::MaxPhi, PV3DBase< T, PVType, FrameType >::phi(), phi, and reco::Photon::superCluster().
Referenced by PhotonPFCandMatch(), and recoPhotonClusterLink().
{ std::pair<double, double>SCsize(0.1,0.4);//Eta, Phi //find maximum distance between SuperCluster Seed and Rec Hits SuperClusterRef recoSC=phot.superCluster(); reco::CaloCluster_iterator cit=recoSC->clustersBegin(); double seedeta=recoSC->seed()->eta(); double seedphi=recoSC->seed()->phi(); EcalRecHitCollection::const_iterator eb; EcalRecHitCollection::const_iterator ee; double MaxEta=-99; double MaxPhi=-99; double MaxR=-99; for(;cit!=recoSC->clustersEnd();++cit){ std::vector< std::pair<DetId, float> >bcCells=(*cit)->hitsAndFractions(); if(phot.isEB()){ for(unsigned int i=0; i<bcCells.size(); ++i){ for(eb=EBReducedRecHits_->begin();eb!= EBReducedRecHits_->end();++eb){ if(eb->id().rawId()==bcCells[i].first.rawId()){ DetId id=bcCells[i].first; float eta=geomBar_->getGeometry(id)->getPosition().eta(); float dEta = fabs(seedeta-eta); if(dEta>MaxEta){ MaxEta=dEta; float phi=geomBar_->getGeometry(id)->getPosition().phi(); float dPhi = acos(cos( seedphi-phi)); if(dPhi>MaxPhi){ MaxPhi=dPhi; } } } } } } else{ for(unsigned int i=0; i<bcCells.size(); ++i){ for(ee=EEReducedRecHits_->begin();ee!= EEReducedRecHits_->end();++ee){ if(ee->id().rawId()==bcCells[i].first.rawId()){ DetId id=bcCells[i].first; float eta=geomEnd_->getGeometry(id)->getPosition().eta(); float phi=geomEnd_->getGeometry(id)->getPosition().phi(); float dR=deltaR(eta, phi, seedeta, seedphi); if(dR>MaxR){ MaxR=dR; MaxEta=fabs(seedeta-eta); MaxPhi= acos(cos(seedphi-phi)); } } } } } } SCsize.first=MaxEta; SCsize.second=MaxPhi; return SCsize; }
static std::pair<double, double> ggPFPhotons::SuperClusterSize | ( | reco::SuperCluster | sc, |
Handle< EcalRecHitCollection > & | EBReducedRecHits, | ||
Handle< EcalRecHitCollection > & | EEReducedRecHits, | ||
const CaloSubdetectorGeometry * | geomBar, | ||
const CaloSubdetectorGeometry * | geomEnd | ||
) | [static] |
Handle<BeamSpot> ggPFPhotons::beamSpotHandle_ [private] |
Definition at line 98 of file ggPFPhotons.h.
Referenced by getPFPhoECorr(), PFElectronVeto(), and SLPoint().
double ggPFPhotons::dEtaLowestC_ [private] |
Definition at line 114 of file ggPFPhotons.h.
Referenced by fillPFClusters(), and recoPhotonClusterLink().
double ggPFPhotons::dPhiLowestC_ [private] |
Definition at line 115 of file ggPFPhotons.h.
Referenced by fillPFClusters(), and recoPhotonClusterLink().
Definition at line 93 of file ggPFPhotons.h.
Referenced by fillPFClusters(), getPFPhoECorr(), PhotonPFCandMatch(), and SuperClusterSize().
Definition at line 94 of file ggPFPhotons.h.
Referenced by fillPFClusters(), getPFPhoECorr(), PhotonPFCandMatch(), and SuperClusterSize().
float ggPFPhotons::EinMustache_ [private] |
Definition at line 108 of file ggPFPhotons.h.
Referenced by fillPFClusters(), and recoPhotonClusterLink().
bool ggPFPhotons::EleVeto_ [private] |
Definition at line 103 of file ggPFPhotons.h.
Handle<EcalRecHitCollection> ggPFPhotons::ESRecHits_ [private] |
Definition at line 95 of file ggPFPhotons.h.
Referenced by fillPFClusters().
const CaloSubdetectorGeometry* ggPFPhotons::geomBar_ [private] |
Definition at line 96 of file ggPFPhotons.h.
Referenced by fillPFClusters(), getPFPhoECorr(), PhotonPFCandMatch(), and SuperClusterSize().
const CaloSubdetectorGeometry* ggPFPhotons::geomEnd_ [private] |
Definition at line 97 of file ggPFPhotons.h.
Referenced by fillPFClusters(), getPFPhoECorr(), PhotonPFCandMatch(), and SuperClusterSize().
bool ggPFPhotons::hasSLConv_ [private] |
Definition at line 105 of file ggPFPhotons.h.
Referenced by SLPoint().
bool ggPFPhotons::isConv_ [private] |
Definition at line 104 of file ggPFPhotons.h.
Referenced by SLPoint().
bool ggPFPhotons::isPFEle_ [private] |
Definition at line 102 of file ggPFPhotons.h.
Referenced by fillPFClusters(), getPFPhoECorr(), ggPFPhotons(), PFElectronVeto(), and SLPoint().
reco::Photon ggPFPhotons::matchedPhot_ [private] |
Definition at line 90 of file ggPFPhotons.h.
Referenced by fillPFClusters(), ggPFPhotons(), PhotonPFCandMatch(), and recoPhotonClusterLink().
bool ggPFPhotons::matchPFReco_ [private] |
Definition at line 101 of file ggPFPhotons.h.
Referenced by ggPFPhotons().
float ggPFPhotons::MustacheEOut_ [private] |
Definition at line 109 of file ggPFPhotons.h.
Referenced by fillPFClusters(), and recoPhotonClusterLink().
float ggPFPhotons::MustacheEtOut_ [private] |
Definition at line 110 of file ggPFPhotons.h.
Referenced by fillPFClusters(), and recoPhotonClusterLink().
double ggPFPhotons::PFClPhiRMS_ [private] |
Definition at line 116 of file ggPFPhotons.h.
Referenced by fillPFClusters(), and recoPhotonClusterLink().
double ggPFPhotons::PFClPhiRMSMust_ [private] |
Definition at line 117 of file ggPFPhotons.h.
Referenced by fillPFClusters(), and recoPhotonClusterLink().
std::vector<reco::CaloCluster> ggPFPhotons::PFClusters_ [private] |
Definition at line 106 of file ggPFPhotons.h.
Referenced by fillPFClusters(), getPFPhoECorr(), and recoPhotonClusterLink().
reco::GsfElectron ggPFPhotons::PFElectron_ [private] |
Definition at line 100 of file ggPFPhotons.h.
Referenced by fillPFClusters(), getPFPhoECorr(), ggPFPhotons(), PFElectronVeto(), and SLPoint().
Definition at line 92 of file ggPFPhotons.h.
float ggPFPhotons::PFLowClusE_ [private] |
Definition at line 113 of file ggPFPhotons.h.
Referenced by fillPFClusters(), and recoPhotonClusterLink().
double ggPFPhotons::PFPhoLocallyCorrE_ [private] |
Definition at line 118 of file ggPFPhotons.h.
Referenced by getPFPhoECorr().
reco::Photon ggPFPhotons::PFPhoton_ [private] |
Definition at line 99 of file ggPFPhotons.h.
Referenced by fillPFClusters(), getPFPhoECorr(), ggPFPhotons(), recoPhotonClusterLink(), and SLPoint().
Handle<reco::PhotonCollection> ggPFPhotons::pfPhotons_ [private] |
Definition at line 91 of file ggPFPhotons.h.
Referenced by ggPFPhotons().
float ggPFPhotons::PFPreShower1_ [private] |
Definition at line 111 of file ggPFPhotons.h.
Referenced by fillPFClusters(), and recoPhotonClusterLink().
float ggPFPhotons::PFPreShower2_ [private] |
Definition at line 112 of file ggPFPhotons.h.
Referenced by fillPFClusters(), and recoPhotonClusterLink().
std::vector<reco::CaloCluster> ggPFPhotons::PFSCFootprintClusters_ [private] |
Definition at line 107 of file ggPFPhotons.h.
Referenced by fillPFClusters().