File indexing completed on 2024-04-06 12:31:33
0001 #ifndef TrackingToolsPatternToolsTrackCollectionTokens_H
0002 #define TrackingToolsPatternToolsTrackCollectionTokens_H
0003
0004 #include "FWCore/Framework/interface/ConsumesCollector.h"
0005 #include "FWCore/Utilities/interface/InputTag.h"
0006
0007 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0008 #include "TrackingTools/PatternTools/interface/Trajectory.h"
0009 #include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h"
0010
0011 #include "FWCore/Framework/interface/Event.h"
0012
0013 struct TrackCollectionTokens {
0014 TrackCollectionTokens(edm::InputTag const& tag, edm::ConsumesCollector&& iC)
0015 : hTrackToken_(iC.consumes<reco::TrackCollection>(tag)),
0016 hTrajToken_(iC.mayConsume<std::vector<Trajectory>>(tag)),
0017 hIndToken_(iC.mayConsume<std::vector<int>>(tag)),
0018 hTTAssToken_(iC.mayConsume<TrajTrackAssociationCollection>(tag)) {}
0019
0020
0021 edm::EDGetTokenT<reco::TrackCollection> hTrackToken_;
0022 edm::EDGetTokenT<std::vector<Trajectory>> hTrajToken_;
0023 edm::EDGetTokenT<std::vector<int>> hIndToken_;
0024 edm::EDGetTokenT<TrajTrackAssociationCollection> hTTAssToken_;
0025
0026 reco::TrackCollection const& tracks(edm::Event& evt) const {
0027 edm::Handle<reco::TrackCollection> h;
0028 evt.getByToken(hTrackToken_, h);
0029 return *h;
0030 }
0031
0032 std::vector<Trajectory> const& trajectories(edm::Event& evt) const {
0033 edm::Handle<std::vector<Trajectory>> h;
0034 evt.getByToken(hTrajToken_, h);
0035 return *h;
0036 }
0037
0038 std::vector<int> const& indicesInput(edm::Event& evt) const {
0039 edm::Handle<std::vector<int>> h;
0040 evt.getByToken(hIndToken_, h);
0041 return *h;
0042 }
0043 };
0044
0045 #endif