CMS 3D CMS Logo

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