CMS 3D CMS Logo

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

#include <RawToText.h>

Inheritance diagram for RawToText:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 RawToText (const edm::ParameterSet &)
 
 ~RawToText () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () 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)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 

Private Attributes

int fedId_
 
std::ofstream file_
 
std::string filename_
 
edm::InputTag inputLabel_
 
int nevt_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 24 of file RawToText.h.

Constructor & Destructor Documentation

◆ RawToText()

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

Definition at line 15 of file RawToText.cc.

References filename_.

16  : inputLabel_(iConfig.getParameter<edm::InputTag>("inputLabel")),
17  fedId_(iConfig.getUntrackedParameter<int>("fedId", 745)),
18  filename_(iConfig.getUntrackedParameter<std::string>("filename", "slinkOutput.txt")),
19  nevt_(0) {
20  edm::LogInfo("TextToDigi") << "Creating ASCII dump " << filename_ << std::endl;
21 }
int fedId_
Definition: RawToText.h:39
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
T getUntrackedParameter(std::string const &, T const &) const
std::string filename_
Definition: RawToText.h:42
Log< level::Info, false > LogInfo
edm::InputTag inputLabel_
Definition: RawToText.h:36
int nevt_
Definition: RawToText.h:45

◆ ~RawToText()

RawToText::~RawToText ( )
override

Definition at line 23 of file RawToText.cc.

23 {}

Member Function Documentation

◆ analyze()

void RawToText::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 25 of file RawToText.cc.

References ztail::d, FEDRawData::data(), data, TauDecayModes::dec, fedId_, l1tstage2emulator_dqm_sourceclient-live_cfg::feds, file_, mps_fire::i, iEvent, inputLabel_, dqmiolumiharvest::j, nevt_, and FEDRawData::size().

25  {
26  nevt_++;
27 
28  // get raw data collection
30  iEvent.getByLabel(inputLabel_, feds);
31  const FEDRawData &gctRcd = feds->FEDData(fedId_);
32 
33  edm::LogInfo("GCT") << "Upacking FEDRawData of size " << std::dec << gctRcd.size() << std::endl;
34 
35  // do a simple check of the raw data
36  if (gctRcd.size() < 16) {
37  edm::LogWarning("Invalid Data") << "Empty/invalid GCT raw data, size = " << gctRcd.size() << std::endl;
38  return;
39  }
40 
41  const unsigned char *data = gctRcd.data();
42 
43  int eventSize = gctRcd.size() / 4;
44 
45  unsigned long d = 0;
46  for (int i = 0; i < eventSize; i++) {
47  d = 0;
48  // d = data[i*4+0] + (data[i*4+1]<<8) + (data[i*4+2]<<16) +
49  // (data[i*4+3]<<24);
50  for (int j = 0; j < 4; j++) {
51  d += ((data[i * 4 + j] & 0xff) << (8 * j));
52  }
53  file_ << std::setw(8) << std::setfill('0') << std::hex << d << std::endl;
54  }
55  file_ << std::flush << std::endl;
56 }
int fedId_
Definition: RawToText.h:39
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:48
std::ofstream file_
Definition: RawToText.h:43
int iEvent
Definition: GenABIO.cc:224
d
Definition: ztail.py:151
Log< level::Info, false > LogInfo
edm::InputTag inputLabel_
Definition: RawToText.h:36
int nevt_
Definition: RawToText.h:45
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
Log< level::Warning, false > LogWarning

◆ beginJob()

void RawToText::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 58 of file RawToText.cc.

References file_, filename_, and MillePedeFileConverter_cfg::out.

58  {
59  // open VME file
60  file_.open(filename_.c_str(), std::ios::out);
61 
62  if (!file_.good()) {
63  edm::LogInfo("RawToText") << "Failed to open ASCII file " << filename_ << std::endl;
64  }
65 }
std::ofstream file_
Definition: RawToText.h:43
std::string filename_
Definition: RawToText.h:42
Log< level::Info, false > LogInfo

◆ endJob()

void RawToText::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 67 of file RawToText.cc.

References file_.

67 { file_.close(); }
std::ofstream file_
Definition: RawToText.h:43

Member Data Documentation

◆ fedId_

int RawToText::fedId_
private

Definition at line 39 of file RawToText.h.

Referenced by analyze().

◆ file_

std::ofstream RawToText::file_
private

Definition at line 43 of file RawToText.h.

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

◆ filename_

std::string RawToText::filename_
private

Definition at line 42 of file RawToText.h.

Referenced by beginJob(), and RawToText().

◆ inputLabel_

edm::InputTag RawToText::inputLabel_
private

Definition at line 36 of file RawToText.h.

Referenced by analyze().

◆ nevt_

int RawToText::nevt_
private

Definition at line 45 of file RawToText.h.

Referenced by analyze().