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 
45  public:
46  explicit FakeInputProducer(const ParameterSet&);
47  ~FakeInputProducer() override;
48 
49  static void fillDescriptions(ConfigurationDescriptions& descriptions);
50 
51  private:
52  void produce(StreamID, Event&, EventSetup const&) const override;
53 
54  // ----------member data ---------------------------
55  //std::shared_ptr<const CaloParams> m_dbpars; // Database parameters for the trigger, to be updated as needed.
56  //std::shared_ptr<const FirmwareVersion> m_fwv;
57  //std::shared_ptr<FirmwareVersion> m_fwv; //not const during testing.
58 
59  // Parameters for EG
60  std::vector<int> fEgBx;
61  std::vector<int> fEgHwPt;
62  std::vector<int> fEgHwPhi;
63  std::vector<int> fEgHwEta;
64  std::vector<int> fEgIso;
65 
66  // Parameters for Mu
67  std::vector<int> fMuBx;
68  std::vector<int> fMuHwPt;
69  std::vector<int> fMuHwPhi;
70  std::vector<int> fMuHwEta;
71  std::vector<int> fMuIso;
72 
73  // Parameters for Tau
74  std::vector<int> fTauBx;
75  std::vector<int> fTauHwPt;
76  std::vector<int> fTauHwPhi;
77  std::vector<int> fTauHwEta;
78  std::vector<int> fTauIso;
79 
80  // Parameters for Jet
81  std::vector<int> fJetBx;
82  std::vector<int> fJetHwPt;
83  std::vector<int> fJetHwPhi;
84  std::vector<int> fJetHwEta;
85 
86  // Parameters for EtSum
87  std::vector<int> fEtSumBx;
88  std::vector<int> fEtSumHwPt;
89  std::vector<int> fEtSumHwPhi;
90  };
91 
92  //
93  // constructors and destructor
94  //
95  FakeInputProducer::FakeInputProducer(const ParameterSet& iConfig) {
96  // register what you produce
97  produces<BXVector<l1t::EGamma>>();
98  produces<BXVector<l1t::Muon>>();
99  produces<BXVector<l1t::Tau>>();
100  produces<BXVector<l1t::Jet>>();
101  produces<BXVector<l1t::EtSum>>();
102 
103  // Setup Parameter Set for EG
104  ParameterSet eg_params = iConfig.getUntrackedParameter<ParameterSet>("egParams");
105 
106  fEgBx = eg_params.getUntrackedParameter<vector<int>>("egBx");
107  fEgHwPt = eg_params.getUntrackedParameter<vector<int>>("egHwPt");
108  fEgHwPhi = eg_params.getUntrackedParameter<vector<int>>("egHwPhi");
109  fEgHwEta = eg_params.getUntrackedParameter<vector<int>>("egHwEta");
110  fEgIso = eg_params.getUntrackedParameter<vector<int>>("egIso");
111 
112  // Setup Parameter Set for Muon
113  ParameterSet mu_params = iConfig.getUntrackedParameter<ParameterSet>("muParams");
114 
115  fMuBx = mu_params.getUntrackedParameter<vector<int>>("muBx");
116  fMuHwPt = mu_params.getUntrackedParameter<vector<int>>("muHwPt");
117  fMuHwPhi = mu_params.getUntrackedParameter<vector<int>>("muHwPhi");
118  fMuHwEta = mu_params.getUntrackedParameter<vector<int>>("muHwEta");
119  fMuIso = mu_params.getUntrackedParameter<vector<int>>("muIso");
120 
121  // Setup Parameter Set for taus
122  ParameterSet tau_params = iConfig.getUntrackedParameter<ParameterSet>("tauParams");
123 
124  fTauBx = tau_params.getUntrackedParameter<vector<int>>("tauBx");
125  fTauHwPt = tau_params.getUntrackedParameter<vector<int>>("tauHwPt");
126  fTauHwPhi = tau_params.getUntrackedParameter<vector<int>>("tauHwPhi");
127  fTauHwEta = tau_params.getUntrackedParameter<vector<int>>("tauHwEta");
128  fTauIso = tau_params.getUntrackedParameter<vector<int>>("tauIso");
129 
130  // Setup Parameter Set for jet
131  ParameterSet jet_params = iConfig.getUntrackedParameter<ParameterSet>("jetParams");
132 
133  fJetBx = jet_params.getUntrackedParameter<vector<int>>("jetBx");
134  fJetHwPt = jet_params.getUntrackedParameter<vector<int>>("jetHwPt");
135  fJetHwPhi = jet_params.getUntrackedParameter<vector<int>>("jetHwPhi");
136  fJetHwEta = jet_params.getUntrackedParameter<vector<int>>("jetHwEta");
137 
138  // Setup Parameter Set for EtSums
139  ParameterSet etsum_params = iConfig.getUntrackedParameter<ParameterSet>("etsumParams");
140 
141  fEtSumBx = etsum_params.getUntrackedParameter<vector<int>>("etsumBx");
142  fEtSumHwPt = etsum_params.getUntrackedParameter<vector<int>>("etsumHwPt");
143  fEtSumHwPhi = etsum_params.getUntrackedParameter<vector<int>>("etsumHwPhi");
144  }
145 
146  FakeInputProducer::~FakeInputProducer() {}
147 
148  //
149  // member functions
150  //
151 
152  // ------------ method called to produce the data ------------
153  void FakeInputProducer::produce(StreamID, Event& iEvent, const EventSetup& iSetup) const {
154  LogDebug("l1t|Global") << "FakeInputProducer::produce function called...\n";
155 
156  // Set the range of BX....TO DO...move to Params or determine from param set.
157  int bxFirst = -2;
158  int bxLast = 2;
159 
160  //outputs
161  std::unique_ptr<l1t::EGammaBxCollection> egammas(new l1t::EGammaBxCollection(0, bxFirst, bxLast));
162  std::unique_ptr<l1t::MuonBxCollection> muons(new l1t::MuonBxCollection(0, bxFirst, bxLast));
163  std::unique_ptr<l1t::TauBxCollection> taus(new l1t::TauBxCollection(0, bxFirst, bxLast));
164  std::unique_ptr<l1t::JetBxCollection> jets(new l1t::JetBxCollection(0, bxFirst, bxLast));
165  std::unique_ptr<l1t::EtSumBxCollection> etsums(new l1t::EtSumBxCollection(0, bxFirst, bxLast));
166 
167  // Put EG into Collections
168  for (unsigned int it = 0; it < fEgBx.size(); it++) {
169  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>* egLorentz =
170  new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>();
171  l1t::EGamma fakeEG(*egLorentz, fEgHwPt.at(it), fEgHwEta.at(it), fEgHwPhi.at(it), 0, fEgIso.at(it));
172  egammas->push_back(fEgBx.at(it), fakeEG);
173  }
174 
175  // Put Muons into Collections
176  for (unsigned int it = 0; it < fMuBx.size(); it++) {
177  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>* muLorentz =
178  new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>();
179  l1t::Muon fakeMU(*muLorentz, fMuHwPt.at(it), fMuHwEta.at(it), fMuHwPhi.at(it), 4, 0, 0, fMuIso.at(it));
180  muons->push_back(fMuBx.at(it), fakeMU);
181  }
182 
183  // Put Taus into Collections
184  for (unsigned int it = 0; it < fTauBx.size(); it++) {
185  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>* tauLorentz =
186  new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>();
187  l1t::Tau fakeTAU(*tauLorentz, fTauHwPt.at(it), fTauHwEta.at(it), fTauHwPhi.at(it), 0, fTauIso.at(it));
188  taus->push_back(fTauBx.at(it), fakeTAU);
189  }
190 
191  // Put Jets into Collections
192  for (unsigned int it = 0; it < fJetBx.size(); it++) {
193  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>* jetLorentz =
194  new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>();
195  l1t::Jet fakeJET(*jetLorentz, fJetHwPt.at(it), fJetHwEta.at(it), fJetHwPhi.at(it), 0);
196  jets->push_back(fJetBx.at(it), fakeJET);
197  }
198 
199  // Put EtSums into Collections
200  for (unsigned int it = 0; it < fEtSumBx.size(); it++) {
201  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>* etsumLorentz =
202  new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>();
203  l1t::EtSum fakeETSUM(
204  *etsumLorentz, l1t::EtSum::EtSumType::kMissingEt, fEtSumHwPt.at(it), 0, fEtSumHwPhi.at(it), 0);
205  etsums->push_back(fEtSumBx.at(it), fakeETSUM);
206  }
207 
208  iEvent.put(std::move(egammas));
209  iEvent.put(std::move(muons));
210  iEvent.put(std::move(taus));
211  iEvent.put(std::move(jets));
212  iEvent.put(std::move(etsums));
213  }
214 
215  // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
217  //The following says we do not know what parameters are allowed so do no validation
218  // Please change this to state exactly what you do use, even if it is no parameters
220  desc.setUnknown();
221  descriptions.addDefault(desc);
222  }
223 
224 } // namespace l1t
225 
226 //define this as a plug-in
std::vector< int > fJetHwPt
std::vector< int > fJetHwPhi
std::vector< int > fMuHwPt
std::vector< int > fMuBx
Definition: Tau.h:20
std::vector< int > fTauHwPt
delete x;
Definition: CaloConfig.h:22
muons
the two sets of parameters below are mutually exclusive, depending if RECO or ALCARECO is used the us...
Definition: DiMuonV_cfg.py:212
std::vector< int > fJetBx
T getUntrackedParameter(std::string const &, T const &) const
Definition: Jet.h:20
int iEvent
Definition: GenABIO.cc:224
void addDefault(ParameterSetDescription const &psetDescription)
std::vector< int > fTauHwEta
std::vector< int > fTauBx
std::vector< int > fEgHwEta
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
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
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:511
std::vector< int > fEtSumHwPt
#define LogDebug(id)
std::vector< int > fMuHwEta