CMS 3D CMS Logo

ProducerZHT.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 ProducerZHT : public stream::EDProducer<> {
33  public:
34  explicit ProducerZHT(const ParameterSet&);
35  ~ProducerZHT() 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  ProducerZHT::ProducerZHT(const ParameterSet& iConfig) : iConfig_(iConfig) {
61  const string& label = iConfig.getParameter<string>("LabelMHT");
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 ProducerZHT::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 ProducerZHT::produce(Event& iEvent, const EventSetup& iSetup) {
86  // empty MHT products
89  // read in HT Product and produce MHT 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 in a region finer rough candidates in r-phi
97  // read in and organize input product
98  zht.consume(streams);
99  // fill output products
100  zht.produce(accepted, lost);
101  }
102  }
103  // store products
104  iEvent.emplace(edPutTokenAccepted_, move(accepted));
105  iEvent.emplace(edPutTokenLost_, move(lost));
106  }
107 
108 } // namespace trackerTFP
109 
virtual void endJob()
Definition: ProducerZHT.cc:40
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
EDGetTokenT< StreamsStub > edGetToken_
Definition: ProducerZHT.cc:43
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
ESGetToken< Setup, SetupRcd > esGetTokenSetup_
Definition: ProducerZHT.cc:49
EDPutTokenT< StreamsStub > edPutTokenAccepted_
Definition: ProducerZHT.cc:45
EDPutTokenT< StreamsStub > edPutTokenLost_
Definition: ProducerZHT.cc:47
void produce(Event &, const EventSetup &) override
Definition: ProducerZHT.cc:85
ESGetToken< DataFormats, DataFormatsRcd > esGetTokenDataFormats_
Definition: ProducerZHT.cc:51
char const * label
int iEvent
Definition: GenABIO.cc:224
Definition: TTTypes.h:54
const Setup * setup_
Definition: ProducerZHT.cc:55
bool configurationSupported() const
Definition: Setup.h:60
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void beginRun(const Run &, const EventSetup &) override
Definition: ProducerZHT.cc:73
ProcessHistory const & processHistory() const
Definition: Run.cc:115
void checkHistory(const edm::ProcessHistory &processHistory) const
Definition: Setup.cc:238
const DataFormats * dataFormats_
Definition: ProducerZHT.cc:57
int numRegions() const
Definition: Setup.h:345
HLT enums.
Class to calculate and provide dataformats used by Track Trigger emulator.
Definition: DataFormats.h:216
L1TrackTrigger r-z Hough Transform emulator.
Definition: ProducerZHT.cc:32
def move(src, dest)
Definition: eostools.py:511
Definition: Run.h:45