16 : m_fileEventOffset(iConfig.getUntrackedParameter<
int>(
"FileEventOffset", 0)),
17 m_textFileName(iConfig.getParameter<
std::
string>(
"TextFileName")),
20 produces<L1GctEmCandCollection>(
"isoEm");
21 produces<L1GctEmCandCollection>(
"nonIsoEm");
22 produces<L1GctJetCandCollection>(
"cenJets");
23 produces<L1GctJetCandCollection>(
"forJets");
24 produces<L1GctJetCandCollection>(
"tauJets");
31 std::stringstream fileStream;
38 <<
"GtPsbTextToDigi::GtPsbTextToDigi : " 39 <<
" couldn't open the file " 48 for (
int i = 0;
i < 4;
i++)
54 for (
unsigned i = 0;
i < 4;
i++) {
67 for (
int i = 0;
i < 4;
i++) {
82 LogDebug(
"GtPsbTextToDigi") <<
"putting empty digi (evt:" <<
m_nevt <<
")\n";
87 unsigned short cbs[2] = {1, 0};
92 LogDebug(
"GtPsbTextToDigi") <<
"[GtPsbTextToDigi::produce()] skipping event " <<
m_nevt << std::endl;
97 unsigned long int buff;
100 for (
int cycle = 0; cycle < 2; cycle++) {
103 unsigned tmp = (buff >> 15) & 0
x1;
104 if (
tmp != cbs[cycle]) {
110 <<
"GtPsbTextToDigi::produce : " 111 <<
" found format inconsistency in file #" <<
ifile <<
"\n in skipped line:" << ievt * 2 + 1
112 <<
" cycle:" <<
tmp <<
" is different from " << cbs[cycle] << std::endl;
116 LogDebug(
"GtPsbTextToDigi") <<
"[GtPsbTextToDigi::produce()] skipping input " << ievt << std::endl;
130 uint16_t
data[4][2] = {{0}};
131 for (
int i = 0;
i < 4;
i++)
132 for (
int j = 0;
j < 2;
j++)
141 LogDebug(
"GtPsbTextToDigi") <<
"GtPsbTextToDigi::produce : " 142 <<
" unexpected end of file " <<
m_textFileName <<
ii <<
".txt" << std::endl;
148 LogDebug(
"GtPsbTextToDigi") <<
"GtPsbTextToDigi::produce : " 155 unsigned long int uLongBuffer;
157 for (
unsigned cycle = 0; cycle < 2; cycle++) {
159 unsigned tmp = (uLongBuffer >> 15) & 0
x1;
162 if (
false &&
tmp != cbs[cycle])
163 std::cout <<
"[GtPsbTextToDigi::produce()] asserting " 164 <<
" evt:" <<
m_nevt <<
" ifile:" <<
ifile <<
" cycle:" << cbs[cycle] << std::hex
165 <<
" buffer:" << uLongBuffer <<
" tmp: " <<
tmp <<
std::dec <<
"\n\n" 168 if (
tmp != cbs[cycle]) {
174 <<
"GtPsbTextToDigi::produce : " 175 <<
" found format inconsistency in file #" <<
ifile 177 << cbs[cycle] << std::endl;
180 data[
ifile][cycle] = (uLongBuffer & 0x7fff);
185 unsigned iIsola, iNoIso;
186 for (
unsigned cycle = 0; cycle < 2; cycle++) {
187 for (
unsigned i = 0;
i < 2;
i++) {
190 gctIsolaEm->push_back(
L1GctEmCand(
data[iIsola][cycle] & 0x7fff,
true));
191 gctNoIsoEm->push_back(
L1GctEmCand(
data[iNoIso][cycle] & 0x7fff,
false));
210 for (
int i = 0;
i < nmem - 1;
i++)
212 LogDebug(
"GtPsbTextToDigi") <<
"[GtPsbTextToDigi::endJob()] ";
214 LogDebug(
"GtPsbTextToDigi") <<
"did not find matching BC0 in all input files: ";
216 LogDebug(
"GtPsbTextToDigi") <<
"detected common BC0 in all input files: ";
217 for (
int i = 0;
i < nmem;
i++)
219 LogDebug(
"GtPsbTextToDigi") << std::flush << std::endl;
~GtPsbTextToDigi() override
auto const good
min quality of good
Level-1 Trigger jet candidate.
void produce(edm::Event &, const edm::EventSetup &) override
GtPsbTextToDigi(const edm::ParameterSet &)
std::string m_textFileName
Name out input file.
Level-1 Trigger EM candidate at output of GCT.
std::vector< L1GctJetCand > L1GctJetCandCollection
int m_fileEventOffset
Number of events to be offset wrt input.
std::ifstream m_file[4]
File handle.
Abs< T >::type abs(const T &t)
void putEmptyDigi(edm::Event &)
Create empty digi collection.
char data[epos_bytes_allocation]
int m_bc0[4]
Hold detected BC0 signal position per file.
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
std::vector< L1GctEmCand > L1GctEmCandCollection