CMS 3D CMS Logo

LightPFTrackProducer.cc
Go to the documentation of this file.
11 
13 public:
15  explicit LightPFTrackProducer(const edm::ParameterSet&);
16 
18  ~LightPFTrackProducer() override;
19 
20 private:
21  void beginRun(const edm::Run&, const edm::EventSetup&) override;
22  void endRun(const edm::Run&, const edm::EventSetup&) override;
23 
25  void produce(edm::Event&, const edm::EventSetup&) override;
26 
29  std::vector<edm::EDGetTokenT<reco::TrackCollection> > tracksContainers_;
30 
35 };
36 
39 
40 using namespace std;
41 using namespace edm;
43  : pfTransformer_(nullptr), magneticFieldToken_(esConsumes<edm::Transition::BeginRun>()) {
44  produces<reco::PFRecTrackCollection>();
45 
46  std::vector<InputTag> tags = iConfig.getParameter<vector<InputTag> >("TkColList");
47 
48  for (unsigned int i = 0; i < tags.size(); ++i)
49  tracksContainers_.push_back(consumes<reco::TrackCollection>(tags[i]));
50 
51  useQuality_ = iConfig.getParameter<bool>("UseQuality");
53 }
54 
56 
58  //create the empty collections
59  auto PfTrColl = std::make_unique<reco::PFRecTrackCollection>();
60 
61  for (unsigned int istr = 0; istr < tracksContainers_.size(); istr++) {
62  //Track collection
63  Handle<reco::TrackCollection> tkRefCollection;
64  iEvent.getByToken(tracksContainers_[istr], tkRefCollection);
65  reco::TrackCollection Tk = *(tkRefCollection.product());
66  for (unsigned int i = 0; i < Tk.size(); i++) {
67  if (useQuality_ && (!(Tk[i].quality(trackQuality_))))
68  continue;
69  reco::TrackRef trackRef(tkRefCollection, i);
70  reco::PFRecTrack pftrack(trackRef->charge(), reco::PFRecTrack::KF, i, trackRef);
71  Trajectory FakeTraj;
72  bool mymsgwarning = false;
73  bool valid = pfTransformer_->addPoints(pftrack, *trackRef, FakeTraj, mymsgwarning);
74  if (valid)
75  PfTrColl->push_back(pftrack);
76  }
77  }
78  iEvent.put(std::move(PfTrColl));
79 }
80 
81 // ------------ method called once each job just before starting event loop ------------
83  auto const& magneticField = &iSetup.getData(magneticFieldToken_);
86 }
87 
88 // ------------ method called once each job just after ending the event loop ------------
89 void LightPFTrackProducer::endRun(const edm::Run& run, const EventSetup& iSetup) {
90  delete pfTransformer_;
91  pfTransformer_ = nullptr;
92 }
mps_fire.i
i
Definition: mps_fire.py:428
edm::Handle::product
T const * product() const
Definition: Handle.h:70
ESHandle.h
edm::Run
Definition: Run.h:45
edm
HLT enums.
Definition: AlignableModifier.h:19
reco::TrackBase::TrackQuality
TrackQuality
track quality
Definition: TrackBase.h:150
EDProducer.h
LightPFTrackProducer::trackQuality_
reco::TrackBase::TrackQuality trackQuality_
Definition: LightPFTrackProducer.cc:34
LightPFTrackProducer::tracksContainers_
std::vector< edm::EDGetTokenT< reco::TrackCollection > > tracksContainers_
Definition: LightPFTrackProducer.cc:29
reco::PFRecTrack::KF
Definition: PFRecTrack.h:25
HLT_FULL_cff.magneticField
magneticField
Definition: HLT_FULL_cff.py:348
LightPFTrackProducer::magneticFieldToken_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
Definition: LightPFTrackProducer.cc:31
PFTrackTransformer.h
edm::Handle< reco::TrackCollection >
LightPFTrackProducer::endRun
void endRun(const edm::Run &, const edm::EventSetup &) override
Definition: LightPFTrackProducer.cc:89
edm::Ref< TrackCollection >
LightPFTrackProducer
Definition: LightPFTrackProducer.cc:12
quality
const uint32_t *__restrict__ Quality * quality
Definition: CAHitNtupletGeneratorKernelsImpl.h:122
MakerMacros.h
PFTrackTransformer::addPoints
bool addPoints(reco::PFRecTrack &pftrack, const reco::Track &track, const Trajectory &traj, bool msgwarning=true) const
Add points to a PFTrack. return false if a TSOS is invalid.
Definition: PFTrackTransformer.cc:40
Track.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
LightPFTrackProducer::useQuality_
bool useQuality_
TRACK QUALITY.
Definition: LightPFTrackProducer.cc:33
IdealMagneticFieldRecord.h
LightPFTrackProducer::pfTransformer_
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
Definition: LightPFTrackProducer.cc:28
Point3DBase< float, GlobalTag >
LightPFTrackProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Produce the PFRecTrack collection.
Definition: LightPFTrackProducer.cc:57
edm::ParameterSet
Definition: ParameterSet.h:47
edm::Transition
Transition
Definition: Transition.h:12
Event.h
LightPFTrackProducer::LightPFTrackProducer
LightPFTrackProducer(const edm::ParameterSet &)
Constructor.
Definition: LightPFTrackProducer.cc:42
math::XYZVector
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::stream::EDProducer
Definition: EDProducer.h:36
MagneticField.h
edm::EventSetup
Definition: EventSetup.h:58
PFRecTrack.h
LightPFTrackProducer::~LightPFTrackProducer
~LightPFTrackProducer() override
Destructor.
Definition: LightPFTrackProducer.cc:55
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord >
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
reco::TrackBase::qualityByName
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:126
Trajectory.h
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
writedatasetfile.run
run
Definition: writedatasetfile.py:27
reco::PFRecTrack
reconstructed track used as an input to particle flow
Definition: PFRecTrack.h:20
Trajectory
Definition: Trajectory.h:38
PFTrackTransformer::OnlyProp
void OnlyProp()
Definition: PFTrackTransformer.h:54
edm::Transition::BeginRun
LightPFTrackProducer::beginRun
void beginRun(const edm::Run &, const edm::EventSetup &) override
Definition: LightPFTrackProducer.cc:82
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
triggerMatcherToHLTDebug_cfi.tags
tags
Definition: triggerMatcherToHLTDebug_cfi.py:9
RunInfoPI::valid
Definition: RunInfoPayloadInspectoHelper.h:16
ParameterSet.h
PFTrackTransformer
Definition: PFTrackTransformer.h:34
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::Event
Definition: Event.h:73
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14