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 
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
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:68
l1t::FakeInputProducer::fMuIso
std::vector< int > fMuIso
Definition: FakeInputProducer.cc:76
MessageLogger.h
BXVector.h
l1t::FakeInputProducer::fEtSumBx
std::vector< int > fEtSumBx
Definition: FakeInputProducer.cc:92
EDProducer.h
l1t::FakeInputProducer::m_paramsCacheId
unsigned long long m_paramsCacheId
Definition: FakeInputProducer.cc:59
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:93
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:81
l1t::FakeInputProducer::fEgHwPhi
std::vector< int > fEgHwPhi
Definition: FakeInputProducer.cc:67
l1t::FakeInputProducer::fEtSumHwPhi
std::vector< int > fEtSumHwPhi
Definition: FakeInputProducer.cc:94
l1t::FakeInputProducer::fEgIso
std::vector< int > fEgIso
Definition: FakeInputProducer.cc:69
l1t::FakeInputProducer::fJetHwEta
std::vector< int > fJetHwEta
Definition: FakeInputProducer.cc:89
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:79
EGamma.h
l1t::FakeInputProducer
Definition: FakeInputProducer.cc:44
fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
l1t::FakeInputProducer::fJetHwPt
std::vector< int > fJetHwPt
Definition: FakeInputProducer.cc:87
l1t::FakeInputProducer::fTauHwPt
std::vector< int > fTauHwPt
Definition: FakeInputProducer.cc:80
EDGetToken.h
l1t::Jet
Definition: Jet.h:20
l1t::FakeInputProducer::fMuHwPt
std::vector< int > fMuHwPt
Definition: FakeInputProducer.cc:73
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
l1t::FakeInputProducer::fJetHwPhi
std::vector< int > fJetHwPhi
Definition: FakeInputProducer.cc:88
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
l1t
delete x;
Definition: CaloConfig.h:22
l1t::FakeInputProducer::fTauIso
std::vector< int > fTauIso
Definition: FakeInputProducer.cc:83
l1t::EtSum
Definition: EtSum.h:20
l1t::FakeInputProducer::fTauHwEta
std::vector< int > fTauHwEta
Definition: FakeInputProducer.cc:82
iEvent
int iEvent
Definition: GenABIO.cc:224
l1t::FakeInputProducer::fMuBx
std::vector< int > fMuBx
Definition: FakeInputProducer.cc:72
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
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
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:86
EventSetup.h
l1t::FakeInputProducer::fMuHwEta
std::vector< int > fMuHwEta
Definition: FakeInputProducer.cc:75
edm::EDProducer
Definition: EDProducer.h:35
l1t::FakeInputProducer::fMuHwPhi
std::vector< int > fMuHwPhi
Definition: FakeInputProducer.cc:74
ParameterSet.h
EtSum.h
l1t::FakeInputProducer::fEgHwPt
std::vector< int > fEgHwPt
Definition: FakeInputProducer.cc:66
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:65
Tau.h