17 iConfig.getUntrackedParameter<
int>(
"FileEventOffset", 0)),
18 m_textFileName(iConfig.getParameter<
std::
string>(
"TextFileName")),
21 produces<L1GctEmCandCollection>(
"isoEm");
22 produces<L1GctEmCandCollection>(
"nonIsoEm");
23 produces<L1GctJetCandCollection>(
"cenJets");
24 produces<L1GctJetCandCollection>(
"forJets");
25 produces<L1GctJetCandCollection>(
"tauJets");
32 std::stringstream fileStream;
39 <<
"GtPsbTextToDigi::GtPsbTextToDigi : " 40 <<
" couldn't open the file " 49 for (
int i = 0;
i < 4;
i++)
55 for (
unsigned i = 0;
i < 4;
i++) {
62 std::unique_ptr<L1GctEmCandCollection> gctIsolaEm(
64 std::unique_ptr<L1GctEmCandCollection> gctNoIsoEm(
66 std::unique_ptr<L1GctJetCandCollection> gctCenJets(
68 std::unique_ptr<L1GctJetCandCollection> gctForJets(
70 std::unique_ptr<L1GctJetCandCollection> gctTauJets(
73 for (
int i = 0;
i < 4;
i++) {
88 LogDebug(
"GtPsbTextToDigi") <<
"putting empty digi (evt:" <<
m_nevt <<
")\n";
95 unsigned short cbs[2] = {1, 0};
101 <<
"[GtPsbTextToDigi::produce()] skipping event " <<
m_nevt 107 unsigned long int buff;
110 for (
int cycle = 0; cycle < 2; cycle++) {
113 unsigned tmp = (buff >> 15) & 0
x1;
114 if (tmp != cbs[cycle]) {
115 if (
m_bc0[ifile] == -1 && cycle == 1 && tmp == 1)
120 <<
"GtPsbTextToDigi::produce : " 121 <<
" found format inconsistency in file #" << ifile
122 <<
"\n in skipped line:" << ievt * 2 + 1 <<
" cycle:" << tmp
123 <<
" is different from " << cbs[cycle] << std::endl;
128 <<
"[GtPsbTextToDigi::produce()] skipping input " << ievt
135 std::unique_ptr<L1GctEmCandCollection> gctIsolaEm(
137 std::unique_ptr<L1GctEmCandCollection> gctNoIsoEm(
139 std::unique_ptr<L1GctJetCandCollection> gctCenJets(
141 std::unique_ptr<L1GctJetCandCollection> gctForJets(
143 std::unique_ptr<L1GctJetCandCollection> gctTauJets(
148 uint16_t
data[4][2] = {{0}};
149 for (
int i = 0;
i < 4;
i++)
150 for (
int j = 0; j < 2; j++)
160 <<
"GtPsbTextToDigi::produce : " 168 LogDebug(
"GtPsbTextToDigi") <<
"GtPsbTextToDigi::produce : " 170 << ii <<
".txt" << std::endl;
176 unsigned long int uLongBuffer;
178 for (
unsigned cycle = 0; cycle < 2; cycle++) {
180 unsigned tmp = (uLongBuffer >> 15) & 0
x1;
183 if (
false && tmp != cbs[cycle])
184 std::cout <<
"[GtPsbTextToDigi::produce()] asserting " 186 <<
" cycle:" << cbs[cycle] << std::hex
187 <<
" buffer:" << uLongBuffer <<
" tmp: " << tmp <<
std::dec 191 if (tmp != cbs[cycle]) {
192 if (
m_bc0[
ifile] == -1 && cycle == 1 && tmp == 1) {
197 <<
"GtPsbTextToDigi::produce : " 198 <<
" found format inconsistency in file #" <<
ifile 200 <<
" cycle:" << tmp <<
" is different from " << cbs[cycle]
204 data[
ifile][cycle] = (uLongBuffer & 0x7fff);
209 unsigned iIsola, iNoIso;
210 for (
unsigned cycle = 0; cycle < 2; cycle++) {
211 for (
unsigned i = 0;
i < 2;
i++) {
214 gctIsolaEm->push_back(
L1GctEmCand(data[iIsola][cycle] & 0x7fff,
true));
215 gctNoIsoEm->push_back(
L1GctEmCand(data[iNoIso][cycle] & 0x7fff,
false));
234 for (
int i = 0;
i < nmem - 1;
i++)
236 LogDebug(
"GtPsbTextToDigi") <<
"[GtPsbTextToDigi::endJob()] ";
239 <<
"did not find matching BC0 in all input files: ";
241 LogDebug(
"GtPsbTextToDigi") <<
"detected common BC0 in all input files: ";
242 for (
int i = 0;
i < nmem;
i++)
244 LogDebug(
"GtPsbTextToDigi") << std::flush << std::endl;
~GtPsbTextToDigi() override
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
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.
std::vector< std::vector< double > > tmp
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