CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
L1TCaloLayer1RawToDigi Class Reference

#include <EventFilter/L1TCaloLayer1RawToDigi/plugins/L1TCaloLayer1RawToDigi.cc>

Inheritance diagram for L1TCaloLayer1RawToDigi:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 L1TCaloLayer1RawToDigi (const ParameterSet &)
 
 ~L1TCaloLayer1RawToDigi ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

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

Private Member Functions

virtual void beginStream (StreamID) override
 
virtual void endStream () override
 
void makeECalTPGs (uint32_t lPhi, UCTCTP7RawData &ctp7Data, std::unique_ptr< EcalTrigPrimDigiCollection > &ecalTPGs)
 
void makeHCalTPGs (uint32_t lPhi, UCTCTP7RawData &ctp7Data, std::unique_ptr< HcalTrigPrimDigiCollection > &hcalTPGs)
 
void makeHFTPGs (uint32_t lPhi, UCTCTP7RawData &ctp7Data, std::unique_ptr< HcalTrigPrimDigiCollection > &hcalTPGs)
 
void makeRegions (uint32_t lPhi, UCTCTP7RawData &ctp7Data, std::unique_ptr< L1CaloRegionCollection > &regions)
 
virtual void produce (Event &, const EventSetup &) override
 

Private Attributes

uint32_t event
 
std::vector< int > fedIDs
 
InputTag fedRawDataLabel
 
bool verbose
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase 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: Raw data unpacker for Layer-1 of Level-1 Calorimeter Trigger

Implementation: This is meant to be simple and straight-forward. Potential complications due to any changes in firmware are not foreseen. It is assumed that if there are major changes, which is unlikely, there will be a new unpacker written to deal with that.

Definition at line 69 of file L1TCaloLayer1RawToDigi.cc.

Constructor & Destructor Documentation

L1TCaloLayer1RawToDigi::L1TCaloLayer1RawToDigi ( const ParameterSet iConfig)
explicit

Definition at line 117 of file L1TCaloLayer1RawToDigi.cc.

References fedRawDataLabel.

117  :
118  fedRawDataLabel(iConfig.getParameter<InputTag>("fedRawDataLabel")),
119  fedIDs(iConfig.getParameter<std::vector<int> >("FEDIDs")),
120  event(0),
121  verbose(iConfig.getParameter<bool>("verbose"))
122 {
123 
124  produces<EcalTrigPrimDigiCollection>();
125  produces<HcalTrigPrimDigiCollection>();
126  produces<L1CaloRegionCollection>();
127 
128  consumes<FEDRawDataCollection>(fedRawDataLabel);
129 
130 }
T getParameter(std::string const &) const
L1TCaloLayer1RawToDigi::~L1TCaloLayer1RawToDigi ( )

Definition at line 133 of file L1TCaloLayer1RawToDigi.cc.

134 {
135 
136 }

Member Function Documentation

void L1TCaloLayer1RawToDigi::beginStream ( StreamID  )
overrideprivatevirtual

Reimplemented from edm::stream::EDProducerBase.

Definition at line 361 of file L1TCaloLayer1RawToDigi.cc.

362 {
363 }
void L1TCaloLayer1RawToDigi::endStream ( )
overrideprivatevirtual

Reimplemented from edm::stream::EDProducerBase.

Definition at line 367 of file L1TCaloLayer1RawToDigi.cc.

367  {
368 }
void L1TCaloLayer1RawToDigi::fillDescriptions ( ConfigurationDescriptions descriptions)
static

Definition at line 404 of file L1TCaloLayer1RawToDigi.cc.

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

404  {
405  //The following says we do not know what parameters are allowed so do no validation
406  // Please change this to state exactly what you do use, even if it is no parameters
408  desc.setUnknown();
409  descriptions.addDefault(desc);
410 }
void addDefault(ParameterSetDescription const &psetDescription)
void L1TCaloLayer1RawToDigi::makeECalTPGs ( uint32_t  lPhi,
UCTCTP7RawData ctp7Data,
std::unique_ptr< EcalTrigPrimDigiCollection > &  ecalTPGs 
)
private

Definition at line 214 of file L1TCaloLayer1RawToDigi.cc.

References funct::abs(), UCTCTP7RawData::EBEE, EcalBarrel, EcalEndcap, UCTCTP7RawData::getET(), UCTCTP7RawData::getFB(), hcalTTPDigis_cfi::id, createfilelist::int, UCTCTP7RawData::isLinkDown(), UCTCTP7RawData::isLinkInError(), UCTCTP7RawData::isLinkMasked(), UCTCTP7RawData::isLinkMisaligned(), UCTCTP7RawData::isTowerMasked(), simplePhotonAnalyzer_cfi::sample, EcalTriggerPrimitiveDigi::setSample(), and EcalTriggerPrimitiveDigi::setSize().

Referenced by produce().

214  {
216  for(uint32_t iPhi = 0; iPhi < 4; iPhi++) { // Loop over all four phi divisions on card
217  int cPhi = - 1 + lPhi * 4 + iPhi; // Calorimeter phi index
218  if(cPhi == 0) cPhi = 72;
219  else if(cPhi == -1) cPhi = 71;
220  else if(cPhi < -1) {
221  LogError("L1TCaloLayer1RawToDigi") << "L1TCaloLayer1RawToDigi: Major error in makeECalTPGs" << std::endl;
222  return;
223  }
224  for(int cEta = -28; cEta <= 28; cEta++) { // Calorimeter Eta indices (HB/HE for now)
225  if(cEta != 0) { // Calorimeter eta = 0 is invalid
226  bool negativeEta = false;
227  if(cEta < 0) negativeEta = true;
228  uint32_t iEta = abs(cEta);
229  // This code is fragile! Note that towerDatum is packed as is done in EcalTriggerPrimitiveSample
230  // Bottom 8-bits are ET
231  // Then finegrain feature bit
232  // Then three bits have ttBits, which I have no clue about (not available on ECAL links so not set)
233  // Then there is a spare FG Veto bit, which is used for L1 spike detection (not available on ECAL links so not set)
234  // Top three bits seem to be unused. So, we steal those to set the tower masking, link masking and link status information
235  // To decode these custom three bits use ((EcalTriggerPrimitiveSample::raw() >> 13) & 0x7)
236  uint32_t towerDatum = ctp7Data.getET(cType, negativeEta, iEta, iPhi);
237  if(ctp7Data.getFB(cType, negativeEta, iEta, iPhi)!=0) towerDatum |= 0x0100;
238  if(ctp7Data.isTowerMasked(cType, negativeEta, iEta, iPhi)) towerDatum |= 0x2000;
239  if(ctp7Data.isLinkMasked(cType, negativeEta, iEta, iPhi)) towerDatum |= 0x4000;
240  if(ctp7Data.isLinkMisaligned(cType, negativeEta, iEta, iPhi) ||
241  ctp7Data.isLinkInError(cType, negativeEta, iEta, iPhi) ||
242  ctp7Data.isLinkDown(cType, negativeEta, iEta, iPhi)) towerDatum |= 0x8000;
243  EcalTriggerPrimitiveSample sample(towerDatum);
244  int zSide = cEta / ((int) iEta);
245  // As far as I can tell, the ECal unpacker only uses barrel and endcap IDs, never EcalTriggerTower
246  const EcalSubdetector ecalTriggerTower = (iEta > 17 ) ? EcalSubdetector::EcalEndcap : EcalSubdetector::EcalBarrel;
247  EcalTrigTowerDetId id(zSide, ecalTriggerTower, iEta, cPhi);
248  EcalTriggerPrimitiveDigi tpg(id);
249  tpg.setSize(1);
250  tpg.setSample(0, sample);
251  ecalTPGs->push_back(tpg);
252  }
253  }
254  }
255 
256 }
uint32_t getFB(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
bool isLinkMasked(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
bool isLinkDown(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
bool isLinkInError(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
bool isTowerMasked(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
uint32_t getET(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
EcalSubdetector
bool isLinkMisaligned(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
void L1TCaloLayer1RawToDigi::makeHCalTPGs ( uint32_t  lPhi,
UCTCTP7RawData ctp7Data,
std::unique_ptr< HcalTrigPrimDigiCollection > &  hcalTPGs 
)
private

Definition at line 258 of file L1TCaloLayer1RawToDigi.cc.

References funct::abs(), UCTCTP7RawData::getET(), UCTCTP7RawData::getFB(), UCTCTP7RawData::HBHE, hcalTTPDigis_cfi::id, UCTCTP7RawData::isLinkDown(), UCTCTP7RawData::isLinkInError(), UCTCTP7RawData::isLinkMasked(), UCTCTP7RawData::isLinkMisaligned(), UCTCTP7RawData::isTowerMasked(), simplePhotonAnalyzer_cfi::sample, HcalTriggerPrimitiveDigi::setSample(), and HcalTriggerPrimitiveDigi::setSize().

Referenced by produce().

258  {
260  for(uint32_t iPhi = 0; iPhi < 4; iPhi++) { // Loop over all four phi divisions on card
261  int cPhi = - 1 + lPhi * 4 + iPhi; // Calorimeter phi index
262  if(cPhi == 0) cPhi = 72;
263  else if(cPhi == -1) cPhi = 71;
264  else if(cPhi < -1) {
265  LogError("L1TCaloLayer1RawToDigi") << "L1TCaloLayer1RawToDigi: Major error in makeHCalTPGs" << std::endl;
266  return;
267  }
268  for(int cEta = -28; cEta <= 28; cEta++) { // Calorimeter Eta indices (HB/HE for now)
269  if(cEta != 0) { // Calorimeter eta = 0 is invalid
270  bool negativeEta = false;
271  if(cEta < 0) negativeEta = true;
272  uint32_t iEta = abs(cEta);
273  // This code is fragile! Note that towerDatum is packed as is done in HcalTriggerPrimitiveSample
274  // Bottom 8-bits are ET
275  // Then feature bit
276  // The remaining bits are undefined presently
277  // We use next three bits for link details, which we did not have room in EcalTriggerPrimitiveSample case
278  // We use next three bits to set the tower masking, link masking and link status information as done for Ecal
279  // To decode these custom six bits use ((EcalTriggerPrimitiveSample::raw() >> 9) & 0x77)
280  uint32_t towerDatum = ctp7Data.getET(cType, negativeEta, iEta, iPhi);
281  if(ctp7Data.getFB(cType, negativeEta, iEta, iPhi)!=0) towerDatum |= 0x0100;
282  if(ctp7Data.isLinkMisaligned(cType, negativeEta, iEta, iPhi)) towerDatum |= 0x0200;
283  if(ctp7Data.isLinkInError(cType, negativeEta, iEta, iPhi)) towerDatum |= 0x0400;
284  if(ctp7Data.isLinkDown(cType, negativeEta, iEta, iPhi)) towerDatum |= 0x0800;
285  if(ctp7Data.isTowerMasked(cType, negativeEta, iEta, iPhi)) towerDatum |= 0x2000;
286  if(ctp7Data.isLinkMasked(cType, negativeEta, iEta, iPhi)) towerDatum |= 0x4000;
287  if(ctp7Data.isLinkMisaligned(cType, negativeEta, iEta, iPhi) ||
288  ctp7Data.isLinkInError(cType, negativeEta, iEta, iPhi) ||
289  ctp7Data.isLinkDown(cType, negativeEta, iEta, iPhi)) towerDatum |= 0x8000;
290  HcalTriggerPrimitiveSample sample(towerDatum);
291  HcalTrigTowerDetId id(cEta, cPhi);
292  HcalTriggerPrimitiveDigi tpg(id);
293  tpg.setSize(1);
294  tpg.setSample(0, sample);
295  hcalTPGs->push_back(tpg);
296  }
297  }
298  }
299 
300 }
uint32_t getFB(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
bool isLinkMasked(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
bool isLinkDown(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
bool isLinkInError(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
bool isTowerMasked(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
uint32_t getET(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
bool isLinkMisaligned(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
void L1TCaloLayer1RawToDigi::makeHFTPGs ( uint32_t  lPhi,
UCTCTP7RawData ctp7Data,
std::unique_ptr< HcalTrigPrimDigiCollection > &  hcalTPGs 
)
private

Definition at line 302 of file L1TCaloLayer1RawToDigi.cc.

References UCTCTP7RawData::getET(), UCTCTP7RawData::getFB(), UCTCTP7RawData::HF, hcalTTPDigis_cfi::id, UCTCTP7RawData::isLinkDown(), UCTCTP7RawData::isLinkInError(), UCTCTP7RawData::isLinkMasked(), UCTCTP7RawData::isLinkMisaligned(), UCTCTP7RawData::isTowerMasked(), simplePhotonAnalyzer_cfi::sample, HcalTriggerPrimitiveDigi::setSample(), and HcalTriggerPrimitiveDigi::setSize().

Referenced by produce().

302  {
304  for(uint32_t side = 0; side <= 1; side++) {
305  bool negativeEta = false;
306  if(side == 0) negativeEta = true;
307  for(uint32_t iEta = 30; iEta <= 40; iEta++) {
308  for(uint32_t iPhi = 0; iPhi < 2; iPhi++) {
309  if(iPhi == 1 && iEta == 40) iEta = 41;
310  int cPhi = 1 + lPhi * 4 + iPhi * 2; // Calorimeter phi index: 1, 3, 5, ... 71
311  if(iEta == 41) cPhi -= 2; // Last two HF are 3, 7, 11, ...
312  cPhi = (cPhi+69)%72 + 1; // cPhi -= 2 mod 72
313  int cEta = iEta;
314  if(negativeEta) cEta = -iEta;
315  // This code is fragile! Note that towerDatum is packed as is done in HcalTriggerPrimitiveSample
316  // Bottom 8-bits are ET
317  // Then feature bit
318  // Then minBias ADC count bit
319  // The remaining bits are undefined presently
320  // We use next three bits for link details, which we did not have room in EcalTriggerPrimitiveSample case
321  // We use next three bits to set the tower masking, link masking and link status information as done for Ecal
322  // To decode these custom six bits use ((EcalTriggerPrimitiveSample::raw() >> 9) & 0x77)
323  uint32_t towerDatum = ctp7Data.getET(cType, negativeEta, iEta, iPhi);
324  towerDatum |= ctp7Data.getFB(cType, negativeEta, iEta, iPhi) << 8;
325  if(ctp7Data.isLinkMisaligned(cType, negativeEta, iEta, iPhi)) towerDatum |= 0x0400;
326  if(ctp7Data.isLinkInError(cType, negativeEta, iEta, iPhi)) towerDatum |= 0x0800;
327  if(ctp7Data.isLinkDown(cType, negativeEta, iEta, iPhi)) towerDatum |= 0x1000;
328  if(ctp7Data.isTowerMasked(cType, negativeEta, iEta, iPhi)) towerDatum |= 0x2000;
329  if(ctp7Data.isLinkMasked(cType, negativeEta, iEta, iPhi)) towerDatum |= 0x4000;
330  if(ctp7Data.isLinkMisaligned(cType, negativeEta, iEta, iPhi) ||
331  ctp7Data.isLinkInError(cType, negativeEta, iEta, iPhi) ||
332  ctp7Data.isLinkDown(cType, negativeEta, iEta, iPhi)) towerDatum |= 0x8000;
333  HcalTriggerPrimitiveSample sample(towerDatum);
334  HcalTrigTowerDetId id(cEta, cPhi);
335  id.setVersion(1); // To not process these 1x1 HF TPGs with RCT
336  HcalTriggerPrimitiveDigi tpg(id);
337  tpg.setSize(1);
338  tpg.setSample(0, sample);
339  hcalTPGs->push_back(tpg);
340  }
341  }
342  }
343 }
uint32_t getFB(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
bool isLinkMasked(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
bool isLinkDown(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
bool isLinkInError(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
bool isTowerMasked(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
uint32_t getET(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
bool isLinkMisaligned(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
void L1TCaloLayer1RawToDigi::makeRegions ( uint32_t  lPhi,
UCTCTP7RawData ctp7Data,
std::unique_ptr< L1CaloRegionCollection > &  regions 
)
private

Definition at line 346 of file L1TCaloLayer1RawToDigi.cc.

References UCTCTP7RawData::getRegionSummary().

Referenced by produce().

346  {
347  for(uint32_t side = 0; side <= 1; side++) {
348  bool negativeEta = false;
349  if(side == 0) negativeEta = true;
350  for(uint32_t region = 0; region <= 6; region++) {
351  uint32_t regionData = ctp7Data.getRegionSummary(negativeEta, region);
352  uint32_t lEta = 10 - region; // GCT eta goes 0-21, 0-3 -HF, 4-10 -B/E, 11-17 +B/E, 18-21 +HF
353  if(!negativeEta) lEta = region + 11;
354  regions->push_back(L1CaloRegion((uint16_t) regionData, (unsigned) lEta, (unsigned) lPhi, (int16_t) 0));
355  }
356  }
357 }
A calorimeter trigger region (sum of 4x4 trigger towers)
Definition: L1CaloRegion.h:22
uint32_t getRegionSummary(bool negativeEta, uint32_t region)
void L1TCaloLayer1RawToDigi::produce ( Event iEvent,
const EventSetup iSetup 
)
overrideprivatevirtual

Definition at line 144 of file L1TCaloLayer1RawToDigi.cc.

References UCTDAQRawData::amcPayload(), FEDRawData::data(), TauDecayModes::dec, FEDRawDataCollection::FEDData(), fedIDs, fedRawDataLabel, edm::Event::getByLabel(), mps_fire::i, edm::HandleBase::isValid(), LogDebug, makeECalTPGs(), makeHCalTPGs(), makeHFTPGs(), makeRegions(), eostools::move(), UCTDAQRawData::nAMCs(), nullptr, UCTDAQRawData::print(), UCTCTP7RawData::print(), edm::Event::put(), and FEDRawData::size().

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

145 {
146  using namespace edm;
147  using namespace std;
148 
149  Handle<FEDRawDataCollection> fedRawDataCollection;
150  iEvent.getByLabel(fedRawDataLabel, fedRawDataCollection);
151 
152  std::unique_ptr<EcalTrigPrimDigiCollection> ecalTPGs(new EcalTrigPrimDigiCollection);
153  std::unique_ptr<HcalTrigPrimDigiCollection> hcalTPGs(new HcalTrigPrimDigiCollection);
154  std::unique_ptr<L1CaloRegionCollection> regions (new L1CaloRegionCollection);
155 
156  // if raw data collection is present, check the headers and do the unpacking
157  if (fedRawDataCollection.isValid()) {
158 
159  for(uint32_t i = 0; i < fedIDs.size(); i++) {
160 
161  uint32_t fed = fedIDs[i];
162 
163  const FEDRawData& fedRawData = fedRawDataCollection->FEDData(fed);
164 
165  //Check FED size
166  if(verbose) LogDebug("L1TCaloLayer1RawToDigi") << "Upacking FEDRawData for fed " << std::dec << fed << " of size " << fedRawData.size();
167 
168  const uint64_t *fedRawDataArray = (const uint64_t *) fedRawData.data();
169 
170  if ( fedRawData.size() == 0 || fedRawDataArray == nullptr ) {
171  LogDebug("L1TCaloLayer1RawToDigi") << "Could not load FED data for " << fed << ", putting empty collections!";
172  continue;
173  }
174 
175  UCTDAQRawData daqData(fedRawDataArray);
176  if(verbose && event < 5) daqData.print();
177  for(uint32_t i = 0; i < daqData.nAMCs(); i++) {
178  UCTAMCRawData amcData(daqData.amcPayload(i));
179  if(verbose && event < 5) {
180  LogDebug("L1TCaloLayer1") << endl;
181  amcData.print();
182  LogDebug("L1TCaloLayer1") << endl;
183  }
184  uint32_t lPhi = amcData.layer1Phi();
185  UCTCTP7RawData ctp7Data(amcData.payload());
186  if(verbose && event < 5) ctp7Data.print();
187  if(verbose && event < 5) LogDebug("L1TCaloLayer1") << endl;
188  makeECalTPGs(lPhi, ctp7Data, ecalTPGs);
189  makeHCalTPGs(lPhi, ctp7Data, hcalTPGs);
190  // Note: HF TPGs are added at the tail of other TPGs
191  makeHFTPGs(lPhi, ctp7Data, hcalTPGs);
192  makeRegions(lPhi, ctp7Data, regions);
193  }
194 
195  }
196 
197  }
198  else{
199 
200  LogError("L1T") << "Cannot unpack: no collection found";
201 
202  return;
203  }
204 
205  iEvent.put(std::move(ecalTPGs));
206  iEvent.put(std::move(hcalTPGs));
207  iEvent.put(std::move(regions));
208 
209  event++;
210  if(verbose && event == 5) LogDebug("L1TCaloLayer1") << "L1TCaloLayer1RawToDigi: Goodbye! Tired of printing junk" << endl;
211 
212 }
#define LogDebug(id)
void makeHCalTPGs(uint32_t lPhi, UCTCTP7RawData &ctp7Data, std::unique_ptr< HcalTrigPrimDigiCollection > &hcalTPGs)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
void makeRegions(uint32_t lPhi, UCTCTP7RawData &ctp7Data, std::unique_ptr< L1CaloRegionCollection > &regions)
#define nullptr
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
bool isValid() const
Definition: HandleBase.h:74
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:416
void makeHFTPGs(uint32_t lPhi, UCTCTP7RawData &ctp7Data, std::unique_ptr< HcalTrigPrimDigiCollection > &hcalTPGs)
unsigned long long uint64_t
Definition: Time.h:15
void makeECalTPGs(uint32_t lPhi, UCTCTP7RawData &ctp7Data, std::unique_ptr< EcalTrigPrimDigiCollection > &ecalTPGs)
HLT enums.
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
std::vector< L1CaloRegion > L1CaloRegionCollection
def move(src, dest)
Definition: eostools.py:510
Definition: event.py:1

Member Data Documentation

uint32_t L1TCaloLayer1RawToDigi::event
private
std::vector<int> L1TCaloLayer1RawToDigi::fedIDs
private

Definition at line 97 of file L1TCaloLayer1RawToDigi.cc.

Referenced by produce().

InputTag L1TCaloLayer1RawToDigi::fedRawDataLabel
private

Definition at line 96 of file L1TCaloLayer1RawToDigi.cc.

Referenced by L1TCaloLayer1RawToDigi(), and produce().

bool L1TCaloLayer1RawToDigi::verbose
private