CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Phase2TrackerRecHits.cc
Go to the documentation of this file.
12 
17 
23 
26 
27 #include <vector>
28 #include <string>
29 
31 public:
32  explicit Phase2TrackerRecHits(const edm::ParameterSet& conf);
33  ~Phase2TrackerRecHits() override{};
34  void produce(edm::StreamID sid, edm::Event& event, const edm::EventSetup& eventSetup) const final;
35 
36 private:
39 
41 };
42 
45  tCPE_(esConsumes(conf.getParameter<edm::ESInputTag>("Phase2StripCPE"))),
46  token_(consumes<Phase2TrackerCluster1DCollectionNew>(conf.getParameter<edm::InputTag>("src"))) {
47  produces<Phase2TrackerRecHit1DCollectionNew>();
48 }
49 
51  // Get the Clusters
53  event.getByToken(token_, clusters);
54 
55  // load the cpe via the eventsetup
56  const auto& cpe = &eventSetup.getData(tCPE_);
57 
58  // Get the geometry
59  const TrackerGeometry* tkGeom = &eventSetup.getData(tTrackerGeom_);
60 
61  // Global container for the RecHits of each module
62  auto outputRecHits = std::make_unique<Phase2TrackerRecHit1DCollectionNew>();
63 
64  // Loop over clusters
65  for (const auto& clusterDetSet : *clusters) {
66  DetId detId(clusterDetSet.detId());
67 
68  // Geometry
69  const GeomDetUnit* geomDetUnit(tkGeom->idToDetUnit(detId));
70 
71  // Container for the clusters that will be produced for this modules
72  Phase2TrackerRecHit1DCollectionNew::FastFiller rechits(*outputRecHits, clusterDetSet.detId());
73 
74  for (const auto& clusterRef : clusterDetSet) {
76  cpe->localParameters(clusterRef, *geomDetUnit);
77 
78  // Create a persistent edm::Ref to the cluster
80  edmNew::makeRefTo(clusters, &clusterRef);
81 
82  // Make a RecHit and add it to the DetSet
83  Phase2TrackerRecHit1D hit(lv.first, lv.second, *geomDetUnit, cluster);
84 
85  rechits.push_back(hit);
86  }
87  }
88 
89  outputRecHits->shrink_to_fit();
90  event.put(std::move(outputRecHits));
91 }
92 
edm::Ref< typename HandleT::element_type, typename HandleT::element_type::value_type::value_type > makeRefTo(const HandleT &iHandle, typename HandleT::element_type::value_type::const_iterator itIter)
edm::ESGetToken< ClusterParameterEstimator< Phase2TrackerCluster1D >, TkPhase2OTCPERecord > const tCPE_
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
bool getData(T &iHolder) const
Definition: EventSetup.h:122
virtual LocalValues localParameters(const T &, const GeomDetUnit &) const =0
def move
Definition: eostools.py:511
Phase2TrackerRecHits(const edm::ParameterSet &conf)
edm::EDGetTokenT< Phase2TrackerCluster1DCollectionNew > token_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > const tTrackerGeom_
Definition: DetId.h:17
void produce(edm::StreamID sid, edm::Event &event, const edm::EventSetup &eventSetup) const final
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283