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 " <<
fileName 47 for(
int i=0;
i<4;
i++)
53 for (
unsigned i=0;
i<4;
i++){
66 for (
int i=0;
i<4;
i++){
81 LogDebug(
"GtPsbTextToDigi") <<
"putting empty digi (evt:" <<
m_nevt <<
")\n";
87 unsigned short cbs[2] = {1,0};
93 <<
"[GtPsbTextToDigi::produce()] skipping event " <<
m_nevt 99 unsigned long int buff;
102 for (
int cycle=0; cycle<2; cycle++){
105 unsigned tmp = (buff>>15)&0
x1;
106 if(tmp!=cbs[cycle]) {
107 if(
m_bc0[ifile]==-1 && cycle==1 && tmp==1)
112 <<
"GtPsbTextToDigi::produce : " 113 <<
" found format inconsistency in file #" << ifile
114 <<
"\n in skipped line:" << ievt*2+1
115 <<
" cycle:" << tmp <<
" is different from " << cbs[cycle]
121 <<
"[GtPsbTextToDigi::produce()] skipping input " << ievt
136 uint16_t
data[4][2]= {{0}};
137 for (
int i=0;
i<4;
i++)
138 for (
int j=0; j<2; j++)
148 <<
"GtPsbTextToDigi::produce : " 157 <<
"GtPsbTextToDigi::produce : " 165 unsigned long int uLongBuffer;
167 for(
unsigned cycle=0; cycle<2; cycle++) {
169 unsigned tmp = (uLongBuffer>>15)&0
x1;
172 if(
false && tmp!=cbs[cycle])
173 std::cout <<
"[GtPsbTextToDigi::produce()] asserting " 175 <<
" ifile:" <<
ifile 176 <<
" cycle:" << cbs[cycle]
178 <<
" buffer:"<< uLongBuffer
181 <<
"\n\n" << std::flush;
189 <<
"GtPsbTextToDigi::produce : " 190 <<
" found format inconsistency in file #" <<
ifile 192 <<
" cycle:" << tmp <<
" is different from " << cbs[cycle]
196 data[
ifile][cycle] = (uLongBuffer&0x7fff);
201 unsigned iIsola, iNoIso;
202 for (
unsigned cycle=0; cycle<2; cycle++){
203 for (
unsigned i=0;
i<2;
i++){
206 gctIsolaEm->push_back(
L1GctEmCand(data[iIsola][cycle]&0x7fff,1));
207 gctNoIsoEm->push_back(
L1GctEmCand(data[iNoIso][cycle]&0x7fff,0));
227 for(
int i=0;
i<nmem-1;
i++)
229 LogDebug(
"GtPsbTextToDigi") <<
"[GtPsbTextToDigi::endJob()] ";
231 LogDebug(
"GtPsbTextToDigi") <<
"did not find matching BC0 in all input files: ";
233 LogDebug(
"GtPsbTextToDigi") <<
"detected common BC0 in all input files: ";
234 for(
int i=0;
i<nmem;
i++)
236 LogDebug(
"GtPsbTextToDigi") << std::flush << std::endl;
virtual void produce(edm::Event &, const edm::EventSetup &)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Level-1 Trigger jet candidate.
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