CMS 3D CMS Logo

AlcaRecoTrackSelector.cc
Go to the documentation of this file.
4 
7 #include "TH1.h"
9 
10 using namespace std;
11 using namespace edm;
12 
14  : tracksTag_(ps.getUntrackedParameter<edm::InputTag>("trackInputTag", edm::InputTag("generalTracks"))),
15  tracksToken_(consumes<reco::TrackCollection>(tracksTag_)),
16  ptmin_(ps.getUntrackedParameter<double>("ptmin", 0.)),
17  pmin_(ps.getUntrackedParameter<double>("pmin", 0.)),
18  etamin_(ps.getUntrackedParameter<double>("etamin", -4.)),
19  etamax_(ps.getUntrackedParameter<double>("etamax", 4.)),
20  nhits_(ps.getUntrackedParameter<uint32_t>("nhits", 1)) {
21  produces<reco::TrackCollection>("");
22 }
23 
25  std::unique_ptr<reco::TrackCollection> outputTColl(new reco::TrackCollection());
26 
27  // Read Track collection
29  iEvent.getByToken(tracksToken_, tracks);
30 
31  if (tracks.isValid()) {
32  for (auto const& trk : *tracks) {
33  if (trk.pt() < ptmin_)
34  continue;
35  if (trk.p() < pmin_)
36  continue;
37  if (trk.eta() < etamin_)
38  continue;
39  if (trk.eta() > etamax_)
40  continue;
41  if (trk.hitPattern().numberOfAllHits(reco::HitPattern::TRACK_HITS) <= nhits_)
42  continue;
43  outputTColl->push_back(trk);
44  }
45 
46  } else {
47  edm::LogError("AlcaRecoTrackSelector") << "Error >> Failed to get AlcaRecoTrackSelector for label: " << tracksTag_;
48  }
49 
50  iEvent.put(std::move(outputTColl));
51 }
52 
53 // Define this as a plug-in
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
Log< level::Error, false > LogError
void produce(edm::StreamID streamID, edm::Event &iEvent, edm::EventSetup const &iSetup) const override
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
const edm::EDGetTokenT< reco::TrackCollection > tracksToken_
const edm::InputTag tracksTag_
AlcaRecoTrackSelector(const edm::ParameterSet &)
fixed size matrix
HLT enums.
def move(src, dest)
Definition: eostools.py:511