![]() |
![]() |
#include <PFAlgo.h>
Public Member Functions | |
void | checkCleaning (const reco::PFRecHitCollection &cleanedHF) |
Check HF Cleaning. | |
PFMuonAlgo * | getPFMuonAlgo () |
PFAlgo () | |
constructor | |
const std::auto_ptr < reco::PFCandidateCollection > & | pfCandidates () const |
void | reconstructParticles (const reco::PFBlockHandle &blockHandle) |
virtual void | reconstructParticles (const reco::PFBlockCollection &blocks) |
reconstruct particles | |
void | setAlgo (int algo) |
void | setCandConnectorParameters (const edm::ParameterSet &iCfgCandConnector) |
void | setCandConnectorParameters (bool bCorrect, bool bCalibPrimary, double dptRel_PrimaryTrack, double dptRel_MergedTrack, double ptErrorSecondary, std::vector< double > nuclCalibFactors) |
void | setDebug (bool debug) |
void | setDisplacedVerticesParameters (bool rejectTracks_Bad, bool rejectTracks_Step45, bool usePFNuclearInteractions, bool usePFConversions, bool usePFDecays, double dptRel_DispVtx) |
void | setEGElectronCollection (const reco::GsfElectronCollection &egelectrons) |
void | setElectronExtraRef (const edm::OrphanHandle< reco::PFCandidateElectronExtraCollection > &extrah) |
void | setHOTag (bool ho) |
void | setMuonHandle (const edm::Handle< reco::MuonCollection > &) |
void | setParameters (double nSigmaECAL, double nSigmaHCAL, const boost::shared_ptr< PFEnergyCalibration > &calibration, const boost::shared_ptr< PFEnergyCalibrationHF > &thepfEnergyCalibrationHF) |
void | setPFEleParameters (double mvaEleCut, std::string mvaWeightFileEleID, bool usePFElectrons, const boost::shared_ptr< PFSCEnergyCalibration > &thePFSCEnergyCalibration, const boost::shared_ptr< PFEnergyCalibration > &thePFEnergyCalibration, double sumEtEcalIsoForEgammaSC_barrel, double sumEtEcalIsoForEgammaSC_endcap, double coneEcalIsoForEgammaSC, double sumPtTrackIsoForEgammaSC_barrel, double sumPtTrackIsoForEgammaSC_endcap, unsigned int nTrackIsoForEgammaSC, double coneTrackIsoForEgammaSC, bool applyCrackCorrections=false, bool usePFSCEleCalib=true, bool useEGElectrons=false, bool useEGammaSupercluster=true) |
void | setPFMuonAlgo (PFMuonAlgo *algo) |
void | setPFMuonAndFakeParameters (const edm::ParameterSet &pset) |
void | setPFPhotonParameters (bool usePFPhoton, std::string mvaWeightFileConvID, double mvaConvCut, bool useReg, std::string X0_Map, const boost::shared_ptr< PFEnergyCalibration > &thePFEnergyCalibration, double sumPtTrackIsoForPhoton, double sumPtTrackIsoSlopeForPhoton) |
void | setPFPhotonRegWeights (const GBRForest *LCorrForestEB, const GBRForest *LCorrForestEE, const GBRForest *GCorrForestBarrel, const GBRForest *GCorrForestEndcapHr9, const GBRForest *GCorrForestEndcapLr9, const GBRForest *PFEcalResolution) |
void | setPFVertexParameters (bool useVertex, const reco::VertexCollection *primaryVertices) |
void | setPhotonExtraRef (const edm::OrphanHandle< reco::PFCandidatePhotonExtraCollection > &pf_extrah) |
void | setPostHFCleaningParameters (bool postHFCleaning, double minHFCleaningPt, double minSignificance, double maxSignificance, double minSignificanceReduction, double maxDeltaPhiPt, double minDeltaMet) |
boost::shared_ptr < PFEnergyCalibration > | thePFEnergyCalibration () |
return the pointer to the calibration function | |
std::auto_ptr < reco::PFCandidateCollection > | transferCandidates () |
std::auto_ptr < reco::PFCandidateCollection > & | transferCleanedCandidates () |
std::auto_ptr < reco::PFCandidateCollection > | transferElectronCandidates () |
std::auto_ptr < reco::PFCandidateElectronExtraCollection > | transferElectronExtra () |
std::auto_ptr < reco::PFCandidatePhotonExtraCollection > | transferPhotonExtra () |
virtual | ~PFAlgo () |
destructor | |
Protected Member Functions | |
void | associatePSClusters (unsigned iEcal, reco::PFBlockElement::Type psElementType, const reco::PFBlock &block, const edm::OwnVector< reco::PFBlockElement > &elements, const reco::PFBlock::LinkData &linkData, std::vector< bool > &active, std::vector< double > &psEne) |
Associate PS clusters to a given ECAL cluster, and return their energy. | |
bool | isFromSecInt (const reco::PFBlockElement &eTrack, std::string order) const |
double | neutralHadronEnergyResolution (double clusterEnergy, double clusterEta) const |
todo: use PFClusterTools for this | |
double | nSigmaHCAL (double clusterEnergy, double clusterEta) const |
void | postCleaning () |
virtual void | processBlock (const reco::PFBlockRef &blockref, std::list< reco::PFBlockRef > &hcalBlockRefs, std::list< reco::PFBlockRef > &ecalBlockRefs) |
unsigned | reconstructCluster (const reco::PFCluster &cluster, double particleEnergy, bool useDirection=false, double particleX=0., double particleY=0., double particleZ=0.) |
unsigned | reconstructTrack (const reco::PFBlockElement &elt, bool allowLoose=false) |
Protected Attributes | |
std::auto_ptr < reco::PFCandidateCollection > | pfCandidates_ |
std::auto_ptr < reco::PFCandidateCollection > | pfCleanedCandidates_ |
std::auto_ptr < reco::PFCandidateCollection > | pfElectronCandidates_ |
the unfiltered electron collection | |
reco::PFCandidateElectronExtraCollection | pfElectronExtra_ |
the unfiltered electron collection | |
std::auto_ptr < reco::PFCandidateCollection > | pfPhotonCandidates_ |
the unfiltered photon collection | |
reco::PFCandidatePhotonExtraCollection | pfPhotonExtra_ |
the extra photon collection | |
Private Member Functions | |
reco::PFBlockRef | createBlockRef (const reco::PFBlockCollection &blocks, unsigned bi) |
Private Attributes | |
int | algo_ |
bool | applyCrackCorrectionsElectrons_ |
reco::PFBlockHandle | blockHandle_ |
input block handle (full framework case) | |
boost::shared_ptr < PFEnergyCalibration > | calibration_ |
double | coneEcalIsoForEgammaSC_ |
double | coneTrackIsoForEgammaSC_ |
PFCandConnector | connector_ |
bool | debug_ |
double | dptRel_DispVtx_ |
std::vector< double > | factors45_ |
double | maxDeltaPhiPt_ |
double | maxSignificance_ |
double | minDeltaMet_ |
double | minHFCleaningPt_ |
double | minSignificance_ |
double | minSignificanceReduction_ |
std::vector< double > | muonECAL_ |
edm::Handle< reco::MuonCollection > | muonHandle_ |
std::vector< double > | muonHCAL_ |
Variables for muons and fakes. | |
std::vector< double > | muonHO_ |
double | mvaEleCut_ |
std::string | mvaWeightFileEleID_ |
Variables for PFElectrons. | |
double | nSigmaECAL_ |
number of sigma to judge energy excess in ECAL | |
double | nSigmaHCAL_ |
number of sigma to judge energy excess in HCAL | |
double | nSigmaTRACK_ |
unsigned int | nTrackIsoForEgammaSC_ |
PFElectronAlgo * | pfele_ |
PFMuonAlgo * | pfmu_ |
PFPhotonAlgo * | pfpho_ |
bool | postHFCleaning_ |
bool | postMuonCleaning_ |
reco::Vertex | primaryVertex_ |
double | ptError_ |
bool | rejectTracks_Bad_ |
bool | rejectTracks_Step45_ |
std::vector< double > | setchi2Values_ |
double | sumEtEcalIsoForEgammaSC_barrel_ |
double | sumEtEcalIsoForEgammaSC_endcap_ |
double | sumPtTrackIsoForEgammaSC_barrel_ |
double | sumPtTrackIsoForEgammaSC_endcap_ |
boost::shared_ptr < PFEnergyCalibrationHF > | thepfEnergyCalibrationHF_ |
boost::shared_ptr < PFSCEnergyCalibration > | thePFSCEnergyCalibration_ |
double | useBestMuonTrack_ |
bool | useEGammaSupercluster_ |
bool | useEGElectrons_ |
bool | useHO_ |
bool | usePFConversions_ |
bool | usePFDecays_ |
bool | usePFElectrons_ |
bool | usePFMuonMomAssign_ |
bool | usePFNuclearInteractions_ |
bool | usePFPhotons_ |
bool | usePFSCEleCalib_ |
bool | useVertices_ |
Friends | |
std::ostream & | operator<< (std::ostream &out, const PFAlgo &algo) |
PFAlgo::PFAlgo | ( | ) |
constructor
Definition at line 57 of file PFAlgo.cc.
: pfCandidates_( new PFCandidateCollection), nSigmaECAL_(0), nSigmaHCAL_(1), algo_(1), debug_(false), pfele_(0), pfpho_(0), useVertices_(false) {}
PFAlgo::~PFAlgo | ( | ) | [virtual] |
destructor
Definition at line 68 of file PFAlgo.cc.
References pfele_, pfpho_, usePFElectrons_, and usePFPhotons_.
{ if (usePFElectrons_) delete pfele_; if (usePFPhotons_) delete pfpho_; }
void PFAlgo::associatePSClusters | ( | unsigned | iEcal, |
reco::PFBlockElement::Type | psElementType, | ||
const reco::PFBlock & | block, | ||
const edm::OwnVector< reco::PFBlockElement > & | elements, | ||
const reco::PFBlock::LinkData & | linkData, | ||
std::vector< bool > & | active, | ||
std::vector< double > & | psEne | ||
) | [protected] |
Associate PS clusters to a given ECAL cluster, and return their energy.
Definition at line 3167 of file PFAlgo.cc.
References reco::PFBlock::associatedElements(), reco::PFBlockElement::ECAL, edm::Ref< C, T, F >::isNull(), and reco::PFBlock::LINKTEST_ALL.
Referenced by PFAlgoTestBenchElectrons::processBlock().
{ // Find all PS clusters with type psElement associated to ECAL cluster iEcal, // within all PFBlockElement "elements" of a given PFBlock "block" // psElement can be reco::PFBlockElement::PS1 or reco::PFBlockElement::PS2 // Returns a vector of PS cluster energies, and updates the "active" vector. // Find all PS clusters linked to the iEcal cluster std::multimap<double, unsigned> sortedPS; typedef std::multimap<double, unsigned>::iterator IE; block.associatedElements( iEcal, linkData, sortedPS, psElementType, reco::PFBlock::LINKTEST_ALL ); // Loop over these PS clusters double totalPS = 0.; for ( IE ips=sortedPS.begin(); ips!=sortedPS.end(); ++ips ) { // CLuster index and distance to iEcal unsigned iPS = ips->second; // double distPS = ips->first; // Ignore clusters already in use if (!active[iPS]) continue; // Check that this cluster is not closer to another ECAL cluster std::multimap<double, unsigned> sortedECAL; block.associatedElements( iPS, linkData, sortedECAL, reco::PFBlockElement::ECAL, reco::PFBlock::LINKTEST_ALL ); unsigned jEcal = sortedECAL.begin()->second; if ( jEcal != iEcal ) continue; // Update PS energy PFBlockElement::Type pstype = elements[ iPS ].type(); assert( pstype == psElementType ); PFClusterRef psclusterref = elements[iPS].clusterRef(); assert(!psclusterref.isNull() ); totalPS += psclusterref->energy(); psEne[0] += psclusterref->energy(); active[iPS] = false; } }
void PFAlgo::checkCleaning | ( | const reco::PFRecHitCollection & | cleanedHF | ) |
Check HF Cleaning.
Definition at line 3365 of file PFAlgo.cc.
References gather_cfg::cout, debug_, reco::PFRecHit::energy(), i, j, reco::PFRecHit::layer(), minDeltaMet_, pfCandidates_, reco::PFRecHit::position(), reco::LeafCandidate::pt(), reco::LeafCandidate::px(), reco::LeafCandidate::py(), reconstructCluster(), createPayload::skip, mathSSE::sqrt(), and reco::PFRecHit::time().
Referenced by PFRootEventManager::particleFlow().
{ // No hits to recover, leave. if ( !cleanedHits.size() ) return; //Compute met and met significance (met/sqrt(SumEt)) double metX = 0.; double metY = 0.; double sumet = 0; std::vector<unsigned int> hitsToBeAdded; for(unsigned i=0; i<pfCandidates_->size(); i++) { const PFCandidate& pfc = (*pfCandidates_)[i]; metX += pfc.px(); metY += pfc.py(); sumet += pfc.pt(); } double met2 = metX*metX+metY*metY; double met2_Original = met2; // Select events with large MET significance. // double significance = std::sqrt(met2/sumet); // double significanceCor = significance; double metXCor = metX; double metYCor = metY; double sumetCor = sumet; double met2Cor = met2; bool next = true; unsigned iCor = 1E9; // Find the cleaned hit with the largest effect on the MET while ( next ) { double metReduc = -1.; // Loop on the candidates for(unsigned i=0; i<cleanedHits.size(); ++i) { const PFRecHit& hit = cleanedHits[i]; double length = std::sqrt(hit.position().Mag2()); double px = hit.energy() * hit.position().x()/length; double py = hit.energy() * hit.position().y()/length; double pt = std::sqrt(px*px + py*py); // Check that it is not already scheculed to be cleaned bool skip = false; for(unsigned j=0; j<hitsToBeAdded.size(); ++j) { if ( i == hitsToBeAdded[j] ) skip = true; if ( skip ) break; } if ( skip ) continue; // Now add the candidate to the MET double metXInt = metX + px; double metYInt = metY + py; double sumetInt = sumet + pt; double met2Int = metXInt*metXInt+metYInt*metYInt; // And check if it could contribute to a MET reduction if ( met2Int < met2Cor ) { metXCor = metXInt; metYCor = metYInt; metReduc = (met2-met2Int)/met2Int; met2Cor = met2Int; sumetCor = sumetInt; // significanceCor = std::sqrt(met2Cor/sumetCor); iCor = i; } } // // If the MET must be significanly reduced, schedule the candidate to be added // if ( metReduc > minDeltaMet_ ) { hitsToBeAdded.push_back(iCor); metX = metXCor; metY = metYCor; sumet = sumetCor; met2 = met2Cor; } else { // Otherwise just stop the loop next = false; } } // // At least 10 GeV MET reduction if ( std::sqrt(met2_Original) - std::sqrt(met2) > 5. ) { if ( debug_ ) { std::cout << hitsToBeAdded.size() << " hits were re-added " << std::endl; std::cout << "MET reduction = " << std::sqrt(met2_Original) << " -> " << std::sqrt(met2Cor) << " = " << std::sqrt(met2Cor) - std::sqrt(met2_Original) << std::endl; std::cout << "Added after cleaning check : " << std::endl; } for(unsigned j=0; j<hitsToBeAdded.size(); ++j) { const PFRecHit& hit = cleanedHits[hitsToBeAdded[j]]; PFCluster cluster(hit.layer(), hit.energy(), hit.position().x(), hit.position().y(), hit.position().z() ); reconstructCluster(cluster,hit.energy()); if ( debug_ ) { std::cout << pfCandidates_->back() << ". time = " << hit.time() << std::endl; } } } }
reco::PFBlockRef PFAlgo::createBlockRef | ( | const reco::PFBlockCollection & | blocks, |
unsigned | bi | ||
) | [private] |
create a reference to a block, transient or persistent depending on the needs
Definition at line 3155 of file PFAlgo.cc.
References blockHandle_, and edm::HandleBase::isValid().
Referenced by reconstructParticles().
{ if( blockHandle_.isValid() ) { return reco::PFBlockRef( blockHandle_, bi ); } else { return reco::PFBlockRef( &blocks, bi ); } }
PFMuonAlgo * PFAlgo::getPFMuonAlgo | ( | ) |
bool PFAlgo::isFromSecInt | ( | const reco::PFBlockElement & | eTrack, |
std::string | order | ||
) | const [protected] |
Definition at line 3222 of file PFAlgo.cc.
References reco::PFBlockElement::T_FROM_DISP, reco::PFBlockElement::T_FROM_V0, reco::PFBlockElement::T_TO_DISP, reco::PFBlockElement::trackType(), usePFDecays_, and usePFNuclearInteractions_.
Referenced by PFAlgoTestBenchElectrons::processBlock(), and reconstructTrack().
{ reco::PFBlockElement::TrackType T_TO_DISP = reco::PFBlockElement::T_TO_DISP; reco::PFBlockElement::TrackType T_FROM_DISP = reco::PFBlockElement::T_FROM_DISP; // reco::PFBlockElement::TrackType T_FROM_GAMMACONV = reco::PFBlockElement::T_FROM_GAMMACONV; reco::PFBlockElement::TrackType T_FROM_V0 = reco::PFBlockElement::T_FROM_V0; bool bPrimary = (order.find("primary") != string::npos); bool bSecondary = (order.find("secondary") != string::npos); bool bAll = (order.find("all") != string::npos); bool isToDisp = usePFNuclearInteractions_ && eTrack.trackType(T_TO_DISP); bool isFromDisp = usePFNuclearInteractions_ && eTrack.trackType(T_FROM_DISP); if (bPrimary && isToDisp) return true; if (bSecondary && isFromDisp ) return true; if (bAll && ( isToDisp || isFromDisp ) ) return true; // bool isFromConv = usePFConversions_ && eTrack.trackType(T_FROM_GAMMACONV); // if ((bAll || bSecondary)&& isFromConv) return true; bool isFromDecay = (bAll || bSecondary) && usePFDecays_ && eTrack.trackType(T_FROM_V0); return isFromDecay; }
double PFAlgo::neutralHadronEnergyResolution | ( | double | clusterEnergy, |
double | clusterEta | ||
) | const [protected] |
todo: use PFClusterTools for this
Definition at line 3102 of file PFAlgo.cc.
References mathSSE::sqrt().
Referenced by PFAlgoTestBenchElectrons::processBlock().
double PFAlgo::nSigmaHCAL | ( | double | clusterEnergy, |
double | clusterEta | ||
) | const [protected] |
Definition at line 3117 of file PFAlgo.cc.
References create_public_lumi_plots::exp, and nSigmaHCAL_.
Referenced by PFAlgoTestBenchElectrons::processBlock(), and setParameters().
{ double nS = fabs(eta) < 1.48 ? nSigmaHCAL_ * (1. + exp(-clusterEnergyHCAL/100.)) : nSigmaHCAL_ * (1. + exp(-clusterEnergyHCAL/100.)); return nS; }
const std::auto_ptr< reco::PFCandidateCollection >& PFAlgo::pfCandidates | ( | ) | const [inline] |
Definition at line 170 of file PFAlgo.h.
References pfCandidates_.
Referenced by operator<<().
{ return pfCandidates_; }
void PFAlgo::postCleaning | ( | ) | [protected] |
Definition at line 3258 of file PFAlgo.cc.
References gather_cfg::cout, SiPixelRawToDigiRegional_cfi::deltaPhi, reco::PFCandidate::egamma_HF, reco::PFCandidate::h_HF, i, j, maxDeltaPhiPt_, maxSignificance_, minDeltaMet_, minHFCleaningPt_, minSignificance_, minSignificanceReduction_, reco::PFCandidate::particleId(), pfCandidates_, pfCleanedCandidates_, postHFCleaning_, reco::LeafCandidate::pt(), reco::LeafCandidate::px(), reco::LeafCandidate::py(), createPayload::skip, and mathSSE::sqrt().
Referenced by reconstructParticles().
{ // Check if the post HF Cleaning was requested - if not, do nothing if ( !postHFCleaning_ ) return; //Compute met and met significance (met/sqrt(SumEt)) double metX = 0.; double metY = 0.; double sumet = 0; std::vector<unsigned int> pfCandidatesToBeRemoved; for(unsigned i=0; i<pfCandidates_->size(); i++) { const PFCandidate& pfc = (*pfCandidates_)[i]; metX += pfc.px(); metY += pfc.py(); sumet += pfc.pt(); } double met2 = metX*metX+metY*metY; // Select events with large MET significance. double significance = std::sqrt(met2/sumet); double significanceCor = significance; if ( significance > minSignificance_ ) { double metXCor = metX; double metYCor = metY; double sumetCor = sumet; double met2Cor = met2; double deltaPhi = 3.14159; double deltaPhiPt = 100.; bool next = true; unsigned iCor = 1E9; // Find the HF candidate with the largest effect on the MET while ( next ) { double metReduc = -1.; // Loop on the candidates for(unsigned i=0; i<pfCandidates_->size(); ++i) { const PFCandidate& pfc = (*pfCandidates_)[i]; // Check that the pfCandidate is in the HF if ( pfc.particleId() != reco::PFCandidate::h_HF && pfc.particleId() != reco::PFCandidate::egamma_HF ) continue; // Check if has meaningful pt if ( pfc.pt() < minHFCleaningPt_ ) continue; // Check that it is not already scheculed to be cleaned bool skip = false; for(unsigned j=0; j<pfCandidatesToBeRemoved.size(); ++j) { if ( i == pfCandidatesToBeRemoved[j] ) skip = true; if ( skip ) break; } if ( skip ) continue; // Check that the pt and the MET are aligned deltaPhi = std::acos((metX*pfc.px()+metY*pfc.py())/(pfc.pt()*std::sqrt(met2))); deltaPhiPt = deltaPhi*pfc.pt(); if ( deltaPhiPt > maxDeltaPhiPt_ ) continue; // Now remove the candidate from the MET double metXInt = metX - pfc.px(); double metYInt = metY - pfc.py(); double sumetInt = sumet - pfc.pt(); double met2Int = metXInt*metXInt+metYInt*metYInt; if ( met2Int < met2Cor ) { metXCor = metXInt; metYCor = metYInt; metReduc = (met2-met2Int)/met2Int; met2Cor = met2Int; sumetCor = sumetInt; significanceCor = std::sqrt(met2Cor/sumetCor); iCor = i; } } // // If the MET must be significanly reduced, schedule the candidate to be cleaned if ( metReduc > minDeltaMet_ ) { pfCandidatesToBeRemoved.push_back(iCor); metX = metXCor; metY = metYCor; sumet = sumetCor; met2 = met2Cor; } else { // Otherwise just stop the loop next = false; } } // // The significance must be significantly reduced to indeed clean the candidates if ( significance - significanceCor > minSignificanceReduction_ && significanceCor < maxSignificance_ ) { std::cout << "Significance reduction = " << significance << " -> " << significanceCor << " = " << significanceCor - significance << std::endl; for(unsigned j=0; j<pfCandidatesToBeRemoved.size(); ++j) { std::cout << "Removed : " << (*pfCandidates_)[pfCandidatesToBeRemoved[j]] << std::endl; pfCleanedCandidates_->push_back( (*pfCandidates_)[ pfCandidatesToBeRemoved[j] ] ); (*pfCandidates_)[pfCandidatesToBeRemoved[j]].rescaleMomentum(1E-6); //reco::PFCandidate::ParticleType unknown = reco::PFCandidate::X; //(*pfCandidates_)[pfCandidatesToBeRemoved[j]].setParticleType(unknown); } } } }
virtual void PFAlgo::processBlock | ( | const reco::PFBlockRef & | blockref, |
std::list< reco::PFBlockRef > & | hcalBlockRefs, | ||
std::list< reco::PFBlockRef > & | ecalBlockRefs | ||
) | [protected, virtual] |
process one block. can be reimplemented in more sophisticated algorithms
Reimplemented in PFAlgoTestBenchConversions, and PFAlgoTestBenchElectrons.
Referenced by reconstructParticles().
unsigned PFAlgo::reconstructCluster | ( | const reco::PFCluster & | cluster, |
double | particleEnergy, | ||
bool | useDirection = false , |
||
double | particleX = 0. , |
||
double | particleY = 0. , |
||
double | particleZ = 0. |
||
) | [protected] |
Reconstruct a neutral particle from a cluster. If chargedEnergy is specified, the neutral particle is created only if the cluster energy is significantly larger than the chargedEnergy. In this case, the energy of the neutral particle is cluster energy - chargedEnergy
Definition at line 2990 of file PFAlgo.cc.
References DeDxDiscriminatorTools::charge(), gather_cfg::cout, debug_, PFLayer::ECAL_BARREL, PFLayer::ECAL_ENDCAP, PFLayer::HCAL_BARREL1, PFLayer::HCAL_ENDCAP, PFLayer::HF_EM, PFLayer::HF_HAD, reco::PFCluster::layer(), pfCandidates_, reco::CaloCluster::position(), primaryVertex_, mathSSE::sqrt(), tmp, useVertices_, reco::Vertex::x(), X, reco::Vertex::y(), and reco::Vertex::z().
Referenced by checkCleaning(), and PFAlgoTestBenchElectrons::processBlock().
{ reco::PFCandidate::ParticleType particleType = reco::PFCandidate::X; // need to convert the math::XYZPoint data member of the PFCluster class= // to a displacement vector: // Transform particleX,Y,Z to a position at ECAL/HCAL entrance double factor = 1.; if ( useDirection ) { switch( cluster.layer() ) { case PFLayer::ECAL_BARREL: case PFLayer::HCAL_BARREL1: factor = std::sqrt(cluster.position().Perp2()/(particleX*particleX+particleY*particleY)); break; case PFLayer::ECAL_ENDCAP: case PFLayer::HCAL_ENDCAP: case PFLayer::HF_HAD: case PFLayer::HF_EM: factor = cluster.position().Z()/particleZ; break; default: assert(0); } } //MIKE First of all let's check if we have vertex. math::XYZPoint vertexPos; if(useVertices_) vertexPos = math::XYZPoint(primaryVertex_.x(),primaryVertex_.y(),primaryVertex_.z()); else vertexPos = math::XYZPoint(0.0,0.0,0.0); math::XYZVector clusterPos( cluster.position().X()-vertexPos.X(), cluster.position().Y()-vertexPos.Y(), cluster.position().Z()-vertexPos.Z()); math::XYZVector particleDirection ( particleX*factor-vertexPos.X(), particleY*factor-vertexPos.Y(), particleZ*factor-vertexPos.Z() ); //math::XYZVector clusterPos( cluster.position().X(), cluster.position().Y(),cluster.position().Z() ); //math::XYZVector particleDirection ( particleX, particleY, particleZ ); clusterPos = useDirection ? particleDirection.Unit() : clusterPos.Unit(); clusterPos *= particleEnergy; // clusterPos is now a vector along the cluster direction, // with a magnitude equal to the cluster energy. double mass = 0; ROOT::Math::LorentzVector<ROOT::Math::PxPyPzM4D<double> > momentum( clusterPos.X(), clusterPos.Y(), clusterPos.Z(), mass); // mathcore is a piece of #$% math::XYZTLorentzVector tmp; // implicit constructor not allowed tmp = momentum; // Charge int charge = 0; // Type switch( cluster.layer() ) { case PFLayer::ECAL_BARREL: case PFLayer::ECAL_ENDCAP: particleType = PFCandidate::gamma; break; case PFLayer::HCAL_BARREL1: case PFLayer::HCAL_ENDCAP: particleType = PFCandidate::h0; break; case PFLayer::HF_HAD: particleType = PFCandidate::h_HF; break; case PFLayer::HF_EM: particleType = PFCandidate::egamma_HF; break; default: assert(0); } // The pf candidate pfCandidates_->push_back( PFCandidate( charge, tmp, particleType ) ); // The position at ECAL entrance (well: watch out, it is not true // for HCAL clusters... to be fixed) pfCandidates_->back(). setPositionAtECALEntrance(math::XYZPointF(cluster.position().X(), cluster.position().Y(), cluster.position().Z())); //Set the cnadidate Vertex pfCandidates_->back().setVertex(vertexPos); if(debug_) cout<<"** candidate: "<<pfCandidates_->back()<<endl; // returns index to the newly created PFCandidate return pfCandidates_->size()-1; }
void PFAlgo::reconstructParticles | ( | const reco::PFBlockCollection & | blocks | ) | [virtual] |
reconstruct particles
Definition at line 351 of file PFAlgo.cc.
References PFMuonAlgo::addMissingMuons(), Association::block, gather_cfg::cout, createBlockRef(), debug_, ECAL, reco::PFBlock::elements(), asciidump::elements, relativeConstraints::empty, reco::PFBlockElement::HCAL, reco::PFBlockElement::HO, i, edm::HandleBase::isValid(), muonHandle_, pfCandidates_, pfCleanedCandidates_, pfElectronCandidates_, pfElectronExtra_, pfmu_, pfPhotonCandidates_, pfPhotonExtra_, PFMuonAlgo::postClean(), postCleaning(), processBlock(), edm::OwnVector< T, P >::push_back(), and edm::OwnVector< T, P >::size().
{ // reset output collection if(pfCandidates_.get() ) pfCandidates_->clear(); else pfCandidates_.reset( new reco::PFCandidateCollection ); if(pfElectronCandidates_.get() ) pfElectronCandidates_->clear(); else pfElectronCandidates_.reset( new reco::PFCandidateCollection); // Clearing pfPhotonCandidates if( pfPhotonCandidates_.get() ) pfPhotonCandidates_->clear(); else pfPhotonCandidates_.reset( new reco::PFCandidateCollection); if(pfCleanedCandidates_.get() ) pfCleanedCandidates_->clear(); else pfCleanedCandidates_.reset( new reco::PFCandidateCollection ); // not a auto_ptr; shout not be deleted after transfer pfElectronExtra_.clear(); pfPhotonExtra_.clear(); if( debug_ ) { cout<<"*********************************************************"<<endl; cout<<"***** Particle flow algorithm *****"<<endl; cout<<"*********************************************************"<<endl; } // sort elements in three lists: std::list< reco::PFBlockRef > hcalBlockRefs; std::list< reco::PFBlockRef > ecalBlockRefs; std::list< reco::PFBlockRef > hoBlockRefs; std::list< reco::PFBlockRef > otherBlockRefs; for( unsigned i=0; i<blocks.size(); ++i ) { // reco::PFBlockRef blockref( blockh,i ); reco::PFBlockRef blockref = createBlockRef( blocks, i); const reco::PFBlock& block = *blockref; const edm::OwnVector< reco::PFBlockElement >& elements = block.elements(); bool singleEcalOrHcal = false; if( elements.size() == 1 ){ if( elements[0].type() == reco::PFBlockElement::ECAL ){ ecalBlockRefs.push_back( blockref ); singleEcalOrHcal = true; } if( elements[0].type() == reco::PFBlockElement::HCAL ){ hcalBlockRefs.push_back( blockref ); singleEcalOrHcal = true; } if( elements[0].type() == reco::PFBlockElement::HO ){ // Single HO elements are likely to be noise. Not considered for now. hoBlockRefs.push_back( blockref ); singleEcalOrHcal = true; } } if(!singleEcalOrHcal) { otherBlockRefs.push_back( blockref ); } }//loop blocks if( debug_ ){ cout<<"# Ecal blocks: "<<ecalBlockRefs.size() <<", # Hcal blocks: "<<hcalBlockRefs.size() <<", # HO blocks: "<<hoBlockRefs.size() <<", # Other blocks: "<<otherBlockRefs.size()<<endl; } // loop on blocks that are not single ecal, // and not single hcal. unsigned nblcks = 0; for( IBR io = otherBlockRefs.begin(); io!=otherBlockRefs.end(); ++io) { if ( debug_ ) std::cout << "Block number " << nblcks++ << std::endl; processBlock( *io, hcalBlockRefs, ecalBlockRefs ); } std::list< reco::PFBlockRef > empty; unsigned hblcks = 0; // process remaining single hcal blocks for( IBR ih = hcalBlockRefs.begin(); ih!=hcalBlockRefs.end(); ++ih) { if ( debug_ ) std::cout << "HCAL block number " << hblcks++ << std::endl; processBlock( *ih, empty, empty ); } unsigned eblcks = 0; // process remaining single ecal blocks for( IBR ie = ecalBlockRefs.begin(); ie!=ecalBlockRefs.end(); ++ie) { if ( debug_ ) std::cout << "ECAL block number " << eblcks++ << std::endl; processBlock( *ie, empty, empty ); } // Post HF Cleaning postCleaning(); //Muon post cleaning pfmu_->postClean(pfCandidates_.get()); //Add Missing muons if( muonHandle_.isValid()) pfmu_->addMissingMuons(muonHandle_,pfCandidates_.get()); }
void PFAlgo::reconstructParticles | ( | const reco::PFBlockHandle & | blockHandle | ) |
reconstruct particles (full framework case) will keep track of the block handle to build persistent references, and call reconstructParticles( const reco::PFBlockCollection& blocks )
Definition at line 343 of file PFAlgo.cc.
References blockHandle_.
Referenced by PFRootEventManager::particleFlow().
{ blockHandle_ = blockHandle; reconstructParticles( *blockHandle_ ); }
unsigned PFAlgo::reconstructTrack | ( | const reco::PFBlockElement & | elt, |
bool | allowLoose = false |
||
) | [protected] |
Reconstruct a charged particle from a track Returns the index of the newly created candidate in pfCandidates_ Michalis added a flag here to treat muons inside jets
Definition at line 2916 of file PFAlgo.cc.
References reco::TrackBase::charge(), DeDxDiscriminatorTools::charge(), gather_cfg::cout, debug_, reco::PFBlockElementTrack::displacedVertexRef(), dptRel_DispVtx_, relval_parameters_module::energy, h, isFromSecInt(), reco::isMuon(), edm::Ref< C, T, F >::isNonnull(), reco::PFBlockElementTrack::muonRef(), reco::TrackBase::p(), pfCandidates_, pfmu_, reco::PFBlockElementTrack::positionAtECALEntrance(), reco::TrackBase::px(), reco::TrackBase::py(), reco::TrackBase::pz(), PFMuonAlgo::reconstructMuon(), mathSSE::sqrt(), reco::PFBlockElement::T_FROM_DISP, reco::PFCandidate::T_FROM_DISP, reco::PFBlockElement::T_TO_DISP, reco::PFCandidate::T_TO_DISP, and reco::PFBlockElementTrack::trackRef().
Referenced by PFAlgoTestBenchElectrons::processBlock().
{ const reco::PFBlockElementTrack* eltTrack = dynamic_cast<const reco::PFBlockElementTrack*>(&elt); reco::TrackRef trackRef = eltTrack->trackRef(); const reco::Track& track = *trackRef; reco::MuonRef muonRef = eltTrack->muonRef(); int charge = track.charge()>0 ? 1 : -1; // Assume this particle is a charged Hadron double px = track.px(); double py = track.py(); double pz = track.pz(); double energy = sqrt(track.p()*track.p() + 0.13957*0.13957); // Create a PF Candidate math::XYZTLorentzVector momentum(px,py,pz,energy); reco::PFCandidate::ParticleType particleType = reco::PFCandidate::h; // Add it to the stack pfCandidates_->push_back( PFCandidate( charge, momentum, particleType ) ); //Set vertex and stuff like this pfCandidates_->back().setVertexSource( PFCandidate::kTrkVertex ); pfCandidates_->back().setTrackRef( trackRef ); pfCandidates_->back().setPositionAtECALEntrance( eltTrack->positionAtECALEntrance()); if( muonRef.isNonnull()) pfCandidates_->back().setMuonRef( muonRef ); //OK Now try to reconstruct the particle as a muon bool isMuon=pfmu_->reconstructMuon(pfCandidates_->back(),muonRef,allowLoose); bool isFromDisp = isFromSecInt(elt, "secondary"); if ((!isMuon) && isFromDisp) { double Dpt = trackRef->ptError(); double dptRel = Dpt/trackRef->pt()*100; //If the track is ill measured it is better to not refit it, since the track information probably would not be used. //In the PFAlgo we use the trackref information. If the track error is too big the refitted information might be very different // from the not refitted one. if (dptRel < dptRel_DispVtx_){ if (debug_) cout << "Not refitted px = " << px << " py = " << py << " pz = " << pz << " energy = " << energy << endl; //reco::TrackRef trackRef = eltTrack->trackRef(); reco::PFDisplacedVertexRef vRef = eltTrack->displacedVertexRef(reco::PFBlockElement::T_FROM_DISP)->displacedVertexRef(); reco::Track trackRefit = vRef->refittedTrack(trackRef); //change the momentum with the refitted track math::XYZTLorentzVector momentum(trackRefit.px(), trackRefit.py(), trackRefit.pz(), sqrt(trackRefit.p()*trackRefit.p() + 0.13957*0.13957)); if (debug_) cout << "Refitted px = " << px << " py = " << py << " pz = " << pz << " energy = " << energy << endl; } pfCandidates_->back().setFlag( reco::PFCandidate::T_FROM_DISP, true); pfCandidates_->back().setDisplacedVertexRef( eltTrack->displacedVertexRef(reco::PFBlockElement::T_FROM_DISP)->displacedVertexRef(), reco::PFCandidate::T_FROM_DISP); } // do not label as primary a track which would be recognised as a muon. A muon cannot produce NI. It is with high probability a fake if(isFromSecInt(elt, "primary") && !isMuon) { pfCandidates_->back().setFlag( reco::PFCandidate::T_TO_DISP, true); pfCandidates_->back().setDisplacedVertexRef( eltTrack->displacedVertexRef(reco::PFBlockElement::T_TO_DISP)->displacedVertexRef(), reco::PFCandidate::T_TO_DISP); } // returns index to the newly created PFCandidate return pfCandidates_->size()-1; }
void PFAlgo::setAlgo | ( | int | algo | ) | [inline] |
Definition at line 61 of file PFAlgo.h.
References algo_.
Referenced by PFRootEventManager::readOptions().
{algo_ = algo;}
void PFAlgo::setCandConnectorParameters | ( | bool | bCorrect, |
bool | bCalibPrimary, | ||
double | dptRel_PrimaryTrack, | ||
double | dptRel_MergedTrack, | ||
double | ptErrorSecondary, | ||
std::vector< double > | nuclCalibFactors | ||
) | [inline] |
Definition at line 75 of file PFAlgo.h.
References connector_, and PFCandConnector::setParameters().
{ connector_.setParameters(bCorrect, bCalibPrimary, dptRel_PrimaryTrack, dptRel_MergedTrack, ptErrorSecondary, nuclCalibFactors); }
void PFAlgo::setCandConnectorParameters | ( | const edm::ParameterSet & | iCfgCandConnector | ) | [inline] |
Definition at line 71 of file PFAlgo.h.
References connector_, and PFCandConnector::setParameters().
Referenced by PFRootEventManager::readOptions().
{ connector_.setParameters(iCfgCandConnector); }
void PFAlgo::setDebug | ( | bool | debug | ) | [inline] |
Definition at line 64 of file PFAlgo.h.
References connector_, debug, debug_, and PFCandConnector::setDebug().
Referenced by PFRootEventManager::readOptions().
{debug_ = debug; connector_.setDebug(debug_);}
void PFAlgo::setDisplacedVerticesParameters | ( | bool | rejectTracks_Bad, |
bool | rejectTracks_Step45, | ||
bool | usePFNuclearInteractions, | ||
bool | usePFConversions, | ||
bool | usePFDecays, | ||
double | dptRel_DispVtx | ||
) |
Definition at line 282 of file PFAlgo.cc.
References dptRel_DispVtx_, rejectTracks_Bad_, rejectTracks_Step45_, usePFConversions_, usePFDecays_, and usePFNuclearInteractions_.
Referenced by PFRootEventManager::readOptions().
{ rejectTracks_Bad_ = rejectTracks_Bad; rejectTracks_Step45_ = rejectTracks_Step45; usePFNuclearInteractions_ = usePFNuclearInteractions; usePFConversions_ = usePFConversions; usePFDecays_ = usePFDecays; dptRel_DispVtx_ = dptRel_DispVtx; }
void PFAlgo::setEGElectronCollection | ( | const reco::GsfElectronCollection & | egelectrons | ) |
Definition at line 3253 of file PFAlgo.cc.
References pfele_, PFElectronAlgo::setEGElectronCollection(), and useEGElectrons_.
Referenced by PFRootEventManager::particleFlow().
{ if(useEGElectrons_ && pfele_) pfele_->setEGElectronCollection(egelectrons); }
void PFAlgo::setElectronExtraRef | ( | const edm::OrphanHandle< reco::PFCandidateElectronExtraCollection > & | extrah | ) |
Definition at line 3470 of file PFAlgo.cc.
References alignCSCRings::e, pfCandidates_, pfElectronCandidates_, pfElectronExtra_, findQualityFiles::size, and usePFElectrons_.
Referenced by PFRootEventManager::particleFlow().
{ if(!usePFElectrons_) return; // std::cout << " setElectronExtraRef " << std::endl; unsigned size=pfCandidates_->size(); for(unsigned ic=0;ic<size;++ic) { // select the electrons and add the extra if((*pfCandidates_)[ic].particleId()==PFCandidate::e) { PFElectronExtraEqual myExtraEqual((*pfCandidates_)[ic].gsfTrackRef()); std::vector<PFCandidateElectronExtra>::const_iterator it=find_if(pfElectronExtra_.begin(),pfElectronExtra_.end(),myExtraEqual); if(it!=pfElectronExtra_.end()) { // std::cout << " Index " << it-pfElectronExtra_.begin() << std::endl; reco::PFCandidateElectronExtraRef theRef(extrah,it-pfElectronExtra_.begin()); (*pfCandidates_)[ic].setPFElectronExtraRef(theRef); } else { (*pfCandidates_)[ic].setPFElectronExtraRef(PFCandidateElectronExtraRef()); } } else // else save the mva and the extra as well ! { if((*pfCandidates_)[ic].trackRef().isNonnull()) { PFElectronExtraKfEqual myExtraEqual((*pfCandidates_)[ic].trackRef()); std::vector<PFCandidateElectronExtra>::const_iterator it=find_if(pfElectronExtra_.begin(),pfElectronExtra_.end(),myExtraEqual); if(it!=pfElectronExtra_.end()) { (*pfCandidates_)[ic].set_mva_e_pi(it->mvaVariable(PFCandidateElectronExtra::MVA_MVA)); reco::PFCandidateElectronExtraRef theRef(extrah,it-pfElectronExtra_.begin()); (*pfCandidates_)[ic].setPFElectronExtraRef(theRef); (*pfCandidates_)[ic].setGsfTrackRef(it->gsfTrackRef()); } } } } size=pfElectronCandidates_->size(); for(unsigned ic=0;ic<size;++ic) { // select the electrons - this test is actually not needed for this collection if((*pfElectronCandidates_)[ic].particleId()==PFCandidate::e) { // find the corresponding extra PFElectronExtraEqual myExtraEqual((*pfElectronCandidates_)[ic].gsfTrackRef()); std::vector<PFCandidateElectronExtra>::const_iterator it=find_if(pfElectronExtra_.begin(),pfElectronExtra_.end(),myExtraEqual); if(it!=pfElectronExtra_.end()) { reco::PFCandidateElectronExtraRef theRef(extrah,it-pfElectronExtra_.begin()); (*pfElectronCandidates_)[ic].setPFElectronExtraRef(theRef); } } } }
void PFAlgo::setHOTag | ( | bool | ho | ) | [inline] |
Definition at line 60 of file PFAlgo.h.
References useHO_.
Referenced by PFRootEventManager::readOptions().
{ useHO_ = ho;}
void PFAlgo::setMuonHandle | ( | const edm::Handle< reco::MuonCollection > & | muons | ) |
Definition at line 259 of file PFAlgo.cc.
References muonHandle_, and patZpeak::muons.
{ muonHandle_ = muons; }
void PFAlgo::setParameters | ( | double | nSigmaECAL, |
double | nSigmaHCAL, | ||
const boost::shared_ptr< PFEnergyCalibration > & | calibration, | ||
const boost::shared_ptr< PFEnergyCalibrationHF > & | thepfEnergyCalibrationHF | ||
) |
Definition at line 75 of file PFAlgo.cc.
References calibration_, nSigmaECAL_, nSigmaHCAL(), nSigmaHCAL_, and thepfEnergyCalibrationHF_.
Referenced by PFRootEventManager::readOptions().
{ nSigmaECAL_ = nSigmaECAL; nSigmaHCAL_ = nSigmaHCAL; calibration_ = calibration; thepfEnergyCalibrationHF_ = thepfEnergyCalibrationHF; }
void PFAlgo::setPFEleParameters | ( | double | mvaEleCut, |
std::string | mvaWeightFileEleID, | ||
bool | usePFElectrons, | ||
const boost::shared_ptr< PFSCEnergyCalibration > & | thePFSCEnergyCalibration, | ||
const boost::shared_ptr< PFEnergyCalibration > & | thePFEnergyCalibration, | ||
double | sumEtEcalIsoForEgammaSC_barrel, | ||
double | sumEtEcalIsoForEgammaSC_endcap, | ||
double | coneEcalIsoForEgammaSC, | ||
double | sumPtTrackIsoForEgammaSC_barrel, | ||
double | sumPtTrackIsoForEgammaSC_endcap, | ||
unsigned int | nTrackIsoForEgammaSC, | ||
double | coneTrackIsoForEgammaSC, | ||
bool | applyCrackCorrections = false , |
||
bool | usePFSCEleCalib = true , |
||
bool | useEGElectrons = false , |
||
bool | useEGammaSupercluster = true |
||
) |
Definition at line 95 of file PFAlgo.cc.
References applyCrackCorrectionsElectrons_, coneEcalIsoForEgammaSC_, coneTrackIsoForEgammaSC_, mvaEleCut_, mvaWeightFileEleID_, nTrackIsoForEgammaSC_, pfele_, sumEtEcalIsoForEgammaSC_barrel_, sumEtEcalIsoForEgammaSC_endcap_, sumPtTrackIsoForEgammaSC_barrel_, sumPtTrackIsoForEgammaSC_endcap_, thePFSCEnergyCalibration_, useEGammaSupercluster_, useEGElectrons_, usePFElectrons_, and usePFSCEleCalib_.
Referenced by PFRootEventManager::readOptions().
{ mvaEleCut_ = mvaEleCut; usePFElectrons_ = usePFElectrons; applyCrackCorrectionsElectrons_ = applyCrackCorrections; usePFSCEleCalib_ = usePFSCEleCalib; thePFSCEnergyCalibration_ = thePFSCEnergyCalibration; useEGElectrons_ = useEGElectrons; useEGammaSupercluster_ = useEGammaSupercluster; sumEtEcalIsoForEgammaSC_barrel_ = sumEtEcalIsoForEgammaSC_barrel; sumEtEcalIsoForEgammaSC_endcap_ = sumEtEcalIsoForEgammaSC_endcap; coneEcalIsoForEgammaSC_ = coneEcalIsoForEgammaSC; sumPtTrackIsoForEgammaSC_barrel_ = sumPtTrackIsoForEgammaSC_barrel; sumPtTrackIsoForEgammaSC_endcap_ = sumPtTrackIsoForEgammaSC_endcap; coneTrackIsoForEgammaSC_ = coneTrackIsoForEgammaSC; nTrackIsoForEgammaSC_ = nTrackIsoForEgammaSC; if(!usePFElectrons_) return; mvaWeightFileEleID_ = mvaWeightFileEleID; FILE * fileEleID = fopen(mvaWeightFileEleID_.c_str(), "r"); if (fileEleID) { fclose(fileEleID); } else { string err = "PFAlgo: cannot open weight file '"; err += mvaWeightFileEleID; err += "'"; throw invalid_argument( err ); } pfele_= new PFElectronAlgo(mvaEleCut_,mvaWeightFileEleID_, thePFSCEnergyCalibration_, thePFEnergyCalibration, applyCrackCorrectionsElectrons_, usePFSCEleCalib_, useEGElectrons_, useEGammaSupercluster_, sumEtEcalIsoForEgammaSC_barrel_, sumEtEcalIsoForEgammaSC_endcap_, coneEcalIsoForEgammaSC_, sumPtTrackIsoForEgammaSC_barrel_, sumPtTrackIsoForEgammaSC_endcap_, nTrackIsoForEgammaSC_, coneTrackIsoForEgammaSC_); }
void PFAlgo::setPFMuonAlgo | ( | PFMuonAlgo * | algo | ) | [inline] |
void PFAlgo::setPFMuonAndFakeParameters | ( | const edm::ParameterSet & | pset | ) |
Definition at line 230 of file PFAlgo.cc.
References factors45_, edm::ParameterSet::getParameter(), muonECAL_, muonHCAL_, muonHO_, nSigmaTRACK_, pfmu_, ptError_, and PFMuonAlgo::setParameters().
Referenced by PFRootEventManager::readOptions().
{ pfmu_ = new PFMuonAlgo(); pfmu_->setParameters(pset); // Muon parameters muonHCAL_= pset.getParameter<std::vector<double> >("muon_HCAL"); muonECAL_= pset.getParameter<std::vector<double> >("muon_ECAL"); muonHO_= pset.getParameter<std::vector<double> >("muon_HO"); assert ( muonHCAL_.size() == 2 && muonECAL_.size() == 2 && muonHO_.size() == 2); nSigmaTRACK_= pset.getParameter<double>("nsigma_TRACK"); ptError_= pset.getParameter<double>("pt_Error"); factors45_ = pset.getParameter<std::vector<double> >("factors_45"); assert ( factors45_.size() == 2 ); }
void PFAlgo::setPFPhotonParameters | ( | bool | usePFPhoton, |
std::string | mvaWeightFileConvID, | ||
double | mvaConvCut, | ||
bool | useReg, | ||
std::string | X0_Map, | ||
const boost::shared_ptr< PFEnergyCalibration > & | thePFEnergyCalibration, | ||
double | sumPtTrackIsoForPhoton, | ||
double | sumPtTrackIsoSlopeForPhoton | ||
) |
Definition at line 157 of file PFAlgo.cc.
References alignCSCRings::e, AlCaHLTBitMon_ParallelJobs::p, pfpho_, primaryVertex_, usePFPhotons_, and useVertices_.
Referenced by PFRootEventManager::readOptions().
{ usePFPhotons_ = usePFPhotons; //for MVA pass PV if there is one in the collection otherwise pass a dummy reco::Vertex dummy; if(useVertices_) { dummy = primaryVertex_; } else { // create a dummy PV reco::Vertex::Error e; e(0, 0) = 0.0015 * 0.0015; e(1, 1) = 0.0015 * 0.0015; e(2, 2) = 15. * 15.; reco::Vertex::Point p(0, 0, 0); dummy = reco::Vertex(p, e, 0, 0, 0); } // pv=&dummy; if(! usePFPhotons_) return; FILE * filePhotonConvID = fopen(mvaWeightFileConvID.c_str(), "r"); if (filePhotonConvID) { fclose(filePhotonConvID); } else { string err = "PFAlgo: cannot open weight file '"; err += mvaWeightFileConvID; err += "'"; throw invalid_argument( err ); } const reco::Vertex* pv=&dummy; pfpho_ = new PFPhotonAlgo(mvaWeightFileConvID, mvaConvCut, useReg, X0_Map, *pv, thePFEnergyCalibration, sumPtTrackIsoForPhoton, sumPtTrackIsoSlopeForPhoton ); return; }
void PFAlgo::setPFPhotonRegWeights | ( | const GBRForest * | LCorrForestEB, |
const GBRForest * | LCorrForestEE, | ||
const GBRForest * | GCorrForestBarrel, | ||
const GBRForest * | GCorrForestEndcapHr9, | ||
const GBRForest * | GCorrForestEndcapLr9, | ||
const GBRForest * | PFEcalResolution | ||
) |
Definition at line 217 of file PFAlgo.cc.
References pfpho_, and PFPhotonAlgo::setGBRForest().
Referenced by PFRootEventManager::readOptions().
{ pfpho_->setGBRForest(LCorrForestEB,LCorrForestEE, GCorrForestBarrel, GCorrForestEndcapHr9, GCorrForestEndcapLr9, PFEcalResolution); }
void PFAlgo::setPFVertexParameters | ( | bool | useVertex, |
const reco::VertexCollection * | primaryVertices | ||
) |
Definition at line 300 of file PFAlgo.cc.
References alignCSCRings::e, i, AlCaHLTBitMon_ParallelJobs::p, pfmu_, pfpho_, primaryVertex_, PFMuonAlgo::setInputsForCleaning(), PFPhotonAlgo::setnPU(), PFPhotonAlgo::setPhotonPrimaryVtx(), usePFPhotons_, and useVertices_.
Referenced by PFRootEventManager::particleFlow().
{ useVertices_ = useVertex; //Set the vertices for muon cleaning pfmu_->setInputsForCleaning(primaryVertices); //Now find the primary vertex! bool primaryVertexFound = false; int nVtx=primaryVertices->size(); if(usePFPhotons_){ pfpho_->setnPU(nVtx); } for (unsigned short i=0 ;i<primaryVertices->size();++i) { if(primaryVertices->at(i).isValid()&&(!primaryVertices->at(i).isFake())) { primaryVertex_ = primaryVertices->at(i); primaryVertexFound = true; break; } } //Use vertices if the user wants to but only if it exists a good vertex useVertices_ = useVertex && primaryVertexFound; if(usePFPhotons_) { if (useVertices_ ){ pfpho_->setPhotonPrimaryVtx(primaryVertex_ ); } else{ reco::Vertex::Error e; e(0, 0) = 0.0015 * 0.0015; e(1, 1) = 0.0015 * 0.0015; e(2, 2) = 15. * 15.; reco::Vertex::Point p(0, 0, 0); reco::Vertex dummy = reco::Vertex(p, e, 0, 0, 0); // std::cout << " PFPho " << pfpho_ << std::endl; pfpho_->setPhotonPrimaryVtx(dummy); } } }
void PFAlgo::setPhotonExtraRef | ( | const edm::OrphanHandle< reco::PFCandidatePhotonExtraCollection > & | pf_extrah | ) |
Definition at line 3522 of file PFAlgo.cc.
References newFWLiteAna::found, pfCandidates_, pfPhotonExtra_, findQualityFiles::size, and usePFPhotons_.
{ if(!usePFPhotons_) return; unsigned int size=pfCandidates_->size(); unsigned int sizePhExtra = pfPhotonExtra_.size(); for(unsigned ic=0;ic<size;++ic) { // select the electrons and add the extra if((*pfCandidates_)[ic].particleId()==PFCandidate::gamma && (*pfCandidates_)[ic].mva_nothing_gamma() > 0.99) { if((*pfCandidates_)[ic].superClusterRef().isNonnull()) { bool found = false; for(unsigned pcextra=0;pcextra<sizePhExtra;++pcextra) { if((*pfCandidates_)[ic].superClusterRef() == pfPhotonExtra_[pcextra].superClusterRef()) { reco::PFCandidatePhotonExtraRef theRef(ph_extrah,pcextra); (*pfCandidates_)[ic].setPFPhotonExtraRef(theRef); found = true; break; } } if(!found) (*pfCandidates_)[ic].setPFPhotonExtraRef((PFCandidatePhotonExtraRef())); // null ref } else { (*pfCandidates_)[ic].setPFPhotonExtraRef((PFCandidatePhotonExtraRef())); // null ref } } } }
void PFAlgo::setPostHFCleaningParameters | ( | bool | postHFCleaning, |
double | minHFCleaningPt, | ||
double | minSignificance, | ||
double | maxSignificance, | ||
double | minSignificanceReduction, | ||
double | maxDeltaPhiPt, | ||
double | minDeltaMet | ||
) |
Definition at line 265 of file PFAlgo.cc.
References maxDeltaPhiPt_, maxSignificance_, minDeltaMet_, minHFCleaningPt_, minSignificance_, minSignificanceReduction_, and postHFCleaning_.
Referenced by PFRootEventManager::readOptions().
{ postHFCleaning_ = postHFCleaning; minHFCleaningPt_ = minHFCleaningPt; minSignificance_ = minSignificance; maxSignificance_ = maxSignificance; minSignificanceReduction_= minSignificanceReduction; maxDeltaPhiPt_ = maxDeltaPhiPt; minDeltaMet_ = minDeltaMet; }
boost::shared_ptr<PFEnergyCalibration> PFAlgo::thePFEnergyCalibration | ( | ) | [inline] |
return the pointer to the calibration function
Definition at line 208 of file PFAlgo.h.
References calibration_.
{ return calibration_; }
std::auto_ptr< reco::PFCandidateCollection > PFAlgo::transferCandidates | ( | ) | [inline] |
Definition at line 203 of file PFAlgo.h.
References PFCandConnector::connect(), connector_, and pfCandidates_.
Referenced by PFRootEventManager::particleFlow().
{ return connector_.connect(pfCandidates_); }
std::auto_ptr< reco::PFCandidateCollection >& PFAlgo::transferCleanedCandidates | ( | ) | [inline] |
Definition at line 198 of file PFAlgo.h.
References pfCleanedCandidates_.
{ return pfCleanedCandidates_; }
std::auto_ptr< reco::PFCandidateCollection> PFAlgo::transferElectronCandidates | ( | ) | [inline] |
Definition at line 175 of file PFAlgo.h.
References pfElectronCandidates_.
{ return pfElectronCandidates_; }
std::auto_ptr< reco::PFCandidateElectronExtraCollection> PFAlgo::transferElectronExtra | ( | ) | [inline] |
Definition at line 181 of file PFAlgo.h.
References pfElectronExtra_, and query::result.
Referenced by PFRootEventManager::particleFlow().
{ std::auto_ptr< reco::PFCandidateElectronExtraCollection> result(new reco::PFCandidateElectronExtraCollection); result->insert(result->end(),pfElectronExtra_.begin(),pfElectronExtra_.end()); return result; }
std::auto_ptr< reco::PFCandidatePhotonExtraCollection> PFAlgo::transferPhotonExtra | ( | ) | [inline] |
Definition at line 190 of file PFAlgo.h.
References pfPhotonExtra_, and query::result.
{ std::auto_ptr< reco::PFCandidatePhotonExtraCollection> result(new reco::PFCandidatePhotonExtraCollection); result->insert(result->end(),pfPhotonExtra_.begin(),pfPhotonExtra_.end()); return result; }
std::ostream& operator<< | ( | std::ostream & | out, |
const PFAlgo & | algo | ||
) | [friend] |
int PFAlgo::algo_ [private] |
bool PFAlgo::applyCrackCorrectionsElectrons_ [private] |
Definition at line 318 of file PFAlgo.h.
Referenced by setPFEleParameters().
reco::PFBlockHandle PFAlgo::blockHandle_ [private] |
input block handle (full framework case)
Definition at line 296 of file PFAlgo.h.
Referenced by createBlockRef(), and reconstructParticles().
boost::shared_ptr<PFEnergyCalibration> PFAlgo::calibration_ [private] |
Definition at line 304 of file PFAlgo.h.
Referenced by operator<<(), PFAlgoTestBenchElectrons::processBlock(), setParameters(), and thePFEnergyCalibration().
double PFAlgo::coneEcalIsoForEgammaSC_ [private] |
Definition at line 324 of file PFAlgo.h.
Referenced by setPFEleParameters().
double PFAlgo::coneTrackIsoForEgammaSC_ [private] |
Definition at line 327 of file PFAlgo.h.
Referenced by setPFEleParameters().
PFCandConnector PFAlgo::connector_ [private] |
A tool used for a postprocessing of displaced vertices based on reconstructed PFCandidates
Definition at line 352 of file PFAlgo.h.
Referenced by setCandConnectorParameters(), setDebug(), and transferCandidates().
bool PFAlgo::debug_ [private] |
Definition at line 310 of file PFAlgo.h.
Referenced by checkCleaning(), PFAlgoTestBenchElectrons::processBlock(), reconstructCluster(), reconstructParticles(), reconstructTrack(), and setDebug().
double PFAlgo::dptRel_DispVtx_ [private] |
Maximal relative uncertainty on the tracks going to or incoming from the displcaed vertex to be used in the PFAlgo
Definition at line 347 of file PFAlgo.h.
Referenced by PFAlgoTestBenchElectrons::processBlock(), reconstructTrack(), and setDisplacedVerticesParameters().
std::vector<double> PFAlgo::factors45_ [private] |
Definition at line 360 of file PFAlgo.h.
Referenced by PFAlgoTestBenchElectrons::processBlock(), and setPFMuonAndFakeParameters().
double PFAlgo::maxDeltaPhiPt_ [private] |
Definition at line 369 of file PFAlgo.h.
Referenced by postCleaning(), and setPostHFCleaningParameters().
double PFAlgo::maxSignificance_ [private] |
Definition at line 367 of file PFAlgo.h.
Referenced by postCleaning(), and setPostHFCleaningParameters().
double PFAlgo::minDeltaMet_ [private] |
Definition at line 370 of file PFAlgo.h.
Referenced by checkCleaning(), postCleaning(), and setPostHFCleaningParameters().
double PFAlgo::minHFCleaningPt_ [private] |
Definition at line 365 of file PFAlgo.h.
Referenced by postCleaning(), and setPostHFCleaningParameters().
double PFAlgo::minSignificance_ [private] |
Definition at line 366 of file PFAlgo.h.
Referenced by postCleaning(), and setPostHFCleaningParameters().
double PFAlgo::minSignificanceReduction_ [private] |
Definition at line 368 of file PFAlgo.h.
Referenced by postCleaning(), and setPostHFCleaningParameters().
std::vector<double> PFAlgo::muonECAL_ [private] |
Definition at line 356 of file PFAlgo.h.
Referenced by PFAlgoTestBenchElectrons::processBlock(), and setPFMuonAndFakeParameters().
edm::Handle<reco::MuonCollection> PFAlgo::muonHandle_ [private] |
Definition at line 377 of file PFAlgo.h.
Referenced by reconstructParticles(), and setMuonHandle().
std::vector<double> PFAlgo::muonHCAL_ [private] |
Variables for muons and fakes.
Definition at line 355 of file PFAlgo.h.
Referenced by PFAlgoTestBenchElectrons::processBlock(), and setPFMuonAndFakeParameters().
std::vector<double> PFAlgo::muonHO_ [private] |
Definition at line 357 of file PFAlgo.h.
Referenced by PFAlgoTestBenchElectrons::processBlock(), and setPFMuonAndFakeParameters().
double PFAlgo::mvaEleCut_ [private] |
Definition at line 315 of file PFAlgo.h.
Referenced by setPFEleParameters().
std::string PFAlgo::mvaWeightFileEleID_ [private] |
Variables for PFElectrons.
Definition at line 313 of file PFAlgo.h.
Referenced by setPFEleParameters().
double PFAlgo::nSigmaECAL_ [private] |
number of sigma to judge energy excess in ECAL
Definition at line 299 of file PFAlgo.h.
Referenced by operator<<(), PFAlgoTestBenchElectrons::processBlock(), and setParameters().
double PFAlgo::nSigmaHCAL_ [private] |
number of sigma to judge energy excess in HCAL
Definition at line 302 of file PFAlgo.h.
Referenced by nSigmaHCAL(), operator<<(), and setParameters().
double PFAlgo::nSigmaTRACK_ [private] |
Definition at line 358 of file PFAlgo.h.
Referenced by PFAlgoTestBenchElectrons::processBlock(), and setPFMuonAndFakeParameters().
unsigned int PFAlgo::nTrackIsoForEgammaSC_ [private] |
Definition at line 328 of file PFAlgo.h.
Referenced by setPFEleParameters().
std::auto_ptr< reco::PFCandidateCollection > PFAlgo::pfCandidates_ [protected] |
Definition at line 258 of file PFAlgo.h.
Referenced by checkCleaning(), operator<<(), pfCandidates(), postCleaning(), PFAlgoTestBenchElectrons::processBlock(), reconstructCluster(), reconstructParticles(), reconstructTrack(), setElectronExtraRef(), setPhotonExtraRef(), and transferCandidates().
std::auto_ptr< reco::PFCandidateCollection > PFAlgo::pfCleanedCandidates_ [protected] |
Definition at line 264 of file PFAlgo.h.
Referenced by postCleaning(), reconstructParticles(), and transferCleanedCandidates().
PFElectronAlgo* PFAlgo::pfele_ [private] |
Definition at line 329 of file PFAlgo.h.
Referenced by PFAlgoTestBenchElectrons::processBlock(), setEGElectronCollection(), setPFEleParameters(), and ~PFAlgo().
std::auto_ptr< reco::PFCandidateCollection > PFAlgo::pfElectronCandidates_ [protected] |
the unfiltered electron collection
Definition at line 260 of file PFAlgo.h.
Referenced by PFAlgoTestBenchElectrons::processBlock(), reconstructParticles(), setElectronExtraRef(), and transferElectronCandidates().
the unfiltered electron collection
Definition at line 267 of file PFAlgo.h.
Referenced by PFAlgoTestBenchElectrons::processBlock(), reconstructParticles(), setElectronExtraRef(), and transferElectronExtra().
PFMuonAlgo* PFAlgo::pfmu_ [private] |
Definition at line 331 of file PFAlgo.h.
Referenced by getPFMuonAlgo(), reconstructParticles(), reconstructTrack(), setPFMuonAlgo(), setPFMuonAndFakeParameters(), and setPFVertexParameters().
PFPhotonAlgo* PFAlgo::pfpho_ [private] |
Definition at line 330 of file PFAlgo.h.
Referenced by PFAlgoTestBenchElectrons::processBlock(), setPFPhotonParameters(), setPFPhotonRegWeights(), setPFVertexParameters(), and ~PFAlgo().
std::auto_ptr< reco::PFCandidateCollection > PFAlgo::pfPhotonCandidates_ [protected] |
the unfiltered photon collection
Definition at line 262 of file PFAlgo.h.
Referenced by PFAlgoTestBenchElectrons::processBlock(), and reconstructParticles().
the extra photon collection
Definition at line 269 of file PFAlgo.h.
Referenced by PFAlgoTestBenchElectrons::processBlock(), reconstructParticles(), setPhotonExtraRef(), and transferPhotonExtra().
bool PFAlgo::postHFCleaning_ [private] |
Definition at line 363 of file PFAlgo.h.
Referenced by postCleaning(), and setPostHFCleaningParameters().
bool PFAlgo::postMuonCleaning_ [private] |
reco::Vertex PFAlgo::primaryVertex_ [private] |
Definition at line 374 of file PFAlgo.h.
Referenced by PFAlgoTestBenchElectrons::processBlock(), reconstructCluster(), setPFPhotonParameters(), and setPFVertexParameters().
double PFAlgo::ptError_ [private] |
Definition at line 359 of file PFAlgo.h.
Referenced by PFAlgoTestBenchElectrons::processBlock(), and setPFMuonAndFakeParameters().
bool PFAlgo::rejectTracks_Bad_ [private] |
Flags to use the protection against fakes and not reconstructed displaced vertices
Definition at line 338 of file PFAlgo.h.
Referenced by PFAlgoTestBenchElectrons::processBlock(), and setDisplacedVerticesParameters().
bool PFAlgo::rejectTracks_Step45_ [private] |
Definition at line 339 of file PFAlgo.h.
Referenced by PFAlgoTestBenchElectrons::processBlock(), and setDisplacedVerticesParameters().
std::vector<double> PFAlgo::setchi2Values_ [private] |
double PFAlgo::sumEtEcalIsoForEgammaSC_barrel_ [private] |
Definition at line 322 of file PFAlgo.h.
Referenced by setPFEleParameters().
double PFAlgo::sumEtEcalIsoForEgammaSC_endcap_ [private] |
Definition at line 323 of file PFAlgo.h.
Referenced by setPFEleParameters().
double PFAlgo::sumPtTrackIsoForEgammaSC_barrel_ [private] |
Definition at line 325 of file PFAlgo.h.
Referenced by setPFEleParameters().
double PFAlgo::sumPtTrackIsoForEgammaSC_endcap_ [private] |
Definition at line 326 of file PFAlgo.h.
Referenced by setPFEleParameters().
boost::shared_ptr<PFEnergyCalibrationHF> PFAlgo::thepfEnergyCalibrationHF_ [private] |
Definition at line 305 of file PFAlgo.h.
Referenced by PFAlgoTestBenchElectrons::processBlock(), and setParameters().
boost::shared_ptr<PFSCEnergyCalibration> PFAlgo::thePFSCEnergyCalibration_ [private] |
Definition at line 306 of file PFAlgo.h.
Referenced by setPFEleParameters().
double PFAlgo::useBestMuonTrack_ [private] |
bool PFAlgo::useEGammaSupercluster_ [private] |
Definition at line 321 of file PFAlgo.h.
Referenced by setPFEleParameters().
bool PFAlgo::useEGElectrons_ [private] |
Definition at line 320 of file PFAlgo.h.
Referenced by setEGElectronCollection(), and setPFEleParameters().
bool PFAlgo::useHO_ [private] |
Definition at line 308 of file PFAlgo.h.
Referenced by PFAlgoTestBenchElectrons::processBlock(), and setHOTag().
bool PFAlgo::usePFConversions_ [private] |
Definition at line 342 of file PFAlgo.h.
Referenced by PFAlgoTestBenchElectrons::processBlock(), and setDisplacedVerticesParameters().
bool PFAlgo::usePFDecays_ [private] |
Definition at line 343 of file PFAlgo.h.
Referenced by isFromSecInt(), and setDisplacedVerticesParameters().
bool PFAlgo::usePFElectrons_ [private] |
Definition at line 316 of file PFAlgo.h.
Referenced by PFAlgoTestBenchElectrons::processBlock(), setElectronExtraRef(), setPFEleParameters(), and ~PFAlgo().
bool PFAlgo::usePFMuonMomAssign_ [private] |
bool PFAlgo::usePFNuclearInteractions_ [private] |
Definition at line 341 of file PFAlgo.h.
Referenced by isFromSecInt(), and setDisplacedVerticesParameters().
bool PFAlgo::usePFPhotons_ [private] |
Definition at line 317 of file PFAlgo.h.
Referenced by PFAlgoTestBenchElectrons::processBlock(), setPFPhotonParameters(), setPFVertexParameters(), setPhotonExtraRef(), and ~PFAlgo().
bool PFAlgo::usePFSCEleCalib_ [private] |
Definition at line 319 of file PFAlgo.h.
Referenced by setPFEleParameters().
bool PFAlgo::useVertices_ [private] |
Definition at line 375 of file PFAlgo.h.
Referenced by reconstructCluster(), setPFPhotonParameters(), and setPFVertexParameters().