CMS 3D CMS Logo

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