CMS 3D CMS Logo

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

#include <GctDigiToPsbText.h>

Inheritance diagram for GctDigiToPsbText:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 GctDigiToPsbText (const edm::ParameterSet &)
 
 ~GctDigiToPsbText () 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
 
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
 

Private Attributes

std::ofstream fdebug
 handle for debug file More...
 
std::ofstream m_file [4]
 handles for output files More...
 
edm::InputTag m_gctInputLabel
 label for input digis More...
 
bool m_hexUpperCase
 write upper case hex words More...
 
std::string m_textFileName
 basename for output files More...
 

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 24 of file GctDigiToPsbText.h.

Constructor & Destructor Documentation

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

open output text files

Definition at line 8 of file GctDigiToPsbText.cc.

References Exception, MillePedeFileConverter_cfg::fileName, mps_fire::i, cuy::ii, m_file, m_textFileName, MillePedeFileConverter_cfg::out, and AlCaHLTBitMon_QueryRunRegistry::string.

8  :
9  m_gctInputLabel(iConfig.getParameter<edm::InputTag>("GctInputLabel")),
10  m_textFileName(iConfig.getParameter<std::string>("TextFileName")),
11  m_hexUpperCase(iConfig.getUntrackedParameter<bool>("HexUpperCase",false)) {
13  for (unsigned i=0; i<4; i++){
14  std::stringstream fileStream;
15  int ii = (i<2)?i:i+4;
16  fileStream << m_textFileName << ii << ".txt";
17  std::string fileName(fileStream.str());
18  m_file[i].open(fileName.c_str(),std::ios::out);
19  if(!m_file[i].good()) {
20  throw cms::Exception("GctDigiToPsbTextTextFileOpenError")
21  << "GctDigiToPsbText::GctDigiToPsbText : "
22  << " couldn't create the file " << fileName
23  << std::endl;
24  }
25  }
26 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::ofstream m_file[4]
handles for output files
std::string m_textFileName
basename for output files
edm::InputTag m_gctInputLabel
label for input digis
ii
Definition: cuy.py:588
bool m_hexUpperCase
write upper case hex words
GctDigiToPsbText::~GctDigiToPsbText ( )
override

close files

Definition at line 28 of file GctDigiToPsbText.cc.

References mps_fire::i, and m_file.

28  {
30  for (unsigned i=0; i<4; i++)
31  m_file[i].close();
32 }
std::ofstream m_file[4]
handles for output files

Member Function Documentation

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

buffer

flush data to files

Definition at line 36 of file GctDigiToPsbText.cc.

References data, edm::Event::getByLabel(), mps_fire::i, compare_using_db::ifile, edm::InputTag::label(), m_file, m_gctInputLabel, m_hexUpperCase, and globals_cff::x1.

36  {
37 
38  //static int nevt = -1; nevt++;
39 
40  // get digis
43  iEvent.getByLabel(m_gctInputLabel.label(), "isoEm", gctIsolaEm);
44  iEvent.getByLabel(m_gctInputLabel.label(), "nonIsoEm", gctNoIsoEm);
45 
47  uint16_t data[4][2]= {{0}};
48  for (int i=0; i<4; i++)
49  for (int j=0; j<2; j++)
50  data[i][j]=0;
51 
52  std::stringstream sstrm;
53  if(m_hexUpperCase)
54  sstrm << std::uppercase;
55  else
56  sstrm.unsetf(std::ios::uppercase);
57 
58  // specify cycle bit sequence 1 0 1 0 ... or 0 1 0 1 ...
59  unsigned short cbs[2] = {1,0};
60 
61  unsigned int ifile;
62  unsigned int cycle;
63  unsigned iIsola, iNoIso;
64 
65  for(int i=0; i<4; i++) {
66  cycle = i/2;
67  ifile = i%2;
68  iIsola = ifile+2;
69  iNoIso = ifile;
70 
71  //get the data
72  data[iIsola][cycle] = gctIsolaEm->at(i).raw();
73  data[iNoIso][cycle] = gctNoIsoEm->at(i).raw();
74 
75  //print electrons
76  sstrm.str("");
77  sstrm << setw(4) << setfill('0') << std::hex
78  << (data[iIsola][cycle] & 0x7fff) + ((cbs[cycle]&0x1)<<15);
79  m_file[iIsola] << sstrm.str() << std::endl;
80  sstrm.str("");
81  sstrm << setw(4) << setfill('0') << std::hex
82  << (data[iNoIso][cycle] & 0x7fff) + ((cbs[cycle]&0x1)<<15);
83  m_file[iNoIso] << sstrm.str() << std::endl;
84  }
85 
87  for (unsigned i=0; i<4; i++)
88  m_file[i] << std::flush;
89 
90 }
std::ofstream m_file[4]
handles for output files
edm::InputTag m_gctInputLabel
label for input digis
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:475
bool m_hexUpperCase
write upper case hex words
std::string const & label() const
Definition: InputTag.h:36
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82

Member Data Documentation

std::ofstream GctDigiToPsbText::fdebug
private

handle for debug file

Definition at line 47 of file GctDigiToPsbText.h.

std::ofstream GctDigiToPsbText::m_file[4]
private

handles for output files

Definition at line 44 of file GctDigiToPsbText.h.

Referenced by analyze(), GctDigiToPsbText(), and ~GctDigiToPsbText().

edm::InputTag GctDigiToPsbText::m_gctInputLabel
private

label for input digis

Definition at line 35 of file GctDigiToPsbText.h.

Referenced by analyze().

bool GctDigiToPsbText::m_hexUpperCase
private

write upper case hex words

Definition at line 41 of file GctDigiToPsbText.h.

Referenced by analyze().

std::string GctDigiToPsbText::m_textFileName
private

basename for output files

Definition at line 38 of file GctDigiToPsbText.h.

Referenced by GctDigiToPsbText().