CMS 3D CMS Logo

PFRecoTauLostTrackPlugin.cc
Go to the documentation of this file.
1 /*
2  * =============================================================================
3  * Filename: PFRecoTauLostTrackPlugin.cc
4  *
5  * Description: Add references to tracks of tau-charged-hadrons built on
6  * top of a track
7  *
8  * Created: 25/04/2022
9  *
10  * Authors: Michal Bluj (NCBJ, Warsaw)
11  *
12  * =============================================================================
13  */
14 
16 
21 
22 namespace reco {
23  namespace tau {
24 
26  public:
28  ~PFRecoTauLostTrackPlugin() override = default;
29  void operator()(PFTau&) const override;
30  void beginEvent() override;
31  void endEvent() override;
32 
33  private:
36  const int verbosity_;
37  };
38 
41  track_token_(iC.consumes(cfg.getParameter<edm::InputTag>("trackSrc"))),
42  verbosity_(cfg.getParameter<int>("verbosity")) {}
43 
45 
47  if (!tracks_.isValid()) { //track collection not available in the event
48  if (verbosity_) {
49  edm::LogPrint("<PFRecoTauLostTrackPlugin::operator()>:")
50  << " Track collection " << tracks_.provenance() << " is not valid."
51  << " No tracks will be added to tau.";
52  }
53  return;
54  }
56  const PFRecoTauChargedHadronCollection& chargedHadrons = tau.signalTauChargedHadronCandidates();
57  for (const auto& chargedHadron : chargedHadrons) {
58  if (chargedHadron.algoIs(PFRecoTauChargedHadron::kTrack) && chargedHadron.getTrack().isNonnull()) {
59  reco::TrackRef trackRef(tracks_, chargedHadron.getTrack().key());
60  lostTracks.push_back(trackRef);
61  }
62  }
63  if (verbosity_) {
64  edm::LogPrint("<PFRecoTauLostTrackPlugin::operator()>:")
65  << " tau: Pt = " << tau.pt() << ", eta = " << tau.eta() << ", phi = " << tau.phi()
66  << ", mass = " << tau.mass() << " (decayMode = " << tau.decayMode() << ")"
67  << ", nChHadrs = " << chargedHadrons.size() << ", nLostTracks = " << lostTracks.size();
68  }
69  if (!lostTracks.empty())
70  tau.setsignalTracks(lostTracks);
71  }
72 
74 
75  } // namespace tau
76 } // namespace reco
77 
79 
edm::Handle< reco::TrackCollection > tracks_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
Provenance const * provenance() const
Definition: HandleBase.h:74
std::vector< PFRecoTauChargedHadron > PFRecoTauChargedHadronCollection
collection of PFRecoTauChargedHadron objects
Log< level::Warning, true > LogPrint
bool isValid() const
Definition: HandleBase.h:70
fixed size matrix
HLT enums.
PFRecoTauLostTrackPlugin(const edm::ParameterSet &, edm::ConsumesCollector &&iC)
#define DEFINE_EDM_PLUGIN(factory, type, name)
const edm::EDGetTokenT< reco::TrackCollection > track_token_
def move(src, dest)
Definition: eostools.py:511
~PFRecoTauLostTrackPlugin() override=default