CMS 3D CMS Logo

Phase2TrackerRecHits.cc
Go to the documentation of this file.
12 
17 
23 
26 
27 #include <vector>
28 #include <string>
29 
31 
32  public:
33 
34  explicit Phase2TrackerRecHits(const edm::ParameterSet& conf);
35  virtual ~Phase2TrackerRecHits() {};
36  void produce(edm::StreamID sid, edm::Event& event, const edm::EventSetup& eventSetup) const override final;
37 
38  private:
39 
42 
43 };
44 
46  token_(consumes< Phase2TrackerCluster1DCollectionNew >(conf.getParameter<edm::InputTag>("src"))),
47  cpeTag_(conf.getParameter<edm::ESInputTag>("Phase2StripCPE")) {
48  produces<Phase2TrackerRecHit1DCollectionNew>();
49 }
50 
52 
53  // Get the Clusters
55  event.getByToken(token_, clusters);
56 
57  // load the cpe via the eventsetup
59  eventSetup.get<TkStripCPERecord>().get(cpeTag_, cpe);
60 
61  // Get the geometry
63  eventSetup.get< TrackerDigiGeometryRecord >().get(geomHandle);
64  const TrackerGeometry* tkGeom(&(*geomHandle));
65 
66  // Global container for the RecHits of each module
67  auto outputRecHits = std::make_unique<Phase2TrackerRecHit1DCollectionNew>();
68 
69  // Loop over clusters
70  for (const auto &clusterDetSet : *clusters) {
71 
72  DetId detId(clusterDetSet.detId());
73 
74  // Geometry
75  const GeomDetUnit * geomDetUnit(tkGeom->idToDetUnit(detId));
76 
77  // Container for the clusters that will be produced for this modules
78  Phase2TrackerRecHit1DCollectionNew::FastFiller rechits(*outputRecHits, clusterDetSet.detId());
79 
80  for (const auto &clusterRef : clusterDetSet) {
81  ClusterParameterEstimator< Phase2TrackerCluster1D >::LocalValues lv = cpe->localParameters(clusterRef, *geomDetUnit);
82 
83  // Create a persistent edm::Ref to the cluster
85 
86  // Make a RecHit and add it to the DetSet
87  Phase2TrackerRecHit1D hit(lv.first, lv.second, *geomDetUnit, cluster);
88 
89  rechits.push_back(hit);
90  }
91  }
92 
93  outputRecHits->shrink_to_fit();
94  event.put(std::move(outputRecHits));
95 
96 }
97 
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)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
void produce(edm::StreamID sid, edm::Event &event, const edm::EventSetup &eventSetup) const override final
Phase2TrackerRecHits(const edm::ParameterSet &conf)
Definition: DetId.h:18
const T & get() const
Definition: EventSetup.h:55
HLT enums.
edm::EDGetTokenT< Phase2TrackerCluster1DCollectionNew > token_
def move(src, dest)
Definition: eostools.py:510
Definition: event.py:1