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
 
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
 

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

9  : m_gctInputLabel(iConfig.getParameter<edm::InputTag>("GctInputLabel")),
10  m_textFileName(iConfig.getParameter<std::string>("TextFileName")),
12  iConfig.getUntrackedParameter<bool>("HexUpperCase", false)) {
14  for (unsigned i = 0; i < 4; i++) {
15  std::stringstream fileStream;
16  int ii = (i < 2) ? i : i + 4;
17  fileStream << m_textFileName << ii << ".txt";
18  std::string fileName(fileStream.str());
19  m_file[i].open(fileName.c_str(), std::ios::out);
20  if (!m_file[i].good()) {
21  throw cms::Exception("GctDigiToPsbTextTextFileOpenError")
22  << "GctDigiToPsbText::GctDigiToPsbText : "
23  << " couldn't create the file " << fileName << 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:590
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 34 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.

35  {
36 
37  // static int nevt = -1; nevt++;
38 
39  // get digis
42  iEvent.getByLabel(m_gctInputLabel.label(), "isoEm", gctIsolaEm);
43  iEvent.getByLabel(m_gctInputLabel.label(), "nonIsoEm", gctNoIsoEm);
44 
46  uint16_t data[4][2] = {{0}};
47  for (int i = 0; i < 4; i++)
48  for (int j = 0; j < 2; j++)
49  data[i][j] = 0;
50 
51  std::stringstream sstrm;
52  if (m_hexUpperCase)
53  sstrm << std::uppercase;
54  else
55  sstrm.unsetf(std::ios::uppercase);
56 
57  // specify cycle bit sequence 1 0 1 0 ... or 0 1 0 1 ...
58  unsigned short cbs[2] = {1, 0};
59 
60  unsigned int ifile;
61  unsigned int cycle;
62  unsigned iIsola, iNoIso;
63 
64  for (int i = 0; i < 4; i++) {
65  cycle = i / 2;
66  ifile = i % 2;
67  iIsola = ifile + 2;
68  iNoIso = ifile;
69 
70  // get the data
71  data[iIsola][cycle] = gctIsolaEm->at(i).raw();
72  data[iNoIso][cycle] = gctNoIsoEm->at(i).raw();
73 
74  // print electrons
75  sstrm.str("");
76  sstrm << setw(4) << setfill('0') << std::hex
77  << (data[iIsola][cycle] & 0x7fff) + ((cbs[cycle] & 0x1) << 15);
78  m_file[iIsola] << sstrm.str() << std::endl;
79  sstrm.str("");
80  sstrm << setw(4) << setfill('0') << std::hex
81  << (data[iNoIso][cycle] & 0x7fff) + ((cbs[cycle] & 0x1) << 15);
82  m_file[iNoIso] << sstrm.str() << std::endl;
83  }
84 
86  for (unsigned i = 0; i < 4; i++)
87  m_file[i] << std::flush;
88 }
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:480
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 46 of file GctDigiToPsbText.h.

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

handles for output files

Definition at line 43 of file GctDigiToPsbText.h.

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

edm::InputTag GctDigiToPsbText::m_gctInputLabel
private

label for input digis

Definition at line 34 of file GctDigiToPsbText.h.

Referenced by analyze().

bool GctDigiToPsbText::m_hexUpperCase
private

write upper case hex words

Definition at line 40 of file GctDigiToPsbText.h.

Referenced by analyze().

std::string GctDigiToPsbText::m_textFileName
private

basename for output files

Definition at line 37 of file GctDigiToPsbText.h.

Referenced by GctDigiToPsbText().