CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
FakeInputProducer.cc
Go to the documentation of this file.
1 
11 // system include files
12 #include <memory>
13 
14 // user include files
15 
25 
26 //#include <vector>
28 
34 
35 using namespace std;
36 using namespace edm;
37 
38 namespace l1t {
39 
40  //
41  // class declaration
42  //
43 
44  class FakeInputProducer : public EDProducer {
45  public:
46  explicit FakeInputProducer(const ParameterSet&);
47  ~FakeInputProducer() override;
48 
49  static void fillDescriptions(ConfigurationDescriptions& descriptions);
50 
51  private:
52  void produce(Event&, EventSetup const&) override;
53  void beginJob() override;
54  void endJob() override;
55  void beginRun(Run const& iR, EventSetup const& iE) override;
56  void endRun(Run const& iR, EventSetup const& iE) override;
57 
58  // ----------member data ---------------------------
59  unsigned long long m_paramsCacheId; // Cache-ID from current parameters, to check if needs to be updated.
60  //std::shared_ptr<const CaloParams> m_dbpars; // Database parameters for the trigger, to be updated as needed.
61  //std::shared_ptr<const FirmwareVersion> m_fwv;
62  //std::shared_ptr<FirmwareVersion> m_fwv; //not const during testing.
63 
64  // Parameters for EG
65  std::vector<int> fEgBx;
66  std::vector<int> fEgHwPt;
67  std::vector<int> fEgHwPhi;
68  std::vector<int> fEgHwEta;
69  std::vector<int> fEgIso;
70 
71  // Parameters for Mu
72  std::vector<int> fMuBx;
73  std::vector<int> fMuHwPt;
74  std::vector<int> fMuHwPhi;
75  std::vector<int> fMuHwEta;
76  std::vector<int> fMuIso;
77 
78  // Parameters for Tau
79  std::vector<int> fTauBx;
80  std::vector<int> fTauHwPt;
81  std::vector<int> fTauHwPhi;
82  std::vector<int> fTauHwEta;
83  std::vector<int> fTauIso;
84 
85  // Parameters for Jet
86  std::vector<int> fJetBx;
87  std::vector<int> fJetHwPt;
88  std::vector<int> fJetHwPhi;
89  std::vector<int> fJetHwEta;
90 
91  // Parameters for EtSum
92  std::vector<int> fEtSumBx;
93  std::vector<int> fEtSumHwPt;
94  std::vector<int> fEtSumHwPhi;
95  };
96 
97  //
98  // constructors and destructor
99  //
100  FakeInputProducer::FakeInputProducer(const ParameterSet& iConfig) {
101  // register what you produce
102  produces<BXVector<l1t::EGamma>>();
103  produces<BXVector<l1t::Muon>>();
104  produces<BXVector<l1t::Tau>>();
105  produces<BXVector<l1t::Jet>>();
106  produces<BXVector<l1t::EtSum>>();
107 
108  // Setup Parameter Set for EG
109  ParameterSet eg_params = iConfig.getUntrackedParameter<ParameterSet>("egParams");
110 
111  fEgBx = eg_params.getUntrackedParameter<vector<int>>("egBx");
112  fEgHwPt = eg_params.getUntrackedParameter<vector<int>>("egHwPt");
113  fEgHwPhi = eg_params.getUntrackedParameter<vector<int>>("egHwPhi");
114  fEgHwEta = eg_params.getUntrackedParameter<vector<int>>("egHwEta");
115  fEgIso = eg_params.getUntrackedParameter<vector<int>>("egIso");
116 
117  // Setup Parameter Set for Muon
118  ParameterSet mu_params = iConfig.getUntrackedParameter<ParameterSet>("muParams");
119 
120  fMuBx = mu_params.getUntrackedParameter<vector<int>>("muBx");
121  fMuHwPt = mu_params.getUntrackedParameter<vector<int>>("muHwPt");
122  fMuHwPhi = mu_params.getUntrackedParameter<vector<int>>("muHwPhi");
123  fMuHwEta = mu_params.getUntrackedParameter<vector<int>>("muHwEta");
124  fMuIso = mu_params.getUntrackedParameter<vector<int>>("muIso");
125 
126  // Setup Parameter Set for taus
127  ParameterSet tau_params = iConfig.getUntrackedParameter<ParameterSet>("tauParams");
128 
129  fTauBx = tau_params.getUntrackedParameter<vector<int>>("tauBx");
130  fTauHwPt = tau_params.getUntrackedParameter<vector<int>>("tauHwPt");
131  fTauHwPhi = tau_params.getUntrackedParameter<vector<int>>("tauHwPhi");
132  fTauHwEta = tau_params.getUntrackedParameter<vector<int>>("tauHwEta");
133  fTauIso = tau_params.getUntrackedParameter<vector<int>>("tauIso");
134 
135  // Setup Parameter Set for jet
136  ParameterSet jet_params = iConfig.getUntrackedParameter<ParameterSet>("jetParams");
137 
138  fJetBx = jet_params.getUntrackedParameter<vector<int>>("jetBx");
139  fJetHwPt = jet_params.getUntrackedParameter<vector<int>>("jetHwPt");
140  fJetHwPhi = jet_params.getUntrackedParameter<vector<int>>("jetHwPhi");
141  fJetHwEta = jet_params.getUntrackedParameter<vector<int>>("jetHwEta");
142 
143  // Setup Parameter Set for EtSums
144  ParameterSet etsum_params = iConfig.getUntrackedParameter<ParameterSet>("etsumParams");
145 
146  fEtSumBx = etsum_params.getUntrackedParameter<vector<int>>("etsumBx");
147  fEtSumHwPt = etsum_params.getUntrackedParameter<vector<int>>("etsumHwPt");
148  fEtSumHwPhi = etsum_params.getUntrackedParameter<vector<int>>("etsumHwPhi");
149 
150  // set cache id to zero, will be set at first beginRun:
151  m_paramsCacheId = 0;
152  }
153 
154  FakeInputProducer::~FakeInputProducer() {}
155 
156  //
157  // member functions
158  //
159 
160  // ------------ method called to produce the data ------------
161  void FakeInputProducer::produce(Event& iEvent, const EventSetup& iSetup) {
162  LogDebug("l1t|Global") << "FakeInputProducer::produce function called...\n";
163 
164  // Set the range of BX....TO DO...move to Params or determine from param set.
165  int bxFirst = -2;
166  int bxLast = 2;
167 
168  //outputs
169  std::unique_ptr<l1t::EGammaBxCollection> egammas(new l1t::EGammaBxCollection(0, bxFirst, bxLast));
170  std::unique_ptr<l1t::MuonBxCollection> muons(new l1t::MuonBxCollection(0, bxFirst, bxLast));
171  std::unique_ptr<l1t::TauBxCollection> taus(new l1t::TauBxCollection(0, bxFirst, bxLast));
172  std::unique_ptr<l1t::JetBxCollection> jets(new l1t::JetBxCollection(0, bxFirst, bxLast));
173  std::unique_ptr<l1t::EtSumBxCollection> etsums(new l1t::EtSumBxCollection(0, bxFirst, bxLast));
174 
175  // Put EG into Collections
176  for (unsigned int it = 0; it < fEgBx.size(); it++) {
177  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>* egLorentz =
178  new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>();
179  l1t::EGamma fakeEG(*egLorentz, fEgHwPt.at(it), fEgHwEta.at(it), fEgHwPhi.at(it), 0, fEgIso.at(it));
180  egammas->push_back(fEgBx.at(it), fakeEG);
181  }
182 
183  // Put Muons into Collections
184  for (unsigned int it = 0; it < fMuBx.size(); it++) {
185  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>* muLorentz =
186  new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>();
187  l1t::Muon fakeMU(*muLorentz, fMuHwPt.at(it), fMuHwEta.at(it), fMuHwPhi.at(it), 4, 0, 0, fMuIso.at(it));
188  muons->push_back(fMuBx.at(it), fakeMU);
189  }
190 
191  // Put Taus into Collections
192  for (unsigned int it = 0; it < fTauBx.size(); it++) {
193  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>* tauLorentz =
194  new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>();
195  l1t::Tau fakeTAU(*tauLorentz, fTauHwPt.at(it), fTauHwEta.at(it), fTauHwPhi.at(it), 0, fTauIso.at(it));
196  taus->push_back(fTauBx.at(it), fakeTAU);
197  }
198 
199  // Put Jets into Collections
200  for (unsigned int it = 0; it < fJetBx.size(); it++) {
201  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>* jetLorentz =
202  new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>();
203  l1t::Jet fakeJET(*jetLorentz, fJetHwPt.at(it), fJetHwEta.at(it), fJetHwPhi.at(it), 0);
204  jets->push_back(fJetBx.at(it), fakeJET);
205  }
206 
207  // Put EtSums into Collections
208  for (unsigned int it = 0; it < fEtSumBx.size(); it++) {
209  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>* etsumLorentz =
210  new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>();
211  l1t::EtSum fakeETSUM(
212  *etsumLorentz, l1t::EtSum::EtSumType::kMissingEt, fEtSumHwPt.at(it), 0, fEtSumHwPhi.at(it), 0);
213  etsums->push_back(fEtSumBx.at(it), fakeETSUM);
214  }
215 
216  iEvent.put(std::move(egammas));
217  iEvent.put(std::move(muons));
218  iEvent.put(std::move(taus));
219  iEvent.put(std::move(jets));
220  iEvent.put(std::move(etsums));
221  }
222 
223  // ------------ method called once each job just before starting event loop ------------
225 
226  // ------------ method called once each job just after ending the event loop ------------
227  void FakeInputProducer::endJob() {}
228 
229  // ------------ method called when starting to processes a run ------------
230 
231  void FakeInputProducer::beginRun(Run const& iR, EventSetup const& iE) {
232  LogDebug("l1t|Global") << "FakeInputProducer::beginRun function called...\n";
233  }
234 
235  // ------------ method called when ending the processing of a run ------------
236  void FakeInputProducer::endRun(Run const& iR, EventSetup const& iE) {}
237 
238  // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
240  //The following says we do not know what parameters are allowed so do no validation
241  // Please change this to state exactly what you do use, even if it is no parameters
243  desc.setUnknown();
244  descriptions.addDefault(desc);
245  }
246 
247 } // namespace l1t
248 
249 //define this as a plug-in
std::vector< int > fJetHwPt
T getUntrackedParameter(std::string const &, T const &) const
std::vector< int > fJetHwPhi
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
std::vector< int > fMuHwPt
std::vector< int > fMuBx
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Definition: Tau.h:20
std::vector< int > fTauHwPt
void beginJob()
Definition: Breakpoints.cc:14
std::vector< int > fJetBx
Definition: Jet.h:20
int iEvent
Definition: GenABIO.cc:224
void addDefault(ParameterSetDescription const &psetDescription)
std::vector< int > fTauHwEta
vector< PseudoJet > jets
def move
Definition: eostools.py:511
std::vector< int > fTauBx
std::vector< int > fEgHwEta
Definition: Muon.h:21
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< int > fMuHwPhi
std::vector< int > fEgBx
std::vector< int > fEtSumHwPhi
std::vector< int > fEgHwPt
std::vector< int > fEgHwPhi
std::vector< int > fTauIso
tuple muons
Definition: patZpeak.py:41
std::vector< int > fJetHwEta
std::vector< int > fEgIso
std::vector< int > fTauHwPhi
std::vector< int > fMuIso
std::vector< int > fEtSumBx
unsigned long long m_paramsCacheId
Definition: Run.h:45
std::vector< int > fEtSumHwPt
#define LogDebug(id)
std::vector< int > fMuHwEta