Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:28:38

0001 #include <vector>
0002 
0003 #include "DataFormats/Common/interface/OrphanHandle.h"
0004 #include "DataFormats/TrackReco/interface/Track.h"
0005 #include "DataFormats/TrackReco/interface/TrackExtra.h"
0006 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0007 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0008 #include "DataFormats/TrajectoryState/interface/LocalTrajectoryParameters.h"
0009 #include "FWCore/Framework/interface/Event.h"
0010 #include "FWCore/Framework/interface/EventSetup.h"
0011 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0012 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0013 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0014 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0015 #include "Geometry/Records/interface/TrackerTopologyRcd.h"
0016 
0017 #include "FWCore/Framework/interface/stream/EDProducer.h"
0018 #include "RecoTracker/PixelTrackFitting/interface/PixelTrackReconstruction.h"
0019 #include "Geometry/Records/interface/TrackerTopologyRcd.h"
0020 #include "storeTracks.h"
0021 
0022 #include "FWCore/PluginManager/interface/ModuleDef.h"
0023 #include "FWCore/Framework/interface/MakerMacros.h"
0024 
0025 namespace edm {
0026   class Event;
0027   class EventSetup;
0028   class ParameterSet;
0029   class ConfigurationDescriptions;
0030 }  // namespace edm
0031 class TrackerTopology;
0032 
0033 using namespace pixeltrackfitting;
0034 using edm::ParameterSet;
0035 
0036 class PixelTrackProducer : public edm::stream::EDProducer<> {
0037 public:
0038   explicit PixelTrackProducer(const edm::ParameterSet& cfg)
0039       : theReconstruction(cfg, consumesCollector()), htTopoToken_(esConsumes()) {
0040     edm::LogInfo("PixelTrackProducer") << " construction...";
0041     produces<TrackingRecHitCollection>();
0042     produces<reco::TrackExtraCollection>();
0043     // TrackCollection refers to TrackingRechit and TrackExtra
0044     // collections, need to declare its production after them to work
0045     // around a rare race condition in framework scheduling
0046     produces<reco::TrackCollection>();
0047   }
0048 
0049   ~PixelTrackProducer() override = default;
0050 
0051   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0052     edm::ParameterSetDescription desc;
0053 
0054     desc.add<std::string>("passLabel", "pixelTracks");  // What is this? It is not used anywhere in this code.
0055     PixelTrackReconstruction::fillDescriptions(desc);
0056 
0057     descriptions.add("pixelTracks", desc);
0058   }
0059 
0060   void produce(edm::Event& ev, const edm::EventSetup& es) override {
0061     LogDebug("PixelTrackProducer, produce") << "event# :" << ev.id();
0062 
0063     TracksWithTTRHs tracks;
0064     theReconstruction.run(tracks, ev, es);
0065     auto htTopo = es.getData(htTopoToken_);
0066 
0067     // store tracks
0068     storeTracks(ev, tracks, htTopo);
0069   }
0070 
0071 private:
0072   PixelTrackReconstruction theReconstruction;
0073   const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> htTopoToken_;
0074 };
0075 
0076 DEFINE_FWK_MODULE(PixelTrackProducer);