CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
- 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
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

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
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- 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 ( )

Definition at line 25 of file RawToText.cc.

25 {}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 28 of file RawToText.cc.

References ztail::d, FEDRawData::data(), data, TauDecayModes::dec, fedId_, HcalMonitorModule_cfi::feds, file_, edm::Event::getByLabel(), i, inputLabel_, j, 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 i
Definition: DBlmapReader.cc:9
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
tuple d
Definition: ztail.py:151
int j
Definition: DBlmapReader.cc:9
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:405
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  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 67 of file RawToText.cc.

References file_, filename_, and dbtoconf::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
tuple out
Definition: dbtoconf.py:99
void RawToText::endJob ( void  )
privatevirtual

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