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 ()
 
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
 
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)
 
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 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 25 of file RawToText.h.

Constructor & Destructor Documentation

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

Definition at line 16 of file RawToText.cc.

References filename_.

16  :
17  inputLabel_(iConfig.getParameter<edm::InputTag>("inputLabel")),
18  fedId_(iConfig.getUntrackedParameter<int>("fedId", 745)),
19  filename_(iConfig.getUntrackedParameter<std::string>("filename", "slinkOutput.txt")),
20  nevt_(0) {
21  edm::LogInfo("TextToDigi") << "Creating ASCII dump " << filename_ << std::endl;
22 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int fedId_
Definition: RawToText.h:41
std::string filename_
Definition: RawToText.h:44
edm::InputTag inputLabel_
Definition: RawToText.h:38
int nevt_
Definition: RawToText.h:47
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 28 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 "
38  << std::dec << gctRcd.size()
39  << std::endl;
40 
41  // do a simple check of the raw data
42  if (gctRcd.size()<16) {
43  edm::LogWarning("Invalid Data")
44  << "Empty/invalid GCT raw data, size = " << gctRcd.size()
45  << std::endl;
46  return;
47  }
48 
49  const unsigned char * data = gctRcd.data();
50 
51  int eventSize = gctRcd.size() / 4;
52 
53  unsigned long d = 0;
54  for(int i=0; i<eventSize; i++) {
55  d = 0;
56  //d = data[i*4+0] + (data[i*4+1]<<8) + (data[i*4+2]<<16) + (data[i*4+3]<<24);
57  for(int j=0; j<4; j++) {
58  d += ((data[i*4+j]&0xff)<<(8*j));
59  }
60  file_ << std::setw(8) << std::setfill('0') << std::hex << d << std::endl;
61  }
62  file_ << std::flush << std::endl;
63 
64 }
int fedId_
Definition: RawToText.h:41
std::ofstream file_
Definition: RawToText.h:45
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:475
edm::InputTag inputLabel_
Definition: RawToText.h:38
int nevt_
Definition: RawToText.h:47
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 67 of file RawToText.cc.

References file_, filename_, and MillePedeFileConverter_cfg::out.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 79 of file RawToText.cc.

References file_.

79  {
80  file_.close();
81 }
std::ofstream file_
Definition: RawToText.h:45

Member Data Documentation

int RawToText::fedId_
private

Definition at line 41 of file RawToText.h.

Referenced by analyze().

std::ofstream RawToText::file_
private

Definition at line 45 of file RawToText.h.

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

std::string RawToText::filename_
private

Definition at line 44 of file RawToText.h.

Referenced by beginJob(), and RawToText().

edm::InputTag RawToText::inputLabel_
private

Definition at line 38 of file RawToText.h.

Referenced by analyze().

int RawToText::nevt_
private

Definition at line 47 of file RawToText.h.

Referenced by analyze().