CMS 3D CMS Logo

ProducerMHT.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 ProducerMHT : public stream::EDProducer<> {
33  public:
34  explicit ProducerMHT(const ParameterSet&);
35  ~ProducerMHT() 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  ProducerMHT::ProducerMHT(const ParameterSet& iConfig) : iConfig_(iConfig) {
61  const string& label = iConfig.getParameter<string>("LabelHT");
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 ProducerMHT::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 ProducerMHT::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  mht.consume(streams);
99  // fill output products
100  mht.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 
ESGetToken< DataFormats, DataFormatsRcd > esGetTokenDataFormats_
Definition: ProducerMHT.cc:51
ESGetToken< Setup, SetupRcd > esGetTokenSetup_
Definition: ProducerMHT.cc:49
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
void beginRun(const Run &, const EventSetup &) override
Definition: ProducerMHT.cc:73
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 > edPutTokenAccepted_
Definition: ProducerMHT.cc:45
EDGetTokenT< StreamsStub > edGetToken_
Definition: ProducerMHT.cc:43
char const * label
int iEvent
Definition: GenABIO.cc:224
Definition: TTTypes.h:54
const DataFormats * dataFormats_
Definition: ProducerMHT.cc:57
virtual void endJob()
Definition: ProducerMHT.cc:40
bool configurationSupported() const
Definition: Setup.h:60
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ProcessHistory const & processHistory() const
Definition: Run.cc:115
void checkHistory(const edm::ProcessHistory &processHistory) const
Definition: Setup.cc:238
EDPutTokenT< StreamsStub > edPutTokenLost_
Definition: ProducerMHT.cc:47
L1TrackTrigger Mini Hough Transform emulator.
Definition: ProducerMHT.cc:32
int numRegions() const
Definition: Setup.h:345
HLT enums.
const Setup * setup_
Definition: ProducerMHT.cc:55
Class to calculate and provide dataformats used by Track Trigger emulator.
Definition: DataFormats.h:216
def move(src, dest)
Definition: eostools.py:511
Definition: Run.h:45
void produce(Event &, const EventSetup &) override
Definition: ProducerMHT.cc:85