CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes
PFEGammaAlgo Class Reference

#include <PFEGammaAlgo.h>

Classes

struct  PFEGConfigInfo
 
struct  ProtoEGObject
 

Public Types

typedef std::unordered_map
< unsigned int, std::vector
< unsigned int > > 
AsscMap
 
typedef std::unordered_map
< const PFClusterElement
*, std::vector
< PFClusterFlaggedElement > > 
ClusterMap
 
typedef
reco::PFCluster::EEtoPSAssociation 
EEtoPSAssociation
 
typedef std::vector< std::pair
< const reco::PFBlockElement
*, const reco::PFBlockElement * > > 
ElementMap
 
typedef std::unordered_map
< const PFGSFElement
*, std::vector
< PFKFFlaggedElement > > 
GSFToTrackMap
 
typedef std::unordered_map
< const PFKFElement *, float > 
KFValMap
 
typedef reco::PFBlockElementBrem PFBremElement
 
typedef std::pair< const
PFBremElement *, bool > 
PFBremFlaggedElement
 
typedef reco::PFBlockElementCluster PFClusterElement
 
typedef std::pair< const
PFClusterElement *, bool > 
PFClusterFlaggedElement
 
typedef std::pair< const
reco::PFBlockElement *, bool > 
PFFlaggedElement
 
typedef
reco::PFBlockElementGsfTrack 
PFGSFElement
 
typedef std::pair< const
PFGSFElement *, bool > 
PFGSFFlaggedElement
 
typedef reco::PFBlockElementTrack PFKFElement
 
typedef std::pair< const
PFKFElement *, bool > 
PFKFFlaggedElement
 
typedef
reco::PFBlockElementSuperCluster 
PFSCElement
 
typedef std::pair< const
PFSCElement *, bool > 
PFSCFlaggedElement
 

Public Member Functions

reco::PFCandidateCollectiongetCandidates ()
 
reco::PFCandidateEGammaExtraCollectiongetEGExtra ()
 
reco::SuperClusterCollectiongetRefinedSCs ()
 
bool isEGValidCandidate (const reco::PFBlockRef &blockRef, std::vector< bool > &active)
 
 PFEGammaAlgo (const PFEGConfigInfo &)
 
void RunPFEG (const reco::PFBlockRef &blockRef, std::vector< bool > &active)
 
void setEEtoPSAssociation (const edm::Handle< EEtoPSAssociation > &eetops)
 
void setnPU (int nVtx)
 
void setPhotonPrimaryVtx (const reco::Vertex &primary)
 
 ~PFEGammaAlgo ()
 

Private Types

enum  verbosityLevel { Silent, Summary, Chatty }
 

Private Member Functions

int attachPSClusters (const PFClusterElement *, ClusterMap::mapped_type &)
 
void buildAndRefineEGObjects (const reco::PFBlockRef &block)
 
reco::SuperCluster buildRefinedSuperCluster (const ProtoEGObject &)
 
float calculate_ele_mva (const ProtoEGObject &, reco::PFCandidateEGammaExtra &)
 
void dumpCurrentRefinableObjects () const
 
float EvaluateSingleLegMVA (const reco::PFBlockRef &blockref, const reco::Vertex &primaryvtx, unsigned int track_index)
 
void fill_extra_info (const ProtoEGObject &, reco::PFCandidateEGammaExtra &)
 
void fillPFCandidates (const std::list< ProtoEGObject > &, reco::PFCandidateCollection &, reco::PFCandidateEGammaExtraCollection &)
 
void initializeProtoCands (std::list< ProtoEGObject > &)
 
bool isAMuon (const reco::PFBlockElement &)
 
bool isPrimaryTrack (const reco::PFBlockElementTrack &KfEl, const reco::PFBlockElementGsfTrack &GsfEl)
 
void linkKFTrackToECAL (const PFKFFlaggedElement &, ProtoEGObject &)
 
void linkRefinableObjectBremTangentsToECAL (ProtoEGObject &)
 
void linkRefinableObjectConvSecondaryKFsToSecondaryKFs (ProtoEGObject &)
 
void linkRefinableObjectECALToSingleLegConv (ProtoEGObject &)
 
void linkRefinableObjectGSFTracksToKFs (ProtoEGObject &)
 
void linkRefinableObjectKFTracksToECAL (ProtoEGObject &)
 
void linkRefinableObjectPrimaryGSFTrackToECAL (ProtoEGObject &)
 
void linkRefinableObjectPrimaryGSFTrackToHCAL (ProtoEGObject &)
 
void linkRefinableObjectPrimaryKFsToSecondaryKFs (ProtoEGObject &)
 
void linkRefinableObjectSecondaryKFsToECAL (ProtoEGObject &)
 
void mergeROsByAnyLink (std::list< ProtoEGObject > &)
 
void removeOrLinkECALClustersToKFTracks ()
 
void unlinkRefinableObjectKFandECALMatchedToHCAL (ProtoEGObject &, bool removeFreeECAL=false, bool removeSCECAL=false)
 
void unlinkRefinableObjectKFandECALWithBadEoverP (ProtoEGObject &)
 
bool unwrapSuperCluster (const reco::PFBlockElementSuperCluster *, std::vector< PFClusterFlaggedElement > &, ClusterMap &)
 
unsigned int whichTrackAlgo (const reco::TrackRef &trackRef)
 

Private Attributes

reco::PFBlockRef _currentblock
 
reco::PFBlock::LinkData _currentlinks
 
reco::PFCandidateCollection _finalCandidates
 
ElementMap _recoveredlinks
 
std::list< ProtoEGObject_refinableObjects
 
std::vector< std::vector
< PFFlaggedElement > > 
_splayedblock
 
std::vector< unsigned int > AddFromElectron_
 
PFEGConfigInfo cfg_
 
float chi2
 
float chi2_gsf
 
float chi2_kf
 
float Clus5x5ratio_
 
float ClusEta_
 
float ClusPhi_
 
float ClusR9_
 
std::vector< std::pair
< unsigned int, unsigned int > > 
convGsfTrack_
 
float CrysEta_
 
int CrysIEta_
 
int CrysIPhi_
 
float CrysPhi_
 
float CrysX_
 
float CrysY_
 
float del_phi
 
float dEta_
 
float DEtaGsfEcalClust
 
float dPhi_
 
float dPtOverPt_gsf
 
float DPtOverPt_gsf
 
float DPtOverPt_kf
 
float e1x3_
 
float e1x5_
 
float e2x5Bottom_
 
float e2x5Left_
 
float e2x5Max_
 
float e2x5Right_
 
float e2x5Top_
 
float e3x1_
 
float e3x3_
 
float E3x3_
 
float e5x5Map [5][5]
 
float earlyBrem
 
float EB
 
float ebottom_
 
edm::Handle
< reco::PFCluster::EEtoPSAssociation
eetops_
 
reco::PFCandidateCollection egCandidate_
 
reco::PFCandidateEGammaExtraCollection egExtra_
 
float EGsfPoutMode
 
float eleft_
 
float EoverPt
 
float eright_
 
float eSeed_
 
float Eta_gsf
 
float etop_
 
float EtotBremPinPoutMode
 
float EtotPinMode
 
float excluded_
 
std::vector< std::pair
< unsigned int, unsigned int > > 
fifthStepKfTrack_
 
float firstBrem
 
std::vector< bool > GsfTrackSingleEcal_
 
float HOverHE
 
float HOverPin
 
float HoverPt
 
bool isvalid_
 
float lateBrem
 
float lnPt_gsf
 
std::vector< bool > lockExtraKf_
 
float logPFClusE_
 
float LowClusE_
 
std::vector< int > match_ind
 
float Mustache_Et_out_
 
float Mustache_EtRatio_
 
float MustE_
 
double mvaValue
 
const char * mvaWeightFile_
 
float nhit_gsf
 
float nhit_kf
 
float nlayers
 
float nlost
 
float nPFClus_
 
float nVtx_
 
reco::PFCandidateCollection outcands_
 
reco::PFCandidateEGammaExtraCollection outcandsextra_
 
std::vector< reco::PFCandidatepermElectronCandidates_
 
float PFCrysEtaCrack_
 
float PFPhoE_
 
float PFPhoECorr_
 
float PFPhoEt_
 
float PFPhoEta_
 
float PFPhoEtCorr_
 
float PFPhoPhi_
 
float PFPhoR9_
 
float PFPhoR9Corr_
 
const reco::VertexprimaryVertex_
 
float RConv_
 
const GBRForestReaderGC_
 
const GBRForestReaderGCEB_
 
const GBRForestReaderGCEEhR9_
 
const GBRForestReaderGCEElR9_
 
const GBRForestReaderLC_
 
const GBRForestReaderLCEB_
 
const GBRForestReaderLCEE_
 
const GBRForestReaderRes_
 
reco::SuperClusterCollection refinedscs_
 
float RMSAll_
 
float RMSMust_
 
float SCEtaWidth_
 
float SCPhiWidth_
 
float SigmaEtaEta
 
float STIP
 
double sumPtTrackIsoForPhoton_
 
double sumPtTrackIsoSlopeForPhoton_
 
TMVA::Reader * tmvaReader_
 
TMVA::Reader * tmvaReaderEle_
 
float TotPS1_
 
float TotPS2_
 
float track_pt
 
verbosityLevel verbosityLevel_
 
float VtxZ_
 
TH2D * X0_inner
 
TH2D * X0_middle
 
TH2D * X0_outer
 
TH2D * X0_sum
 
float x0inner_
 
float x0middle_
 
float x0outer_
 

Detailed Description

Definition at line 51 of file PFEGammaAlgo.h.

Member Typedef Documentation

typedef std::unordered_map<unsigned int, std::vector<unsigned int> > PFEGammaAlgo::AsscMap

Definition at line 65 of file PFEGammaAlgo.h.

typedef std::unordered_map<const PFClusterElement*, std::vector<PFClusterFlaggedElement> > PFEGammaAlgo::ClusterMap

Definition at line 71 of file PFEGammaAlgo.h.

Definition at line 53 of file PFEGammaAlgo.h.

typedef std::vector<std::pair<const reco::PFBlockElement*, const reco::PFBlockElement*> > PFEGammaAlgo::ElementMap

Definition at line 67 of file PFEGammaAlgo.h.

typedef std::unordered_map<const PFGSFElement*, std::vector<PFKFFlaggedElement> > PFEGammaAlgo::GSFToTrackMap

Definition at line 69 of file PFEGammaAlgo.h.

typedef std::unordered_map<const PFKFElement*, float > PFEGammaAlgo::KFValMap

Definition at line 73 of file PFEGammaAlgo.h.

Definition at line 55 of file PFEGammaAlgo.h.

typedef std::pair<const PFBremElement*,bool> PFEGammaAlgo::PFBremFlaggedElement

Definition at line 61 of file PFEGammaAlgo.h.

Definition at line 58 of file PFEGammaAlgo.h.

Definition at line 64 of file PFEGammaAlgo.h.

typedef std::pair<const reco::PFBlockElement*,bool> PFEGammaAlgo::PFFlaggedElement

Definition at line 59 of file PFEGammaAlgo.h.

Definition at line 56 of file PFEGammaAlgo.h.

typedef std::pair<const PFGSFElement*,bool> PFEGammaAlgo::PFGSFFlaggedElement

Definition at line 62 of file PFEGammaAlgo.h.

Definition at line 57 of file PFEGammaAlgo.h.

typedef std::pair<const PFKFElement*,bool> PFEGammaAlgo::PFKFFlaggedElement

Definition at line 63 of file PFEGammaAlgo.h.

Definition at line 54 of file PFEGammaAlgo.h.

typedef std::pair<const PFSCElement*,bool> PFEGammaAlgo::PFSCFlaggedElement

Definition at line 60 of file PFEGammaAlgo.h.

Member Enumeration Documentation

Enumerator
Silent 
Summary 
Chatty 

Definition at line 168 of file PFEGammaAlgo.h.

Constructor & Destructor Documentation

PFEGammaAlgo::PFEGammaAlgo ( const PFEGConfigInfo cfg)

Definition at line 687 of file PFEGammaAlgo.cc.

References cfg_, chi2, chi2_gsf, chi2_kf, del_phi, DEtaGsfEcalClust, DPtOverPt_gsf, dPtOverPt_gsf, EGsfPoutMode, EoverPt, Eta_gsf, EtotBremPinPoutMode, EtotPinMode, firstBrem, HOverHE, HoverPt, lateBrem, lnPt_gsf, PFEGammaAlgo::PFEGConfigInfo::mvaweightfile, PFEGammaAlgo::PFEGConfigInfo::mvaWeightFileEleID, nhit_kf, nlayers, nlost, SigmaEtaEta, STIP, tmvaReader_, tmvaReaderEle_, track_pt, X0_inner, PFEGammaAlgo::PFEGConfigInfo::X0_Map, X0_middle, X0_outer, and X0_sum.

687  :
688  cfg_(cfg),
689  isvalid_(false),
691  nlost(0.0), nlayers(0.0),
692  chi2(0.0), STIP(0.0), del_phi(0.0),HoverPt(0.0), EoverPt(0.0), track_pt(0.0),
693  mvaValue(0.0),
694  CrysPhi_(0.0), CrysEta_(0.0), VtxZ_(0.0), ClusPhi_(0.0), ClusEta_(0.0),
695  ClusR9_(0.0), Clus5x5ratio_(0.0), PFCrysEtaCrack_(0.0), logPFClusE_(0.0), e3x3_(0.0),
696  CrysIPhi_(0), CrysIEta_(0),
697  CrysX_(0.0), CrysY_(0.0),
698  EB(0.0),
699  eSeed_(0.0), e1x3_(0.0),e3x1_(0.0), e1x5_(0.0), e2x5Top_(0.0), e2x5Bottom_(0.0), e2x5Left_(0.0), e2x5Right_(0.0),
700  etop_(0.0), ebottom_(0.0), eleft_(0.0), eright_(0.0),
701  e2x5Max_(0.0),
702  PFPhoEta_(0.0), PFPhoPhi_(0.0), PFPhoR9_(0.0), PFPhoR9Corr_(0.0), SCPhiWidth_(0.0), SCEtaWidth_(0.0),
703  PFPhoEt_(0.0), RConv_(0.0), PFPhoEtCorr_(0.0), PFPhoE_(0.0), PFPhoECorr_(0.0), MustE_(0.0), E3x3_(0.0),
704  dEta_(0.0), dPhi_(0.0), LowClusE_(0.0), RMSAll_(0.0), RMSMust_(0.0), nPFClus_(0.0),
705  TotPS1_(0.0), TotPS2_(0.0),
706  nVtx_(0.0),
707  x0inner_(0.0), x0middle_(0.0), x0outer_(0.0),
709 {
710 
711  // Set the tmva reader for electrons
712  tmvaReaderEle_ = new TMVA::Reader("!Color:Silent");
713  tmvaReaderEle_->AddVariable("lnPt_gsf",&lnPt_gsf);
714  tmvaReaderEle_->AddVariable("Eta_gsf",&Eta_gsf);
715  tmvaReaderEle_->AddVariable("dPtOverPt_gsf",&dPtOverPt_gsf);
716  tmvaReaderEle_->AddVariable("DPtOverPt_gsf",&DPtOverPt_gsf);
717  //tmvaReaderEle_->AddVariable("nhit_gsf",&nhit_gsf);
718  tmvaReaderEle_->AddVariable("chi2_gsf",&chi2_gsf);
719  //tmvaReaderEle_->AddVariable("DPtOverPt_kf",&DPtOverPt_kf);
720  tmvaReaderEle_->AddVariable("nhit_kf",&nhit_kf);
721  tmvaReaderEle_->AddVariable("chi2_kf",&chi2_kf);
722  tmvaReaderEle_->AddVariable("EtotPinMode",&EtotPinMode);
723  tmvaReaderEle_->AddVariable("EGsfPoutMode",&EGsfPoutMode);
724  tmvaReaderEle_->AddVariable("EtotBremPinPoutMode",&EtotBremPinPoutMode);
725  tmvaReaderEle_->AddVariable("DEtaGsfEcalClust",&DEtaGsfEcalClust);
726  tmvaReaderEle_->AddVariable("SigmaEtaEta",&SigmaEtaEta);
727  tmvaReaderEle_->AddVariable("HOverHE",&HOverHE);
728 // tmvaReaderEle_->AddVariable("HOverPin",&HOverPin);
729  tmvaReaderEle_->AddVariable("lateBrem",&lateBrem);
730  tmvaReaderEle_->AddVariable("firstBrem",&firstBrem);
731  tmvaReaderEle_->BookMVA("BDT",cfg_.mvaWeightFileEleID.c_str());
732 
733 
734  //Book MVA
735  tmvaReader_ = new TMVA::Reader("!Color:Silent");
736  tmvaReader_->AddVariable("del_phi",&del_phi);
737  tmvaReader_->AddVariable("nlayers", &nlayers);
738  tmvaReader_->AddVariable("chi2",&chi2);
739  tmvaReader_->AddVariable("EoverPt",&EoverPt);
740  tmvaReader_->AddVariable("HoverPt",&HoverPt);
741  tmvaReader_->AddVariable("track_pt", &track_pt);
742  tmvaReader_->AddVariable("STIP",&STIP);
743  tmvaReader_->AddVariable("nlost", &nlost);
744  tmvaReader_->BookMVA("BDT",cfg_.mvaweightfile.c_str());
745 
746  //Material Map
747  TFile *XO_File = new TFile(cfg_.X0_Map.c_str(),"READ");
748  X0_sum = (TH2D*)XO_File->Get("TrackerSum");
749  X0_inner = (TH2D*)XO_File->Get("Inner");
750  X0_middle = (TH2D*)XO_File->Get("Middle");
751  X0_outer = (TH2D*)XO_File->Get("Outer");
752 
753 }
float SCEtaWidth_
Definition: PFEGammaAlgo.h:365
float EtotBremPinPoutMode
Definition: PFEGammaAlgo.h:309
double mvaValue
Definition: PFEGammaAlgo.h:350
tuple cfg
Definition: looper.py:259
float e2x5Bottom_
Definition: PFEGammaAlgo.h:361
float EGsfPoutMode
Definition: PFEGammaAlgo.h:309
float Mustache_Et_out_
Definition: PFEGammaAlgo.h:376
float DEtaGsfEcalClust
Definition: PFEGammaAlgo.h:310
TH2D * X0_outer
Definition: PFEGammaAlgo.h:373
float Clus5x5ratio_
Definition: PFEGammaAlgo.h:355
float PFPhoEtCorr_
Definition: PFEGammaAlgo.h:365
float e2x5Right_
Definition: PFEGammaAlgo.h:361
PFEGConfigInfo cfg_
Definition: PFEGammaAlgo.h:292
float DPtOverPt_gsf
Definition: PFEGammaAlgo.h:303
float SCPhiWidth_
Definition: PFEGammaAlgo.h:365
float Mustache_EtRatio_
Definition: PFEGammaAlgo.h:376
float dPtOverPt_gsf
Definition: PFEGammaAlgo.h:303
float logPFClusE_
Definition: PFEGammaAlgo.h:355
float PFPhoECorr_
Definition: PFEGammaAlgo.h:365
float SigmaEtaEta
Definition: PFEGammaAlgo.h:311
TMVA::Reader * tmvaReaderEle_
Definition: PFEGammaAlgo.h:294
float EtotPinMode
Definition: PFEGammaAlgo.h:309
TH2D * X0_inner
Definition: PFEGammaAlgo.h:371
float PFPhoR9Corr_
Definition: PFEGammaAlgo.h:365
TMVA::Reader * tmvaReader_
Definition: PFEGammaAlgo.h:330
TH2D * X0_middle
Definition: PFEGammaAlgo.h:372
verbosityLevel verbosityLevel_
Definition: PFEGammaAlgo.h:323
float PFCrysEtaCrack_
Definition: PFEGammaAlgo.h:355
PFEGammaAlgo::~PFEGammaAlgo ( )
inline

Definition at line 132 of file PFEGammaAlgo.h.

References tmvaReader_, and tmvaReaderEle_.

132 {delete tmvaReaderEle_; delete tmvaReader_; };
TMVA::Reader * tmvaReaderEle_
Definition: PFEGammaAlgo.h:294
TMVA::Reader * tmvaReader_
Definition: PFEGammaAlgo.h:330

Member Function Documentation

int PFEGammaAlgo::attachPSClusters ( const PFClusterElement ,
ClusterMap::mapped_type &   
)
private

Definition at line 1253 of file PFEGammaAlgo.cc.

References _splayedblock, docast, PFLayer::ECAL_BARREL, eetops_, edm::Ptr< T >::key(), reco::PFBlockElement::PS1, reco::PFBlockElement::PS2, edm::refToPtr(), and groupFilesInBlocks::temp.

Referenced by linkKFTrackToECAL(), linkRefinableObjectBremTangentsToECAL(), linkRefinableObjectPrimaryGSFTrackToECAL(), linkRefinableObjectSecondaryKFsToECAL(), and unwrapSuperCluster().

1254  {
1255  if( ecalclus->clusterRef()->layer() == PFLayer::ECAL_BARREL ) return 0;
1256  edm::Ptr<reco::PFCluster> clusptr = refToPtr(ecalclus->clusterRef());
1257  EEtoPSElement ecalkey = std::make_pair(clusptr.key(),clusptr);
1258  auto assc_ps = std::equal_range(eetops_->cbegin(),
1259  eetops_->cend(),
1260  ecalkey,
1261  comparePSMapByKey);
1262  for( const auto& ps1 : _splayedblock[reco::PFBlockElement::PS1] ) {
1263  edm::Ptr<reco::PFCluster> temp = refToPtr(ps1.first->clusterRef());
1264  for( auto pscl = assc_ps.first; pscl != assc_ps.second; ++pscl ) {
1265  if( pscl->second == temp ) {
1266  const ClusterElement* pstemp =
1267  docast(const ClusterElement*,ps1.first);
1268  eslist.push_back( PFClusterFlaggedElement(pstemp,true) );
1269  }
1270  }
1271  }
1272  for( const auto& ps2 : _splayedblock[reco::PFBlockElement::PS2] ) {
1273  edm::Ptr<reco::PFCluster> temp = refToPtr(ps2.first->clusterRef());
1274  for( auto pscl = assc_ps.first; pscl != assc_ps.second; ++pscl ) {
1275  if( pscl->second == temp ) {
1276  const ClusterElement* pstemp =
1277  docast(const ClusterElement*,ps2.first);
1278  eslist.push_back( PFClusterFlaggedElement(pstemp,true) );
1279  }
1280  }
1281  }
1282  return eslist.size();
1283  }
Ptr< typename C::value_type > refToPtr(Ref< C, typename C::value_type, refhelper::FindUsingAdvance< C, typename C::value_type > > const &ref)
Definition: RefToPtr.h:18
key_type key() const
Definition: Ptr.h:169
std::pair< const PFClusterElement *, bool > PFClusterFlaggedElement
Definition: PFEGammaAlgo.h:64
std::vector< std::vector< PFFlaggedElement > > _splayedblock
Definition: PFEGammaAlgo.h:187
edm::Handle< reco::PFCluster::EEtoPSAssociation > eetops_
Definition: PFEGammaAlgo.h:182
#define docast(x, y)
Definition: PFEGammaAlgo.cc:42
void PFEGammaAlgo::buildAndRefineEGObjects ( const reco::PFBlockRef block)
private

Definition at line 849 of file PFEGammaAlgo.cc.

References _currentblock, _currentlinks, _finalCandidates, _recoveredlinks, _refinableObjects, _splayedblock, a, b, createPayload::block, dumpCurrentRefinableObjects(), fillPFCandidates(), initializeProtoCands(), isAMuon(), linkRefinableObjectBremTangentsToECAL(), linkRefinableObjectConvSecondaryKFsToSecondaryKFs(), linkRefinableObjectECALToSingleLegConv(), linkRefinableObjectGSFTracksToKFs(), linkRefinableObjectKFTracksToECAL(), linkRefinableObjectPrimaryGSFTrackToECAL(), linkRefinableObjectPrimaryGSFTrackToHCAL(), linkRefinableObjectPrimaryKFsToSecondaryKFs(), linkRefinableObjectSecondaryKFsToECAL(), LOGDRESSED, LOGVERB, mergeROsByAnyLink(), outcands_, outcandsextra_, removeOrLinkECALClustersToKFTracks(), python.multivaluedict::sort(), unlinkRefinableObjectKFandECALMatchedToHCAL(), and unlinkRefinableObjectKFandECALWithBadEoverP().

Referenced by RunPFEG().

849  {
850  LOGVERB("PFEGammaAlgo")
851  << "Resetting PFEGammaAlgo for new block and running!" << std::endl;
852  _splayedblock.clear();
853  _recoveredlinks.clear();
854  _refinableObjects.clear();
855  _finalCandidates.clear();
856  _splayedblock.resize(12); // make sure that we always have the SC entry
857 
859  _currentlinks = block->linkData();
860  //LOGDRESSED("PFEGammaAlgo") << *_currentblock << std::endl;
861  LOGVERB("PFEGammaAlgo") << "Splaying block" << std::endl;
862  //unwrap the PF block into a fast access map
863  for( const auto& pfelement : _currentblock->elements() ) {
864  if( isAMuon(pfelement) ) continue; // don't allow muons in our element list
865  const size_t itype = (size_t)pfelement.type();
866  if( itype >= _splayedblock.size() ) _splayedblock.resize(itype+1);
867  _splayedblock[itype].push_back(std::make_pair(&pfelement,true));
868  }
869 
870  // show the result of splaying the tree if it's really *really* needed
871 #ifdef PFLOW_DEBUG
872  std::stringstream splayout;
873  for( size_t itype = 0; itype < _splayedblock.size(); ++itype ) {
874  splayout << "\tType: " << itype << " indices: ";
875  for( const auto& flaggedelement : _splayedblock[itype] ) {
876  splayout << flaggedelement.first->index() << ' ';
877  }
878  if( itype != _splayedblock.size() - 1 ) splayout << std::endl;
879  }
880  LOGVERB("PFEGammaAlgo") << splayout.str();
881 #endif
882 
883  // precleaning of the ECAL clusters with respect to primary KF tracks
884  // we don't allow clusters in super clusters to be locked out this way
886 
888  LOGDRESSED("PFEGammaAlgo")
889  << "Initialized " << _refinableObjects.size() << " proto-EGamma objects"
890  << std::endl;
892 
893  //
894  // now we start the refining steps
895  //
896  //
897 
898  // --- Primary Linking Step ---
899  // since this is particle flow and we try to work from the pixels out
900  // we start by linking the tracks together and finding the ECAL clusters
901  for( auto& RO : _refinableObjects ) {
902  // find the KF tracks associated to GSF primary tracks
904  // do the same for HCAL clusters associated to the GSF
906  // link secondary KF tracks associated to primary KF tracks
908  // pick up clusters that are linked to the GSF primary
910  // link associated KF to ECAL (ECAL part grabs PS clusters too if able)
912  // now finally look for clusters associated to brem tangents
914  }
915 
916  LOGDRESSED("PFEGammaAlgo")
917  << "Dumping after GSF and KF Track (Primary) Linking : " << std::endl;
919 
920  // merge objects after primary linking
921  mergeROsByAnyLink(_refinableObjects);
922 
923  LOGDRESSED("PFEGammaAlgo")
924  << "Dumping after first merging operation : " << std::endl;
926 
927  // --- Secondary Linking Step ---
928  // after this we go through the ECAL clusters on the remaining tracks
929  // and try to link those in...
930  for( auto& RO : _refinableObjects ) {
931  // look for conversion legs
934  // look for tracks that complement conversion legs
936  // look again for ECAL clusters (this time with an e/p cut)
938  }
939 
940  LOGDRESSED("PFEGammaAlgo")
941  << "Dumping after ECAL to Track (Secondary) Linking : " << std::endl;
943 
944  // merge objects after primary linking
945  mergeROsByAnyLink(_refinableObjects);
946 
947  LOGDRESSED("PFEGammaAlgo")
948  << "There are " << _refinableObjects.size()
949  << " after the 2nd merging step." << std::endl;
951 
952  // -- unlinking and proto-object vetos, final sorting
953  for( auto& RO : _refinableObjects ) {
954  // remove secondary KFs (and possibly ECALs) matched to HCAL clusters
956  // remove secondary KFs and ECALs linked to them that have bad E/p_in
957  // and spoil the resolution
959  // put things back in order after partitioning
960  std::sort(RO.ecalclusters.begin(), RO.ecalclusters.end(),
961  [](const PFClusterFlaggedElement& a,
962  const PFClusterFlaggedElement& b)
963  { return ( a.first->clusterRef()->correctedEnergy() >
964  b.first->clusterRef()->correctedEnergy() ) ; });
965  setROElectronCluster(RO);
966  }
967 
968  LOGDRESSED("PFEGammaAlgo")
969  << "There are " << _refinableObjects.size()
970  << " after the unlinking and vetos step." << std::endl;
972 
973  // fill the PF candidates and then build the refined SC
974  fillPFCandidates(_refinableObjects,outcands_,outcandsextra_);
975 
976 }
void unlinkRefinableObjectKFandECALWithBadEoverP(ProtoEGObject &)
std::pair< const PFClusterElement *, bool > PFClusterFlaggedElement
Definition: PFEGammaAlgo.h:64
void linkRefinableObjectPrimaryGSFTrackToECAL(ProtoEGObject &)
std::vector< std::vector< PFFlaggedElement > > _splayedblock
Definition: PFEGammaAlgo.h:187
void linkRefinableObjectBremTangentsToECAL(ProtoEGObject &)
reco::PFBlockRef _currentblock
Definition: PFEGammaAlgo.h:183
void linkRefinableObjectECALToSingleLegConv(ProtoEGObject &)
#define LOGVERB(x)
Definition: PFEGammaAlgo.cc:43
#define LOGDRESSED(x)
Definition: PFEGammaAlgo.cc:46
void dumpCurrentRefinableObjects() const
void initializeProtoCands(std::list< ProtoEGObject > &)
void linkRefinableObjectPrimaryKFsToSecondaryKFs(ProtoEGObject &)
std::list< ProtoEGObject > _refinableObjects
Definition: PFEGammaAlgo.h:201
reco::PFCandidateEGammaExtraCollection outcandsextra_
Definition: PFEGammaAlgo.h:177
reco::PFBlock::LinkData _currentlinks
Definition: PFEGammaAlgo.h:184
bool isAMuon(const reco::PFBlockElement &)
double b
Definition: hdecay.h:120
void linkRefinableObjectGSFTracksToKFs(ProtoEGObject &)
ElementMap _recoveredlinks
Definition: PFEGammaAlgo.h:188
void removeOrLinkECALClustersToKFTracks()
void unlinkRefinableObjectKFandECALMatchedToHCAL(ProtoEGObject &, bool removeFreeECAL=false, bool removeSCECAL=false)
double a
Definition: hdecay.h:121
void mergeROsByAnyLink(std::list< ProtoEGObject > &)
void linkRefinableObjectKFTracksToECAL(ProtoEGObject &)
void linkRefinableObjectSecondaryKFsToECAL(ProtoEGObject &)
reco::PFCandidateCollection _finalCandidates
Definition: PFEGammaAlgo.h:203
void linkRefinableObjectConvSecondaryKFsToSecondaryKFs(ProtoEGObject &)
reco::PFCandidateCollection outcands_
Definition: PFEGammaAlgo.h:176
void fillPFCandidates(const std::list< ProtoEGObject > &, reco::PFCandidateCollection &, reco::PFCandidateEGammaExtraCollection &)
void linkRefinableObjectPrimaryGSFTrackToHCAL(ProtoEGObject &)
reco::SuperCluster PFEGammaAlgo::buildRefinedSuperCluster ( const ProtoEGObject RO)
private

Definition at line 2222 of file PFEGammaAlgo.cc.

References reco::SuperCluster::addCluster(), reco::CaloCluster::addHitAndFraction(), reco::SuperCluster::addPreshowerCluster(), PFEGammaAlgo::PFEGConfigInfo::applyCrackCorrections, cfg_, TauDecayModes::dec, PFEGammaAlgo::ProtoEGObject::ecal2ps, PFLayer::ECAL_ENDCAP, PFEGammaAlgo::ProtoEGObject::ecalclusters, edm::hlt::Exception, spr::find(), plotBeamSpotDB::first, edm::Ptr< T >::get(), PFClusterWidthAlgo::pflowEtaWidth(), PFClusterWidthAlgo::pflowPhiWidth(), reco::SuperCluster::preshowerClustersBegin(), reco::SuperCluster::preshowerClustersEnd(), reco::PFBlockElement::PS1, reco::PFBlockElement::PS2, reco::SuperCluster::rawEnergy(), reco::CaloCluster::setCorrectedEnergy(), reco::SuperCluster::setEtaWidth(), reco::SuperCluster::setPhiWidth(), reco::SuperCluster::setPreshowerEnergy(), reco::SuperCluster::setPreshowerEnergyPlane1(), reco::SuperCluster::setPreshowerEnergyPlane2(), reco::SuperCluster::setSeed(), and PFEGammaAlgo::PFEGConfigInfo::thePFEnergyCalibration.

Referenced by fillPFCandidates().

2222  {
2223  if( !RO.ecalclusters.size() ) {
2224  return reco::SuperCluster(0.0,math::XYZPoint(0,0,0));
2225  }
2226 
2227  SumPSEnergy sumps1(reco::PFBlockElement::PS1),
2228  sumps2(reco::PFBlockElement::PS2);
2229 
2230  bool isEE = false;
2231  edm::Ptr<reco::PFCluster> clusptr;
2232  // need the vector of raw pointers for a PF width class
2233  std::vector<const reco::PFCluster*> bare_ptrs;
2234  // calculate necessary parameters and build the SC
2235  double posX(0), posY(0), posZ(0),
2236  rawSCEnergy(0), corrSCEnergy(0), corrPSEnergy(0),
2237  PS1_clus_sum(0), PS2_clus_sum(0),
2238  ePS1(0), ePS2(0), ps1_energy(0.0), ps2_energy(0.0);
2239  for( auto& clus : RO.ecalclusters ) {
2240  ePS1 = 0;
2241  ePS2 = 0;
2242  isEE = PFLayer::ECAL_ENDCAP == clus.first->clusterRef()->layer();
2243  clusptr =
2244  edm::refToPtr<reco::PFClusterCollection>(clus.first->clusterRef());
2245  bare_ptrs.push_back(clusptr.get());
2246 
2247  const double cluseraw = clusptr->energy();
2248  double cluscalibe = clusptr->correctedEnergy();
2249  const math::XYZPoint& cluspos = clusptr->position();
2250  posX += cluseraw * cluspos.X();
2251  posY += cluseraw * cluspos.Y();
2252  posZ += cluseraw * cluspos.Z();
2253  // update EE calibrated super cluster energies
2254  if( isEE ) {
2255  const auto& psclusters = RO.ecal2ps.at(clus.first);
2256  PS1_clus_sum = std::accumulate(psclusters.begin(),psclusters.end(),
2257  0.0,sumps1);
2258  PS2_clus_sum = std::accumulate(psclusters.begin(),psclusters.end(),
2259  0.0,sumps2);
2260  cluscalibe =
2261  cfg_.thePFEnergyCalibration->energyEm(*clusptr,
2262  PS1_clus_sum,PS2_clus_sum,
2263  ePS1, ePS2,
2265  }
2266 
2267  rawSCEnergy += cluseraw;
2268  corrSCEnergy += cluscalibe;
2269  ps1_energy += ePS1;
2270  ps2_energy += ePS2;
2271  corrPSEnergy += ePS1 + ePS2;
2272  }
2273  posX /= rawSCEnergy;
2274  posY /= rawSCEnergy;
2275  posZ /= rawSCEnergy;
2276 
2277  // now build the supercluster
2278  reco::SuperCluster new_sc(corrSCEnergy,math::XYZPoint(posX,posY,posZ));
2279 
2280  clusptr =
2281  edm::refToPtr<reco::PFClusterCollection>(RO.ecalclusters.front().
2282  first->clusterRef());
2283  new_sc.setCorrectedEnergy(corrSCEnergy);
2284  new_sc.setSeed(clusptr);
2285  new_sc.setPreshowerEnergyPlane1(ps1_energy);
2286  new_sc.setPreshowerEnergyPlane2(ps2_energy);
2287  new_sc.setPreshowerEnergy(corrPSEnergy);
2288  for( const auto& clus : RO.ecalclusters ) {
2289  clusptr =
2290  edm::refToPtr<reco::PFClusterCollection>(clus.first->clusterRef());
2291  new_sc.addCluster(clusptr);
2292  auto& hits_and_fractions = clusptr->hitsAndFractions();
2293  for( auto& hit_and_fraction : hits_and_fractions ) {
2294  new_sc.addHitAndFraction(hit_and_fraction.first,hit_and_fraction.second);
2295  }
2296  // put the preshower stuff back in later
2297  const auto& cluspsassociation = RO.ecal2ps.at(clus.first);
2298  // EE rechits should be uniquely matched to sets of pre-shower
2299  // clusters at this point, so we throw an exception if otherwise
2300  // now wrapped in EDM debug flags
2301  for( const auto& pscluselem : cluspsassociation ) {
2302  edm::Ptr<reco::PFCluster> psclus =
2303  edm::refToPtr<reco::PFClusterCollection>(pscluselem.first->
2304  clusterRef());
2305 #ifdef PFFLOW_DEBUG
2306  auto found_pscluster = std::find(new_sc.preshowerClustersBegin(),
2307  new_sc.preshowerClustersEnd(),
2308  reco::CaloClusterPtr(psclus));
2309  if( found_pscluster == new_sc.preshowerClustersEnd() ) {
2310 #endif
2311  new_sc.addPreshowerCluster(psclus);
2312 #ifdef PFFLOW_DEBUG
2313  } else {
2314  throw cms::Exception("PFECALSuperClusterAlgo::buildSuperCluster")
2315  << "Found a PS cluster matched to more than one EE cluster!"
2316  << std::endl << std::hex << psclus.get() << " == "
2317  << found_pscluster->get() << std::dec << std::endl;
2318  }
2319 #endif
2320  }
2321  }
2322 
2323  // calculate linearly weighted cluster widths
2324  PFClusterWidthAlgo pfwidth(bare_ptrs);
2325  new_sc.setEtaWidth(pfwidth.pflowEtaWidth());
2326  new_sc.setPhiWidth(pfwidth.pflowPhiWidth());
2327 
2328  // cache the value of the raw energy
2329  new_sc.rawEnergy();
2330 
2331  return new_sc;
2332 }
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:143
std::shared_ptr< PFEnergyCalibration > thePFEnergyCalibration
Definition: PFEGammaAlgo.h:107
edm::Ptr< CaloCluster > CaloClusterPtr
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
PFEGConfigInfo cfg_
Definition: PFEGammaAlgo.h:292
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
float PFEGammaAlgo::calculate_ele_mva ( const ProtoEGObject RO,
reco::PFCandidateEGammaExtra xtra 
)
private

Definition at line 2031 of file PFEGammaAlgo.cc.

References _currentblock, a, funct::abs(), b, PFEGammaAlgo::ProtoEGObject::brems, chi2_gsf, chi2_kf, constexpr, DEtaGsfEcalClust, dPtOverPt_gsf, DPtOverPt_gsf, DPtOverPt_kf, alignCSCRings::e, earlyBrem, patCandidatesForDimuonsSequences_cff::ecal, PFEGammaAlgo::ProtoEGObject::ecalclusters, EGsfPoutMode, PFEGammaAlgo::ProtoEGObject::electronClusters, Eta_gsf, EtotBremPinPoutMode, EtotPinMode, f, spr::find(), PFEGammaAlgo::ProtoEGObject::firstBrem, firstBrem, reco::PFBlockElementGsfTrack::GsftrackRef(), PFEGammaAlgo::ProtoEGObject::hcalClusters, HOverHE, HOverPin, edm::Ref< C, T, F >::isNonnull(), PFEGammaAlgo::ProtoEGObject::lateBrem, lateBrem, lnPt_gsf, PFEGammaAlgo::ProtoEGObject::localMap, cmsBatch::log, bookConverter::max, min(), PFEGammaAlgo::ProtoEGObject::nBremsWithClusters, nhit_gsf, nhit_kf, NULL, PFClusterWidthAlgo::pflowSigmaEtaEta(), reco::PFBlockElementGsfTrack::positionAtECALEntrance(), reco::PFBlockElementGsfTrack::Pout(), PFEGammaAlgo::ProtoEGObject::primaryGSFs, PFEGammaAlgo::ProtoEGObject::primaryKFs, reco::PFCandidateEGammaExtra::setDeltaEta(), reco::PFCandidateEGammaExtra::setEarlyBrem(), reco::PFCandidateEGammaExtra::setGsfElectronClusterRef(), reco::PFCandidateEGammaExtra::setGsfTrackPout(), reco::PFCandidateEGammaExtra::setHadEnergy(), reco::PFCandidateEGammaExtra::setLateBrem(), reco::PFCandidateEGammaExtra::setSigmaEtaEta(), SigmaEtaEta, and tmvaReaderEle_.

Referenced by fillPFCandidates().

2032  {
2033  if( !RO.primaryGSFs.size() ) return -2.0f;
2034  const PFGSFElement* gsfElement = RO.primaryGSFs.front().first;
2035  const PFKFElement* kfElement = NULL;
2036  if( RO.primaryKFs.size() ) kfElement = RO.primaryKFs.front().first;
2037  reco::GsfTrackRef RefGSF= gsfElement->GsftrackRef();
2038  reco::TrackRef RefKF;
2039  constexpr float m_el = 0.000511;
2040  const double Ein_gsf = std::hypot(RefGSF->pMode(),m_el);
2041  double deta_gsfecal = 1e6;
2042  double sigmaEtaEta = 1e-14;
2043  const double Ene_hcalgsf = std::accumulate(RO.hcalClusters.begin(),
2044  RO.hcalClusters.end(),
2045  0.0,
2046  [](const double a,
2047  const PFClusterFlaggedElement& b)
2048  { return a + b.first->clusterRef()->energy(); }
2049  );
2050  if( RO.primaryKFs.size() ) {
2051  RefKF = RO.primaryKFs.front().first->trackRef();
2052  }
2053  const double Eout_gsf = gsfElement->Pout().t();
2054  const double Etaout_gsf = gsfElement->positionAtECALEntrance().eta();
2055  double FirstEcalGsfEnergy(0.0), OtherEcalGsfEnergy(0.0), EcalBremEnergy(0.0);
2056  //shower shape of cluster closest to gsf track
2057  std::vector<const reco::PFCluster*> gsfcluster;
2058  for( const auto& ecal : RO.ecalclusters ) {
2059  const double cenergy = ecal.first->clusterRef()->correctedEnergy();
2060  ElementMap::value_type gsfToEcal(gsfElement,ecal.first);
2061  ElementMap::value_type kfToEcal(kfElement,ecal.first);
2062  bool hasgsf =
2063  ( std::find(RO.localMap.begin(), RO.localMap.end(), gsfToEcal) ==
2064  RO.localMap.end() );
2065  bool haskf =
2066  ( std::find(RO.localMap.begin(), RO.localMap.end(), kfToEcal) ==
2067  RO.localMap.end() );
2068  bool hasbrem = false;
2069  for( const auto& brem : RO.brems ) {
2070  ElementMap::value_type bremToEcal(brem.first,ecal.first);
2071  if( std::find(RO.localMap.begin(), RO.localMap.end(), bremToEcal) !=
2072  RO.localMap.end() ) {
2073  hasbrem = true;
2074  }
2075  }
2076  if( hasbrem && ecal.first != RO.electronClusters[0] ) {
2077  EcalBremEnergy += cenergy;
2078  }
2079  if( !hasbrem && ecal.first != RO.electronClusters[0] ) {
2080  if( hasgsf ) OtherEcalGsfEnergy += cenergy;
2081  if( haskf ) EcalBremEnergy += cenergy; // from conv. brem!
2082  if( !(hasgsf || haskf) ) OtherEcalGsfEnergy += cenergy; // stuff from SC
2083  }
2084  }
2085 
2086  if( RO.electronClusters[0] ) {
2087  reco::PFClusterRef cref = RO.electronClusters[0]->clusterRef();
2088  xtra.setGsfElectronClusterRef(_currentblock,*(RO.electronClusters[0]));
2089  FirstEcalGsfEnergy = cref->correctedEnergy();
2090  deta_gsfecal = cref->positionREP().eta() - Etaout_gsf;
2091  gsfcluster.push_back(&*cref);
2092  PFClusterWidthAlgo pfwidth(gsfcluster);
2093  sigmaEtaEta = pfwidth.pflowSigmaEtaEta();
2094  }
2095 
2096  // brem sequence information
2097  lateBrem = firstBrem = earlyBrem = -1.0f;
2098  if(RO.nBremsWithClusters > 0) {
2099  if (RO.lateBrem == 1) lateBrem = 1.0f;
2100  else lateBrem = 0.0f;
2101  firstBrem = RO.firstBrem;
2102  if(RO.firstBrem < 4) earlyBrem = 1.0f;
2103  else earlyBrem = 0.0f;
2104  }
2105  xtra.setEarlyBrem(earlyBrem);
2106  xtra.setLateBrem(lateBrem);
2107  if( FirstEcalGsfEnergy > 0.0 ) {
2108  if( RefGSF.isNonnull() ) {
2109  xtra.setGsfTrackPout(gsfElement->Pout());
2110  // normalization observables
2111  const float Pt_gsf = RefGSF->ptMode();
2112  lnPt_gsf = std::log(Pt_gsf);
2113  Eta_gsf = RefGSF->etaMode();
2114  // tracking observables
2115  const double ptModeErrorGsf = RefGSF->ptModeError();
2116  dPtOverPt_gsf = (ptModeErrorGsf > 0. ? ptModeErrorGsf/Pt_gsf : 1.0);
2117  nhit_gsf = RefGSF->hitPattern().trackerLayersWithMeasurement();
2118  chi2_gsf = RefGSF->normalizedChi2();
2119  DPtOverPt_gsf = (Pt_gsf - gsfElement->Pout().pt())/Pt_gsf;
2120  // kalman filter vars
2121  nhit_kf = 0;
2122  chi2_kf = -0.01;
2123  DPtOverPt_kf = -0.01;
2124  if( RefKF.isNonnull() ) {
2125  nhit_kf = RefKF->hitPattern().trackerLayersWithMeasurement();
2126  chi2_kf = RefKF->normalizedChi2();
2127  // not used for moment, weird behavior of variable
2128  // DPtOverPt_kf = (RefKF->pt() - RefKF->outerPt())/RefKF->pt();
2129  }
2130  //tracker + calorimetry observables
2131  const double EcalETot =
2132  (FirstEcalGsfEnergy+OtherEcalGsfEnergy+EcalBremEnergy);
2133  EtotPinMode = EcalETot / Ein_gsf;
2134  EGsfPoutMode = FirstEcalGsfEnergy / Eout_gsf;
2135  EtotBremPinPoutMode = ( (EcalBremEnergy + OtherEcalGsfEnergy) /
2136  (Ein_gsf - Eout_gsf) );
2137  DEtaGsfEcalClust = std::abs(deta_gsfecal);
2138  SigmaEtaEta = std::log(sigmaEtaEta);
2140  xtra.setSigmaEtaEta(sigmaEtaEta);
2141 
2142  HOverHE = Ene_hcalgsf/(Ene_hcalgsf + FirstEcalGsfEnergy);
2143  HOverPin = Ene_hcalgsf / Ein_gsf;
2144  xtra.setHadEnergy(Ene_hcalgsf);
2145 
2146  // Apply bounds to variables and calculate MVA
2150  chi2_gsf = std::min(chi2_gsf,10.0f);
2153  chi2_kf = std::min(chi2_kf,10.0f);
2161  SigmaEtaEta = std::max(SigmaEtaEta,-14.0f);
2162  HOverPin = std::max(HOverPin,0.0f);
2163  HOverPin = std::min(HOverPin,5.0f);
2164  /*
2165  std::cout << " **** PFEG BDT observables ****" << endl;
2166  std::cout << " < Normalization > " << endl;
2167  std::cout << " Pt_gsf " << Pt_gsf << " Pin " << Ein_gsf
2168  << " Pout " << Eout_gsf << " Eta_gsf " << Eta_gsf << endl;
2169  std::cout << " < PureTracking > " << endl;
2170  std::cout << " dPtOverPt_gsf " << dPtOverPt_gsf
2171  << " DPtOverPt_gsf " << DPtOverPt_gsf
2172  << " chi2_gsf " << chi2_gsf
2173  << " nhit_gsf " << nhit_gsf
2174  << " DPtOverPt_kf " << DPtOverPt_kf
2175  << " chi2_kf " << chi2_kf
2176  << " nhit_kf " << nhit_kf << endl;
2177  std::cout << " < track-ecal-hcal-ps " << endl;
2178  std::cout << " EtotPinMode " << EtotPinMode
2179  << " EGsfPoutMode " << EGsfPoutMode
2180  << " EtotBremPinPoutMode " << EtotBremPinPoutMode
2181  << " DEtaGsfEcalClust " << DEtaGsfEcalClust
2182  << " SigmaEtaEta " << SigmaEtaEta
2183  << " HOverHE " << HOverHE << " Hcal energy " << Ene_hcalgsf
2184  << " HOverPin " << HOverPin
2185  << " lateBrem " << lateBrem
2186  << " firstBrem " << firstBrem << endl;
2187  */
2188 
2189  return tmvaReaderEle_->EvaluateMVA("BDT");
2190  }
2191  }
2192  return -2.0f;
2193 }
float EtotBremPinPoutMode
Definition: PFEGammaAlgo.h:309
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
void setGsfElectronClusterRef(const reco::PFBlockRef &blk, const reco::PFBlockElementCluster &ref)
set gsf electron cluster ref
float EGsfPoutMode
Definition: PFEGammaAlgo.h:309
std::pair< const PFClusterElement *, bool > PFClusterFlaggedElement
Definition: PFEGammaAlgo.h:64
void setHadEnergy(float val)
set the had energy. The cluster energies should be entered before
reco::PFBlockElementGsfTrack PFGSFElement
Definition: PFEGammaAlgo.h:56
float DEtaGsfEcalClust
Definition: PFEGammaAlgo.h:310
#define NULL
Definition: scimark2.h:8
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
reco::PFBlockRef _currentblock
Definition: PFEGammaAlgo.h:183
#define constexpr
float DPtOverPt_gsf
Definition: PFEGammaAlgo.h:303
void setSigmaEtaEta(float val)
set the sigmaetaeta
void setEarlyBrem(float val)
set EarlyBrem
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float DPtOverPt_kf
Definition: PFEGammaAlgo.h:303
void setGsfTrackPout(const math::XYZTLorentzVector &pout)
set the pout (not trivial to get from the GSF track)
float dPtOverPt_gsf
Definition: PFEGammaAlgo.h:303
double f[11][100]
T min(T a, T b)
Definition: MathUtil.h:58
Container::value_type value_type
void setDeltaEta(float val)
set the delta eta
reco::PFBlockElementTrack PFKFElement
Definition: PFEGammaAlgo.h:57
float SigmaEtaEta
Definition: PFEGammaAlgo.h:311
double b
Definition: hdecay.h:120
TMVA::Reader * tmvaReaderEle_
Definition: PFEGammaAlgo.h:294
float EtotPinMode
Definition: PFEGammaAlgo.h:309
double a
Definition: hdecay.h:121
void setLateBrem(float val)
set LateBrem
tuple log
Definition: cmsBatch.py:347
void PFEGammaAlgo::dumpCurrentRefinableObjects ( ) const
private

Definition at line 1285 of file PFEGammaAlgo.cc.

References _refinableObjects, and info().

Referenced by buildAndRefineEGObjects().

1285  {
1286  #ifdef PFLOW_DEBUG
1287  edm::LogVerbatim("PFEGammaAlgo")
1288  //<< "Dumping current block: " << std::endl << *_currentblock << std::endl
1289  << "Dumping " << _refinableObjects.size()
1290  << " refinable objects for this block: " << std::endl;
1291  for( const auto& ro : _refinableObjects ) {
1292  std::stringstream info;
1293  info << "Refinable Object:" << std::endl;
1294  if( ro.parentSC ) {
1295  info << "\tSuperCluster element attached to object:" << std::endl
1296  << '\t';
1297  ro.parentSC->Dump(info,"\t");
1298  info << std::endl;
1299  }
1300  if( ro.electronSeed.isNonnull() ) {
1301  info << "\tGSF element attached to object:" << std::endl;
1302  ro.primaryGSFs.front().first->Dump(info,"\t");
1303  info << std::endl;
1304  info << "firstBrem : " << ro.firstBrem
1305  << " lateBrem : " << ro.lateBrem
1306  << " nBrems with cluster : " << ro.nBremsWithClusters
1307  << std::endl;;
1308  if( ro.electronClusters.size() && ro.electronClusters[0] ) {
1309  info << "electron cluster : ";
1310  ro.electronClusters[0]->Dump(info,"\t");
1311  info << std::endl;
1312  } else {
1313  info << " no electron cluster." << std::endl;
1314  }
1315  }
1316  if( ro.primaryKFs.size() ) {
1317  info << "\tPrimary KF tracks attached to object: " << std::endl;
1318  for( const auto& kf : ro.primaryKFs ) {
1319  kf.first->Dump(info,"\t");
1320  info << std::endl;
1321  }
1322  }
1323  if( ro.secondaryKFs.size() ) {
1324  info << "\tSecondary KF tracks attached to object: " << std::endl;
1325  for( const auto& kf : ro.secondaryKFs ) {
1326  kf.first->Dump(info,"\t");
1327  info << std::endl;
1328  }
1329  }
1330  if( ro.brems.size() ) {
1331  info << "\tBrem tangents attached to object: " << std::endl;
1332  for( const auto& brem : ro.brems ) {
1333  brem.first->Dump(info,"\t");
1334  info << std::endl;
1335  }
1336  }
1337  if( ro.ecalclusters.size() ) {
1338  info << "\tECAL clusters attached to object: " << std::endl;
1339  for( const auto& clus : ro.ecalclusters ) {
1340  clus.first->Dump(info,"\t");
1341  info << std::endl;
1342  if( ro.ecal2ps.find(clus.first) != ro.ecal2ps.end() ) {
1343  for( const auto& psclus : ro.ecal2ps.at(clus.first) ) {
1344  info << "\t\t Attached PS Cluster: ";
1345  psclus.first->Dump(info,"");
1346  info << std::endl;
1347  }
1348  }
1349  }
1350  }
1351  edm::LogVerbatim("PFEGammaAlgo") << info.str();
1352  }
1353  #endif
1354  }
static const TGPicture * info(bool iBackgroundIsBlack)
std::list< ProtoEGObject > _refinableObjects
Definition: PFEGammaAlgo.h:201
float PFEGammaAlgo::EvaluateSingleLegMVA ( const reco::PFBlockRef blockref,
const reco::Vertex primaryvtx,
unsigned int  track_index 
)
private

Definition at line 771 of file PFEGammaAlgo.cc.

References reco::PFBlock::associatedElements(), createPayload::block, chi2, del_phi, SiPixelRawToDigiRegional_cfi::deltaPhi, reco::PFBlockElement::ECAL, reco::PFBlock::elements(), asciidump::elements, EoverPt, reco::PFBlockElement::HCAL, HoverPt, reco::PFBlock::linkData(), reco::PFBlock::LINKTEST_ALL, mvaValue, nlayers, nlost, colinearityKinematic::Phi, PV3DBase< T, PVType, FrameType >::phi(), STIP, tmvaReader_, track_pt, X, reco::Vertex::x(), reco::Vertex::y(), and reco::Vertex::z().

Referenced by fillPFCandidates(), and linkRefinableObjectECALToSingleLegConv().

773  {
774  const reco::PFBlock& block = *blockref;
776  //use this to store linkdata in the associatedElements function below
777  PFBlock::LinkData linkData = block.linkData();
778  //calculate MVA Variables
779  chi2=elements[track_index].trackRef()->chi2()/elements[track_index].trackRef()->ndof();
780  nlost=elements[track_index].trackRef()->hitPattern().numberOfLostHits(HitPattern::MISSING_INNER_HITS);
781  nlayers=elements[track_index].trackRef()->hitPattern().trackerLayersWithMeasurement();
782  track_pt=elements[track_index].trackRef()->pt();
783  STIP=elements[track_index].trackRefPF()->STIP();
784 
785  float linked_e=0;
786  float linked_h=0;
787  std::multimap<double, unsigned int> ecalAssoTrack;
788  block.associatedElements( track_index,linkData,
789  ecalAssoTrack,
792  std::multimap<double, unsigned int> hcalAssoTrack;
793  block.associatedElements( track_index,linkData,
794  hcalAssoTrack,
797  if(ecalAssoTrack.size() > 0) {
798  for(std::multimap<double, unsigned int>::iterator itecal = ecalAssoTrack.begin();
799  itecal != ecalAssoTrack.end(); ++itecal) {
800  linked_e=linked_e+elements[itecal->second].clusterRef()->energy();
801  }
802  }
803  if(hcalAssoTrack.size() > 0) {
804  for(std::multimap<double, unsigned int>::iterator ithcal = hcalAssoTrack.begin();
805  ithcal != hcalAssoTrack.end(); ++ithcal) {
806  linked_h=linked_h+elements[ithcal->second].clusterRef()->energy();
807  }
808  }
809  EoverPt=linked_e/elements[track_index].trackRef()->pt();
810  HoverPt=linked_h/elements[track_index].trackRef()->pt();
811  GlobalVector rvtx(elements[track_index].trackRef()->innerPosition().X()-primaryvtx.x(),
812  elements[track_index].trackRef()->innerPosition().Y()-primaryvtx.y(),
813  elements[track_index].trackRef()->innerPosition().Z()-primaryvtx.z());
814  double vtx_phi=rvtx.phi();
815  //delta Phi between conversion vertex and track
816  del_phi=fabs(deltaPhi(vtx_phi, elements[track_index].trackRef()->innerMomentum().Phi()));
817  mvaValue = tmvaReader_->EvaluateMVA("BDT");
818 
819  return mvaValue;
820 }
double mvaValue
Definition: PFEGammaAlgo.h:350
double y() const
y coordinate
Definition: Vertex.h:110
std::map< unsigned int, Link > LinkData
Definition: PFBlock.h:46
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
#define X(str)
Definition: MuonsGrabber.cc:48
list elements
Definition: asciidump.py:414
const edm::OwnVector< reco::PFBlockElement > & elements() const
Definition: PFBlock.h:107
const LinkData & linkData() const
Definition: PFBlock.h:112
double z() const
y coordinate
Definition: Vertex.h:112
double x() const
x coordinate
Definition: Vertex.h:108
void associatedElements(unsigned i, const LinkData &linkData, std::multimap< double, unsigned > &sortedAssociates, reco::PFBlockElement::Type type=PFBlockElement::NONE, LinkTest test=LINKTEST_RECHIT) const
Definition: PFBlock.cc:75
TMVA::Reader * tmvaReader_
Definition: PFEGammaAlgo.h:330
Block of elements.
Definition: PFBlock.h:30
void PFEGammaAlgo::fill_extra_info ( const ProtoEGObject RO,
reco::PFCandidateEGammaExtra xtra 
)
private

Definition at line 2195 of file PFEGammaAlgo.cc.

References _currentblock, _currentlinks, _splayedblock, reco::PFCandidateEGammaExtra::addExtraNonConvTrack(), docast, reco::PFBlockElement::ECAL, patCandidatesForDimuonsSequences_cff::ecal, PFEGammaAlgo::ProtoEGObject::ecalclusters, and reco::PFBlockElement::TRACK.

Referenced by fillPFCandidates().

2196  {
2197  // add tracks associated to clusters that are not T_FROM_GAMMACONV
2198  // info about single-leg convs is already save, so just veto in loops
2199  IsConversionTrack<reco::PFBlockElementTrack> isConvKf;
2200  auto KFbegin = _splayedblock[reco::PFBlockElement::TRACK].begin();
2201  auto KFend = _splayedblock[reco::PFBlockElement::TRACK].end();
2202  for( auto& ecal : RO.ecalclusters ) {
2203  NotCloserToOther<reco::PFBlockElement::ECAL,
2205  true>
2206  ECALToTracks(_currentblock,_currentlinks,ecal.first);
2207  auto notmatchedkf = std::partition(KFbegin,KFend,ECALToTracks);
2208  auto notconvkf = std::partition(KFbegin,notmatchedkf,isConvKf);
2209  // go through non-conv-identified kfs and check MVA to add conversions
2210  for( auto kf = notconvkf; kf != notmatchedkf; ++kf ) {
2211  const reco::PFBlockElementTrack* elemaskf =
2212  docast(const reco::PFBlockElementTrack*,kf->first);
2213  xtra.addExtraNonConvTrack(_currentblock,*elemaskf);
2214  }
2215  }
2216 }
std::vector< std::vector< PFFlaggedElement > > _splayedblock
Definition: PFEGammaAlgo.h:187
reco::PFBlockRef _currentblock
Definition: PFEGammaAlgo.h:183
reco::PFBlock::LinkData _currentlinks
Definition: PFEGammaAlgo.h:184
#define docast(x, y)
Definition: PFEGammaAlgo.cc:42
void addExtraNonConvTrack(const reco::PFBlockRef &blk, const reco::PFBlockElementTrack &tkref)
track counting for electrons and photons
void PFEGammaAlgo::fillPFCandidates ( const std::list< ProtoEGObject > &  ,
reco::PFCandidateCollection ,
reco::PFCandidateEGammaExtraCollection  
)
private

Definition at line 1904 of file PFEGammaAlgo.cc.

References _currentblock, reco::PFCandidateEGammaExtra::addConversionRef(), reco::PFCandidate::addElementInBlock(), reco::PFCandidateEGammaExtra::addSingleLegConvTrackRefMva(), buildRefinedSuperCluster(), calculate_ele_mva(), cfg_, reco::PFBlockElementTrack::convRefs(), patCandidatesForDimuonsSequences_cff::ecal, reco::CaloCluster::energy(), EvaluateSingleLegMVA(), fill_extra_info(), reco::PFBlockElementGsfTrack::GsftrackRef(), reco::PFBlockElement::index(), edm::Ref< C, T, F >::index(), p4, reco::Vertex::position(), reco::CaloCluster::position(), reco::PFBlockElementTrack::positionAtECALEntrance(), reco::PFBlockElementGsfTrack::positionAtECALEntrance(), PFEGammaAlgo::PFEGConfigInfo::primaryVtx, PFEGammaAlgo::PFEGConfigInfo::produceEGCandsWithNoSuperCluster, reco::SuperCluster::rawEnergy(), refinedscs_, reco::SuperCluster::seed(), reco::PFCandidate::set_mva_e_pi(), reco::LeafCandidate::setCharge(), reco::PFCandidate::setEcalEnergy(), reco::PFCandidateEGammaExtra::setGsfTrackRef(), reco::PFCandidate::setGsfTrackRef(), reco::PFCandidateEGammaExtra::setKfTrackRef(), reco::PFCandidateEGammaExtra::setMVA(), reco::LeafCandidate::setP4(), reco::LeafCandidate::setPdgId(), reco::PFCandidate::setPositionAtECALEntrance(), reco::PFCandidateEGammaExtra::setSuperClusterPFECALRef(), reco::PFCandidateEGammaExtra::setSuperClusterRef(), reco::PFCandidate::setSuperClusterRef(), reco::PFCandidate::setTrackRef(), and reco::PFBlockElementTrack::trackRef().

Referenced by buildAndRefineEGObjects().

1906  {
1907  // reset output collections
1908  egcands.clear();
1909  egxs.clear();
1910  refinedscs_.clear();
1911  egcands.reserve(ROs.size());
1912  egxs.reserve(ROs.size());
1913  refinedscs_.reserve(ROs.size());
1914  for( auto& RO : ROs ) {
1915  if( RO.ecalclusters.size() == 0 &&
1917 
1918  reco::PFCandidate cand;
1920  if( RO.primaryGSFs.size() || RO.primaryKFs.size() ) {
1921  cand.setPdgId(-11); // anything with a primary track is an electron
1922  } else {
1923  cand.setPdgId(22); // anything with no primary track is a photon
1924  }
1925  if( RO.primaryKFs.size() ) {
1926  cand.setCharge(RO.primaryKFs[0].first->trackRef()->charge());
1927  xtra.setKfTrackRef(RO.primaryKFs[0].first->trackRef());
1928  cand.setTrackRef(RO.primaryKFs[0].first->trackRef());
1929  cand.addElementInBlock(_currentblock,RO.primaryKFs[0].first->index());
1930  }
1931  if( RO.primaryGSFs.size() ) {
1932  cand.setCharge(RO.primaryGSFs[0].first->GsftrackRef()->chargeMode());
1933  xtra.setGsfTrackRef(RO.primaryGSFs[0].first->GsftrackRef());
1934  cand.setGsfTrackRef(RO.primaryGSFs[0].first->GsftrackRef());
1935  cand.addElementInBlock(_currentblock,RO.primaryGSFs[0].first->index());
1936  }
1937  if( RO.parentSC ) {
1938  xtra.setSuperClusterPFECALRef(RO.parentSC->superClusterRef());
1939  // we'll set to the refined supercluster back up in the producer
1940  cand.setSuperClusterRef(RO.parentSC->superClusterRef());
1941  xtra.setSuperClusterRef(RO.parentSC->superClusterRef());
1942  cand.addElementInBlock(_currentblock,RO.parentSC->index());
1943  }
1944  // add brems
1945  for( const auto& bremflagged : RO.brems ) {
1946  const PFBremElement* brem = bremflagged.first;
1947  cand.addElementInBlock(_currentblock,brem->index());
1948  }
1949  // add clusters and ps clusters
1950  for( const auto& ecal : RO.ecalclusters ) {
1951  const PFClusterElement* clus = ecal.first;
1952  cand.addElementInBlock(_currentblock,clus->index());
1953  for( auto& ps : RO.ecal2ps.at(clus) ) {
1954  const PFClusterElement* psclus = ps.first;
1955  cand.addElementInBlock(_currentblock,psclus->index());
1956  }
1957  }
1958  // add secondary tracks
1959  for( const auto& secdkf : RO.secondaryKFs ) {
1960  const PFKFElement* kf = secdkf.first;
1962  const reco::ConversionRefVector& convrefs = kf->convRefs();
1963  bool no_conv_ref = true;
1964  for( const auto& convref : convrefs ) {
1965  if( convref.isNonnull() && convref.isAvailable() ) {
1966  xtra.addConversionRef(convref);
1967  no_conv_ref = false;
1968  }
1969  }
1970  if( no_conv_ref ) {
1971  //single leg conversions
1972 
1973  //look for stored mva value in map or else recompute
1974  const auto &mvavalmapped = RO.singleLegConversionMvaMap.find(kf);
1975  //FIXME: Abuse single mva value to store both provenance and single leg mva score
1976  //by storing 3.0 + mvaval
1977  float mvaval = mvavalmapped!=RO.singleLegConversionMvaMap.end() ? mvavalmapped->second : 3.0 + EvaluateSingleLegMVA(_currentblock, *cfg_.primaryVtx,
1978  kf->index());
1979 
1980  xtra.addSingleLegConvTrackRefMva(std::make_pair(kf->trackRef(),mvaval));
1981  }
1982  }
1983 
1984  // build the refined supercluster from those clusters left in the cand
1985  refinedscs_.push_back(buildRefinedSuperCluster(RO));
1986 
1987  const reco::SuperCluster& the_sc = refinedscs_.back();
1988  // with the refined SC in hand we build a naive candidate p4
1989  // and set the candidate ECAL position to either the barycenter of the
1990  // supercluster (if super-cluster present) or the seed of the
1991  // new SC generated by the EGAlgo
1992  const double scE = the_sc.energy();
1993  if( scE != 0.0 ) {
1994  const math::XYZPoint& seedPos = the_sc.seed()->position();
1995  math::XYZVector egDir = the_sc.position()-cfg_.primaryVtx->position();
1996  egDir = egDir.Unit();
1997  cand.setP4(math::XYZTLorentzVector(scE*egDir.x(),
1998  scE*egDir.y(),
1999  scE*egDir.z(),
2000  scE ));
2001  math::XYZPointF ecalPOS_f(seedPos.x(),seedPos.y(),seedPos.z());
2002  cand.setPositionAtECALEntrance(ecalPOS_f);
2003  cand.setEcalEnergy(the_sc.rawEnergy(),the_sc.energy());
2004  } else if ( cfg_.produceEGCandsWithNoSuperCluster &&
2005  RO.primaryGSFs.size() ) {
2006  const PFGSFElement* gsf = RO.primaryGSFs[0].first;
2007  reco::GsfTrackRef gref = gsf->GsftrackRef();
2008  math::XYZTLorentzVector p4(gref->pxMode(),gref->pyMode(),
2009  gref->pzMode(),gref->pMode());
2010  cand.setP4(p4);
2011  cand.setPositionAtECALEntrance(gsf->positionAtECALEntrance());
2012  } else if ( cfg_.produceEGCandsWithNoSuperCluster &&
2013  RO.primaryKFs.size() ) {
2014  const PFKFElement* kf = RO.primaryKFs[0].first;
2015  reco::TrackRef kref = RO.primaryKFs[0].first->trackRef();
2016  math::XYZTLorentzVector p4(kref->px(),kref->py(),kref->pz(),kref->p());
2017  cand.setP4(p4);
2018  cand.setPositionAtECALEntrance(kf->positionAtECALEntrance());
2019  }
2020  const float ele_mva_value = calculate_ele_mva(RO,xtra);
2021  fill_extra_info(RO,xtra);
2022  //std::cout << "PFEG ele_mva: " << ele_mva_value << std::endl;
2023  xtra.setMVA(ele_mva_value);
2024  cand.set_mva_e_pi(ele_mva_value);
2025  egcands.push_back(cand);
2026  egxs.push_back(xtra);
2027  }
2028 }
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:126
void setSuperClusterRef(reco::SuperClusterRef sc)
set reference to the corresponding supercluster
reco::SuperClusterCollection refinedscs_
Definition: PFEGammaAlgo.h:178
void setPositionAtECALEntrance(const math::XYZPointF &pos)
set position at ECAL entrance
Definition: PFCandidate.h:348
virtual void setCharge(Charge q)
set electric charge
Definition: LeafCandidate.h:93
void addSingleLegConvTrackRefMva(const std::pair< reco::TrackRef, float > &trackrefmva)
add Single Leg Conversion TrackRef
reco::PFBlockElementGsfTrack PFGSFElement
Definition: PFEGammaAlgo.h:56
key_type index() const
Definition: Ref.h:269
virtual void setP4(const LorentzVector &p4)
set 4-momentum
unsigned int index
index type
Definition: Vertex.h:49
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float > > XYZPointF
point in space with cartesian internal representation
Definition: Point3D.h:10
const reco::Vertex * primaryVtx
Definition: PFEGammaAlgo.h:124
reco::PFBlockRef _currentblock
Definition: PFEGammaAlgo.h:183
void setGsfTrackRef(const reco::GsfTrackRef &ref)
set gsftrack reference
const Point & position() const
position
Definition: Vertex.h:106
PFEGConfigInfo cfg_
Definition: PFEGammaAlgo.h:292
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
float EvaluateSingleLegMVA(const reco::PFBlockRef &blockref, const reco::Vertex &primaryvtx, unsigned int track_index)
void set_mva_e_pi(float mvaNI)
Definition: PFCandidate.h:311
void addElementInBlock(const reco::PFBlockRef &blockref, unsigned elementIndex)
add an element to the current PFCandidate
Definition: PFCandidate.cc:211
double p4[4]
Definition: TauolaWrapper.h:92
double energy() const
cluster energy
Definition: CaloCluster.h:121
reco::PFBlockElementCluster PFClusterElement
Definition: PFEGammaAlgo.h:58
reco::PFBlockElementBrem PFBremElement
Definition: PFEGammaAlgo.h:55
void setEcalEnergy(float eeRaw, float eeCorr)
set corrected Ecal energy
Definition: PFCandidate.h:217
double rawEnergy() const
raw uncorrected energy (sum of energies of component BasicClusters)
Definition: SuperCluster.h:47
void fill_extra_info(const ProtoEGObject &, reco::PFCandidateEGammaExtra &)
void setGsfTrackRef(const reco::GsfTrackRef &ref)
set gsftrack reference
Definition: PFCandidate.cc:454
float calculate_ele_mva(const ProtoEGObject &, reco::PFCandidateEGammaExtra &)
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
reco::PFBlockElementTrack PFKFElement
Definition: PFEGammaAlgo.h:57
void setSuperClusterPFECALRef(reco::SuperClusterRef sc)
set reference to the corresponding supercluster
void addConversionRef(const reco::ConversionRef &convref)
add Conversions from PF
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:39
reco::SuperCluster buildRefinedSuperCluster(const ProtoEGObject &)
virtual void setPdgId(int pdgId)
void setSuperClusterRef(const reco::SuperClusterRef &scRef)
Definition: PFCandidate.cc:620
void setKfTrackRef(const reco::TrackRef &ref)
set kf track reference
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:66
void setMVA(float val)
set the result (mostly for debugging)
void setTrackRef(const reco::TrackRef &ref)
set track reference
Definition: PFCandidate.cc:416
reco::PFCandidateCollection& PFEGammaAlgo::getCandidates ( )
inline

Definition at line 157 of file PFEGammaAlgo.h.

References outcands_.

157 {return outcands_;}
reco::PFCandidateCollection outcands_
Definition: PFEGammaAlgo.h:176
reco::PFCandidateEGammaExtraCollection& PFEGammaAlgo::getEGExtra ( )
inline

Definition at line 160 of file PFEGammaAlgo.h.

References outcandsextra_.

160 {return outcandsextra_;}
reco::PFCandidateEGammaExtraCollection outcandsextra_
Definition: PFEGammaAlgo.h:177
reco::SuperClusterCollection& PFEGammaAlgo::getRefinedSCs ( )
inline

Definition at line 163 of file PFEGammaAlgo.h.

References refinedscs_.

163 {return refinedscs_;}
reco::SuperClusterCollection refinedscs_
Definition: PFEGammaAlgo.h:178
void PFEGammaAlgo::initializeProtoCands ( std::list< ProtoEGObject > &  )
private

Definition at line 979 of file PFEGammaAlgo.cc.

References _currentblock, _currentlinks, _refinableObjects, _splayedblock, PFEGammaAlgo::ProtoEGObject::brems, docast, reco::PFBlockElementGsfTrack::Dump(), PFEGammaAlgo::ProtoEGObject::ecal2ps, PFEGammaAlgo::ProtoEGObject::ecalclusters, PFEGammaAlgo::ProtoEGObject::electronSeed, edm::hlt::Exception, f, PFEGammaAlgo::ProtoEGObject::firstBrem, edm::Ref< C, T, F >::get(), reco::PFBlockElementGsfTrack::GsftrackRef(), reco::PFBlockElement::index(), edm::Ref< C, T, F >::isAvailable(), edm::Ref< C, T, F >::isNonnull(), edm::Ref< C, T, F >::isNull(), PFEGammaAlgo::ProtoEGObject::lateBrem, reco::PFBlock::LINKTEST_ALL, PFEGammaAlgo::ProtoEGObject::localMap, LOGDRESSED, LOGVERB, eostools::move(), PFEGammaAlgo::ProtoEGObject::nBremsWithClusters, PFEGammaAlgo::ProtoEGObject::parentBlock, PFEGammaAlgo::ProtoEGObject::parentSC, PFEGammaAlgo::ProtoEGObject::primaryGSFs, reco::PFBlockElement::T_FROM_GAMMACONV, reco::PFBlockElementGsfTrack::trackType(), and unwrapSuperCluster().

Referenced by buildAndRefineEGObjects().

979  {
980  // step 1: build SC based proto-candidates
981  // in the future there will be an SC Et requirement made here to control
982  // block size
983  for( auto& element : _splayedblock[PFBlockElement::SC] ) {
984  LOGDRESSED("PFEGammaAlgo")
985  << "creating SC-based proto-object" << std::endl
986  << "\tSC at index: " << element.first->index()
987  << " has type: " << element.first->type() << std::endl;
988  element.second = false;
989  ProtoEGObject fromSC;
990  fromSC.nBremsWithClusters = -1;
991  fromSC.firstBrem = -1;
992  fromSC.lateBrem = -1;
993  fromSC.parentBlock = _currentblock;
994  fromSC.parentSC = docast(const PFSCElement*,element.first);
995  // splay the supercluster so we can knock out used elements
996  bool sc_success =
997  unwrapSuperCluster(fromSC.parentSC,fromSC.ecalclusters,fromSC.ecal2ps);
998  if( sc_success ) {
999  /*
1000  auto ins_pos = std::lower_bound(_refinableObjects.begin(),
1001  _refinableObjects.end(),
1002  fromSC,
1003  [&](const ProtoEGObject& a,
1004  const ProtoEGObject& b){
1005  const double a_en =
1006  a.parentSC->superClusterRef()->energy();
1007  const double b_en =
1008  b.parentSC->superClusterRef()->energy();
1009  return a_en < b_en;
1010  });
1011  */
1012  _refinableObjects.insert(_refinableObjects.end(),fromSC);
1013  }
1014  }
1015  // step 2: build GSF-seed-based proto-candidates
1016  reco::GsfTrackRef gsfref_forextra;
1017  reco::TrackExtraRef gsftrk_extra;
1018  reco::ElectronSeedRef theseedref;
1019  std::list<ProtoEGObject>::iterator objsbegin, objsend;
1020  for( auto& element : _splayedblock[PFBlockElement::GSF] ) {
1021  LOGDRESSED("PFEGammaAlgo")
1022  << "creating GSF-based proto-object" << std::endl
1023  << "\tGSF at index: " << element.first->index()
1024  << " has type: " << element.first->type() << std::endl;
1025  const PFGSFElement* elementAsGSF =
1026  docast(const PFGSFElement*,element.first);
1027  if( elementAsGSF->trackType(reco::PFBlockElement::T_FROM_GAMMACONV) ) {
1028  continue; // for now, do not allow dedicated brems to make proto-objects
1029  }
1030  element.second = false;
1031 
1032  ProtoEGObject fromGSF;
1033  fromGSF.nBremsWithClusters = -1;
1034  fromGSF.firstBrem = -1;
1035  fromGSF.lateBrem = 0;
1036  gsfref_forextra = elementAsGSF->GsftrackRef();
1037  gsftrk_extra = ( gsfref_forextra.isAvailable() ?
1038  gsfref_forextra->extra() : reco::TrackExtraRef() );
1039  theseedref = ( gsftrk_extra.isAvailable() ?
1040  gsftrk_extra->seedRef().castTo<reco::ElectronSeedRef>() :
1041  reco::ElectronSeedRef() );
1042  fromGSF.electronSeed = theseedref;
1043  // exception if there's no seed
1044  if(fromGSF.electronSeed.isNull() || !fromGSF.electronSeed.isAvailable()) {
1045  std::stringstream gsf_err;
1046  elementAsGSF->Dump(gsf_err,"\t");
1047  throw cms::Exception("PFEGammaAlgo::initializeProtoCands()")
1048  << "Found a GSF track with no seed! This should not happen!"
1049  << std::endl << gsf_err.str() << std::endl;
1050  }
1051  // flag this GSF element as globally used and push back the track ref
1052  // into the protocand
1053  element.second = false;
1054  fromGSF.parentBlock = _currentblock;
1055  fromGSF.primaryGSFs.push_back(std::make_pair(elementAsGSF,true));
1056  // add the directly matched brem tangents
1057  for( auto& brem : _splayedblock[PFBlockElement::BREM] ) {
1058  float dist = _currentblock->dist(elementAsGSF->index(),
1059  brem.first->index(),
1060  _currentlinks,
1062  if( dist == 0.001f ) {
1063  const PFBremElement* eAsBrem =
1064  docast(const PFBremElement*,brem.first);
1065  fromGSF.brems.push_back(std::make_pair(eAsBrem,true));
1066  fromGSF.localMap.push_back( ElementMap::value_type(eAsBrem,elementAsGSF) );
1067  fromGSF.localMap.push_back( ElementMap::value_type(elementAsGSF,eAsBrem) );
1068  brem.second = false;
1069  }
1070  }
1071  // if this track is ECAL seeded reset links or import cluster
1072  // tracker (this is pixel only, right?) driven seeds just get the GSF
1073  // track associated since this only branches for ECAL Driven seeds
1074  if( fromGSF.electronSeed->isEcalDriven() ) {
1075  // step 2a: either merge with existing ProtoEG object with SC or add
1076  // SC directly to this proto EG object if not present
1077  LOGDRESSED("PFEGammaAlgo")
1078  << "GSF-based proto-object is ECAL driven, merging SC-cand"
1079  << std::endl;
1080  LOGVERB("PFEGammaAlgo")
1081  << "ECAL Seed Ptr: " << fromGSF.electronSeed.get()
1082  << " isAvailable: " << fromGSF.electronSeed.isAvailable()
1083  << " isNonnull: " << fromGSF.electronSeed.isNonnull()
1084  << std::endl;
1085  SeedMatchesToProtoObject sctoseedmatch(fromGSF.electronSeed);
1086  objsbegin = _refinableObjects.begin();
1087  objsend = _refinableObjects.end();
1088  // this auto is a std::list<ProtoEGObject>::iterator
1089  auto clusmatch = std::find_if(objsbegin,objsend,sctoseedmatch);
1090  if( clusmatch != objsend ) {
1091  fromGSF.parentSC = clusmatch->parentSC;
1092  fromGSF.ecalclusters = std::move(clusmatch->ecalclusters);
1093  fromGSF.ecal2ps = std::move(clusmatch->ecal2ps);
1094  _refinableObjects.erase(clusmatch);
1095  } else if (fromGSF.electronSeed.isAvailable() &&
1096  fromGSF.electronSeed.isNonnull()) {
1097  // link tests in the gap region can current split a gap electron
1098  // HEY THIS IS A WORK AROUND FOR A KNOWN BUG IN PFBLOCKALGO
1099  // MAYBE WE SHOULD FIX IT??????????????????????????????????
1100  LOGDRESSED("PFEGammaAlgo")
1101  << "Encountered the known GSF-SC splitting bug "
1102  << " in PFBlockAlgo! We should really fix this!" << std::endl;
1103  } else { // SC was not in a earlier proto-object
1104  std::stringstream gsf_err;
1105  elementAsGSF->Dump(gsf_err,"\t");
1106  throw cms::Exception("PFEGammaAlgo::initializeProtoCands()")
1107  << "Expected SuperCluster from ECAL driven GSF seed "
1108  << "was not found in the block!" << std::endl
1109  << gsf_err.str() << std::endl;
1110  } // supercluster in block
1111  } // is ECAL driven seed?
1112  /*
1113  auto ins_pos = std::lower_bound(_refinableObjects.begin(),
1114  _refinableObjects.end(),
1115  fromGSF,
1116  [&](const ProtoEGObject& a,
1117  const ProtoEGObject& b){
1118  const double a_en = ( a.parentSC ?
1119  a.parentSC->superClusterRef()->energy() :
1120  a.primaryGSFs[0].first->GsftrackRef()->pt() );
1121  const double b_en = ( b.parentSC ?
1122  b.parentSC->superClusterRef()->energy() :
1123  b.primaryGSFs[0].first->GsftrackRef()->pt() );
1124  return a_en < b_en;
1125  });
1126  */
1127  _refinableObjects.insert(_refinableObjects.end(),fromGSF);
1128  } // end loop on GSF elements of block
1129 }
bool isAvailable() const
Definition: Ref.h:614
reco::PFBlockElementSuperCluster PFSCElement
Definition: PFEGammaAlgo.h:54
reco::PFBlockElementGsfTrack PFGSFElement
Definition: PFEGammaAlgo.h:56
edm::Ref< TrackExtraCollection > TrackExtraRef
persistent reference to a TrackExtra
Definition: TrackExtraFwd.h:17
std::vector< std::vector< PFFlaggedElement > > _splayedblock
Definition: PFEGammaAlgo.h:187
reco::PFBlockRef _currentblock
Definition: PFEGammaAlgo.h:183
#define LOGVERB(x)
Definition: PFEGammaAlgo.cc:43
#define LOGDRESSED(x)
Definition: PFEGammaAlgo.cc:46
bool unwrapSuperCluster(const reco::PFBlockElementSuperCluster *, std::vector< PFClusterFlaggedElement > &, ClusterMap &)
def move
Definition: eostools.py:508
double f[11][100]
std::list< ProtoEGObject > _refinableObjects
Definition: PFEGammaAlgo.h:201
reco::PFBlockElementBrem PFBremElement
Definition: PFEGammaAlgo.h:55
Container::value_type value_type
reco::PFBlock::LinkData _currentlinks
Definition: PFEGammaAlgo.h:184
#define docast(x, y)
Definition: PFEGammaAlgo.cc:42
bool PFEGammaAlgo::isAMuon ( const reco::PFBlockElement pfbe)
private

Definition at line 822 of file PFEGammaAlgo.cc.

References _currentblock, _currentlinks, asciidump::elements, reco::PFBlockElement::GSF, reco::PFBlockElement::index(), PFMuonAlgo::isMuon(), reco::PFBlock::LINKTEST_ALL, reco::PFBlockElement::TRACK, and reco::PFBlockElement::type().

Referenced by buildAndRefineEGObjects().

822  {
823  switch( pfbe.type() ) {
825  {
826  auto& elements = _currentblock->elements();
827  std::multimap<double,unsigned> tks;
828  _currentblock->associatedElements(pfbe.index(),
830  tks,
833  for( const auto& tk : tks ) {
834  if( PFMuonAlgo::isMuon(elements[tk.second]) ) {
835  return true;
836  }
837  }
838  }
839  break;
840  case reco::PFBlockElement::TRACK:
841  return PFMuonAlgo::isMuon(pfbe);
842  break;
843  default:
844  break;
845  }
846  return false;
847 }
static bool isMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:153
Type type() const
list elements
Definition: asciidump.py:414
reco::PFBlockRef _currentblock
Definition: PFEGammaAlgo.h:183
unsigned index() const
reco::PFBlock::LinkData _currentlinks
Definition: PFEGammaAlgo.h:184
bool PFEGammaAlgo::isEGValidCandidate ( const reco::PFBlockRef blockRef,
std::vector< bool > &  active 
)
inline

Definition at line 150 of file PFEGammaAlgo.h.

References egCandidate_, and RunPFEG().

151  {
152  RunPFEG(blockRef,active);
153  return (egCandidate_.size()>0);
154  };
void RunPFEG(const reco::PFBlockRef &blockRef, std::vector< bool > &active)
reco::PFCandidateCollection egCandidate_
Definition: PFEGammaAlgo.h:380
bool PFEGammaAlgo::isPrimaryTrack ( const reco::PFBlockElementTrack KfEl,
const reco::PFBlockElementGsfTrack GsfEl 
)
private

Definition at line 2545 of file PFEGammaAlgo.cc.

References reco::PFBlockElementGsfTrack::GsftrackRefPF(), edm::Ref< C, T, F >::isNonnull(), and reco::PFBlockElementTrack::trackRefPF().

Referenced by linkRefinableObjectGSFTracksToKFs().

2546  {
2547  bool isPrimary = false;
2548 
2549  GsfPFRecTrackRef gsfPfRef = GsfEl.GsftrackRefPF();
2550 
2551  if(gsfPfRef.isNonnull()) {
2552  PFRecTrackRef kfPfRef = KfEl.trackRefPF();
2553  PFRecTrackRef kfPfRef_fromGsf = (*gsfPfRef).kfPFRecTrackRef();
2554  if(kfPfRef.isNonnull() && kfPfRef_fromGsf.isNonnull()) {
2555  reco::TrackRef kfref= (*kfPfRef).trackRef();
2556  reco::TrackRef kfref_fromGsf = (*kfPfRef_fromGsf).trackRef();
2557  if(kfref.isNonnull() && kfref_fromGsf.isNonnull()) {
2558  if(kfref == kfref_fromGsf)
2559  isPrimary = true;
2560  }
2561  }
2562  }
2563 
2564  return isPrimary;
2565 }
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
const GsfPFRecTrackRef & GsftrackRefPF() const
const PFRecTrackRef & trackRefPF() const
void PFEGammaAlgo::linkKFTrackToECAL ( const PFKFFlaggedElement ,
ProtoEGObject  
)
private

Definition at line 1683 of file PFEGammaAlgo.cc.

References _currentblock, _currentlinks, _splayedblock, attachPSClusters(), docast, reco::PFBlockElement::ECAL, PFEGammaAlgo::ProtoEGObject::ecal2ps, PFEGammaAlgo::ProtoEGObject::ecalclusters, PFEGammaAlgo::ProtoEGObject::localMap, and LOGDRESSED.

Referenced by linkRefinableObjectKFTracksToECAL().

1684  {
1685  std::vector<PFClusterFlaggedElement>& currentECAL = RO.ecalclusters;
1686  auto ECALbegin = _splayedblock[reco::PFBlockElement::ECAL].begin();
1687  auto ECALend = _splayedblock[reco::PFBlockElement::ECAL].end();
1688  NotCloserToOther<reco::PFBlockElement::TRACK,reco::PFBlockElement::ECAL>
1689  kfTrackToECALs(_currentblock,_currentlinks,kfflagged.first);
1690  NotCloserToOther<reco::PFBlockElement::GSF,reco::PFBlockElement::ECAL>
1691  kfTrackGSFToECALs(_currentblock,_currentlinks,kfflagged.first);
1692  //get the ECAL elements not used and not closer to another KF
1693  auto notmatched_sc = std::partition(currentECAL.begin(),
1694  currentECAL.end(),
1695  kfTrackToECALs);
1696  //get subset ECAL elements not used or closer to another GSF of any type
1697  notmatched_sc = std::partition(currentECAL.begin(),
1698  notmatched_sc,
1699  kfTrackGSFToECALs);
1700  for( auto ecalitr = currentECAL.begin(); ecalitr != notmatched_sc;
1701  ++ecalitr ) {
1702  const PFClusterElement* elemascluster =
1703  docast(const PFClusterElement*,ecalitr->first);
1704  PFClusterFlaggedElement flaggedclus(elemascluster,true);
1705 
1706  LOGDRESSED("PFEGammaAlgo::linkKFTracktoECAL()")
1707  << "Found a cluster already in RO by KF extrapolation"
1708  << " at ECAL surface!" << std::endl
1709  << *elemascluster << std::endl;
1710  RO.localMap.push_back(ElementMap::value_type(elemascluster,
1711  kfflagged.first));
1712  RO.localMap.push_back(ElementMap::value_type(kfflagged.first,
1713  elemascluster));
1714  }
1715  //get the ECAL elements not used and not closer to another KF
1716  auto notmatched_blk = std::partition(ECALbegin,ECALend,kfTrackToECALs);
1717  //get subset ECAL elements not used or closer to another GSF of any type
1718  notmatched_blk = std::partition(ECALbegin,notmatched_blk,kfTrackGSFToECALs);
1719  for( auto ecalitr = ECALbegin; ecalitr != notmatched_blk; ++ecalitr ) {
1720  const PFClusterElement* elemascluster =
1721  docast(const PFClusterElement*,ecalitr->first);
1722  if( addPFClusterToROSafe(elemascluster,RO) ) {
1723  attachPSClusters(elemascluster,RO.ecal2ps[elemascluster]);
1724  ecalitr->second = false;
1725 
1726  LOGDRESSED("PFEGammaAlgo::linkKFTracktoECAL()")
1727  << "Found a cluster not in RO by KF extrapolation"
1728  << " at ECAL surface!" << std::endl
1729  << *elemascluster << std::endl;
1730  RO.localMap.push_back(ElementMap::value_type(elemascluster,
1731  kfflagged.first));
1732  RO.localMap.push_back( ElementMap::value_type(kfflagged.first,
1733  elemascluster));
1734  }
1735  }
1736 }
std::pair< const PFClusterElement *, bool > PFClusterFlaggedElement
Definition: PFEGammaAlgo.h:64
std::vector< std::vector< PFFlaggedElement > > _splayedblock
Definition: PFEGammaAlgo.h:187
reco::PFBlockRef _currentblock
Definition: PFEGammaAlgo.h:183
#define LOGDRESSED(x)
Definition: PFEGammaAlgo.cc:46
reco::PFBlockElementCluster PFClusterElement
Definition: PFEGammaAlgo.h:58
Container::value_type value_type
reco::PFBlock::LinkData _currentlinks
Definition: PFEGammaAlgo.h:184
#define docast(x, y)
Definition: PFEGammaAlgo.cc:42
int attachPSClusters(const PFClusterElement *, ClusterMap::mapped_type &)
void PFEGammaAlgo::linkRefinableObjectBremTangentsToECAL ( ProtoEGObject RO)
private

Definition at line 1739 of file PFEGammaAlgo.cc.

References _currentblock, _currentlinks, _splayedblock, funct::abs(), attachPSClusters(), PFEGammaAlgo::ProtoEGObject::brems, docast, reco::PFBlockElement::ECAL, patCandidatesForDimuonsSequences_cff::ecal, PFEGammaAlgo::ProtoEGObject::ecal2ps, PFEGammaAlgo::ProtoEGObject::ecalclusters, PFEGammaAlgo::ProtoEGObject::firstBrem, PFEGammaAlgo::ProtoEGObject::localMap, LOGDRESSED, and PFEGammaAlgo::ProtoEGObject::nBremsWithClusters.

Referenced by buildAndRefineEGObjects().

1739  {
1740  if( !RO.brems.size() ) return;
1741  int FirstBrem = -1;
1742  int TrajPos = -1;
1743  int lastBremTrajPos = -1;
1744  for( auto& bremflagged : RO.brems ) {
1745  bool has_clusters = false;
1746  TrajPos = (bremflagged.first->indTrajPoint())-2;
1747  auto ECALbegin = _splayedblock[reco::PFBlockElement::ECAL].begin();
1748  auto ECALend = _splayedblock[reco::PFBlockElement::ECAL].end();
1749  NotCloserToOther<reco::PFBlockElement::BREM,reco::PFBlockElement::ECAL>
1750  BremToECALs(_currentblock,_currentlinks,bremflagged.first);
1751  // check for late brem using clusters already in the SC
1752  auto RSCBegin = RO.ecalclusters.begin();
1753  auto RSCEnd = RO.ecalclusters.end();
1754  auto notmatched_rsc = std::partition(RSCBegin,RSCEnd,BremToECALs);
1755  for( auto ecal = RSCBegin; ecal != notmatched_rsc; ++ecal ) {
1756  float deta =
1757  std::abs( ecal->first->clusterRef()->positionREP().eta() -
1758  bremflagged.first->positionAtECALEntrance().eta() );
1759  if( deta < 0.015 ) {
1760  has_clusters = true;
1761  if( lastBremTrajPos == -1 || lastBremTrajPos < TrajPos ) {
1762  lastBremTrajPos = TrajPos;
1763  }
1764  if( FirstBrem == -1 || TrajPos < FirstBrem ) { // set brem information
1765  FirstBrem = TrajPos;
1766  RO.firstBrem = TrajPos;
1767  }
1768  LOGDRESSED("PFEGammaAlgo::linkBremToECAL()")
1769  << "Found a cluster already in SC linked to brem extrapolation"
1770  << " at ECAL surface!" << std::endl;
1771  RO.localMap.push_back( ElementMap::value_type(ecal->first,bremflagged.first) );
1772  RO.localMap.push_back( ElementMap::value_type(bremflagged.first,ecal->first) );
1773  }
1774  }
1775  // grab new clusters from the block (ensured to not be late brem)
1776  auto notmatched_block = std::partition(ECALbegin,ECALend,BremToECALs);
1777  for( auto ecal = ECALbegin; ecal != notmatched_block; ++ecal ) {
1778  float deta =
1779  std::abs( ecal->first->clusterRef()->positionREP().eta() -
1780  bremflagged.first->positionAtECALEntrance().eta() );
1781  if( deta < 0.015 ) {
1782  has_clusters = true;
1783  if( lastBremTrajPos == -1 || lastBremTrajPos < TrajPos ) {
1784  lastBremTrajPos = TrajPos;
1785  }
1786  if( FirstBrem == -1 || TrajPos < FirstBrem ) { // set brem information
1787 
1788  FirstBrem = TrajPos;
1789  RO.firstBrem = TrajPos;
1790  }
1791  const PFClusterElement* elemasclus =
1792  docast(const PFClusterElement*,ecal->first);
1793  if( addPFClusterToROSafe(elemasclus,RO) ) {
1794  attachPSClusters(elemasclus,RO.ecal2ps[elemasclus]);
1795 
1796  RO.localMap.push_back( ElementMap::value_type(ecal->first,bremflagged.first) );
1797  RO.localMap.push_back( ElementMap::value_type(bremflagged.first,ecal->first) );
1798  ecal->second = false;
1799  LOGDRESSED("PFEGammaAlgo::linkBremToECAL()")
1800  << "Found a cluster not already associated by brem extrapolation"
1801  << " at ECAL surface!" << std::endl;
1802  }
1803 
1804  }
1805  }
1806  if(has_clusters) {
1807  if( RO.nBremsWithClusters == -1 ) RO.nBremsWithClusters = 0;
1808  ++RO.nBremsWithClusters;
1809  }
1810  }
1811 }
std::vector< std::vector< PFFlaggedElement > > _splayedblock
Definition: PFEGammaAlgo.h:187
reco::PFBlockRef _currentblock
Definition: PFEGammaAlgo.h:183
#define LOGDRESSED(x)
Definition: PFEGammaAlgo.cc:46
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
reco::PFBlockElementCluster PFClusterElement
Definition: PFEGammaAlgo.h:58
Container::value_type value_type
reco::PFBlock::LinkData _currentlinks
Definition: PFEGammaAlgo.h:184
#define docast(x, y)
Definition: PFEGammaAlgo.cc:42
int attachPSClusters(const PFClusterElement *, ClusterMap::mapped_type &)
void PFEGammaAlgo::linkRefinableObjectConvSecondaryKFsToSecondaryKFs ( ProtoEGObject RO)
private

Definition at line 1814 of file PFEGammaAlgo.cc.

References _currentblock, _currentlinks, _splayedblock, HLT_25ns14e33_v1_cff::distance, docast, plotBeamSpotDB::first, customizeTrackingMonitorSeedNumber::idx, PFEGammaAlgo::ProtoEGObject::localMap, PFEGammaAlgo::ProtoEGObject::secondaryKFs, and reco::PFBlockElement::TRACK.

Referenced by buildAndRefineEGObjects().

1814  {
1815  IsConversionTrack<reco::PFBlockElementTrack> isConvKf;
1816  auto KFbegin = _splayedblock[reco::PFBlockElement::TRACK].begin();
1817  auto KFend = _splayedblock[reco::PFBlockElement::TRACK].end();
1818  auto BeginROskfs = RO.secondaryKFs.begin();
1819  auto EndROskfs = RO.secondaryKFs.end();
1820  auto ronotconv = std::partition(BeginROskfs,EndROskfs,isConvKf);
1821  size_t convkfs_end = std::distance(BeginROskfs,ronotconv);
1822  for( size_t idx = 0; idx < convkfs_end; ++idx ) {
1823  const std::vector<PFKFFlaggedElement>& secKFs = RO.secondaryKFs; //we want the entry at the index but we allocate to secondaryKFs in loop which invalidates all iterators, references and pointers, hence we need to get the entry fresh each time
1824  NotCloserToOther<reco::PFBlockElement::TRACK,
1826  true>
1827  TracksToTracks(_currentblock,_currentlinks, secKFs[idx].first);
1828  auto notmatched = std::partition(KFbegin,KFend,TracksToTracks);
1829  notmatched = std::partition(KFbegin,notmatched,isConvKf);
1830  for( auto kf = KFbegin; kf != notmatched; ++kf ) {
1831  const reco::PFBlockElementTrack* elemaskf =
1832  docast(const reco::PFBlockElementTrack*,kf->first);
1833  RO.secondaryKFs.push_back( std::make_pair(elemaskf,true) );
1834  RO.localMap.push_back( ElementMap::value_type(secKFs[idx].first,kf->first) );
1835  RO.localMap.push_back( ElementMap::value_type(kf->first,secKFs[idx].first) );
1836  kf->second = false;
1837  }
1838  }
1839 }
std::vector< std::vector< PFFlaggedElement > > _splayedblock
Definition: PFEGammaAlgo.h:187
reco::PFBlockRef _currentblock
Definition: PFEGammaAlgo.h:183
Container::value_type value_type
reco::PFBlock::LinkData _currentlinks
Definition: PFEGammaAlgo.h:184
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
#define docast(x, y)
Definition: PFEGammaAlgo.cc:42
void PFEGammaAlgo::linkRefinableObjectECALToSingleLegConv ( ProtoEGObject RO)
private

Definition at line 1842 of file PFEGammaAlgo.cc.

References _currentblock, _currentlinks, _splayedblock, cfg_, docast, reco::PFBlockElement::ECAL, patCandidatesForDimuonsSequences_cff::ecal, PFEGammaAlgo::ProtoEGObject::ecalclusters, EvaluateSingleLegMVA(), PFEGammaAlgo::ProtoEGObject::localMap, PFEGammaAlgo::PFEGConfigInfo::mvaConvCut, PFEGammaAlgo::PFEGConfigInfo::primaryVtx, PFEGammaAlgo::ProtoEGObject::secondaryKFs, PFEGammaAlgo::ProtoEGObject::singleLegConversionMvaMap, and reco::PFBlockElement::TRACK.

Referenced by buildAndRefineEGObjects().

1842  {
1843  IsConversionTrack<reco::PFBlockElementTrack> isConvKf;
1844  auto KFbegin = _splayedblock[reco::PFBlockElement::TRACK].begin();
1845  auto KFend = _splayedblock[reco::PFBlockElement::TRACK].end();
1846  for( auto& ecal : RO.ecalclusters ) {
1847  NotCloserToOther<reco::PFBlockElement::ECAL,
1849  true>
1850  ECALToTracks(_currentblock,_currentlinks,ecal.first);
1851  auto notmatchedkf = std::partition(KFbegin,KFend,ECALToTracks);
1852  auto notconvkf = std::partition(KFbegin,notmatchedkf,isConvKf);
1853  // add identified KF conversion tracks
1854  for( auto kf = KFbegin; kf != notconvkf; ++kf ) {
1855  const reco::PFBlockElementTrack* elemaskf =
1856  docast(const reco::PFBlockElementTrack*,kf->first);
1857  RO.secondaryKFs.push_back( std::make_pair(elemaskf,true) );
1858  RO.localMap.push_back( ElementMap::value_type(ecal.first,elemaskf) );
1859  RO.localMap.push_back( ElementMap::value_type(elemaskf,ecal.first) );
1860  kf->second = false;
1861  }
1862  // go through non-conv-identified kfs and check MVA to add conversions
1863  for( auto kf = notconvkf; kf != notmatchedkf; ++kf ) {
1865  kf->first->index());
1866  if(mvaval > cfg_.mvaConvCut) {
1867  const reco::PFBlockElementTrack* elemaskf =
1868  docast(const reco::PFBlockElementTrack*,kf->first);
1869  RO.secondaryKFs.push_back( std::make_pair(elemaskf,true) );
1870  RO.localMap.push_back( ElementMap::value_type(ecal.first,elemaskf) );
1871  RO.localMap.push_back( ElementMap::value_type(elemaskf,ecal.first) );
1872  kf->second = false;
1873 
1874  RO.singleLegConversionMvaMap.insert(std::make_pair(elemaskf, mvaval));
1875  }
1876  }
1877  }
1878 }
unsigned int index
index type
Definition: Vertex.h:49
std::vector< std::vector< PFFlaggedElement > > _splayedblock
Definition: PFEGammaAlgo.h:187
const reco::Vertex * primaryVtx
Definition: PFEGammaAlgo.h:124
reco::PFBlockRef _currentblock
Definition: PFEGammaAlgo.h:183
PFEGConfigInfo cfg_
Definition: PFEGammaAlgo.h:292
float EvaluateSingleLegMVA(const reco::PFBlockRef &blockref, const reco::Vertex &primaryvtx, unsigned int track_index)
Container::value_type value_type
reco::PFBlock::LinkData _currentlinks
Definition: PFEGammaAlgo.h:184
#define docast(x, y)
Definition: PFEGammaAlgo.cc:42
void PFEGammaAlgo::linkRefinableObjectGSFTracksToKFs ( ProtoEGObject RO)
private

Definition at line 1523 of file PFEGammaAlgo.cc.

References _currentblock, _currentlinks, _splayedblock, constexpr, docast, PFEGammaAlgo::ProtoEGObject::electronSeed, edm::Ref< C, T, F >::isNull(), isPrimaryTrack(), PFEGammaAlgo::ProtoEGObject::localMap, PFEGammaAlgo::ProtoEGObject::primaryGSFs, PFEGammaAlgo::ProtoEGObject::primaryKFs, PFEGammaAlgo::ProtoEGObject::secondaryKFs, findQualityFiles::size, reco::PFBlockElement::T_FROM_GAMMACONV, reco::PFBlockElement::TRACK, reco::PFBlockElementTrack::trackType(), and reco::PFBlockElementGsfTrack::trackType().

Referenced by buildAndRefineEGObjects().

1523  {
1527  auto KFbegin = _splayedblock[reco::PFBlockElement::TRACK].begin();
1528  auto KFend = _splayedblock[reco::PFBlockElement::TRACK].end();
1529  for( auto& gsfflagged : RO.primaryGSFs ) {
1530  const PFGSFElement* seedtk = gsfflagged.first;
1531  // don't process SC-only ROs or secondary seeded ROs
1532  if( RO.electronSeed.isNull() || seedtk->trackType(convType) ) continue;
1533  NotCloserToOther<reco::PFBlockElement::GSF,reco::PFBlockElement::TRACK>
1534  gsfTrackToKFs(_currentblock,_currentlinks,seedtk);
1535  // get KF tracks not closer to another and not already used
1536  auto notlinked = std::partition(KFbegin,KFend,gsfTrackToKFs);
1537  // attach tracks and set as used
1538  for( auto kft = KFbegin; kft != notlinked; ++kft ) {
1539  const PFKFElement* elemaskf =
1540  docast(const PFKFElement*,kft->first);
1541  // don't care about things that aren't primaries or directly
1542  // associated secondary tracks
1543  if( isPrimaryTrack(*elemaskf,*seedtk) &&
1544  !elemaskf->trackType(convType) ) {
1545  kft->second = false;
1546  RO.primaryKFs.push_back(std::make_pair(elemaskf,true));
1547  RO.localMap.push_back( ElementMap::value_type(seedtk,elemaskf) );
1548  RO.localMap.push_back( ElementMap::value_type(elemaskf,seedtk) );
1549  } else if ( elemaskf->trackType(convType) ) {
1550  kft->second = false;
1551  RO.secondaryKFs.push_back(std::make_pair(elemaskf,true));
1552  RO.localMap.push_back( ElementMap::value_type(seedtk,elemaskf) );
1553  RO.localMap.push_back( ElementMap::value_type(elemaskf,seedtk) );
1554  }
1555  }// loop on closest KFs not closer to other GSFs
1556  } // loop on GSF primaries on RO
1557 }
reco::PFBlockElementGsfTrack PFGSFElement
Definition: PFEGammaAlgo.h:56
bool isPrimaryTrack(const reco::PFBlockElementTrack &KfEl, const reco::PFBlockElementGsfTrack &GsfEl)
std::vector< std::vector< PFFlaggedElement > > _splayedblock
Definition: PFEGammaAlgo.h:187
reco::PFBlockRef _currentblock
Definition: PFEGammaAlgo.h:183
#define constexpr
Container::value_type value_type
reco::PFBlock::LinkData _currentlinks
Definition: PFEGammaAlgo.h:184
reco::PFBlockElementTrack PFKFElement
Definition: PFEGammaAlgo.h:57
#define docast(x, y)
Definition: PFEGammaAlgo.cc:42
tuple size
Write out results.
void PFEGammaAlgo::linkRefinableObjectKFTracksToECAL ( ProtoEGObject RO)
private

Definition at line 1676 of file PFEGammaAlgo.cc.

References _splayedblock, reco::PFBlockElement::ECAL, linkKFTrackToECAL(), PFEGammaAlgo::ProtoEGObject::primaryKFs, PFEGammaAlgo::ProtoEGObject::secondaryKFs, and findQualityFiles::size.

Referenced by buildAndRefineEGObjects().

1676  {
1677  if( !_splayedblock[reco::PFBlockElement::ECAL].size() ) return;
1678  for( auto& primkf : RO.primaryKFs ) linkKFTrackToECAL(primkf,RO);
1679  for( auto& secdkf : RO.secondaryKFs ) linkKFTrackToECAL(secdkf,RO);
1680 }
std::vector< std::vector< PFFlaggedElement > > _splayedblock
Definition: PFEGammaAlgo.h:187
void linkKFTrackToECAL(const PFKFFlaggedElement &, ProtoEGObject &)
tuple size
Write out results.
void PFEGammaAlgo::linkRefinableObjectPrimaryGSFTrackToECAL ( ProtoEGObject RO)
private

Definition at line 1596 of file PFEGammaAlgo.cc.

References _currentblock, _currentlinks, _splayedblock, attachPSClusters(), docast, reco::PFBlockElement::ECAL, patCandidatesForDimuonsSequences_cff::ecal, PFEGammaAlgo::ProtoEGObject::ecal2ps, PFEGammaAlgo::ProtoEGObject::ecalclusters, PFEGammaAlgo::ProtoEGObject::electronClusters, PFEGammaAlgo::ProtoEGObject::localMap, LOGDRESSED, NULL, PFEGammaAlgo::ProtoEGObject::primaryGSFs, findQualityFiles::size, and groupFilesInBlocks::temp.

Referenced by buildAndRefineEGObjects().

1596  {
1598  RO.electronClusters.push_back(NULL);
1599  return;
1600  }
1601  auto ECALbegin = _splayedblock[reco::PFBlockElement::ECAL].begin();
1602  auto ECALend = _splayedblock[reco::PFBlockElement::ECAL].end();
1603  for( auto& primgsf : RO.primaryGSFs ) {
1604  NotCloserToOther<reco::PFBlockElement::GSF,reco::PFBlockElement::ECAL>
1605  gsfTracksToECALs(_currentblock,_currentlinks,primgsf.first);
1606  CompatibleEoPOut eoverp_test(primgsf.first);
1607  // get set of matching ecals not already in SC
1608  auto notmatched_blk = std::partition(ECALbegin,ECALend,gsfTracksToECALs);
1609  notmatched_blk = std::partition(ECALbegin,notmatched_blk,eoverp_test);
1610  // get set of matching ecals already in the RO
1611  auto notmatched_sc = std::partition(RO.ecalclusters.begin(),
1612  RO.ecalclusters.end(),
1613  gsfTracksToECALs);
1614  notmatched_sc = std::partition(RO.ecalclusters.begin(),
1615  notmatched_sc,
1616  eoverp_test);
1617  // look inside the SC for the ECAL cluster
1618  for( auto ecal = RO.ecalclusters.begin(); ecal != notmatched_sc; ++ecal ) {
1619  const PFClusterElement* elemascluster =
1620  docast(const PFClusterElement*,ecal->first);
1621  PFClusterFlaggedElement temp(elemascluster,true);
1622  LOGDRESSED("PFEGammaAlgo::linkGSFTracktoECAL()")
1623  << "Found a cluster already in RO by GSF extrapolation"
1624  << " at ECAL surface!" << std::endl
1625  << *elemascluster << std::endl;
1626 
1627  RO.localMap.push_back(ElementMap::value_type(primgsf.first,temp.first));
1628  RO.localMap.push_back(ElementMap::value_type(temp.first,primgsf.first));
1629  }
1630  // look outside the SC for the ecal cluster
1631  for( auto ecal = ECALbegin; ecal != notmatched_blk; ++ecal ) {
1632  const PFClusterElement* elemascluster =
1633  docast(const PFClusterElement*,ecal->first);
1634  LOGDRESSED("PFEGammaAlgo::linkGSFTracktoECAL()")
1635  << "Found a cluster not already in RO by GSF extrapolation"
1636  << " at ECAL surface!" << std::endl
1637  << *elemascluster << std::endl;
1638  if( addPFClusterToROSafe(elemascluster,RO) ) {
1639  attachPSClusters(elemascluster,RO.ecal2ps[elemascluster]);
1640  RO.localMap.push_back(ElementMap::value_type(primgsf.first,elemascluster));
1641  RO.localMap.push_back(ElementMap::value_type(elemascluster,primgsf.first));
1642  ecal->second = false;
1643  }
1644  }
1645  }
1646 }
std::pair< const PFClusterElement *, bool > PFClusterFlaggedElement
Definition: PFEGammaAlgo.h:64
#define NULL
Definition: scimark2.h:8
std::vector< std::vector< PFFlaggedElement > > _splayedblock
Definition: PFEGammaAlgo.h:187
reco::PFBlockRef _currentblock
Definition: PFEGammaAlgo.h:183
#define LOGDRESSED(x)
Definition: PFEGammaAlgo.cc:46
reco::PFBlockElementCluster PFClusterElement
Definition: PFEGammaAlgo.h:58
Container::value_type value_type
reco::PFBlock::LinkData _currentlinks
Definition: PFEGammaAlgo.h:184
#define docast(x, y)
Definition: PFEGammaAlgo.cc:42
int attachPSClusters(const PFClusterElement *, ClusterMap::mapped_type &)
tuple size
Write out results.
void PFEGammaAlgo::linkRefinableObjectPrimaryGSFTrackToHCAL ( ProtoEGObject RO)
private

Definition at line 1650 of file PFEGammaAlgo.cc.

References _currentblock, _currentlinks, _splayedblock, docast, reco::PFBlockElement::HCAL, patCandidatesForDimuonsSequences_cff::hcal, PFEGammaAlgo::ProtoEGObject::hcalClusters, PFEGammaAlgo::ProtoEGObject::localMap, LOGDRESSED, PFEGammaAlgo::ProtoEGObject::primaryGSFs, findQualityFiles::size, and groupFilesInBlocks::temp.

Referenced by buildAndRefineEGObjects().

1650  {
1651  if( !_splayedblock[reco::PFBlockElement::HCAL].size() ) return;
1652  auto HCALbegin = _splayedblock[reco::PFBlockElement::HCAL].begin();
1653  auto HCALend = _splayedblock[reco::PFBlockElement::HCAL].end();
1654  for( auto& primgsf : RO.primaryGSFs ) {
1655  NotCloserToOther<reco::PFBlockElement::GSF,reco::PFBlockElement::HCAL>
1656  gsfTracksToHCALs(_currentblock,_currentlinks,primgsf.first);
1657  CompatibleEoPOut eoverp_test(primgsf.first);
1658  auto notmatched = std::partition(HCALbegin,HCALend,gsfTracksToHCALs);
1659  for( auto hcal = HCALbegin; hcal != notmatched; ++hcal ) {
1660  const PFClusterElement* elemascluster =
1661  docast(const PFClusterElement*,hcal->first);
1662  PFClusterFlaggedElement temp(elemascluster,true);
1663  LOGDRESSED("PFEGammaAlgo::linkGSFTracktoECAL()")
1664  << "Found an HCAL cluster associated to GSF extrapolation"
1665  << std::endl;
1666  RO.hcalClusters.push_back(temp);
1667  RO.localMap.push_back( ElementMap::value_type(primgsf.first,temp.first) );
1668  RO.localMap.push_back( ElementMap::value_type(temp.first,primgsf.first) );
1669  hcal->second = false;
1670  }
1671  }
1672 }
std::pair< const PFClusterElement *, bool > PFClusterFlaggedElement
Definition: PFEGammaAlgo.h:64
std::vector< std::vector< PFFlaggedElement > > _splayedblock
Definition: PFEGammaAlgo.h:187
reco::PFBlockRef _currentblock
Definition: PFEGammaAlgo.h:183
#define LOGDRESSED(x)
Definition: PFEGammaAlgo.cc:46
reco::PFBlockElementCluster PFClusterElement
Definition: PFEGammaAlgo.h:58
Container::value_type value_type
reco::PFBlock::LinkData _currentlinks
Definition: PFEGammaAlgo.h:184
#define docast(x, y)
Definition: PFEGammaAlgo.cc:42
tuple size
Write out results.
void PFEGammaAlgo::linkRefinableObjectPrimaryKFsToSecondaryKFs ( ProtoEGObject RO)
private

Definition at line 1560 of file PFEGammaAlgo.cc.

References _currentblock, _currentlinks, _splayedblock, constexpr, docast, edm::hlt::Exception, PFEGammaAlgo::ProtoEGObject::localMap, PFEGammaAlgo::ProtoEGObject::primaryKFs, PFEGammaAlgo::ProtoEGObject::secondaryKFs, findQualityFiles::size, reco::PFBlockElement::T_FROM_GAMMACONV, reco::PFBlockElement::TRACK, and reco::PFBlockElementTrack::trackType().

Referenced by buildAndRefineEGObjects().

1560  {
1564  auto KFbegin = _splayedblock[reco::PFBlockElement::TRACK].begin();
1565  auto KFend = _splayedblock[reco::PFBlockElement::TRACK].end();
1566  for( auto& kfflagged : RO.primaryKFs ) {
1567  const PFKFElement* primkf = kfflagged.first;
1568  // don't process SC-only ROs or secondary seeded ROs
1569  if( primkf->trackType(convType) ) {
1570  throw cms::Exception("PFEGammaAlgo::linkRefinableObjectPrimaryKFsToSecondaryKFs()")
1571  << "A KF track from conversion has been assigned as a primary!!"
1572  << std::endl;
1573  }
1574  NotCloserToOther<reco::PFBlockElement::TRACK,reco::PFBlockElement::TRACK,true>
1575  kfTrackToKFs(_currentblock,_currentlinks,primkf);
1576  // get KF tracks not closer to another and not already used
1577  auto notlinked = std::partition(KFbegin,KFend,kfTrackToKFs);
1578  // attach tracks and set as used
1579  for( auto kft = KFbegin; kft != notlinked; ++kft ) {
1580  const PFKFElement* elemaskf =
1581  docast(const PFKFElement*,kft->first);
1582  // don't care about things that aren't primaries or directly
1583  // associated secondary tracks
1584  if( elemaskf->trackType(convType) ) {
1585  kft->second = false;
1586  RO.secondaryKFs.push_back(std::make_pair(elemaskf,true));
1587  RO.localMap.push_back( ElementMap::value_type(primkf,elemaskf) );
1588  RO.localMap.push_back( ElementMap::value_type(elemaskf,primkf) );
1589  }
1590  }// loop on closest KFs not closer to other KFs
1591  } // loop on KF primaries on RO
1592 }
std::vector< std::vector< PFFlaggedElement > > _splayedblock
Definition: PFEGammaAlgo.h:187
reco::PFBlockRef _currentblock
Definition: PFEGammaAlgo.h:183
#define constexpr
Container::value_type value_type
reco::PFBlock::LinkData _currentlinks
Definition: PFEGammaAlgo.h:184
reco::PFBlockElementTrack PFKFElement
Definition: PFEGammaAlgo.h:57
#define docast(x, y)
Definition: PFEGammaAlgo.cc:42
tuple size
Write out results.
void PFEGammaAlgo::linkRefinableObjectSecondaryKFsToECAL ( ProtoEGObject RO)
private

Definition at line 1881 of file PFEGammaAlgo.cc.

References _currentblock, _currentlinks, _splayedblock, attachPSClusters(), docast, reco::PFBlockElement::ECAL, patCandidatesForDimuonsSequences_cff::ecal, PFEGammaAlgo::ProtoEGObject::ecal2ps, PFEGammaAlgo::ProtoEGObject::localMap, PFEGammaAlgo::ProtoEGObject::secondaryKFs, and reco::PFBlockElement::TRACK.

Referenced by buildAndRefineEGObjects().

1881  {
1882  auto ECALbegin = _splayedblock[reco::PFBlockElement::ECAL].begin();
1883  auto ECALend = _splayedblock[reco::PFBlockElement::ECAL].end();
1884  for( auto& skf : RO.secondaryKFs ) {
1885  NotCloserToOther<reco::PFBlockElement::TRACK,
1887  false>
1888  TracksToECALwithCut(_currentblock,_currentlinks,skf.first,1.5f);
1889  auto notmatched = std::partition(ECALbegin,ECALend,TracksToECALwithCut);
1890  for( auto ecal = ECALbegin; ecal != notmatched; ++ecal ) {
1891  const reco::PFBlockElementCluster* elemascluster =
1892  docast(const reco::PFBlockElementCluster*,ecal->first);
1893  if( addPFClusterToROSafe(elemascluster,RO) ) {
1894  attachPSClusters(elemascluster,RO.ecal2ps[elemascluster]);
1895  RO.localMap.push_back(ElementMap::value_type(skf.first,elemascluster));
1896  RO.localMap.push_back(ElementMap::value_type(elemascluster,skf.first));
1897  ecal->second = false;
1898  }
1899  }
1900  }
1901 }
std::vector< std::vector< PFFlaggedElement > > _splayedblock
Definition: PFEGammaAlgo.h:187
reco::PFBlockRef _currentblock
Definition: PFEGammaAlgo.h:183
Container::value_type value_type
reco::PFBlock::LinkData _currentlinks
Definition: PFEGammaAlgo.h:184
#define docast(x, y)
Definition: PFEGammaAlgo.cc:42
int attachPSClusters(const PFClusterElement *, ClusterMap::mapped_type &)
void PFEGammaAlgo::mergeROsByAnyLink ( std::list< ProtoEGObject > &  )
private

Definition at line 1440 of file PFEGammaAlgo.cc.

References PFEGammaAlgo::ProtoEGObject::brems, HLT_25ns14e33_v1_cff::distance, PFEGammaAlgo::ProtoEGObject::ecal2ps, PFEGammaAlgo::ProtoEGObject::ecalclusters, PFEGammaAlgo::ProtoEGObject::electronClusters, PFEGammaAlgo::ProtoEGObject::electronSeed, PFEGammaAlgo::ProtoEGObject::firstBrem, edm::Ref< C, T, F >::isNonnull(), edm::Ref< C, T, F >::isNull(), PFEGammaAlgo::ProtoEGObject::lateBrem, PFEGammaAlgo::ProtoEGObject::localMap, LOGDRESSED, LOGWARN, PFEGammaAlgo::ProtoEGObject::nBremsWithClusters, PFEGammaAlgo::ProtoEGObject::parentSC, PFEGammaAlgo::ProtoEGObject::primaryGSFs, PFEGammaAlgo::ProtoEGObject::primaryKFs, PFEGammaAlgo::ProtoEGObject::secondaryKFs, and std::swap().

Referenced by buildAndRefineEGObjects().

1440  {
1441  if( ROs.size() < 2 ) return; // nothing to do with one or zero ROs
1442  bool check_for_merge = true;
1443  while( check_for_merge ) {
1444  // bugfix for early termination merging loop (15 April 2014)
1445  // check all pairwise combinations in the list
1446  // if one has a merge shuffle it to the front of the list
1447  // if there are no merges left to do we can terminate
1448  for( auto it1 = ROs.begin(); it1 != ROs.end(); ++it1 ) {
1449  TestIfROMergableByLink mergeTest(*it1);
1450  auto find_start = it1; ++find_start;
1451  auto has_merge = std::find_if(find_start,ROs.end(),mergeTest);
1452  if( has_merge != ROs.end() && it1 != ROs.begin() ) {
1453  std::swap(*(ROs.begin()),*it1);
1454  break;
1455  }
1456  }// ensure mergables are shuffled to the front
1457  ProtoEGObject& thefront = ROs.front();
1458  TestIfROMergableByLink mergeTest(thefront);
1459  auto mergestart = ROs.begin(); ++mergestart;
1460  auto nomerge = std::partition(mergestart,ROs.end(),mergeTest);
1461  if( nomerge != mergestart ) {
1462  LOGDRESSED("PFEGammaAlgo::mergeROsByAnyLink()")
1463  << "Found objects " << std::distance(mergestart,nomerge)
1464  << " to merge by links to the front!" << std::endl;
1465  for( auto roToMerge = mergestart; roToMerge != nomerge; ++roToMerge) {
1466  thefront.ecalclusters.insert(thefront.ecalclusters.end(),
1467  roToMerge->ecalclusters.begin(),
1468  roToMerge->ecalclusters.end());
1469  thefront.ecal2ps.insert(roToMerge->ecal2ps.begin(),
1470  roToMerge->ecal2ps.end());
1471  thefront.secondaryKFs.insert(thefront.secondaryKFs.end(),
1472  roToMerge->secondaryKFs.begin(),
1473  roToMerge->secondaryKFs.end());
1474 
1475  thefront.localMap.insert(thefront.localMap.end(),
1476  roToMerge->localMap.begin(),
1477  roToMerge->localMap.end());
1478  // TO FIX -> use best (E_gsf - E_clustersum)/E_GSF
1479  if( !thefront.parentSC && roToMerge->parentSC ) {
1480  thefront.parentSC = roToMerge->parentSC;
1481  }
1482  if( thefront.electronSeed.isNull() &&
1483  roToMerge->electronSeed.isNonnull() ) {
1484  thefront.electronSeed = roToMerge->electronSeed;
1485  thefront.primaryGSFs.insert(thefront.primaryGSFs.end(),
1486  roToMerge->primaryGSFs.begin(),
1487  roToMerge->primaryGSFs.end());
1488  thefront.primaryKFs.insert(thefront.primaryKFs.end(),
1489  roToMerge->primaryKFs.begin(),
1490  roToMerge->primaryKFs.end());
1491  thefront.brems.insert(thefront.brems.end(),
1492  roToMerge->brems.begin(),
1493  roToMerge->brems.end());
1494  thefront.electronClusters = roToMerge->electronClusters;
1495  thefront.nBremsWithClusters = roToMerge->nBremsWithClusters;
1496  thefront.firstBrem = roToMerge->firstBrem;
1497  thefront.lateBrem = roToMerge->lateBrem;
1498  } else if ( thefront.electronSeed.isNonnull() &&
1499  roToMerge->electronSeed.isNonnull()) {
1500  LOGWARN("PFEGammaAlgo::mergeROsByAnyLink")
1501  << "Need to implement proper merging of two gsf candidates!"
1502  << std::endl;
1503  }
1504  }
1505  ROs.erase(mergestart,nomerge);
1506  // put the merged element in the back of the cleaned list
1507  ROs.push_back(ROs.front());
1508  ROs.pop_front();
1509  } else {
1510  check_for_merge = false;
1511  }
1512  }
1513  LOGDRESSED("PFEGammaAlgo::mergeROsByAnyLink()")
1514  << "After merging by links there are: " << ROs.size()
1515  << " refinable EGamma objects!" << std::endl;
1516  }
#define LOGDRESSED(x)
Definition: PFEGammaAlgo.cc:46
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
#define LOGWARN(x)
Definition: PFEGammaAlgo.cc:44
void PFEGammaAlgo::removeOrLinkECALClustersToKFTracks ( )
private

Definition at line 1358 of file PFEGammaAlgo.cc.

References _currentblock, _currentlinks, _recoveredlinks, _splayedblock, cfg_, docast, reco::PFBlockElement::ECAL, f, reco::PFBlockElement::GSF, reco::PFBlockElement::index(), reco::PFBlock::LINKTEST_ALL, PFEGammaAlgo::PFEGConfigInfo::primaryVtx, reco::PFBlockElement::SC, findQualityFiles::size, reco::PFBlockElement::T_FROM_GAMMACONV, reco::PFBlockElement::TRACK, reco::PFBlockElementTrack::trackRef(), reco::Vertex::tracks_begin(), reco::Vertex::tracks_end(), and reco::PFBlockElementGsfTrack::trackType().

Referenced by buildAndRefineEGObjects().

1358  {
1361  std::multimap<double, unsigned> matchedGSFs, matchedECALs;
1362  for( auto& kftrack : _splayedblock[reco::PFBlockElement::TRACK] ) {
1363  matchedGSFs.clear();
1364  _currentblock->associatedElements(kftrack.first->index(), _currentlinks,
1365  matchedGSFs,
1368  if( !matchedGSFs.size() ) { // only run this is we aren't associated to GSF
1369  LesserByDistance closestTrackToECAL(_currentblock,_currentlinks,
1370  &kftrack);
1371  auto ecalbegin = _splayedblock[reco::PFBlockElement::ECAL].begin();
1372  auto ecalend = _splayedblock[reco::PFBlockElement::ECAL].end();
1373  std::partial_sort(ecalbegin,ecalbegin+1,ecalend,closestTrackToECAL);
1374  PFFlaggedElement& closestECAL =
1376  const float dist = _currentblock->dist(kftrack.first->index(),
1377  closestECAL.first->index(),
1378  _currentlinks,
1380  bool inSC = false;
1381  for( auto& sc : _splayedblock[reco::PFBlockElement::SC] ) {
1382  float dist_sc = _currentblock->dist(sc.first->index(),
1383  closestECAL.first->index(),
1384  _currentlinks,
1386  if( dist_sc != -1.0f) { inSC = true; break; }
1387  }
1388 
1389  if( dist != -1.0f && closestECAL.second ) {
1390  bool gsflinked = false;
1391  // check that this cluster is not associated to a GSF track
1392  for(const auto& gsfflag : _splayedblock[reco::PFBlockElement::GSF]) {
1393  const reco::PFBlockElementGsfTrack* elemasgsf =
1394  docast(const reco::PFBlockElementGsfTrack*,gsfflag.first);
1396  continue; // keep clusters that have a found conversion GSF near
1397  }
1398  matchedECALs.clear();
1399  _currentblock->associatedElements(elemasgsf->index(), _currentlinks,
1400  matchedECALs,
1403  if( matchedECALs.size() ) {
1404  if( matchedECALs.begin()->second == closestECAL.first->index() ) {
1405  gsflinked = true;
1406  break;
1407  }
1408  }
1409  } // loop over primary GSF tracks
1410  if( !gsflinked && !inSC) {
1411  // determine if we should remove the matched cluster
1412  const reco::PFBlockElementTrack * kfEle =
1413  docast(const reco::PFBlockElementTrack*,kftrack.first);
1414  const reco::TrackRef trackref = kfEle->trackRef();
1415  const unsigned Algo = trackref->algo();
1416  const int nexhits =
1417  trackref->hitPattern().numberOfLostHits(HitPattern::MISSING_INNER_HITS);
1418  bool fromprimaryvertex = false;
1419  for( auto vtxtks = cfg_.primaryVtx->tracks_begin();
1420  vtxtks != cfg_.primaryVtx->tracks_end(); ++ vtxtks ) {
1421  if( trackref == vtxtks->castTo<reco::TrackRef>() ) {
1422  fromprimaryvertex = true;
1423  break;
1424  }
1425  }// loop over tracks in primary vertex
1426  // if associated to good non-GSF matched track remove this cluster
1427  if( Algo < 9 && nexhits == 0 && fromprimaryvertex ) {
1428  closestECAL.second = false;
1429  } else { // otherwise associate the cluster and KF track
1430  _recoveredlinks.push_back( ElementMap::value_type(closestECAL.first,kftrack.first) );
1431  _recoveredlinks.push_back( ElementMap::value_type(kftrack.first,closestECAL.first) );
1432  }
1433  }
1434  } // found a good closest ECAL match
1435  } // no GSF track matched to KF
1436  } // loop over KF elements
1437  }
const reco::TrackRef & trackRef() const
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.cc:44
std::vector< std::vector< PFFlaggedElement > > _splayedblock
Definition: PFEGammaAlgo.h:187
const reco::Vertex * primaryVtx
Definition: PFEGammaAlgo.h:124
reco::PFBlockRef _currentblock
Definition: PFEGammaAlgo.h:183
std::pair< const reco::PFBlockElement *, bool > PFFlaggedElement
Definition: PFEGammaAlgo.h:59
PFEGConfigInfo cfg_
Definition: PFEGammaAlgo.h:292
unsigned index() const
double f[11][100]
virtual bool trackType(TrackType trType) const
Container::value_type value_type
reco::PFBlock::LinkData _currentlinks
Definition: PFEGammaAlgo.h:184
#define docast(x, y)
Definition: PFEGammaAlgo.cc:42
ElementMap _recoveredlinks
Definition: PFEGammaAlgo.h:188
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.cc:39
tuple size
Write out results.
Definition: fakeMenu.h:6
void PFEGammaAlgo::RunPFEG ( const reco::PFBlockRef blockRef,
std::vector< bool > &  active 
)

Definition at line 755 of file PFEGammaAlgo.cc.

References buildAndRefineEGObjects(), Chatty, convGsfTrack_, egCandidate_, egExtra_, fifthStepKfTrack_, and verbosityLevel_.

Referenced by isEGValidCandidate().

756  {
757 
758  fifthStepKfTrack_.clear();
759  convGsfTrack_.clear();
760 
761  egCandidate_.clear();
762  egExtra_.clear();
763 
764  // define how much is printed out for debugging.
765  // ... will be setable via CFG file parameter
766  verbosityLevel_ = Chatty; // Chatty mode.
767 
768  buildAndRefineEGObjects(blockRef);
769 }
reco::PFCandidateEGammaExtraCollection egExtra_
Definition: PFEGammaAlgo.h:384
std::vector< std::pair< unsigned int, unsigned int > > fifthStepKfTrack_
Definition: PFEGammaAlgo.h:289
void buildAndRefineEGObjects(const reco::PFBlockRef &block)
reco::PFCandidateCollection egCandidate_
Definition: PFEGammaAlgo.h:380
std::vector< std::pair< unsigned int, unsigned int > > convGsfTrack_
Definition: PFEGammaAlgo.h:290
verbosityLevel verbosityLevel_
Definition: PFEGammaAlgo.h:323
void PFEGammaAlgo::setEEtoPSAssociation ( const edm::Handle< EEtoPSAssociation > &  eetops)
inline

Definition at line 134 of file PFEGammaAlgo.h.

References eetops_.

134  {
135  eetops_ = eetops;
136  }
edm::Handle< reco::PFCluster::EEtoPSAssociation > eetops_
Definition: PFEGammaAlgo.h:182
void PFEGammaAlgo::setnPU ( int  nVtx)
inline

Definition at line 138 of file PFEGammaAlgo.h.

References nVtx_.

138  {
139  nVtx_=nVtx;
140  }
void PFEGammaAlgo::setPhotonPrimaryVtx ( const reco::Vertex primary)
inline

Definition at line 141 of file PFEGammaAlgo.h.

References cfg_, and PFEGammaAlgo::PFEGConfigInfo::primaryVtx.

141  {
142  cfg_.primaryVtx = & primary;
143  }
const reco::Vertex * primaryVtx
Definition: PFEGammaAlgo.h:124
PFEGConfigInfo cfg_
Definition: PFEGammaAlgo.h:292
void PFEGammaAlgo::unlinkRefinableObjectKFandECALMatchedToHCAL ( ProtoEGObject RO,
bool  removeFreeECAL = false,
bool  removeSCECAL = false 
)
private

Definition at line 2425 of file PFEGammaAlgo.cc.

References _currentblock, _currentlinks, _splayedblock, reco::PFBlockElementCluster::clusterRef(), HLT_25ns14e33_v1_cff::distance, patCandidatesForDimuonsSequences_cff::ecal, PFEGammaAlgo::ProtoEGObject::ecalclusters, f, spr::find(), reco::PFBlockElement::HCAL, reco::PFBlock::LINKTEST_ALL, PFEGammaAlgo::ProtoEGObject::localMap, LOGDRESSED, PFEGammaAlgo::ProtoEGObject::parentSC, PFEGammaAlgo::ProtoEGObject::secondaryKFs, and whichTrackAlgo().

Referenced by buildAndRefineEGObjects().

2427  {
2428  std::vector<bool> cluster_in_sc;
2429  auto ecal_begin = RO.ecalclusters.begin();
2430  auto ecal_end = RO.ecalclusters.end();
2431  auto hcal_begin = _splayedblock[reco::PFBlockElement::HCAL].begin();
2432  auto hcal_end = _splayedblock[reco::PFBlockElement::HCAL].end();
2433  for( auto secd_kf = RO.secondaryKFs.begin();
2434  secd_kf != RO.secondaryKFs.end(); ++secd_kf ) {
2435  bool remove_this_kf = false;
2436  NotCloserToOther<reco::PFBlockElement::TRACK,reco::PFBlockElement::HCAL>
2437  tracksToHCALs(_currentblock,_currentlinks,secd_kf->first);
2438  reco::TrackRef trkRef = secd_kf->first->trackRef();
2439  const unsigned int Algo = whichTrackAlgo(trkRef);
2440  const float secpin = trkRef->p();
2441 
2442  for( auto ecal = ecal_begin; ecal != ecal_end; ++ecal ) {
2443  const double ecalenergy = ecal->first->clusterRef()->correctedEnergy();
2444  // first check if the cluster is in the SC (use dist calc for fastness)
2445  const size_t clus_idx = std::distance(ecal_begin,ecal);
2446  if( cluster_in_sc.size() < clus_idx + 1) {
2447  float dist = -1.0f;
2448  if( RO.parentSC ) {
2449  dist = _currentblock->dist(secd_kf->first->index(),
2450  ecal->first->index(),
2451  _currentlinks,
2453  }
2454  cluster_in_sc.push_back(dist != -1.0f);
2455  }
2456 
2457  ElementMap::value_type check_match(ecal->first,secd_kf->first);
2458  auto kf_matched = std::find(RO.localMap.begin(),
2459  RO.localMap.end(),
2460  check_match);
2461  // if we've found a secondary KF that matches this ecal cluster
2462  // now we see if it is matched to HCAL
2463  // if it is matched to an HCAL cluster we take different
2464  // actions if the cluster was in an SC or not
2465  if( kf_matched != RO.localMap.end() ) {
2466  auto hcal_matched = std::partition(hcal_begin,hcal_end,tracksToHCALs);
2467  for( auto hcalclus = hcal_begin;
2468  hcalclus != hcal_matched;
2469  ++hcalclus ) {
2470  const reco::PFBlockElementCluster * clusthcal =
2471  dynamic_cast<const reco::PFBlockElementCluster*>(hcalclus->first);
2472  const double hcalenergy = clusthcal->clusterRef()->energy();
2473  const double hpluse = ecalenergy+hcalenergy;
2474  const bool isHoHE = ( (hcalenergy / hpluse ) > 0.1 && Algo < 3 );
2475  const bool isHoE = ( hcalenergy > ecalenergy );
2476  const bool isPoHE = ( secpin > hpluse );
2477  if( cluster_in_sc[clus_idx] ) {
2478  if(isHoE || isPoHE) {
2479  LOGDRESSED("PFEGammaAlgo")
2480  << "REJECTED TRACK FOR H/E or P/(H+E), CLUSTER IN SC"
2481  << " H/H+E " << (hcalenergy / hpluse)
2482  << " H/E " << (hcalenergy > ecalenergy)
2483  << " P/(H+E) " << (secpin/hpluse)
2484  << " HCAL ENE " << hcalenergy
2485  << " ECAL ENE " << ecalenergy
2486  << " secPIN " << secpin
2487  << " Algo Track " << Algo << std::endl;
2488  remove_this_kf = true;
2489  }
2490  } else {
2491  if(isHoHE){
2492  LOGDRESSED("PFEGammaAlgo")
2493  << "REJECTED TRACK FOR H/H+E, CLUSTER NOT IN SC"
2494  << " H/H+E " << (hcalenergy / hpluse)
2495  << " H/E " << (hcalenergy > ecalenergy)
2496  << " P/(H+E) " << (secpin/hpluse)
2497  << " HCAL ENE " << hcalenergy
2498  << " ECAL ENE " << ecalenergy
2499  << " secPIN " << secpin
2500  << " Algo Track " << Algo << std::endl;
2501  remove_this_kf = true;
2502  }
2503  }
2504  }
2505  }
2506  }
2507  if( remove_this_kf ) {
2508  secd_kf = RO.secondaryKFs.erase(secd_kf);
2509  if( secd_kf == RO.secondaryKFs.end() ) break;
2510  }
2511  }
2512 }
unsigned int whichTrackAlgo(const reco::TrackRef &trackRef)
const PFClusterRef & clusterRef() const
std::vector< std::vector< PFFlaggedElement > > _splayedblock
Definition: PFEGammaAlgo.h:187
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
reco::PFBlockRef _currentblock
Definition: PFEGammaAlgo.h:183
#define LOGDRESSED(x)
Definition: PFEGammaAlgo.cc:46
double f[11][100]
Container::value_type value_type
reco::PFBlock::LinkData _currentlinks
Definition: PFEGammaAlgo.h:184
Definition: fakeMenu.h:6
void PFEGammaAlgo::unlinkRefinableObjectKFandECALWithBadEoverP ( ProtoEGObject RO)
private

Definition at line 2335 of file PFEGammaAlgo.cc.

References _currentblock, _currentlinks, funct::abs(), PFEGammaAlgo::ProtoEGObject::brems, HLT_25ns14e33_v1_cff::distance, patCandidatesForDimuonsSequences_cff::ecal, PFEGammaAlgo::ProtoEGObject::ecalclusters, eta(), f, spr::find(), reco::PFBlock::LINKTEST_ALL, PFEGammaAlgo::ProtoEGObject::localMap, LOGDRESSED, PFEGammaAlgo::ProtoEGObject::primaryGSFs, and PFEGammaAlgo::ProtoEGObject::secondaryKFs.

Referenced by buildAndRefineEGObjects().

2335  {
2336  // this only means something for ROs with a primary GSF track
2337  if( !RO.primaryGSFs.size() ) return;
2338  // need energy sums to tell if we've added crap or not
2339  const double Pin_gsf = RO.primaryGSFs.front().first->GsftrackRef()->pMode();
2340  const double gsfOuterEta =
2341  RO.primaryGSFs.front().first->positionAtECALEntrance().Eta();
2342  double tot_ecal= 0.0;
2343  std::vector<double> min_brem_dists;
2344  std::vector<double> closest_brem_eta;
2345  // first get the total ecal energy (we should replace this with a cache)
2346  for( const auto& ecal : RO.ecalclusters ) {
2347  tot_ecal += ecal.first->clusterRef()->correctedEnergy();
2348  // we also need to look at the minimum distance to brems
2349  // since energetic brems will be closer to the brem than the track
2350  double min_brem_dist = 5000.0;
2351  double eta = -999.0;
2352  for( const auto& brem : RO.brems ) {
2353  const float dist = _currentblock->dist(brem.first->index(),
2354  ecal.first->index(),
2355  _currentlinks,
2357  if( dist < min_brem_dist && dist != -1.0f ) {
2358  min_brem_dist = dist;
2359  eta = brem.first->positionAtECALEntrance().Eta();
2360  }
2361  }
2362  min_brem_dists.push_back(min_brem_dist);
2363  closest_brem_eta.push_back(eta);
2364  }
2365 
2366  // loop through the ECAL clusters and remove ECAL clusters matched to
2367  // secondary track either in *or* out of the SC if the E/pin is bad
2368  for( auto secd_kf = RO.secondaryKFs.begin();
2369  secd_kf != RO.secondaryKFs.end(); ++secd_kf ) {
2370  reco::TrackRef trkRef = secd_kf->first->trackRef();
2371  const float secpin = secd_kf->first->trackRef()->p();
2372  bool remove_this_kf = false;
2373  for( auto ecal = RO.ecalclusters.begin();
2374  ecal != RO.ecalclusters.end(); ++ecal ) {
2375  size_t bremidx = std::distance(RO.ecalclusters.begin(),ecal);
2376  const float minbremdist = min_brem_dists[bremidx];
2377  const double ecalenergy = ecal->first->clusterRef()->correctedEnergy();
2378  const double Epin = ecalenergy/secpin;
2379  const double detaGsf =
2380  std::abs(gsfOuterEta - ecal->first->clusterRef()->positionREP().Eta());
2381  const double detaBrem =
2382  std::abs(closest_brem_eta[bremidx] -
2383  ecal->first->clusterRef()->positionREP().Eta());
2384 
2385  ElementMap::value_type check_match(ecal->first,secd_kf->first);
2386  auto kf_matched = std::find(RO.localMap.begin(),
2387  RO.localMap.end(),
2388  check_match);
2389 
2390  const float tkdist = _currentblock->dist(secd_kf->first->index(),
2391  ecal->first->index(),
2392  _currentlinks,
2394 
2395  // do not reject this track if it is closer to a brem than the
2396  // secondary track, or if it lies in the delta-eta plane with the
2397  // gsf track or if it is in the dEta plane with the brems
2398  if( Epin > 3 && kf_matched != RO.localMap.end() &&
2399  tkdist != -1.0f && tkdist < minbremdist &&
2400  detaGsf > 0.05 && detaBrem > 0.015) {
2401  double res_with = std::abs((tot_ecal-Pin_gsf)/Pin_gsf);
2402  double res_without = std::abs((tot_ecal-ecalenergy-Pin_gsf)/Pin_gsf);
2403  if(res_without < res_with) {
2404  LOGDRESSED("PFEGammaAlgo")
2405  << " REJECTED_RES totenergy " << tot_ecal
2406  << " Pin_gsf " << Pin_gsf
2407  << " cluster to secondary " << ecalenergy
2408  << " res_with " << res_with
2409  << " res_without " << res_without << std::endl;
2410  tot_ecal -= ecalenergy;
2411  remove_this_kf = true;
2412  ecal = RO.ecalclusters.erase(ecal);
2413  if( ecal == RO.ecalclusters.end() ) break;
2414  }
2415  }
2416  }
2417  if( remove_this_kf ) {
2418  secd_kf = RO.secondaryKFs.erase(secd_kf);
2419  if( secd_kf == RO.secondaryKFs.end() ) break;
2420  }
2421  }
2422 }
T eta() const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
reco::PFBlockRef _currentblock
Definition: PFEGammaAlgo.h:183
#define LOGDRESSED(x)
Definition: PFEGammaAlgo.cc:46
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
Container::value_type value_type
reco::PFBlock::LinkData _currentlinks
Definition: PFEGammaAlgo.h:184
bool PFEGammaAlgo::unwrapSuperCluster ( const reco::PFBlockElementSuperCluster thesc,
std::vector< PFClusterFlaggedElement > &  ecalclusters,
ClusterMap ecal2ps 
)
private

Definition at line 1132 of file PFEGammaAlgo.cc.

References _currentblock, _currentlinks, _splayedblock, attachPSClusters(), TauDecayModes::dec, HLT_25ns14e33_v1_cff::distance, docast, reco::PFBlockElementCluster::Dump(), reco::PFBlockElementSuperCluster::Dump(), reco::PFBlockElement::ECAL, edm::hlt::Exception, spr::find(), reco::PFBlockElementSuperCluster::fromPFSuperCluster(), edm::Ref< C, T, F >::get(), edm::Ref< C, T, F >::isAvailable(), edm::Ref< C, T, F >::isNonnull(), LOGDRESSED, LOGERR, LOGVERB, and reco::PFBlockElementSuperCluster::superClusterRef().

Referenced by initializeProtoCands().

1134  {
1135  ecalclusters.clear();
1136  ecal2ps.clear();
1137  LOGVERB("PFEGammaAlgo")
1138  << "Pointer to SC element: 0x"
1139  << std::hex << thesc << std::dec << std::endl
1140  << "cleared ecalclusters and ecal2ps!" << std::endl;
1141  auto ecalbegin = _splayedblock[reco::PFBlockElement::ECAL].begin();
1142  auto ecalend = _splayedblock[reco::PFBlockElement::ECAL].end();
1143  if( ecalbegin == ecalend ) {
1144  LOGERR("PFEGammaAlgo::unwrapSuperCluster()")
1145  << "There are no ECAL elements in a block with imported SC!"
1146  << " This is a bug we should fix this!"
1147  << std::endl;
1148  return false;
1149  }
1150  reco::SuperClusterRef scref = thesc->superClusterRef();
1151  const bool is_pf_sc = thesc->fromPFSuperCluster();
1152  if( !(scref.isAvailable() && scref.isNonnull()) ) {
1153  throw cms::Exception("PFEGammaAlgo::unwrapSuperCluster()")
1154  << "SuperCluster pointed to by block element is null!"
1155  << std::endl;
1156  }
1157  LOGDRESSED("PFEGammaAlgo")
1158  << "Got a valid super cluster ref! 0x"
1159  << std::hex << scref.get() << std::dec << std::endl;
1160  const size_t nscclusters = scref->clustersSize();
1161  const size_t nscpsclusters = scref->preshowerClustersSize();
1162  size_t npfpsclusters = 0;
1163  size_t npfclusters = 0;
1164  LOGDRESSED("PFEGammaAlgo")
1165  << "Precalculated cluster multiplicities: "
1166  << nscclusters << ' ' << nscpsclusters << std::endl;
1167  NotCloserToOther<reco::PFBlockElement::SC,reco::PFBlockElement::ECAL>
1168  ecalClustersInSC(_currentblock,_currentlinks,thesc);
1169  auto firstnotinsc = std::partition(ecalbegin,ecalend,ecalClustersInSC);
1170  //reset the begin and end iterators
1171  ecalbegin = _splayedblock[reco::PFBlockElement::ECAL].begin();
1172  ecalend = _splayedblock[reco::PFBlockElement::ECAL].end();
1173 
1174  //get list of associated clusters by det id and energy matching
1175  //(only needed when using non-pf supercluster)
1176  std::vector<const ClusterElement*> safePFClusters = is_pf_sc ? std::vector<const ClusterElement*>() : getSCAssociatedECALsSafe(scref,_splayedblock[reco::PFBlockElement::ECAL]);
1177 
1178  if( firstnotinsc == ecalbegin ) {
1179  LOGERR("PFEGammaAlgo::unwrapSuperCluster()")
1180  << "No associated block elements to SuperCluster!"
1181  << " This is a bug we should fix!"
1182  << std::endl;
1183  return false;
1184  }
1185  npfclusters = std::distance(ecalbegin,firstnotinsc);
1186  // ensure we have found the correct number of PF ecal clusters in the case
1187  // that this is a PF supercluster, otherwise all bets are off
1188  if( is_pf_sc && nscclusters != npfclusters ) {
1189  std::stringstream sc_err;
1190  thesc->Dump(sc_err,"\t");
1191  throw cms::Exception("PFEGammaAlgo::unwrapSuperCluster()")
1192  << "The number of found ecal elements ("
1193  << nscclusters << ") in block is not the same as"
1194  << " the number of ecal PF clusters reported by the PFSuperCluster"
1195  << " itself (" << npfclusters
1196  << ")! This should not happen!" << std::endl
1197  << sc_err.str() << std::endl;
1198  }
1199  for( auto ecalitr = ecalbegin; ecalitr != firstnotinsc; ++ecalitr ) {
1200  const PFClusterElement* elemascluster =
1201  docast(const PFClusterElement*,ecalitr->first);
1202 
1203  // reject clusters that really shouldn't be associated to the SC
1204  // (only needed when using non-pf-supercluster)
1205  if(!is_pf_sc && std::find(safePFClusters.begin(),safePFClusters.end(),elemascluster) ==
1206  safePFClusters.end() ) continue;
1207 
1208  //add cluster
1209  ecalclusters.push_back(std::make_pair(elemascluster,true));
1210  //mark cluster as used
1211  ecalitr->second = false;
1212 
1213  // process the ES elements
1214  // auto is a pair<Iterator,bool> here, bool is false when placing fails
1215  auto emplaceresult = ecal2ps.emplace(elemascluster,
1216  ClusterMap::mapped_type());
1217  if( !emplaceresult.second ) {
1218  std::stringstream clus_err;
1219  elemascluster->Dump(clus_err,"\t");
1220  throw cms::Exception("PFEGammaAlgo::unwrapSuperCluster()")
1221  << "List of pointers to ECAL block elements contains non-unique items!"
1222  << " This is very bad!" << std::endl
1223  << "cluster ptr = 0x" << std::hex << elemascluster << std::dec
1224  << std::endl << clus_err.str() << std::endl;
1225  }
1226  ClusterMap::mapped_type& eslist = emplaceresult.first->second;
1227  npfpsclusters += attachPSClusters(elemascluster,eslist);
1228  } // loop over ecal elements
1229 
1230  /*
1231  if( is_pf_sc && nscpsclusters != npfpsclusters) {
1232  std::stringstream sc_err;
1233  thesc->Dump(sc_err,"\t");
1234  throw cms::Exception("PFEGammaAlgo::unwrapSuperCluster()")
1235  << "The number of found PF preshower elements ("
1236  << npfpsclusters << ") in block is not the same as"
1237  << " the number of preshower clusters reported by the PFSuperCluster"
1238  << " itself (" << nscpsclusters << ")! This should not happen!"
1239  << std::endl
1240  << sc_err.str() << std::endl;
1241  }
1242  */
1243 
1244  LOGDRESSED("PFEGammaAlgo")
1245  << " Unwrapped SC has " << npfclusters << " ECAL sub-clusters"
1246  << " and " << npfpsclusters << " PreShower layers 1 & 2 clusters!"
1247  << std::endl;
1248  return true;
1249  }
bool isAvailable() const
Definition: Ref.h:614
const SuperClusterRef & superClusterRef() const
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
std::vector< std::vector< PFFlaggedElement > > _splayedblock
Definition: PFEGammaAlgo.h:187
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
reco::PFBlockRef _currentblock
Definition: PFEGammaAlgo.h:183
#define LOGERR(x)
Definition: PFEGammaAlgo.cc:45
#define LOGVERB(x)
Definition: PFEGammaAlgo.cc:43
#define LOGDRESSED(x)
Definition: PFEGammaAlgo.cc:46
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:242
reco::PFBlockElementCluster PFClusterElement
Definition: PFEGammaAlgo.h:58
reco::PFBlock::LinkData _currentlinks
Definition: PFEGammaAlgo.h:184
#define docast(x, y)
Definition: PFEGammaAlgo.cc:42
void Dump(std::ostream &out=std::cout, const char *tab=" ") const
print the object inside the element
int attachPSClusters(const PFClusterElement *, ClusterMap::mapped_type &)
unsigned int PFEGammaAlgo::whichTrackAlgo ( const reco::TrackRef trackRef)
private

Definition at line 2515 of file PFEGammaAlgo.cc.

References DetachedTripletStep_cff::detachedTripletStep, InitialStep_cff::initialStep, LowPU_MixedTripletStep_cff::mixedTripletStep, and PixelLessStep_cff::pixelLessStep.

Referenced by unlinkRefinableObjectKFandECALMatchedToHCAL().

2515  {
2516  unsigned int Algo = 0;
2517  switch (trackRef->algo()) {
2518  case TrackBase::ctf:
2520  case TrackBase::lowPtTripletStep:
2521  case TrackBase::pixelPairStep:
2522  case TrackBase::jetCoreRegionalStep:
2523  case TrackBase::muonSeededStepInOut:
2524  case TrackBase::muonSeededStepOutIn:
2525  Algo = 0;
2526  break;
2528  Algo = 1;
2529  break;
2531  Algo = 2;
2532  break;
2534  Algo = 3;
2535  break;
2536  case TrackBase::tobTecStep:
2537  Algo = 4;
2538  break;
2539  default:
2540  Algo = 5;
2541  break;
2542  }
2543  return Algo;
2544 }
Definition: fakeMenu.h:6

Member Data Documentation

reco::PFBlockRef PFEGammaAlgo::_currentblock
private
reco::PFBlock::LinkData PFEGammaAlgo::_currentlinks
private
reco::PFCandidateCollection PFEGammaAlgo::_finalCandidates
private

Definition at line 203 of file PFEGammaAlgo.h.

Referenced by buildAndRefineEGObjects().

ElementMap PFEGammaAlgo::_recoveredlinks
private

Definition at line 188 of file PFEGammaAlgo.h.

Referenced by buildAndRefineEGObjects(), and removeOrLinkECALClustersToKFTracks().

std::list<ProtoEGObject> PFEGammaAlgo::_refinableObjects
private
std::vector<std::vector<PFFlaggedElement> > PFEGammaAlgo::_splayedblock
private
std::vector<unsigned int> PFEGammaAlgo::AddFromElectron_
private

Definition at line 378 of file PFEGammaAlgo.h.

PFEGConfigInfo PFEGammaAlgo::cfg_
private
float PFEGammaAlgo::chi2
private

Definition at line 349 of file PFEGammaAlgo.h.

Referenced by EvaluateSingleLegMVA(), and PFEGammaAlgo().

float PFEGammaAlgo::chi2_gsf
private

Definition at line 303 of file PFEGammaAlgo.h.

Referenced by calculate_ele_mva(), and PFEGammaAlgo().

float PFEGammaAlgo::chi2_kf
private

Definition at line 303 of file PFEGammaAlgo.h.

Referenced by calculate_ele_mva(), and PFEGammaAlgo().

float PFEGammaAlgo::Clus5x5ratio_
private

Definition at line 355 of file PFEGammaAlgo.h.

float PFEGammaAlgo::ClusEta_
private

Definition at line 355 of file PFEGammaAlgo.h.

float PFEGammaAlgo::ClusPhi_
private

Definition at line 355 of file PFEGammaAlgo.h.

float PFEGammaAlgo::ClusR9_
private

Definition at line 355 of file PFEGammaAlgo.h.

std::vector< std::pair <unsigned int, unsigned int> > PFEGammaAlgo::convGsfTrack_
private

Definition at line 290 of file PFEGammaAlgo.h.

Referenced by RunPFEG().

float PFEGammaAlgo::CrysEta_
private

Definition at line 355 of file PFEGammaAlgo.h.

int PFEGammaAlgo::CrysIEta_
private

Definition at line 357 of file PFEGammaAlgo.h.

int PFEGammaAlgo::CrysIPhi_
private

Definition at line 357 of file PFEGammaAlgo.h.

float PFEGammaAlgo::CrysPhi_
private

Definition at line 355 of file PFEGammaAlgo.h.

float PFEGammaAlgo::CrysX_
private

Definition at line 358 of file PFEGammaAlgo.h.

float PFEGammaAlgo::CrysY_
private

Definition at line 358 of file PFEGammaAlgo.h.

float PFEGammaAlgo::del_phi
private

Definition at line 349 of file PFEGammaAlgo.h.

Referenced by EvaluateSingleLegMVA(), and PFEGammaAlgo().

float PFEGammaAlgo::dEta_
private

Definition at line 366 of file PFEGammaAlgo.h.

float PFEGammaAlgo::DEtaGsfEcalClust
private

Definition at line 310 of file PFEGammaAlgo.h.

Referenced by calculate_ele_mva(), and PFEGammaAlgo().

float PFEGammaAlgo::dPhi_
private

Definition at line 366 of file PFEGammaAlgo.h.

float PFEGammaAlgo::dPtOverPt_gsf
private

Definition at line 303 of file PFEGammaAlgo.h.

Referenced by calculate_ele_mva(), and PFEGammaAlgo().

float PFEGammaAlgo::DPtOverPt_gsf
private

Definition at line 303 of file PFEGammaAlgo.h.

Referenced by calculate_ele_mva(), and PFEGammaAlgo().

float PFEGammaAlgo::DPtOverPt_kf
private

Definition at line 303 of file PFEGammaAlgo.h.

Referenced by calculate_ele_mva().

float PFEGammaAlgo::e1x3_
private

Definition at line 361 of file PFEGammaAlgo.h.

float PFEGammaAlgo::e1x5_
private

Definition at line 361 of file PFEGammaAlgo.h.

float PFEGammaAlgo::e2x5Bottom_
private

Definition at line 361 of file PFEGammaAlgo.h.

float PFEGammaAlgo::e2x5Left_
private

Definition at line 361 of file PFEGammaAlgo.h.

float PFEGammaAlgo::e2x5Max_
private

Definition at line 363 of file PFEGammaAlgo.h.

float PFEGammaAlgo::e2x5Right_
private

Definition at line 361 of file PFEGammaAlgo.h.

float PFEGammaAlgo::e2x5Top_
private

Definition at line 361 of file PFEGammaAlgo.h.

float PFEGammaAlgo::e3x1_
private

Definition at line 361 of file PFEGammaAlgo.h.

float PFEGammaAlgo::e3x3_
private

Definition at line 355 of file PFEGammaAlgo.h.

float PFEGammaAlgo::E3x3_
private

Definition at line 365 of file PFEGammaAlgo.h.

float PFEGammaAlgo::e5x5Map[5][5]
private

Definition at line 352 of file PFEGammaAlgo.h.

float PFEGammaAlgo::earlyBrem
private

Definition at line 313 of file PFEGammaAlgo.h.

Referenced by calculate_ele_mva().

float PFEGammaAlgo::EB
private

Definition at line 359 of file PFEGammaAlgo.h.

float PFEGammaAlgo::ebottom_
private

Definition at line 362 of file PFEGammaAlgo.h.

edm::Handle<reco::PFCluster::EEtoPSAssociation> PFEGammaAlgo::eetops_
private

Definition at line 182 of file PFEGammaAlgo.h.

Referenced by attachPSClusters(), and setEEtoPSAssociation().

reco::PFCandidateCollection PFEGammaAlgo::egCandidate_
private

Definition at line 380 of file PFEGammaAlgo.h.

Referenced by isEGValidCandidate(), and RunPFEG().

reco::PFCandidateEGammaExtraCollection PFEGammaAlgo::egExtra_
private

Definition at line 384 of file PFEGammaAlgo.h.

Referenced by RunPFEG().

float PFEGammaAlgo::EGsfPoutMode
private

Definition at line 309 of file PFEGammaAlgo.h.

Referenced by calculate_ele_mva(), and PFEGammaAlgo().

float PFEGammaAlgo::eleft_
private

Definition at line 362 of file PFEGammaAlgo.h.

float PFEGammaAlgo::EoverPt
private

Definition at line 349 of file PFEGammaAlgo.h.

Referenced by EvaluateSingleLegMVA(), and PFEGammaAlgo().

float PFEGammaAlgo::eright_
private

Definition at line 362 of file PFEGammaAlgo.h.

float PFEGammaAlgo::eSeed_
private

Definition at line 361 of file PFEGammaAlgo.h.

float PFEGammaAlgo::Eta_gsf
private

Definition at line 300 of file PFEGammaAlgo.h.

Referenced by calculate_ele_mva(), and PFEGammaAlgo().

float PFEGammaAlgo::etop_
private

Definition at line 362 of file PFEGammaAlgo.h.

float PFEGammaAlgo::EtotBremPinPoutMode
private

Definition at line 309 of file PFEGammaAlgo.h.

Referenced by calculate_ele_mva(), and PFEGammaAlgo().

float PFEGammaAlgo::EtotPinMode
private

Definition at line 309 of file PFEGammaAlgo.h.

Referenced by calculate_ele_mva(), and PFEGammaAlgo().

float PFEGammaAlgo::excluded_
private

Definition at line 376 of file PFEGammaAlgo.h.

std::vector< std::pair <unsigned int, unsigned int> > PFEGammaAlgo::fifthStepKfTrack_
private

Definition at line 289 of file PFEGammaAlgo.h.

Referenced by RunPFEG().

float PFEGammaAlgo::firstBrem
private

Definition at line 313 of file PFEGammaAlgo.h.

Referenced by calculate_ele_mva(), and PFEGammaAlgo().

std::vector<bool> PFEGammaAlgo::GsfTrackSingleEcal_
private

Definition at line 288 of file PFEGammaAlgo.h.

float PFEGammaAlgo::HOverHE
private

Definition at line 314 of file PFEGammaAlgo.h.

Referenced by calculate_ele_mva(), and PFEGammaAlgo().

float PFEGammaAlgo::HOverPin
private

Definition at line 314 of file PFEGammaAlgo.h.

Referenced by calculate_ele_mva().

float PFEGammaAlgo::HoverPt
private

Definition at line 349 of file PFEGammaAlgo.h.

Referenced by EvaluateSingleLegMVA(), and PFEGammaAlgo().

bool PFEGammaAlgo::isvalid_
private

Definition at line 316 of file PFEGammaAlgo.h.

float PFEGammaAlgo::lateBrem
private

Definition at line 313 of file PFEGammaAlgo.h.

Referenced by calculate_ele_mva(), and PFEGammaAlgo().

float PFEGammaAlgo::lnPt_gsf
private

Definition at line 300 of file PFEGammaAlgo.h.

Referenced by calculate_ele_mva(), and PFEGammaAlgo().

std::vector<bool> PFEGammaAlgo::lockExtraKf_
private

Definition at line 287 of file PFEGammaAlgo.h.

float PFEGammaAlgo::logPFClusE_
private

Definition at line 355 of file PFEGammaAlgo.h.

float PFEGammaAlgo::LowClusE_
private

Definition at line 366 of file PFEGammaAlgo.h.

std::vector<int> PFEGammaAlgo::match_ind
private

Definition at line 344 of file PFEGammaAlgo.h.

float PFEGammaAlgo::Mustache_Et_out_
private

Definition at line 376 of file PFEGammaAlgo.h.

float PFEGammaAlgo::Mustache_EtRatio_
private

Definition at line 376 of file PFEGammaAlgo.h.

float PFEGammaAlgo::MustE_
private

Definition at line 365 of file PFEGammaAlgo.h.

double PFEGammaAlgo::mvaValue
private

Definition at line 350 of file PFEGammaAlgo.h.

Referenced by EvaluateSingleLegMVA().

const char* PFEGammaAlgo::mvaWeightFile_
private

Definition at line 296 of file PFEGammaAlgo.h.

float PFEGammaAlgo::nhit_gsf
private

Definition at line 306 of file PFEGammaAlgo.h.

Referenced by calculate_ele_mva().

float PFEGammaAlgo::nhit_kf
private

Definition at line 306 of file PFEGammaAlgo.h.

Referenced by calculate_ele_mva(), and PFEGammaAlgo().

float PFEGammaAlgo::nlayers
private

Definition at line 348 of file PFEGammaAlgo.h.

Referenced by EvaluateSingleLegMVA(), and PFEGammaAlgo().

float PFEGammaAlgo::nlost
private

Definition at line 348 of file PFEGammaAlgo.h.

Referenced by EvaluateSingleLegMVA(), and PFEGammaAlgo().

float PFEGammaAlgo::nPFClus_
private

Definition at line 366 of file PFEGammaAlgo.h.

float PFEGammaAlgo::nVtx_
private

Definition at line 368 of file PFEGammaAlgo.h.

Referenced by setnPU().

reco::PFCandidateCollection PFEGammaAlgo::outcands_
private

Definition at line 176 of file PFEGammaAlgo.h.

Referenced by buildAndRefineEGObjects(), and getCandidates().

reco::PFCandidateEGammaExtraCollection PFEGammaAlgo::outcandsextra_
private

Definition at line 177 of file PFEGammaAlgo.h.

Referenced by buildAndRefineEGObjects(), and getEGExtra().

std::vector< reco::PFCandidate > PFEGammaAlgo::permElectronCandidates_
private

Definition at line 347 of file PFEGammaAlgo.h.

float PFEGammaAlgo::PFCrysEtaCrack_
private

Definition at line 355 of file PFEGammaAlgo.h.

float PFEGammaAlgo::PFPhoE_
private

Definition at line 365 of file PFEGammaAlgo.h.

float PFEGammaAlgo::PFPhoECorr_
private

Definition at line 365 of file PFEGammaAlgo.h.

float PFEGammaAlgo::PFPhoEt_
private

Definition at line 365 of file PFEGammaAlgo.h.

float PFEGammaAlgo::PFPhoEta_
private

Definition at line 365 of file PFEGammaAlgo.h.

float PFEGammaAlgo::PFPhoEtCorr_
private

Definition at line 365 of file PFEGammaAlgo.h.

float PFEGammaAlgo::PFPhoPhi_
private

Definition at line 365 of file PFEGammaAlgo.h.

float PFEGammaAlgo::PFPhoR9_
private

Definition at line 365 of file PFEGammaAlgo.h.

float PFEGammaAlgo::PFPhoR9Corr_
private

Definition at line 365 of file PFEGammaAlgo.h.

const reco::Vertex* PFEGammaAlgo::primaryVertex_
private

Definition at line 329 of file PFEGammaAlgo.h.

float PFEGammaAlgo::RConv_
private

Definition at line 365 of file PFEGammaAlgo.h.

const GBRForest* PFEGammaAlgo::ReaderGC_
private

Definition at line 332 of file PFEGammaAlgo.h.

const GBRForest* PFEGammaAlgo::ReaderGCEB_
private

Definition at line 337 of file PFEGammaAlgo.h.

const GBRForest* PFEGammaAlgo::ReaderGCEEhR9_
private

Definition at line 338 of file PFEGammaAlgo.h.

const GBRForest* PFEGammaAlgo::ReaderGCEElR9_
private

Definition at line 339 of file PFEGammaAlgo.h.

const GBRForest* PFEGammaAlgo::ReaderLC_
private

Definition at line 331 of file PFEGammaAlgo.h.

const GBRForest* PFEGammaAlgo::ReaderLCEB_
private

Definition at line 335 of file PFEGammaAlgo.h.

const GBRForest* PFEGammaAlgo::ReaderLCEE_
private

Definition at line 336 of file PFEGammaAlgo.h.

const GBRForest* PFEGammaAlgo::ReaderRes_
private

Definition at line 333 of file PFEGammaAlgo.h.

reco::SuperClusterCollection PFEGammaAlgo::refinedscs_
private

Definition at line 178 of file PFEGammaAlgo.h.

Referenced by fillPFCandidates(), and getRefinedSCs().

float PFEGammaAlgo::RMSAll_
private

Definition at line 366 of file PFEGammaAlgo.h.

float PFEGammaAlgo::RMSMust_
private

Definition at line 366 of file PFEGammaAlgo.h.

float PFEGammaAlgo::SCEtaWidth_
private

Definition at line 365 of file PFEGammaAlgo.h.

float PFEGammaAlgo::SCPhiWidth_
private

Definition at line 365 of file PFEGammaAlgo.h.

float PFEGammaAlgo::SigmaEtaEta
private

Definition at line 311 of file PFEGammaAlgo.h.

Referenced by calculate_ele_mva(), and PFEGammaAlgo().

float PFEGammaAlgo::STIP
private

Definition at line 349 of file PFEGammaAlgo.h.

Referenced by EvaluateSingleLegMVA(), and PFEGammaAlgo().

double PFEGammaAlgo::sumPtTrackIsoForPhoton_
private

Definition at line 342 of file PFEGammaAlgo.h.

double PFEGammaAlgo::sumPtTrackIsoSlopeForPhoton_
private

Definition at line 343 of file PFEGammaAlgo.h.

TMVA::Reader* PFEGammaAlgo::tmvaReader_
private

Definition at line 330 of file PFEGammaAlgo.h.

Referenced by EvaluateSingleLegMVA(), PFEGammaAlgo(), and ~PFEGammaAlgo().

TMVA::Reader* PFEGammaAlgo::tmvaReaderEle_
private

Definition at line 294 of file PFEGammaAlgo.h.

Referenced by calculate_ele_mva(), PFEGammaAlgo(), and ~PFEGammaAlgo().

float PFEGammaAlgo::TotPS1_
private

Definition at line 367 of file PFEGammaAlgo.h.

float PFEGammaAlgo::TotPS2_
private

Definition at line 367 of file PFEGammaAlgo.h.

float PFEGammaAlgo::track_pt
private

Definition at line 349 of file PFEGammaAlgo.h.

Referenced by EvaluateSingleLegMVA(), and PFEGammaAlgo().

verbosityLevel PFEGammaAlgo::verbosityLevel_
private

Definition at line 323 of file PFEGammaAlgo.h.

Referenced by RunPFEG().

float PFEGammaAlgo::VtxZ_
private

Definition at line 355 of file PFEGammaAlgo.h.

TH2D* PFEGammaAlgo::X0_inner
private

Definition at line 371 of file PFEGammaAlgo.h.

Referenced by PFEGammaAlgo().

TH2D* PFEGammaAlgo::X0_middle
private

Definition at line 372 of file PFEGammaAlgo.h.

Referenced by PFEGammaAlgo().

TH2D* PFEGammaAlgo::X0_outer
private

Definition at line 373 of file PFEGammaAlgo.h.

Referenced by PFEGammaAlgo().

TH2D* PFEGammaAlgo::X0_sum
private

Definition at line 370 of file PFEGammaAlgo.h.

Referenced by PFEGammaAlgo().

float PFEGammaAlgo::x0inner_
private

Definition at line 374 of file PFEGammaAlgo.h.

float PFEGammaAlgo::x0middle_
private

Definition at line 374 of file PFEGammaAlgo.h.

float PFEGammaAlgo::x0outer_
private

Definition at line 374 of file PFEGammaAlgo.h.