CMS 3D CMS Logo

ProducerHT.cc
Go to the documentation of this file.
12 
17 
18 #include <string>
19 #include <numeric>
20 
21 using namespace std;
22 using namespace edm;
23 using namespace tt;
24 
25 namespace trackerTFP {
26 
32  class ProducerHT : public stream::EDProducer<> {
33  public:
34  explicit ProducerHT(const ParameterSet&);
35  ~ProducerHT() override {}
36 
37  private:
38  void beginRun(const Run&, const EventSetup&) override;
39  void produce(Event&, const EventSetup&) override;
40  virtual void endJob() {}
41 
42  // ED input token of gp stubs
44  // ED output token for accepted stubs
46  // ED output token for lost stubs
48  // Setup token
50  // DataFormats token
52  // configuration
54  // helper class to store configurations
55  const Setup* setup_ = nullptr;
56  // helper class to extract structured data from tt::Frames
57  const DataFormats* dataFormats_ = nullptr;
58  };
59 
60  ProducerHT::ProducerHT(const ParameterSet& iConfig) : iConfig_(iConfig) {
61  const string& label = iConfig.getParameter<string>("LabelGP");
62  const string& branchAccepted = iConfig.getParameter<string>("BranchAcceptedStubs");
63  const string& branchLost = iConfig.getParameter<string>("BranchLostStubs");
64  // book in- and output ED products
65  edGetToken_ = consumes<StreamsStub>(InputTag(label, branchAccepted));
66  edPutTokenAccepted_ = produces<StreamsStub>(branchAccepted);
67  edPutTokenLost_ = produces<StreamsStub>(branchLost);
68  // book ES products
69  esGetTokenSetup_ = esConsumes<Setup, SetupRcd, Transition::BeginRun>();
70  esGetTokenDataFormats_ = esConsumes<DataFormats, DataFormatsRcd, Transition::BeginRun>();
71  }
72 
73  void ProducerHT::beginRun(const Run& iRun, const EventSetup& iSetup) {
74  // helper class to store configurations
75  setup_ = &iSetup.getData(esGetTokenSetup_);
77  return;
78  // check process history if desired
79  if (iConfig_.getParameter<bool>("CheckHistory"))
81  // helper class to extract structured data from tt::Frames
83  }
84 
85  void ProducerHT::produce(Event& iEvent, const EventSetup& iSetup) {
86  // empty HT products
89  // read in DTC Product and produce TFP product
92  iEvent.getByToken<StreamsStub>(edGetToken_, handle);
93  const StreamsStub& streams = *handle.product();
94  for (int region = 0; region < setup_->numRegions(); region++) {
95  // object to find initial rough candidates in r-phi in a region
97  // read in and organize input product
98  ht.consume(streams);
99  // fill output products
100  ht.produce(accepted, lost);
101  }
102  }
103  // store products
104  iEvent.emplace(edPutTokenAccepted_, std::move(accepted));
105  iEvent.emplace(edPutTokenLost_, std::move(lost));
106  }
107 
108 } // namespace trackerTFP
109 
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
int numStreams(Process p) const
Definition: DataFormats.h:500
Class to process and provide run-time constants used by Track Trigger emulators.
Definition: Setup.h:44
std::vector< StreamStub > StreamsStub
Definition: TTTypes.h:66
void produce(Event &, const EventSetup &) override
Definition: ProducerHT.cc:85
~ProducerHT() override
Definition: ProducerHT.cc:35
virtual void endJob()
Definition: ProducerHT.cc:40
char const * label
int iEvent
Definition: GenABIO.cc:224
Definition: TTTypes.h:54
ESGetToken< Setup, SetupRcd > esGetTokenSetup_
Definition: ProducerHT.cc:49
L1TrackTrigger Hough Transform emulator.
Definition: ProducerHT.cc:32
bool configurationSupported() const
Definition: Setup.h:60
EDPutTokenT< StreamsStub > edPutTokenAccepted_
Definition: ProducerHT.cc:45
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ProcessHistory const & processHistory() const
Definition: Run.cc:115
void beginRun(const Run &, const EventSetup &) override
Definition: ProducerHT.cc:73
void checkHistory(const edm::ProcessHistory &processHistory) const
Definition: Setup.cc:242
ParameterSet iConfig_
Definition: ProducerHT.cc:53
int numRegions() const
Definition: Setup.h:349
HLT enums.
const Setup * setup_
Definition: ProducerHT.cc:55
Class to calculate and provide dataformats used by Track Trigger emulator.
Definition: DataFormats.h:216
ESGetToken< DataFormats, DataFormatsRcd > esGetTokenDataFormats_
Definition: ProducerHT.cc:51
const DataFormats * dataFormats_
Definition: ProducerHT.cc:57
def move(src, dest)
Definition: eostools.py:511
EDGetTokenT< StreamsStub > edGetToken_
Definition: ProducerHT.cc:43
Definition: Run.h:45
EDPutTokenT< StreamsStub > edPutTokenLost_
Definition: ProducerHT.cc:47