21 #include <boost/shared_ptr.hpp>
73 virtual void endJob()
override;
104 verbosity_(ps.getParameter<int>(
"verbosity")),
105 bxFirst_(ps.getParameter<int>(
"bxFirst")),
106 bxLast_(ps.getParameter<int>(
"bxLast")),
111 ecalToken_(bxLast_+1-bxFirst_),
112 hcalToken_(bxLast_+1-bxFirst_),
118 produces<CaloTowerBxCollection> ();
145 LogDebug(
"l1t|stage 2") <<
"L1TStage2Layer1Producer::produce function called..." << std::endl;
176 std::auto_ptr< std::vector<CaloTower> > localInTowers (
new std::vector<CaloTower>(CaloTools::caloTowerHashMax()));
177 std::auto_ptr< std::vector<CaloTower> > localOutTowers (
new std::vector<CaloTower>());
182 for (ecalItr=ecalTPs->begin(); ecalItr!=ecalTPs->end(); ++ecalItr, ++nEcal) {
184 int ieta = ecalItr->id().ieta();
185 int iphi = ecalItr->id().iphi();
187 int ietIn = ecalItr->compressedEt();
188 bool ifg = ecalItr->fineGrain();
191 double et = ecalScale->et( ietIn,
abs(ieta), (ieta>0) );
196 LogDebug(
"L1TDebug") <<
" ECAL TP : " << ieta <<
", " << iphi <<
", " << ietIn <<
", " << et <<
", " << ietOut << std::endl;
198 int itow = CaloTools::caloTowerHash(ieta, iphi);
199 localInTowers->at(itow).setHwEtEm(ietOut);
200 localInTowers->at(itow).setHwQual( localInTowers->at(itow).hwQual() | (ifg ? 0x4 : 0x0) );
207 for (hcalItr=hcalTPs->begin(); hcalItr!=hcalTPs->end(); ++hcalItr, ++nHcal) {
209 int ieta = hcalItr->id().ieta();
210 int iphi = hcalItr->id().iphi();
212 int ietIn = hcalItr->SOI_compressedEt();
216 double et = hcalScale->et( ietIn,
abs(ieta), (ieta>0) );
221 LogDebug(
"L1TDebug") <<
" HCAL TP : " << ieta <<
", " << iphi <<
", " << ietIn <<
", " << et <<
", " << ietOut << std::endl;
223 int itow = CaloTools::caloTowerHash(ieta, iphi);
224 localInTowers->at(itow).setHwEtHad(ietOut);
234 if(!CaloTools::isValidIEtaIPhi(ieta,iphi))
continue;
236 int itow = CaloTools::caloTowerHash(ieta, iphi);
239 int ietEcal = localInTowers->at(itow).hwEtEm();
240 int ietHcal = localInTowers->at(itow).hwEtHad();
243 int iet = ietEcal + ietHcal;
247 localInTowers->at(itow).setHwPt(iet);
248 localInTowers->at(itow).setHwEta(ieta);
249 localInTowers->at(itow).setHwPhi(iphi);
255 processor_->processEvent(*localInTowers, *localOutTowers);
258 for(std::vector<CaloTower>::const_iterator tower = localOutTowers->begin();
259 tower != localOutTowers->end();
261 towersColl->push_back(ibx, *tower);
263 LogDebug(
"L1TDebug") <<
"BX=" << ibx <<
", N(Tower in)=" << localInTowers->size() <<
", N(Tower out)=" << localOutTowers->size() << std::endl;
267 iEvent.
put(towersColl);
308 edm::LogError(
"l1t|caloStage2") <<
"Could not retrieve params from Event Setup" << std::endl;
326 edm::LogError(
"l1t|caloStage2") <<
"Layer 1 firmware could not be configured.\n";
T getParameter(std::string const &) const
boost::shared_ptr< Stage2PreProcessor > processor_
std::vector< edm::EDGetToken > ecalToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
virtual void beginJob() override
std::vector< EcalTriggerPrimitiveDigi >::const_iterator const_iterator
CaloParamsHelper * params_
L1TStage2Layer1Producer(const edm::ParameterSet &ps)
void addDefault(ParameterSetDescription const &psetDescription)
Stage2Layer1FirmwareFactory factory_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Abs< T >::type abs(const T &t)
~L1TStage2Layer1Producer()
unsigned long long paramsCacheId_
ReturnType create(unsigned fwv, CaloParamsHelper *params)
std::vector< edm::EDGetToken > hcalToken_
virtual void beginRun(edm::Run const &, edm::EventSetup const &) override
T const * product() const
virtual void endRun(edm::Run const &, edm::EventSetup const &) override
virtual void produce(edm::Event &, const edm::EventSetup &) override
virtual void endJob() override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)