CMS 3D CMS Logo

ProducerAS.cc
Go to the documentation of this file.
12 
15 
16 #include <string>
17 
18 using namespace std;
19 using namespace edm;
20 using namespace tt;
21 
22 namespace trklet {
23 
29  class ProducerAS : public stream::EDProducer<> {
30  public:
31  explicit ProducerAS(const ParameterSet&);
32  ~ProducerAS() override {}
33 
34  private:
35  void beginRun(const Run&, const EventSetup&) override;
36  void produce(Event&, const EventSetup&) override;
37  void endJob() {}
38 
39  // ED input token of kf tracks
41  // ED input token of kf TTtracks
43  // ED output token for TTTrackRefMap
45  // Setup token
47  // configuration
49  // helper class to store configurations
50  const Setup* setup_ = nullptr;
51  };
52 
53  ProducerAS::ProducerAS(const ParameterSet& iConfig) : iConfig_(iConfig) {
54  const string& labelKF = iConfig.getParameter<string>("LabelKF");
55  const string& labelTT = iConfig.getParameter<string>("LabelTT");
56  const string& branch = iConfig.getParameter<string>("BranchAcceptedTracks");
57  // book in- and output ED products
58  edGetTokenKF_ = consumes<StreamsTrack>(InputTag(labelKF, branch));
59  edGetTokenTT_ = consumes<TTTracks>(InputTag(labelTT, branch));
60  edPutToken_ = produces<TTTrackRefMap>(branch);
61  // book ES products
62  esGetTokenSetup_ = esConsumes<Setup, SetupRcd, Transition::BeginRun>();
63  }
64 
65  void ProducerAS::beginRun(const Run& iRun, const EventSetup& iSetup) {
66  // helper class to store configurations
67  setup_ = &iSetup.getData(esGetTokenSetup_);
69  return;
70  // check process history if desired
71  if (iConfig_.getParameter<bool>("CheckHistory"))
73  }
74 
75  void ProducerAS::produce(Event& iEvent, const EventSetup& iSetup) {
76  // empty KFTTTrack product
77  TTTrackRefMap ttTrackMap;
78  // read in KF Product and produce AssociatorKF product
80  Handle<StreamsTrack> handleKF;
81  iEvent.getByToken<StreamsTrack>(edGetTokenKF_, handleKF);
82  const StreamsTrack& streams = *handleKF.product();
83  Handle<TTTracks> handleTT;
84  iEvent.getByToken<TTTracks>(edGetTokenTT_, handleTT);
85  int i(0);
86  for (const StreamTrack& stream : streams)
87  for (const FrameTrack& frame : stream)
88  if (frame.first.isNonnull())
89  ttTrackMap.emplace(TTTrackRef(handleTT, i++), frame.first);
90  }
91  // store products
92  iEvent.emplace(edPutToken_, move(ttTrackMap));
93  }
94 
95 } // namespace trklet
96 
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::vector< StreamTrack > StreamsTrack
Definition: TTTypes.h:67
std::map< TTTrackRef, TTTrackRef > TTTrackRefMap
Definition: TTTypes.h:69
EDGetTokenT< TTTracks > edGetTokenTT_
Definition: ProducerAS.cc:42
Class to process and provide run-time constants used by Track Trigger emulators.
Definition: Setup.h:44
T const * product() const
Definition: Handle.h:70
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
ESGetToken< Setup, SetupRcd > esGetTokenSetup_
Definition: ProducerAS.cc:46
std::vector< FrameTrack > StreamTrack
Definition: TTTypes.h:64
std::pair< TTTrackRef, Frame > FrameTrack
Definition: TTTypes.h:62
int iEvent
Definition: GenABIO.cc:224
Definition: TTTypes.h:54
void beginRun(const Run &, const EventSetup &) override
Definition: ProducerAS.cc:65
bool configurationSupported() const
Definition: Setup.h:60
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ProcessHistory const & processHistory() const
Definition: Run.cc:115
bool getData(T &iHolder) const
Definition: EventSetup.h:122
EDGetTokenT< StreamsTrack > edGetTokenKF_
Definition: ProducerAS.cc:40
const Setup * setup_
Definition: ProducerAS.cc:50
~ProducerAS() override
Definition: ProducerAS.cc:32
void checkHistory(const edm::ProcessHistory &processHistory) const
Definition: Setup.cc:238
void produce(Event &, const EventSetup &) override
Definition: ProducerAS.cc:75
ParameterSet iConfig_
Definition: ProducerAS.cc:48
HLT enums.
std::vector< TTTrack< Ref_Phase2TrackerDigi_ > > TTTracks
Definition: TTTypes.h:70
EDPutTokenT< TTTrackRefMap > edPutToken_
Definition: ProducerAS.cc:44
def move(src, dest)
Definition: eostools.py:511
Definition: Run.h:45
Associate the TTTracks output by KF fitter with the tracks input to KF fitter.
Definition: ProducerAS.cc:29