237 const float coneSizeDR = 0.3;
238 const float dxyMax = 0.1;
239 const float dzMax = 0.2;
251 <<
"DataFormat does not contain a photon source!";
281 if( !vertices.isValid() )
283 if (vertices->empty())
return;
295 if( !pfCandidatesHandle.
isValid() )
298 if( !isAOD && !src->empty() ) {
300 if(
test.isNull() || !
test.isAvailable() ) {
302 <<
"DataFormat is detected as miniAOD but cannot cast to pat::Photon!";
308 std::vector<float> phoFull5x5SigmaIEtaIEta;
309 std::vector<float> phoFull5x5SigmaIEtaIPhi;
310 std::vector<float> phoFull5x5E1x3;
311 std::vector<float> phoFull5x5E2x2;
312 std::vector<float> phoFull5x5E2x5Max;
313 std::vector<float> phoFull5x5E5x5;
314 std::vector<float> phoESEffSigmaRR;
320 std::vector<float> phoWorstChargedIsolationWithConeVeto;
321 std::vector<float> phoWorstChargedIsolationWithPVConstraint;
322 std::vector<float> phoWorstChargedIsolationWithConeVetoWithPVConstraint;
325 std::vector<float> phoTrkIsolation;
326 std::vector<float> phoHcalPFClIsolation;
327 std::vector<float> phoEcalPFClIsolation;
330 for (
unsigned idxpho = 0; idxpho < src->size(); ++idxpho) {
331 const auto& iPho = src->ptrAt(idxpho);
336 const auto& theseed = *(iPho->superCluster()->seed());
343 std::vector<float> vCov =
lazyToolnoZS->localCovariances( theseed );
344 see = (
isnan(vCov[0]) ? 0. :
sqrt(vCov[0]));
346 phoFull5x5SigmaIEtaIEta.push_back(see);
347 phoFull5x5SigmaIEtaIPhi.push_back(sep);
349 phoFull5x5E1x3 .push_back(
lazyToolnoZS-> e1x3 (theseed) );
350 phoFull5x5E2x2 .push_back(
lazyToolnoZS-> e2x2 (theseed) );
351 phoFull5x5E2x5Max.push_back(
lazyToolnoZS-> e2x5Max(theseed) );
354 phoESEffSigmaRR .push_back(
lazyToolnoZS->eseffsirir( *(iPho->superCluster()) ) );
362 iPho->superCluster()->y() - pv.
y(),
363 iPho->superCluster()->z() - pv.
z());
366 phoTrkIsolation .push_back( iPho->trkSumPtSolidConeDR04());
369 phoHcalPFClIsolation .push_back(0.
f);
370 phoEcalPFClIsolation .push_back(0.
f);
375 phoHcalPFClIsolation .push_back(
patPhotonPtr->hcalPFClusterIso());
376 phoEcalPFClIsolation .push_back(
patPhotonPtr->ecalPFClusterIso());
381 float chargedIsoSum = 0;
382 float neutralHadronIsoSum = 0;
383 float photonIsoSum = 0;
386 for (
unsigned idxcand = 0; idxcand < pfCandidatesHandle->size(); ++idxcand ){
390 const auto& iCand = pfCandidatesHandle->ptrAt(idxcand);
407 float dR2 =
deltaR2(photon_directionWrtVtx.Eta(),photon_directionWrtVtx.Phi(),
408 iCand->eta(), iCand->phi());
409 if( dR2 > coneSizeDR*coneSizeDR )
continue;
412 bool inFootprint =
false;
414 inFootprint =
isInFootprint( (*particleBasedIsolationMap)[iPho], iCand );
420 if( inFootprint )
continue;
429 float dxy = -999,
dz=-999;
433 if(fabs(dxy) > dxyMax)
continue;
434 if (fabs(
dz) > dzMax)
continue;
437 chargedIsoSum += iCand->pt();
441 neutralHadronIsoSum += iCand->pt();
444 photonIsoSum += iCand->pt();
447 phoChargedIsolation .push_back( chargedIsoSum );
448 phoNeutralHadronIsolation.push_back( neutralHadronIsoSum );
449 phoPhotonIsolation .push_back( photonIsoSum );
453 float dRvetoBarrel = 0.0;
454 float dRvetoEndcap = 0.0;
456 bool isPVConstraint=
false;
457 float worstChargedIso =
459 isAOD, isPVConstraint,pv,coneSizeDR, dxyMax, dzMax,
460 dRvetoBarrel, dRvetoEndcap, ptMin);
461 phoWorstChargedIsolation .push_back( worstChargedIso );
468 float worstChargedIsoWithConeVeto =
470 isAOD, isPVConstraint,pv, coneSizeDR, dxyMax, dzMax,
471 dRvetoBarrel, dRvetoEndcap, ptMin);
472 phoWorstChargedIsolationWithConeVeto .push_back( worstChargedIsoWithConeVeto );
475 float worstChargedIsoWithPVConstraint =
477 isAOD, isPVConstraint,pv,coneSizeDR, dxyMax, dzMax,
478 dRvetoBarrel, dRvetoEndcap, ptMin);
479 phoWorstChargedIsolationWithPVConstraint .push_back( worstChargedIsoWithPVConstraint );
486 float worstChargedIsoWithConeVetoWithPVConstraint =
488 isAOD,isPVConstraint, pv, coneSizeDR, dxyMax, dzMax,
489 dRvetoBarrel, dRvetoEndcap, ptMin);
490 phoWorstChargedIsolationWithConeVetoWithPVConstraint .push_back( worstChargedIsoWithConeVetoWithPVConstraint );
void writeValueMap(edm::Event &iEvent, const edm::Handle< edm::View< reco::Photon > > &handle, const std::vector< float > &values, const std::string &label) const
edm::EDGetTokenT< EcalRecHitCollection > esReducedRecHitCollectionMiniAOD_
edm::EDGetTokenT< reco::VertexCollection > vtxToken_
ParticleType
particle types
edm::EDGetTokenT< reco::VertexCollection > vtxTokenMiniAOD_
static char phoHcalPFClIsolation_[]
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::unique_ptr< noZS::EcalClusterLazyTools > lazyToolnoZS
edm::EDGetTokenT< EcalRecHitCollection > eeReducedRecHitCollectionMiniAOD_
double y() const
y coordinate
reco::PFCandidate::ParticleType candidatePdgId(const edm::Ptr< reco::Candidate > candidate, bool isAOD)
edm::EDGetTokenT< EcalRecHitCollection > ebReducedRecHitCollection_
edm::EDGetToken srcMiniAOD_
edm::EDGetTokenT< edm::ValueMap< std::vector< reco::PFCandidateRef > > > particleBasedIsolationToken_
static char phoChargedIsolation_[]
static char phoFull5x5E2x2_[]
edm::EDGetTokenT< EcalRecHitCollection > ebReducedRecHitCollectionMiniAOD_
static char phoFull5x5E1x3_[]
static char phoFull5x5E2x5Max_[]
static char phoWorstChargedIsolation_[]
edm::EDGetTokenT< edm::View< reco::Candidate > > pfCandidatesTokenMiniAOD_
static char phoFull5x5E5x5_[]
edm::EDGetTokenT< EcalRecHitCollection > eeReducedRecHitCollection_
static char phoEcalPFClIsolation_[]
static char phoNeutralHadronIsolation_[]
bool isInFootprint(const T &thefootprint, const U &theCandidate)
double z() const
z coordinate
edm::EDGetTokenT< edm::View< reco::Candidate > > pfCandidatesToken_
double x() const
x coordinate
static char phoPhotonIsolation_[]
static char phoTrkIsolation_[]
static char phoFull5x5SigmaIEtaIPhi_[]
XYZVectorD XYZVector
spatial vector with cartesian internal representation
edm::EDGetTokenT< EcalRecHitCollection > esReducedRecHitCollection_
static char phoWorstChargedIsolationWithConeVetoWithPVConstraint_[]
float computeWorstPFChargedIsolation(const T &photon, const U &pfCandidates, const edm::Handle< reco::VertexCollection > vertices, bool isAOD, bool isPVConstraint, const reco::Vertex &pv, float dRmax, float dxyMax, float dzMax, float dRvetoBarrel, float dRvetoEndcap, float ptMin)
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
edm::Ptr< pat::Photon > patPhotonPtr
static char phoESEffSigmaRR_[]
static char phoWorstChargedIsolationWithPVConstraint_[]
static char phoFull5x5SigmaIEtaIEta_[]
void getImpactParameters(const edm::Ptr< reco::Candidate > &candidate, bool isAOD, const reco::Vertex &pv, float &dxy, float &dz)
phoNeutralHadronIsolation
static char phoWorstChargedIsolationWithConeVeto_[]