CMS 3D CMS Logo

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

#include <ESDigiToRaw.h>

Inheritance diagram for ESDigiToRaw:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef uint32_t Word32
 
typedef uint64_t Word64
 
- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 ESDigiToRaw (const edm::ParameterSet &ps)
 
void produce (edm::StreamID, edm::Event &e, const edm::EventSetup &es) const override
 
 ~ESDigiToRaw () override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- 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 ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
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, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- 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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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 selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Attributes

static const int BXMAX = 2808
 
static const int KCHIP_BC_RANGE = 4096
 
static const int KCHIP_EC_RANGE = 256
 
static const int LHC_BX_RANGE = 3564
 

Private Attributes

const bool debug_
 
const ESDataFormatterESDataFormatter_
 
const edm::EDGetTokenT< ESDigiCollectionESDigiToken_
 
int fedId_ [2][2][40][40]
 
const int formatMajor_
 
const int formatMinor_
 
const std::string instanceName_
 
const std::string label_
 
const edm::FileInPath lookup_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 20 of file ESDigiToRaw.h.

Member Typedef Documentation

◆ Word32

typedef uint32_t ESDigiToRaw::Word32

Definition at line 27 of file ESDigiToRaw.h.

◆ Word64

typedef uint64_t ESDigiToRaw::Word64

Definition at line 28 of file ESDigiToRaw.h.

Constructor & Destructor Documentation

◆ ESDigiToRaw()

ESDigiToRaw::ESDigiToRaw ( const edm::ParameterSet ps)

Definition at line 14 of file ESDigiToRaw.cc.

References gather_cfg::cout, ESDataFormatter_, fedId_, geometryDiff::file, formatMajor_, edm::FileInPath::fullPath(), mps_fire::i, dqmiolumiharvest::j, dqmdumpme::k, lookup_, visualization-live-secondInstance_cfg::m, and submitDQMOfflineCAF::nLines.

15  : ESDataFormatter_(nullptr),
16  label_(ps.getParameter<string>("Label")),
17  instanceName_(ps.getParameter<string>("InstanceES")),
18  ESDigiToken_(consumes<ESDigiCollection>(edm::InputTag(label_, instanceName_))),
19  lookup_(ps.getUntrackedParameter<FileInPath>("LookupTable")),
20  debug_(ps.getUntrackedParameter<bool>("debugMode", false)),
21  formatMajor_(ps.getUntrackedParameter<int>("formatMajor", 4)),
22  formatMinor_(ps.getUntrackedParameter<int>("formatMinor", 1)) {
23  if (formatMajor_ == 4)
25  else
27 
28  produces<FEDRawDataCollection>();
29  // initialize look-up table
30  for (int i = 0; i < 2; ++i)
31  for (int j = 0; j < 2; ++j)
32  for (int k = 0; k < 40; ++k)
33  for (int m = 0; m < 40; m++)
34  fedId_[i][j][k][m] = -1;
35 
36  // read in look-up table
37  int nLines, iz, ip, ix, iy, fed, kchip, pace, bundle, fiber, optorx;
38  ifstream file;
39  file.open(lookup_.fullPath().c_str());
40  if (file.is_open()) {
41  file >> nLines;
42  for (int i = 0; i < nLines; ++i) {
43  file >> iz >> ip >> ix >> iy >> fed >> kchip >> pace >> bundle >> fiber >> optorx;
44  fedId_[(3 - iz) / 2 - 1][ip - 1][ix - 1][iy - 1] = fed;
45  }
46  } else {
47  cout << "[ESDigiToRaw] Look up table file can not be found in " << lookup_.fullPath().c_str() << endl;
48  }
49 
50  file.close();
51 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::string fullPath() const
Definition: FileInPath.cc:161
const edm::EDGetTokenT< ESDigiCollection > ESDigiToken_
Definition: ESDigiToRaw.h:41
T getUntrackedParameter(std::string const &, T const &) const
const int formatMajor_
Definition: ESDigiToRaw.h:44
const ESDataFormatter * ESDataFormatter_
Definition: ESDigiToRaw.h:38
int fedId_[2][2][40][40]
Definition: ESDigiToRaw.h:36
const bool debug_
Definition: ESDigiToRaw.h:43
const edm::FileInPath lookup_
Definition: ESDigiToRaw.h:42
const std::string label_
Definition: ESDigiToRaw.h:39
const std::string instanceName_
Definition: ESDigiToRaw.h:40
const int formatMinor_
Definition: ESDigiToRaw.h:45

◆ ~ESDigiToRaw()

ESDigiToRaw::~ESDigiToRaw ( )
override

Definition at line 53 of file ESDigiToRaw.cc.

References ESDataFormatter_.

53  {
54  if (ESDataFormatter_)
55  delete ESDataFormatter_;
56 }
const ESDataFormatter * ESDataFormatter_
Definition: ESDigiToRaw.h:38

Member Function Documentation

◆ produce()

void ESDigiToRaw::produce ( edm::StreamID  ,
edm::Event e,
const edm::EventSetup es 
) const
overridevirtual

Implements edm::global::EDProducerBase.

Definition at line 58 of file ESDigiToRaw.cc.

References edm::DataFrameContainer::begin(), ESDataFormatter::Meta_Data::bx, gather_cfg::cout, debug_, hgcalPerformanceValidation::df, ESDataFormatter::DigiToRaw(), edm::DataFrameContainer::end(), ESDataFormatter_, ESDigiToken_, makeMEIFBenchmarkPlots::ev, fedId_, l1t_dqm_sourceclient-live_cfg::fedRawData, ESDataFormatter::Meta_Data::kchip_bc, KCHIP_BC_RANGE, ESDataFormatter::Meta_Data::kchip_ec, KCHIP_EC_RANGE, LHC_BX_RANGE, ESDataFormatter::Meta_Data::lv1, eostools::move(), ESDataFormatter::Meta_Data::orbit_number, ESDetId::plane(), ESDataFormatter::Meta_Data::run_number, ESDetId::six(), ESDetId::siy(), and ESDetId::zside().

58  {
60  meta_data.lv1 = ev.id().event();
61  meta_data.run_number = ev.id().run();
62  meta_data.orbit_number = meta_data.lv1 / LHC_BX_RANGE;
63  meta_data.bx = (meta_data.lv1 % LHC_BX_RANGE);
64 
65  meta_data.kchip_ec = (meta_data.lv1 % KCHIP_EC_RANGE);
66  meta_data.kchip_bc = (meta_data.lv1 % KCHIP_BC_RANGE);
67 
69  ev.getByToken(ESDigiToken_, digis);
70 
71  int ifed;
73  Digis.clear();
74 
75  for (ESDigiCollection::const_iterator it = digis->begin(); it != digis->end(); ++it) {
76  const ESDataFrame& df = *it;
77  const ESDetId& detId = it->id();
78 
79  ifed = fedId_[(3 - detId.zside()) / 2 - 1][detId.plane() - 1][detId.six() - 1][detId.siy() - 1];
80  if (ifed < 0)
81  continue;
82 
83  Digis[ifed].push_back(df);
84  }
85 
86  auto productRawData = std::make_unique<FEDRawDataCollection>();
87 
88  ESDataFormatter::Digis::const_iterator itfed;
89  for (itfed = Digis.begin(); itfed != Digis.end(); ++itfed) {
90  int fId = (*itfed).first;
91 
92  FEDRawData& fedRawData = productRawData->FEDData(fId);
93  ESDataFormatter_->DigiToRaw(fId, Digis, fedRawData, meta_data);
94 
95  if (debug_)
96  cout << "FED : " << fId << " Data size : " << fedRawData.size() << " (Bytes)" << endl;
97  }
98 
99  ev.put(std::move(productRawData));
100 
101  return;
102 }
static const int KCHIP_EC_RANGE
Definition: ESDigiToRaw.h:33
const edm::EDGetTokenT< ESDigiCollection > ESDigiToken_
Definition: ESDigiToRaw.h:41
int zside() const
Definition: ESDetId.h:39
std::map< int, DetDigis > Digis
const ESDataFormatter * ESDataFormatter_
Definition: ESDigiToRaw.h:38
int fedId_[2][2][40][40]
Definition: ESDigiToRaw.h:36
int plane() const
Definition: ESDetId.h:41
const bool debug_
Definition: ESDigiToRaw.h:43
const_iterator end() const
const_iterator begin() const
The iterator returned can not safely be used across threads.
int siy() const
Definition: ESDetId.h:45
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
static const int KCHIP_BC_RANGE
Definition: ESDigiToRaw.h:32
int six() const
Definition: ESDetId.h:43
virtual void DigiToRaw(int fedId, Digis &digis, FEDRawData &fedRawData, const Meta_Data &meta_data) const =0
static const int LHC_BX_RANGE
Definition: ESDigiToRaw.h:31
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ BXMAX

const int ESDigiToRaw::BXMAX = 2808
static

Definition at line 30 of file ESDigiToRaw.h.

◆ debug_

const bool ESDigiToRaw::debug_
private

Definition at line 43 of file ESDigiToRaw.h.

Referenced by produce().

◆ ESDataFormatter_

const ESDataFormatter* ESDigiToRaw::ESDataFormatter_
private

Definition at line 38 of file ESDigiToRaw.h.

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

◆ ESDigiToken_

const edm::EDGetTokenT<ESDigiCollection> ESDigiToRaw::ESDigiToken_
private

Definition at line 41 of file ESDigiToRaw.h.

Referenced by produce().

◆ fedId_

int ESDigiToRaw::fedId_[2][2][40][40]
private

Definition at line 36 of file ESDigiToRaw.h.

Referenced by ESDigiToRaw(), and produce().

◆ formatMajor_

const int ESDigiToRaw::formatMajor_
private

Definition at line 44 of file ESDigiToRaw.h.

Referenced by ESDigiToRaw().

◆ formatMinor_

const int ESDigiToRaw::formatMinor_
private

Definition at line 45 of file ESDigiToRaw.h.

◆ instanceName_

const std::string ESDigiToRaw::instanceName_
private

Definition at line 40 of file ESDigiToRaw.h.

◆ KCHIP_BC_RANGE

const int ESDigiToRaw::KCHIP_BC_RANGE = 4096
static

Definition at line 32 of file ESDigiToRaw.h.

Referenced by produce().

◆ KCHIP_EC_RANGE

const int ESDigiToRaw::KCHIP_EC_RANGE = 256
static

Definition at line 33 of file ESDigiToRaw.h.

Referenced by produce().

◆ label_

const std::string ESDigiToRaw::label_
private

◆ LHC_BX_RANGE

const int ESDigiToRaw::LHC_BX_RANGE = 3564
static

Definition at line 31 of file ESDigiToRaw.h.

Referenced by produce().

◆ lookup_

const edm::FileInPath ESDigiToRaw::lookup_
private

Definition at line 42 of file ESDigiToRaw.h.

Referenced by ESDigiToRaw().