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
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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 wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
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)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 24 of file GctDigiToPsbText.h.

Constructor & Destructor Documentation

◆ GctDigiToPsbText()

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

open output text files

Definition at line 8 of file GctDigiToPsbText.cc.

References Exception, MillePedeFileConverter_cfg::fileName, good, 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")),
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 << std::endl;
23  }
24  }
25 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
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:589
bool m_hexUpperCase
write upper case hex words
auto const good
min quality of good

◆ ~GctDigiToPsbText()

GctDigiToPsbText::~GctDigiToPsbText ( )
override

close files

Definition at line 27 of file GctDigiToPsbText.cc.

References mps_fire::i, and m_file.

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

Member Function Documentation

◆ analyze()

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

buffer

flush data to files

Implements edm::EDAnalyzer.

Definition at line 33 of file GctDigiToPsbText.cc.

References data, mps_fire::i, iEvent, compare_using_db::ifile, dqmiolumiharvest::j, edm::InputTag::label(), m_file, m_gctInputLabel, m_hexUpperCase, and testProducerWithPsetDescEmpty_cfi::x1.

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

Member Data Documentation

◆ fdebug

std::ofstream GctDigiToPsbText::fdebug
private

handle for debug file

Definition at line 45 of file GctDigiToPsbText.h.

◆ m_file

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

handles for output files

Definition at line 42 of file GctDigiToPsbText.h.

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

◆ m_gctInputLabel

edm::InputTag GctDigiToPsbText::m_gctInputLabel
private

label for input digis

Definition at line 33 of file GctDigiToPsbText.h.

Referenced by analyze().

◆ m_hexUpperCase

bool GctDigiToPsbText::m_hexUpperCase
private

write upper case hex words

Definition at line 39 of file GctDigiToPsbText.h.

Referenced by analyze().

◆ m_textFileName

std::string GctDigiToPsbText::m_textFileName
private

basename for output files

Definition at line 36 of file GctDigiToPsbText.h.

Referenced by GctDigiToPsbText().