Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:27:28

0001 #include "RecoParticleFlow/PFProducer/interface/BlockElementLinkerBase.h"
0002 #include "DataFormats/ParticleFlowReco/interface/PFRecTrack.h"
0003 #include "DataFormats/ParticleFlowReco/interface/PFBlockElementGsfTrack.h"
0004 #include "DataFormats/ParticleFlowReco/interface/PFBlockElementBrem.h"
0005 #include "RecoParticleFlow/PFClusterTools/interface/LinkByRecHit.h"
0006 
0007 class GSFAndGSFLinker : public BlockElementLinkerBase {
0008 public:
0009   GSFAndGSFLinker(const edm::ParameterSet& conf)
0010       : BlockElementLinkerBase(conf),
0011         useKDTree_(conf.getParameter<bool>("useKDTree")),
0012         debug_(conf.getUntrackedParameter<bool>("debug", false)) {}
0013 
0014   double testLink(const reco::PFBlockElement*, const reco::PFBlockElement*) const override;
0015 
0016 private:
0017   bool useKDTree_, debug_;
0018 };
0019 
0020 DEFINE_EDM_PLUGIN(BlockElementLinkerFactory, GSFAndGSFLinker, "GSFAndGSFLinker");
0021 
0022 double GSFAndGSFLinker::testLink(const reco::PFBlockElement* elem1, const reco::PFBlockElement* elem2) const {
0023   constexpr reco::PFBlockElement::TrackType T_FROM_GAMMACONV = reco::PFBlockElement::T_FROM_GAMMACONV;
0024   double dist = -1.0;
0025   const reco::PFBlockElementGsfTrack* gsfelem1 = static_cast<const reco::PFBlockElementGsfTrack*>(elem1);
0026   const reco::PFBlockElementGsfTrack* gsfelem2 = static_cast<const reco::PFBlockElementGsfTrack*>(elem2);
0027   const reco::GsfPFRecTrackRef& gsfref1 = gsfelem1->GsftrackRefPF();
0028   const reco::GsfPFRecTrackRef& gsfref2 = gsfelem2->GsftrackRefPF();
0029   if (gsfref1.isNonnull() && gsfref2.isNonnull()) {
0030     if (gsfelem1->trackType(T_FROM_GAMMACONV) !=  // we want **one** primary GSF
0031             gsfelem2->trackType(T_FROM_GAMMACONV) &&
0032         gsfref1->trackId() == gsfref2->trackId()) {
0033       dist = 0.001;
0034     }
0035   }
0036   return dist;
0037 }