CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
L1TCaloLayer1 Class Reference

#include <L1Trigger/L1TCaloLayer1/plugins/L1TCaloLayer1.cc>

Inheritance diagram for L1TCaloLayer1:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 L1TCaloLayer1 (const edm::ParameterSet &)
 
 ~L1TCaloLayer1 ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

virtual void beginJob () override
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &) override
 
virtual void endJob () override
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

std::vector< std::vector
< std::vector< uint32_t > > > 
ecalLUT
 
edm::EDGetTokenT
< EcalTrigPrimDigiCollection
ecalTPSource
 
std::string ecalTPSourceLabel
 
std::vector< std::vector
< std::vector< uint32_t > > > 
hcalLUT
 
edm::EDGetTokenT
< HcalTrigPrimDigiCollection
hcalTPSource
 
std::string hcalTPSourceLabel
 
std::vector< std::vector
< uint32_t > > 
hfLUT
 
UCTLayer1 * layer1
 
std::vector< UCTTower * > twrList
 
bool unpackEcalMask
 
bool unpackHcalMask
 
bool useCalib
 
bool useECALLUT
 
bool useHCALLUT
 
bool useHFLUT
 
bool useLSB
 
bool verbose
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 56 of file L1TCaloLayer1.cc.

Constructor & Destructor Documentation

L1TCaloLayer1::L1TCaloLayer1 ( const edm::ParameterSet iConfig)
explicit

Definition at line 112 of file L1TCaloLayer1.cc.

References a, b, layer1, HLT_FULL_cff::towers, and twrList.

112  :
113  ecalTPSource(consumes<EcalTrigPrimDigiCollection>(iConfig.getParameter<edm::InputTag>("ecalToken"))),
114  ecalTPSourceLabel(iConfig.getParameter<edm::InputTag>("ecalToken").label()),
115  hcalTPSource(consumes<HcalTrigPrimDigiCollection>(iConfig.getParameter<edm::InputTag>("hcalToken"))),
116  hcalTPSourceLabel(iConfig.getParameter<edm::InputTag>("hcalToken").label()),
117  ecalLUT(28, std::vector< std::vector<uint32_t> >(2, std::vector<uint32_t>(256))),
118  hcalLUT(28, std::vector< std::vector<uint32_t> >(2, std::vector<uint32_t>(256))),
119  hfLUT(12, std::vector < uint32_t >(256)),
120  useLSB(iConfig.getParameter<bool>("useLSB")),
121  useCalib(iConfig.getParameter<bool>("useCalib")),
122  useECALLUT(iConfig.getParameter<bool>("useECALLUT")),
123  useHCALLUT(iConfig.getParameter<bool>("useHCALLUT")),
124  useHFLUT(iConfig.getParameter<bool>("useHFLUT")),
125  verbose(iConfig.getParameter<bool>("verbose")),
126  unpackHcalMask(iConfig.getParameter<bool>("unpackHcalMask")),
127  unpackEcalMask(iConfig.getParameter<bool>("unpackEcalMask"))
128 {
129  produces<CaloTowerBxCollection>();
130  layer1 = new UCTLayer1;
131  vector<UCTCrate*> crates = layer1->getCrates();
132  for(uint32_t crt = 0; crt < crates.size(); crt++) {
133  vector<UCTCard*> cards = crates[crt]->getCards();
134  for(uint32_t crd = 0; crd < cards.size(); crd++) {
135  vector<UCTRegion*> regions = cards[crd]->getRegions();
136  for(uint32_t rgn = 0; rgn < regions.size(); rgn++) {
137  vector<UCTTower*> towers = regions[rgn]->getTowers();
138  for(uint32_t twr = 0; twr < towers.size(); twr++) {
139  twrList.push_back(towers[twr]);
140  }
141  }
142  }
143  }
144 
145  // This sort corresponds to the sort condition on
146  // the output CaloTowerBxCollection
147  std::sort(twrList.begin(), twrList.end(), [](UCTTower* a, UCTTower* b) {
148  return CaloTools::caloTowerHash(a->caloEta(), a->caloPhi()) < CaloTools::caloTowerHash(b->caloEta(), b->caloPhi());
149  });
150 }
T getParameter(std::string const &) const
std::vector< std::vector< std::vector< uint32_t > > > hcalLUT
std::vector< std::vector< uint32_t > > hfLUT
edm::EDGetTokenT< HcalTrigPrimDigiCollection > hcalTPSource
std::vector< UCTTower * > twrList
std::vector< std::vector< std::vector< uint32_t > > > ecalLUT
std::string ecalTPSourceLabel
edm::EDGetTokenT< EcalTrigPrimDigiCollection > ecalTPSource
UCTLayer1 * layer1
double b
Definition: hdecay.h:120
std::string hcalTPSourceLabel
std::string const & label() const
Definition: InputTag.h:36
double a
Definition: hdecay.h:121
L1TCaloLayer1::~L1TCaloLayer1 ( )

Definition at line 152 of file L1TCaloLayer1.cc.

References layer1.

152  {
153  if(layer1 != 0) delete layer1;
154 }
UCTLayer1 * layer1

Member Function Documentation

void L1TCaloLayer1::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 263 of file L1TCaloLayer1.cc.

264 {
265 }
void L1TCaloLayer1::beginRun ( edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 274 of file L1TCaloLayer1.cc.

References ecalLUT, hcalLUT, hfLUT, L1TCaloLayer1FetchLUTs(), LOG_ERROR, twrList, useCalib, useECALLUT, useHCALLUT, useHFLUT, and useLSB.

275 {
277  LOG_ERROR << "L1TCaloLayer1::beginRun: failed to fetch LUTS - using unity" << std::endl;
278  }
279  for(uint32_t twr = 0; twr < twrList.size(); twr++) {
280  twrList[twr]->setECALLUT(&ecalLUT);
281  twrList[twr]->setHCALLUT(&hcalLUT);
282  twrList[twr]->setHFLUT(&hfLUT);
283  }
284 }
std::vector< std::vector< std::vector< uint32_t > > > hcalLUT
std::vector< std::vector< uint32_t > > hfLUT
std::vector< UCTTower * > twrList
std::vector< std::vector< std::vector< uint32_t > > > ecalLUT
bool L1TCaloLayer1FetchLUTs(const edm::EventSetup &iSetup, std::vector< std::vector< std::vector< uint32_t > > > &eLUT, std::vector< std::vector< std::vector< uint32_t > > > &hLUT, std::vector< std::vector< uint32_t > > &hfLUT, bool useLSB, bool useCalib, bool useECALLUT, bool useHCALLUT, bool useHFLUT)
#define LOG_ERROR
Definition: CSCDQM_Logger.h:41
void L1TCaloLayer1::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 269 of file L1TCaloLayer1.cc.

269  {
270 }
void L1TCaloLayer1::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 313 of file L1TCaloLayer1.cc.

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

313  {
314  //The following says we do not know what parameters are allowed so do no validation
315  // Please change this to state exactly what you do use, even if it is no parameters
317  desc.setUnknown();
318  descriptions.addDefault(desc);
319 }
void addDefault(ParameterSetDescription const &psetDescription)
void L1TCaloLayer1::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 162 of file L1TCaloLayer1.cc.

References funct::abs(), ecalTPSource, edm::Event::getByToken(), hcalTPSource, layer1, LOG_ERROR, edm::Event::put(), l1t::L1Candidate::setHwEta(), l1t::CaloTower::setHwEtEm(), l1t::CaloTower::setHwEtHad(), l1t::CaloTower::setHwEtRatio(), l1t::L1Candidate::setHwPhi(), l1t::L1Candidate::setHwPt(), l1t::L1Candidate::setHwQual(), lumiQTWidget::t, twrList, unpackEcalMask, and unpackHcalMask.

163 {
164  using namespace edm;
165 
167  iEvent.getByToken(ecalTPSource, ecalTPs);
169  iEvent.getByToken(hcalTPSource, hcalTPs);
170 
171  std::auto_ptr<CaloTowerBxCollection> towersColl (new CaloTowerBxCollection);
172 
173  uint32_t expectedTotalET = 0;
174  if(!layer1->clearEvent()) {
175  LOG_ERROR << "UCT: Failed to clear event" << std::endl;
176  return;
177  }
178 
179  for ( const auto& ecalTp : *ecalTPs ) {
180  if ( unpackEcalMask && ((ecalTp.sample(0).raw()>>13) & 0x1) ) continue;
181  int caloEta = ecalTp.id().ieta();
182  int caloPhi = ecalTp.id().iphi();
183  int et = ecalTp.compressedEt();
184  bool fgVeto = ecalTp.fineGrain();
185  if(et != 0) {
186  UCTTowerIndex t = UCTTowerIndex(caloEta, caloPhi);
187  if(!layer1->setECALData(t,fgVeto,et)) {
188  LOG_ERROR << "UCT: Failed loading an ECAL tower" << std::endl;
189  return;
190  }
191  expectedTotalET += et;
192  }
193  }
194 
195  for ( const auto& hcalTp : *hcalTPs ) {
196  if ( unpackHcalMask && ((hcalTp.sample(0).raw()>>13) & 0x1) ) continue;
197  int caloEta = hcalTp.id().ieta();
198  uint32_t absCaloEta = abs(caloEta);
199  // Tower 29 is not used by Layer-1
200  if(absCaloEta == 29) {
201  continue;
202  }
203  // Prevent usage of HF TPs with Layer-1 emulator if HCAL TPs are old style
204  else if(hcalTp.id().version() == 0 && absCaloEta > 29) {
205  continue;
206  }
207  else if(absCaloEta <= 41) {
208  int caloPhi = hcalTp.id().iphi();
209  if(caloPhi <= 72) {
210  int et = hcalTp.SOI_compressedEt();
211  bool fg = hcalTp.SOI_fineGrain();
212  if(et != 0) {
213  UCTTowerIndex t = UCTTowerIndex(caloEta, caloPhi);
214  uint32_t featureBits = 0;
215  if(fg) featureBits = 0x1F; // Set all five feature bits for the moment - they are not defined in HW / FW yet!
216  if(!layer1->setHCALData(t, featureBits, et)) {
217  LOG_ERROR << "caloEta = " << caloEta << "; caloPhi =" << caloPhi << std::endl;
218  LOG_ERROR << "UCT: Failed loading an HCAL tower" << std::endl;
219  return;
220 
221  }
222  expectedTotalET += et;
223  }
224  }
225  else {
226  LOG_ERROR << "Illegal Tower: caloEta = " << caloEta << "; caloPhi =" << caloPhi << std::endl;
227  }
228  }
229  else {
230  LOG_ERROR << "Illegal Tower: caloEta = " << caloEta << std::endl;
231  }
232  }
233 
234 
235  //Process
236  if(!layer1->process()) {
237  LOG_ERROR << "UCT: Failed to process layer 1" << std::endl;
238  }
239 
240 
241  int theBX = 0; // Currently we only read and process the "hit" BX only
242 
243  for(uint32_t twr = 0; twr < twrList.size(); twr++) {
244  CaloTower caloTower;
245  caloTower.setHwPt(twrList[twr]->et()); // Bits 0-8 of the 16-bit word per the interface protocol document
246  caloTower.setHwEtRatio(twrList[twr]->er()); // Bits 9-11 of the 16-bit word per the interface protocol document
247  caloTower.setHwQual(twrList[twr]->miscBits()); // Bits 12-15 of the 16-bit word per the interface protocol document
248  caloTower.setHwEta(twrList[twr]->caloEta()); // caloEta = 1-28 and 30-41
249  caloTower.setHwPhi(twrList[twr]->caloPhi()); // caloPhi = 1-72
250  caloTower.setHwEtEm(twrList[twr]->getEcalET()); // This is provided as a courtesy - not available to hardware
251  caloTower.setHwEtHad(twrList[twr]->getHcalET()); // This is provided as a courtesy - not available to hardware
252  towersColl->push_back(theBX, caloTower);
253  }
254 
255  iEvent.put(towersColl);
256 
257 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
edm::EDGetTokenT< HcalTrigPrimDigiCollection > hcalTPSource
void setHwQual(int qual)
Definition: L1Candidate.cc:64
void setHwEtHad(int et)
Definition: CaloTower.cc:44
std::vector< UCTTower * > twrList
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void setHwEtRatio(int ratio)
Definition: CaloTower.cc:49
edm::EDGetTokenT< EcalTrigPrimDigiCollection > ecalTPSource
UCTLayer1 * layer1
void setHwPhi(int phi)
Definition: L1Candidate.cc:54
void setHwPt(int pt)
Definition: L1Candidate.cc:44
void setHwEta(int eta)
Definition: L1Candidate.cc:49
void setHwEtEm(int et)
Definition: CaloTower.cc:39
#define LOG_ERROR
Definition: CSCDQM_Logger.h:41

Member Data Documentation

std::vector< std::vector< std::vector < uint32_t > > > L1TCaloLayer1::ecalLUT
private

Definition at line 81 of file L1TCaloLayer1.cc.

Referenced by beginRun().

edm::EDGetTokenT<EcalTrigPrimDigiCollection> L1TCaloLayer1::ecalTPSource
private

Definition at line 76 of file L1TCaloLayer1.cc.

Referenced by produce().

std::string L1TCaloLayer1::ecalTPSourceLabel
private

Definition at line 77 of file L1TCaloLayer1.cc.

std::vector< std::vector< std::vector < uint32_t > > > L1TCaloLayer1::hcalLUT
private

Definition at line 82 of file L1TCaloLayer1.cc.

Referenced by beginRun().

edm::EDGetTokenT<HcalTrigPrimDigiCollection> L1TCaloLayer1::hcalTPSource
private

Definition at line 78 of file L1TCaloLayer1.cc.

Referenced by produce().

std::string L1TCaloLayer1::hcalTPSourceLabel
private

Definition at line 79 of file L1TCaloLayer1.cc.

std::vector< std::vector< uint32_t > > L1TCaloLayer1::hfLUT
private

Definition at line 83 of file L1TCaloLayer1.cc.

Referenced by beginRun().

UCTLayer1* L1TCaloLayer1::layer1
private

Definition at line 96 of file L1TCaloLayer1.cc.

Referenced by L1TCaloLayer1(), produce(), and ~L1TCaloLayer1().

std::vector< UCTTower* > L1TCaloLayer1::twrList
private

Definition at line 85 of file L1TCaloLayer1.cc.

Referenced by beginRun(), L1TCaloLayer1(), and produce().

bool L1TCaloLayer1::unpackEcalMask
private

Definition at line 94 of file L1TCaloLayer1.cc.

Referenced by produce().

bool L1TCaloLayer1::unpackHcalMask
private

Definition at line 93 of file L1TCaloLayer1.cc.

Referenced by produce().

bool L1TCaloLayer1::useCalib
private

Definition at line 88 of file L1TCaloLayer1.cc.

Referenced by beginRun().

bool L1TCaloLayer1::useECALLUT
private

Definition at line 89 of file L1TCaloLayer1.cc.

Referenced by beginRun().

bool L1TCaloLayer1::useHCALLUT
private

Definition at line 90 of file L1TCaloLayer1.cc.

Referenced by beginRun().

bool L1TCaloLayer1::useHFLUT
private

Definition at line 91 of file L1TCaloLayer1.cc.

Referenced by beginRun().

bool L1TCaloLayer1::useLSB
private

Definition at line 87 of file L1TCaloLayer1.cc.

Referenced by beginRun().

bool L1TCaloLayer1::verbose
private