CMS 3D CMS Logo

FastTrackerRecHitCombiner.cc
Go to the documentation of this file.
1 // system include files
2 #include <memory>
3 
4 // frame work stuff
11 
12 // specific for this producer
17 
23 
25 public:
27  ~FastTrackerRecHitCombiner() override { ; }
28 
29  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
30 
31 private:
32  void beginStream(edm::StreamID) override { ; }
33  void produce(edm::Event&, const edm::EventSetup&) override;
34  void endStream() override { ; }
35 
36  // ----------member data ---------------------------
39  unsigned int minNHits;
40 };
41 
43  : simHitsToken(consumes<edm::PSimHitContainer>(iConfig.getParameter<edm::InputTag>("simHits"))),
44  simHit2RecHitMapToken(
45  consumes<FastTrackerRecHitRefCollection>(iConfig.getParameter<edm::InputTag>("simHit2RecHitMap"))),
46  minNHits(iConfig.getParameter<unsigned int>("minNHits")) {
47  produces<FastTrackerRecHitCombinationCollection>();
48 }
49 
51  // input
53  iEvent.getByToken(simHitsToken, simHits);
54 
57 
58  // output
59  std::unique_ptr<FastTrackerRecHitCombinationCollection> output(new FastTrackerRecHitCombinationCollection);
60 
61  FastTrackerRecHitCombination currentCombination;
62  for (unsigned int simHitCounter = 0; simHitCounter < simHits->size(); simHitCounter++) {
63  // get simHit and recHit
64  const PSimHit& simHit = (*simHits)[simHitCounter];
65  const FastTrackerRecHitRef& recHit = (*simHit2RecHitMap)[simHitCounter];
66 
67  // add recHit to latest combination
68  if (!recHit.isNull())
69  currentCombination.push_back(recHit);
70 
71  // if simTrackId is about to change, add combination
72  if (simHits->size() - simHitCounter == 1 || simHit.trackId() != (*simHits)[simHitCounter + 1].trackId()) {
73  // combination must have sufficient hits
74  if (currentCombination.size() >= minNHits) {
75  currentCombination.shrink_to_fit();
76  output->push_back(currentCombination);
77  }
78  currentCombination.clear();
79  }
80  }
81 
82  // put output in event
83  iEvent.put(std::move(output));
84 }
85 
86 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
88  //The following says we do not know what parameters are allowed so do no validation
89  // Please change this to state exactly what you do use, even if it is no parameters
91  desc.setUnknown();
92  descriptions.addDefault(desc);
93 }
94 
95 //define this as a plug-in
edm::StreamID
Definition: StreamID.h:30
TrackerGeometry.h
ESHandle.h
FastTrackerRecHitCombiner::endStream
void endStream() override
Definition: FastTrackerRecHitCombiner.cc:34
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
edm::EDGetTokenT< edm::PSimHitContainer >
edm
HLT enums.
Definition: AlignableModifier.h:19
PSimHitContainer.h
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89281
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
EDProducer.h
FastTrackerRecHitCombiner_cfi.simHits
simHits
Definition: FastTrackerRecHitCombiner_cfi.py:5
FastTrackerRecHitCombiner
Definition: FastTrackerRecHitCombiner.cc:24
FastTrackerRecHitCombiner::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: FastTrackerRecHitCombiner.cc:50
edm::Handle< edm::PSimHitContainer >
FastTrackerRecHitCombiner_cfi.minNHits
minNHits
Definition: FastTrackerRecHitCombiner_cfi.py:7
rpcPointValidation_cfi.recHit
recHit
Definition: rpcPointValidation_cfi.py:7
FastTrackerRecHitCombiner::~FastTrackerRecHitCombiner
~FastTrackerRecHitCombiner() override
Definition: FastTrackerRecHitCombiner.cc:27
edm::Ref
Definition: AssociativeIterator.h:58
MakerMacros.h
FastTrackerRecHitSplitter.h
TrackerTopologyRcd.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
rpcPointValidation_cfi.simHit
simHit
Definition: rpcPointValidation_cfi.py:24
Reconstruction_BefMix_cff.simHit2RecHitMap
simHit2RecHitMap
Definition: Reconstruction_BefMix_cff.py:22
FastTrackerRecHitCombiner::minNHits
unsigned int minNHits
Definition: FastTrackerRecHitCombiner.cc:39
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
FastTrackerRecHitCombinationCollection
std::vector< FastTrackerRecHitCombination > FastTrackerRecHitCombinationCollection
Definition: FastTrackerRecHitCollection.h:12
FastTrackerRecHitCombiner::simHitsToken
edm::EDGetTokenT< edm::PSimHitContainer > simHitsToken
Definition: FastTrackerRecHitCombiner.cc:37
TrackerDigiGeometryRecord.h
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::stream::EDProducer
Definition: EDProducer.h:38
edm::EventSetup
Definition: EventSetup.h:58
FastTrackerRecHitCollection.h
FastTrackerRecHitRefCollection
std::vector< FastTrackerRecHitRef > FastTrackerRecHitRefCollection
Definition: FastTrackerRecHitCollection.h:10
FastTrackerRecHitCombiner::simHit2RecHitMapToken
edm::EDGetTokenT< FastTrackerRecHitRefCollection > simHit2RecHitMapToken
Definition: FastTrackerRecHitCombiner.cc:38
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
FastTrackerRecHitCombination
std::vector< FastTrackerRecHitRef > FastTrackerRecHitCombination
Definition: FastTrackerRecHitCollection.h:11
Frameworkfwd.h
FastTrackerRecHitCombiner::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: FastTrackerRecHitCombiner.cc:87
EventSetup.h
FastTrackerRecHitCombiner::beginStream
void beginStream(edm::StreamID) override
Definition: FastTrackerRecHitCombiner.cc:32
FastTrackerRecHitCombiner::FastTrackerRecHitCombiner
FastTrackerRecHitCombiner(const edm::ParameterSet &)
Definition: FastTrackerRecHitCombiner.cc:42
edm::PSimHitContainer
std::vector< PSimHit > PSimHitContainer
Definition: PSimHitContainer.h:11
ParameterSet.h
PSimHit
Definition: PSimHit.h:15
edm::Event
Definition: Event.h:73
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
StreamID.h
SimTrackContainer.h