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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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

Definition at line 24 of file RawToText.h.

Constructor & Destructor Documentation

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",
19  "slinkOutput.txt")),
20  nevt_(0) {
21  edm::LogInfo("TextToDigi")
22  << "Creating ASCII dump " << filename_ << std::endl;
23 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int fedId_
Definition: RawToText.h:39
std::string filename_
Definition: RawToText.h:42
edm::InputTag inputLabel_
Definition: RawToText.h:36
int nevt_
Definition: RawToText.h:45
RawToText::~RawToText ( )
override

Definition at line 25 of file RawToText.cc.

25 {}

Member Function Documentation

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

Definition at line 27 of file RawToText.cc.

References edmIntegrityCheck::d, FEDRawData::data(), data, TauDecayModes::dec, FEDRawDataCollection::FEDData(), fedId_, file_, edm::Event::getByLabel(), mps_fire::i, inputLabel_, nevt_, and FEDRawData::size().

28  {
29 
30  nevt_++;
31 
32  // get raw data collection
34  iEvent.getByLabel(inputLabel_, feds);
35  const FEDRawData &gctRcd = feds->FEDData(fedId_);
36 
37  edm::LogInfo("GCT") << "Upacking FEDRawData of size " << std::dec
38  << gctRcd.size() << std::endl;
39 
40  // do a simple check of the raw data
41  if (gctRcd.size() < 16) {
42  edm::LogWarning("Invalid Data")
43  << "Empty/invalid GCT raw data, size = " << gctRcd.size() << std::endl;
44  return;
45  }
46 
47  const unsigned char *data = gctRcd.data();
48 
49  int eventSize = gctRcd.size() / 4;
50 
51  unsigned long d = 0;
52  for (int i = 0; i < eventSize; i++) {
53  d = 0;
54  // d = data[i*4+0] + (data[i*4+1]<<8) + (data[i*4+2]<<16) +
55  // (data[i*4+3]<<24);
56  for (int j = 0; j < 4; j++) {
57  d += ((data[i * 4 + j] & 0xff) << (8 * j));
58  }
59  file_ << std::setw(8) << std::setfill('0') << std::hex << d << std::endl;
60  }
61  file_ << std::flush << std::endl;
62 }
int fedId_
Definition: RawToText.h:39
std::ofstream file_
Definition: RawToText.h:43
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 getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:480
edm::InputTag inputLabel_
Definition: RawToText.h:36
int nevt_
Definition: RawToText.h:45
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
void RawToText::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 64 of file RawToText.cc.

References file_, filename_, and MillePedeFileConverter_cfg::out.

64  {
65 
66  // open VME file
67  file_.open(filename_.c_str(), std::ios::out);
68 
69  if (!file_.good()) {
70  edm::LogInfo("RawToText")
71  << "Failed to open ASCII file " << filename_ << std::endl;
72  }
73 }
std::ofstream file_
Definition: RawToText.h:43
std::string filename_
Definition: RawToText.h:42
void RawToText::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 75 of file RawToText.cc.

References file_.

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

Member Data Documentation

int RawToText::fedId_
private

Definition at line 39 of file RawToText.h.

Referenced by analyze().

std::ofstream RawToText::file_
private

Definition at line 43 of file RawToText.h.

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

std::string RawToText::filename_
private

Definition at line 42 of file RawToText.h.

Referenced by beginJob(), and RawToText().

edm::InputTag RawToText::inputLabel_
private

Definition at line 36 of file RawToText.h.

Referenced by analyze().

int RawToText::nevt_
private

Definition at line 45 of file RawToText.h.

Referenced by analyze().