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::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 RawToText (const edm::ParameterSet &)
 
 ~RawToText () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (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::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices 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::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

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.

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 }

References filename_.

◆ ~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::EDAnalyzer.

Definition at line 25 of file RawToText.cc.

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 }

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().

◆ beginJob()

void RawToText::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 58 of file RawToText.cc.

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 }

References file_, filename_, and MillePedeFileConverter_cfg::out.

◆ endJob()

void RawToText::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 67 of file RawToText.cc.

67 { file_.close(); }

References file_.

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().

l1tstage2emulator_dqm_sourceclient-live_cfg.feds
feds
Definition: l1tstage2emulator_dqm_sourceclient-live_cfg.py:146
mps_fire.i
i
Definition: mps_fire.py:355
RawToText::inputLabel_
edm::InputTag inputLabel_
Definition: RawToText.h:36
edm::LogInfo
Definition: MessageLogger.h:254
RawToText::nevt_
int nevt_
Definition: RawToText.h:45
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::Handle
Definition: AssociativeIterator.h:50
FEDRawData::data
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
FEDRawData
Definition: FEDRawData.h:19
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogWarning
Definition: MessageLogger.h:141
iEvent
int iEvent
Definition: GenABIO.cc:224
RawToText::filename_
std::string filename_
Definition: RawToText.h:42
FEDRawData::size
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
RawToText::fedId_
int fedId_
Definition: RawToText.h:39
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
ztail.d
d
Definition: ztail.py:151
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
edm::InputTag
Definition: InputTag.h:15
RawToText::file_
std::ofstream file_
Definition: RawToText.h:43