CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
l1t::AMC13DumpToRaw Class Reference
Inheritance diagram for l1t::AMC13DumpToRaw:
edm::one::EDProducer<> edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 AMC13DumpToRaw (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::one::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () 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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

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

Private Member Functions

void beginJob () override
 
void endJob () override
 
void produce (edm::Event &, const edm::EventSetup &) override
 
void readEvent (std::vector< uint32_t > &load32)
 

Private Attributes

int boardId_
 
int evType_
 
int fedId_
 
std::ifstream file_
 
std::string filename_
 
int fwVer_
 
int iAmc_
 
int slinkHeaderSize_
 
int slinkTrailerSize_
 

Additional Inherited Members

- Public Types inherited from edm::one::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
 
- 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 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 49 of file AMC13DumpToRaw.cc.

Constructor & Destructor Documentation

◆ AMC13DumpToRaw()

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

Definition at line 91 of file AMC13DumpToRaw.cc.

92  : filename_(iConfig.getUntrackedParameter<std::string>("filename", "data.txt")),
93  fedId_(iConfig.getUntrackedParameter<int>("fedId", 1)),
94  iAmc_(iConfig.getUntrackedParameter<int>("iAmc", 1)),
95  boardId_(iConfig.getUntrackedParameter<int>("boardId", 1)),
96  evType_(iConfig.getUntrackedParameter<int>("eventType", 1)),
97  fwVer_(iConfig.getUntrackedParameter<int>("fwVersion", 1)),
98  slinkHeaderSize_(iConfig.getUntrackedParameter<int>("lenSlinkHeader", 8)),
99  slinkTrailerSize_(iConfig.getUntrackedParameter<int>("lenSlinkTrailer", 8)) {
100  produces<FEDRawDataCollection>();
101  }
T getUntrackedParameter(std::string const &, T const &) const

Member Function Documentation

◆ beginJob()

void AMC13DumpToRaw::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 208 of file AMC13DumpToRaw.cc.

References file_, filename_, and recoMuon::in.

208  {
209  // open VME file
210  file_.open(filename_.c_str(), std::ios::in);
211  if (!file_.good()) {
212  edm::LogInfo("TextToDigi") << "Failed to open ASCII file " << filename_ << std::endl;
213  }
214  }
Log< level::Info, false > LogInfo
std::ifstream file_

◆ endJob()

void AMC13DumpToRaw::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 217 of file AMC13DumpToRaw.cc.

References file_.

217 { file_.close(); }
std::ifstream file_

◆ fillDescriptions()

void AMC13DumpToRaw::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 220 of file AMC13DumpToRaw.cc.

References edm::ConfigurationDescriptions::addDefault(), and submitPVResolutionJobs::desc.

220  {
221  //The following says we do not know what parameters are allowed so do no validation
222  // Please change this to state exactly what you do use, even if it is no parameters
224  desc.setUnknown();
225  descriptions.addDefault(desc);
226  }
void addDefault(ParameterSetDescription const &psetDescription)

◆ produce()

void AMC13DumpToRaw::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDProducerBase.

Definition at line 108 of file AMC13DumpToRaw.cc.

References FEDRawData::data(), fedId_, EcalFEDMonitor_cfi::FEDRawDataCollection, mps_fire::i, iEvent, dqmiolumiharvest::j, LogDebug, eostools::move(), readEvent(), FEDRawData::resize(), and FEDRawData::size().

108  {
109  using namespace edm;
110 
111  // create AMC 13 packet
112  // amc13::Packet amc13;
113 
114  std::vector<uint32_t> load32;
115 
116  readEvent(load32);
117 
118  // formatAMC(amc13, load32);
119 
120  int size = load32.size() * 4;
121 
122  LogDebug("L1T") << "AMC13 size " << size << " bytes";
123 
124  // prepare the raw data collection
125  std::unique_ptr<FEDRawDataCollection> raw_coll(new FEDRawDataCollection());
126  FEDRawData& fed_data = raw_coll->FEDData(fedId_);
127 
128  fed_data.resize(size);
129 
130  // fill FEDRawData object
131  for (unsigned i = 0; i < load32.size(); ++i) {
132  for (unsigned j = 0; j < 4; ++j) {
133  fed_data.data()[i * 4 + j] = (load32.at(i) >> (8 * j)) & 0xff;
134  }
135  }
136 
137  // formatRaw(iEvent, amc13, fed_data);
138 
139  LogDebug("L1T") << "Packing FED ID " << fedId_ << " size " << fed_data.size();
140 
141  // put the collection in the event
142  iEvent.put(std::move(raw_coll));
143  }
size
Write out results.
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:48
int iEvent
Definition: GenABIO.cc:224
void resize(size_t newsize, size_t wordsize=8)
Definition: FEDRawData.cc:28
HLT enums.
void readEvent(std::vector< uint32_t > &load32)
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
def move(src, dest)
Definition: eostools.py:511
#define LogDebug(id)

◆ readEvent()

void AMC13DumpToRaw::readEvent ( std::vector< uint32_t > &  load32)
private

Definition at line 145 of file AMC13DumpToRaw.cc.

References ztail::d, file_, mps_splice::line, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by produce().

145  {
146  // read file
148 
149  // while not encountering dumb errors
150  while (getline(file_, line) && !line.empty()) {
151  std::istringstream iss(line);
152  unsigned long d;
153  iss >> std::hex >> d;
154 
155  load32.push_back(d);
156  }
157  }
d
Definition: ztail.py:151
std::ifstream file_

Member Data Documentation

◆ boardId_

int l1t::AMC13DumpToRaw::boardId_
private

Definition at line 73 of file AMC13DumpToRaw.cc.

◆ evType_

int l1t::AMC13DumpToRaw::evType_
private

Definition at line 74 of file AMC13DumpToRaw.cc.

◆ fedId_

int l1t::AMC13DumpToRaw::fedId_
private

Definition at line 71 of file AMC13DumpToRaw.cc.

Referenced by produce().

◆ file_

std::ifstream l1t::AMC13DumpToRaw::file_
private

Definition at line 67 of file AMC13DumpToRaw.cc.

Referenced by beginJob(), endJob(), and readEvent().

◆ filename_

std::string l1t::AMC13DumpToRaw::filename_
private

Definition at line 68 of file AMC13DumpToRaw.cc.

Referenced by beginJob().

◆ fwVer_

int l1t::AMC13DumpToRaw::fwVer_
private

Definition at line 75 of file AMC13DumpToRaw.cc.

◆ iAmc_

int l1t::AMC13DumpToRaw::iAmc_
private

Definition at line 72 of file AMC13DumpToRaw.cc.

◆ slinkHeaderSize_

int l1t::AMC13DumpToRaw::slinkHeaderSize_
private

Definition at line 76 of file AMC13DumpToRaw.cc.

◆ slinkTrailerSize_

int l1t::AMC13DumpToRaw::slinkTrailerSize_
private

Definition at line 77 of file AMC13DumpToRaw.cc.