CMS 3D CMS Logo

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