CMS 3D CMS Logo

SeedCombiner.cc
Go to the documentation of this file.
1 #include "SeedCombiner.h"
2 
7 
9 
13 
16 
20 
22 
25 
26 using namespace edm;
27 //using namespace reco;
28 
30  inputCollections_ =
31  edm::vector_transform(cfg.getParameter<std::vector<edm::InputTag> >("seedCollections"),
32  [this](edm::InputTag const& tag) { return consumes<TrajectorySeedCollection>(tag); });
33  produces<TrajectorySeedCollection>();
34  reKeing_ = false;
35  if (cfg.exists("clusterRemovalInfos")) {
36  clusterRemovalInfos_ = cfg.getParameter<std::vector<edm::InputTag> >("clusterRemovalInfos");
37  clusterRemovalTokens_.resize(clusterRemovalInfos_.size());
38  for (unsigned int i = 0; i < clusterRemovalInfos_.size(); ++i)
39  if (!(clusterRemovalInfos_[i] == edm::InputTag("")))
40  clusterRemovalTokens_[i] = consumes<reco::ClusterRemovalInfo>(clusterRemovalInfos_[i]);
41  if (!clusterRemovalInfos_.empty() && clusterRemovalInfos_.size() == inputCollections_.size())
42  reKeing_ = true;
43  }
44 }
45 
47 
49  // Read inputs, and count total seeds
50  size_t ninputs = inputCollections_.size();
51  size_t nseeds = 0;
52  std::vector<Handle<TrajectorySeedCollection> > seedCollections(ninputs);
53  for (size_t i = 0; i < ninputs; ++i) {
54  ev.getByToken(inputCollections_[i], seedCollections[i]);
55  nseeds += seedCollections[i]->size();
56  }
57 
58  // Prepare output collections, with the correct capacity
59  auto result = std::make_unique<TrajectorySeedCollection>();
60  result->reserve(nseeds);
61 
62  // Write into output collection
63  unsigned int iSC = 0, iSC_max = seedCollections.size();
64  for (; iSC != iSC_max; ++iSC) {
66  if (reKeing_ && !(clusterRemovalInfos_[iSC] == edm::InputTag(""))) {
67  ClusterRemovalRefSetter refSetter(ev, clusterRemovalTokens_[iSC]);
68 
69  for (TrajectorySeedCollection::const_iterator iS = collection->begin(); iS != collection->end(); ++iS) {
70  TrajectorySeed::RecHitContainer newRecHitContainer;
71  newRecHitContainer.reserve(iS->nHits());
72  //loop seed rechits, copy over and rekey.
73  for (auto const& recHit : iS->recHits()) {
74  newRecHitContainer.push_back(recHit);
75  refSetter.reKey(&newRecHitContainer.back());
76  }
77  result->push_back(TrajectorySeed(iS->startingState(), std::move(newRecHitContainer), iS->direction()));
78  }
79  } else {
80  //just insert the new seeds as they are
81  result->insert(result->end(), collection->begin(), collection->end());
82  }
83  }
84 
85  // Save result into the event
86  ev.put(std::move(result));
87 }
Handle.h
mps_fire.i
i
Definition: mps_fire.py:428
SeedGeneratorFromRegionHits.h
edm
HLT enums.
Definition: AlignableModifier.h:19
SeedCombiner.h
edm::Handle
Definition: AssociativeIterator.h:50
rpcPointValidation_cfi.recHit
recHit
Definition: rpcPointValidation_cfi.py:7
TrackingRegionProducer.h
TrackingRegionProducerFactory.h
ClusterRemovalRefSetter
Definition: ClusterRemovalRefSetter.h:21
seedmultiplicitymonitor_cfi.seedCollections
seedCollections
Definition: seedmultiplicitymonitor_cfi.py:5
SeedCombiner::produce
void produce(edm::Event &ev, const edm::EventSetup &es) override
Definition: SeedCombiner.cc:48
edm::OwnVector::back
reference back()
Definition: OwnVector.h:431
edm::vector_transform
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
edm::OwnVector::reserve
void reserve(size_t)
Definition: OwnVector.h:320
edm::ParameterSet
Definition: ParameterSet.h:47
SeedComparitorFactory.h
Event.h
SeedCombiner::~SeedCombiner
~SeedCombiner() override
Definition: SeedCombiner.cc:46
ClusterRemovalRefSetter.h
makeGlobalPositionRcd_cfg.tag
tag
Definition: makeGlobalPositionRcd_cfg.py:6
OrderedHitsGeneratorFactory.h
universalConfigTemplate.collection
collection
Definition: universalConfigTemplate.py:81
ClusterRemovalRefSetter::reKey
void reKey(TrackingRecHit *hit) const
edm::EventSetup
Definition: EventSetup.h:58
TrajectorySeedCollection.h
looper.cfg
cfg
Definition: looper.py:296
SeedComparitor.h
eostools.move
def move(src, dest)
Definition: eostools.py:511
transform.h
ev
bool ev
Definition: Hydjet2Hadronizer.cc:97
TrajectorySeed
Definition: TrajectorySeed.h:18
EventSetup.h
edm::OwnVector::push_back
void push_back(D *&d)
Definition: OwnVector.h:326
SeedCombiner::SeedCombiner
SeedCombiner(const edm::ParameterSet &cfg)
Definition: SeedCombiner.cc:29
mps_fire.result
result
Definition: mps_fire.py:311
TrackingRegion.h
ParameterSet.h
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
edm::OwnVector< TrackingRecHit >
OrderedHitsGenerator.h