CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
CSCFileReader Class Reference

#include <CSCFileReader.h>

Inheritance diagram for CSCFileReader:
DaqBaseReader

Public Member Functions

 CSCFileReader (const edm::ParameterSet &pset)
 
int fillRawData (edm::EventID &eID, edm::Timestamp &tstamp, FEDRawDataCollection *&data)
 
virtual ~CSCFileReader (void)
 
- Public Member Functions inherited from DaqBaseReader
 DaqBaseReader ()
 
virtual void setRunNumber (edm::RunNumber_t runNumber)
 set the run number More...
 
virtual ~DaqBaseReader ()
 

Private Member Functions

int buildEventFromRUIs (FEDRawDataCollection *data)
 
int nextEventFromFUs (FEDRawDataCollection *data)
 
int readFU (int fu, const unsigned short *&buf, size_t &length)
 
int readRUI (int rui, const unsigned short *&buf, size_t &length)
 

Private Attributes

std::vector< std::string >
::const_iterator 
currentFile [40]
 
int currentL1A [40]
 
int expectedNextL1A
 
std::map< unsigned int,
std::list< unsigned int > > 
FED
 
std::vector< std::string > fileNames [40]
 
int firstEvent
 
FileReaderDCC FU [4]
 
const unsigned short * fuEvent [4]
 
size_t fuEventSize [4]
 
int nActiveFUs
 
int nActiveRUIs
 
int nEvents
 
const unsigned short * ruBuf [40]
 
size_t ruBufSize [40]
 
FileReaderDDU RUI [40]
 
int tfDDUnumber
 
unsigned short * tmpBuf
 

Detailed Description

Definition at line 15 of file CSCFileReader.h.

Constructor & Destructor Documentation

CSCFileReader::CSCFileReader ( const edm::ParameterSet pset)

Definition at line 30 of file CSCFileReader.cc.

References currentFile, currentL1A, FileReaderDCC::DCCoversize, FileReaderDDU::DDUoversize, end, edm::hlt::Exception, expectedNextL1A, FED, FileReaderDDU::FFFF, FileReaderDCC::FFFF, fileNames, firstEvent, FU, fuEvent, fuEventSize, edm::ParameterSet::getUntrackedParameter(), LogDebug, FEDNumbering::MAXCSCFEDID, FEDNumbering::MAXCSCTFFEDID, FEDNumbering::MINCSCFEDID, FEDNumbering::MINCSCTFFEDID, nActiveFUs, nActiveRUIs, mergeVDriftHistosByStation::name, nEvents, nFUs, nRUIs, FileReaderDCC::open(), FileReaderDDU::open(), FileReaderDCC::reject(), FileReaderDDU::reject(), ruBuf, ruBufSize, RUI, FileReaderDDU::select(), FileReaderDCC::select(), tfDDUnumber, tmpBuf, csvLumiCalc::unit, FileReaderDCC::Unknown, and FileReaderDDU::Unknown.

30  :DaqBaseReader(){
31  LogDebug("CSCFileReader|ctor")<<"Started ...";
32  // Below some data members are recycled for both cases: RUIs and FUs
33  // this is ok as long as eighter of RUI or FU are are provided in .cfg (not both)
34  nActiveRUIs = 0;
35  nActiveFUs = 0;
36  for(int unit=0; unit<nRUIs; unit++){
37  std::ostringstream ruiName, fuName;
38  ruiName<<"RUI"<<(unit<10?"0":"")<<unit<<std::ends;
39  fuName <<"FU" <<unit<<std::ends;
40  std::vector<std::string> ruiFiles = pset.getUntrackedParameter< std::vector<std::string> >(ruiName.str().c_str(),std::vector<std::string>(0));
41  std::vector<std::string> fuFiles = pset.getUntrackedParameter< std::vector<std::string> >(fuName.str().c_str(),std::vector<std::string>(0));
42  if( ruiFiles.begin() != ruiFiles.end() ) nActiveRUIs++;
43  if( fuFiles.begin() != fuFiles.end() ) nActiveFUs++;
44  }
45  if( nActiveFUs && nActiveRUIs )
46  throw cms::Exception("CSCFileReader|configuration")<<"RUIs and FUs in conflict: either RUI or FU may be defined at a time, not both";
47  if( !nActiveFUs && !nActiveRUIs )
48  throw cms::Exception("CSCFileReader|configuration")<<"Module lacks configuration";
49 
50 
51  // Get list of RUI input files from .cfg file
52  for(int rui=0; rui<nRUIs && !nActiveFUs; rui++){
53  std::ostringstream name;
54  name<<"RUI"<<(rui<10?"0":"")<<rui<<std::ends;
55 
56  // Obtain list of files associated with current RUI
57  fileNames[rui] = pset.getUntrackedParameter< std::vector<std::string> >(name.str().c_str(),std::vector<std::string>(0));
58  currentFile[rui] = fileNames[rui].begin();
59 
60  // If list of files is not empty, open first file
61  if( currentFile[rui] != fileNames[rui].end() ){
62  try {
63  RUI[rui].open(currentFile[rui]->c_str());
64  } catch ( std::runtime_error err ){
65  throw cms::Exception("CSCFileReader")<<"InputFileMissing: "<<err.what()<<" (errno="<<errno<<")";
66  }
67  nActiveRUIs++;
68  }
69 
70  // Filter out possible corruptions
72  // Do not select anything in particular
73  RUI[rui].select(0);
74 
75  currentL1A[rui] = -1;
76  }
77 
78  // Get list of FU input files from .cfg file
79  for(int fu=0; fu<nFUs && !nActiveRUIs; fu++){
80  std::ostringstream name;
81  name<<"FU"<<fu<<std::ends;
82 
83  // Obtain list of files associated with current FU
84  fileNames[fu] = pset.getUntrackedParameter< std::vector<std::string> >(name.str().c_str(),std::vector<std::string>(0));
85  currentFile[fu] = fileNames[fu].begin();
86 
87  // If list of files is not empty, open first file
88  if( currentFile[fu] != fileNames[fu].end() ){
89  try {
90  FU[fu].open(currentFile[fu]->c_str());
91  } catch ( std::runtime_error err ){
92  throw cms::Exception("CSCFileReader")<<"InputFileMissing: "<<err.what()<<" (errno="<<errno<<")";
93  }
94  nActiveFUs++;
95  }
96 
97  // Filter out possible corruptions
99  // Do not select anything in particular
100  FU[fu].select(0);
101 
102  currentL1A[fu] = -1;
103  }
104 
105  if( nActiveRUIs && !nActiveFUs ){
106  // Assign RUIs to FEDs
107  for(int fed=FEDNumbering::MINCSCFEDID; fed<=FEDNumbering::MAXCSCFEDID; fed++){
108  std::ostringstream name;
109  name<<"FED"<<fed<<std::ends;
110  std::vector<std::string> rui_list = pset.getUntrackedParameter< std::vector<std::string> >(name.str().c_str(),std::vector<std::string>(0));
111  for(std::vector<std::string>::const_iterator rui=rui_list.begin(); rui!=rui_list.end(); rui++)
112  FED[fed].push_back((unsigned int)atoi(rui->c_str()+rui->length()-2));
113  }
114  // Do the same for Track-Finder FED
116  std::ostringstream name;
117  name<<"FED"<<fed<<std::ends;
118  std::vector<std::string> rui_list = pset.getUntrackedParameter< std::vector<std::string> >(name.str().c_str(),std::vector<std::string>(0));
119  for(std::vector<std::string>::const_iterator rui=rui_list.begin(); rui!=rui_list.end(); rui++)
120  FED[fed].push_back((unsigned int)atoi(rui->c_str()+rui->length()-2));
121  }
122  }
123  // Starting point
124  firstEvent = pset.getUntrackedParameter<int>("firstEvent",0);
125  nEvents = 0;
126  expectedNextL1A = -1;
127 
128  // If Track-Finder was in readout specify its position in the record or set -1 otherwise
129  // Current agriment is that if there is a TF event it is first DDU record
130  tfDDUnumber = pset.getUntrackedParameter<int>("tfDDUnumber",-1);
131 
132  // For efficiency reasons create this big chunk of data only once
133  tmpBuf = new unsigned short[200000*nRUIs+4*4];
134  // Event buffer and its length for every FU
135  fuEvent[0]=0; fuEventSize[0]=0;
136  fuEvent[1]=0; fuEventSize[1]=0;
137  fuEvent[2]=0; fuEventSize[2]=0;
138  fuEvent[3]=0; fuEventSize[3]=0;
139  // Event buffer and its length for every RU
140  for(int rui=0; rui<nRUIs; rui++){
141  ruBuf[rui] = 0;
142  ruBufSize[rui] = 0;
143  }
144  LogDebug("CSCFileReader|ctor")<<"... and finished";
145 }
#define LogDebug(id)
T getUntrackedParameter(std::string const &, T const &) const
const unsigned short * fuEvent[4]
Definition: CSCFileReader.h:25
int open(const char *filename)
std::vector< std::string > fileNames[40]
Definition: CSCFileReader.h:17
std::map< unsigned int, std::list< unsigned int > > FED
Definition: CSCFileReader.h:33
#define nRUIs
size_t ruBufSize[40]
Definition: CSCFileReader.h:28
#define nFUs
string unit
Definition: csvLumiCalc.py:46
void select(unsigned int criteria)
Definition: FileReaderDDU.h:28
void select(unsigned int criteria)
Definition: FileReaderDCC.h:28
std::vector< std::string >::const_iterator currentFile[40]
Definition: CSCFileReader.h:18
size_t fuEventSize[4]
Definition: CSCFileReader.h:26
#define end
Definition: vmac.h:38
FileReaderDCC FU[4]
Definition: CSCFileReader.h:31
void reject(unsigned int criteria)
Definition: FileReaderDDU.h:30
unsigned short * tmpBuf
Definition: CSCFileReader.h:24
void reject(unsigned int criteria)
Definition: FileReaderDCC.h:30
int currentL1A[40]
Definition: CSCFileReader.h:21
FileReaderDDU RUI[40]
Definition: CSCFileReader.h:30
int open(const char *filename)
const unsigned short * ruBuf[40]
Definition: CSCFileReader.h:27
CSCFileReader::~CSCFileReader ( void  )
virtual

Definition at line 147 of file CSCFileReader.cc.

References tmpBuf.

147 { if(tmpBuf) delete [] tmpBuf; }
unsigned short * tmpBuf
Definition: CSCFileReader.h:24

Member Function Documentation

int CSCFileReader::buildEventFromRUIs ( FEDRawDataCollection data)
private

Definition at line 192 of file CSCFileReader.cc.

References filterCSVwithJSON::copy, currentL1A, FEDRawData::data(), edm::hlt::Exception, expectedNextL1A, FED, FEDRawDataCollection::FEDData(), firstEvent, Association::map, FEDNumbering::MINCSCTFFEDID, nEvents, nRUIs, readRUI(), FEDRawData::resize(), ruBuf, ruBufSize, and tmpBuf.

Referenced by fillRawData().

192  {
193  int eventNumber =-1; // Will determine below
194 
195  do {
196  // Read next event from RUIs
197  for(int rui=0; rui<nRUIs; rui++){
198  // read event from the RUI only in two cases:
199  // 1) it is readable (currentL1A>0) and we expect next event from the RUI
200  // 2) it is first time (expectedNextL1A<0)
201  if((currentL1A[rui]>0 && currentL1A[rui]<expectedNextL1A) || expectedNextL1A<0 )
202  currentL1A[rui] = readRUI(rui,ruBuf[rui],ruBufSize[rui]);
203  }
204  eventNumber =-1;
205 
206  // Select lowest L1A from all RUIs and don't expect next event from RUIs that currently hold higher L1A
207  for(int rui=0; rui<nRUIs; rui++)
208  if( currentL1A[rui]>=0 && (eventNumber>currentL1A[rui] || eventNumber==-1) ) eventNumber=currentL1A[rui];
209  // No readable RUIs => fall out
210  if( eventNumber<0 ) return -1;
211  // Expect next event to be incremented by 1 wrt. to the current event
212  expectedNextL1A = eventNumber+1;
213 
214  } while(nEvents++<firstEvent);
215 
216  for(std::map<unsigned int,std::list<unsigned int> >::const_iterator fed=FED.begin(); fed!=FED.end(); fed++)
217  if( fed->first<(unsigned int)FEDNumbering::MINCSCTFFEDID ){
218  // Now let's pretend that DDU data were wrapped with DCC Header (2 64-bit words) and Trailer (2 64-bit words):
219  unsigned short *dccBuf=tmpBuf, *dccCur=dccBuf;
220  dccCur[3] = 0x5000; dccCur[2] = 0x0000; dccCur[1] = 0x0000; dccCur[0] = 0x005F; // Fake DCC Header 1
221  dccCur[7] = 0xD900; dccCur[6] = 0x0000; dccCur[5] = 0x0000; dccCur[4] = 0x0017; // Fake DCC Header 2
222  dccCur += 8;
223 
224  for(std::list<unsigned int>::const_iterator rui=fed->second.begin(); rui!=fed->second.end(); rui++){
225 //cout<<"Event:"<<eventNumber<<" FED:"<<fed->first<<" RUI:"<<*(fed->second.begin())<<" currL1A:"<<currentL1A[*rui]<<endl;
226  if( currentL1A[*rui]==eventNumber ){
227  if(dccCur-dccBuf+ruBufSize[*rui]>=200000*nRUIs+8) throw cms::Exception("CSCFileReader|eventBuffer")<<"OutOfBuffer: Event size exceeds maximal size allowed!";
228  memcpy(dccCur,ruBuf[*rui],ruBufSize[*rui]*sizeof(unsigned short));
229  dccCur += ruBufSize[*rui];
230  }
231  }
232  dccCur[3] = 0xEF00; dccCur[2] = 0x0000; dccCur[1] = 0x0000; dccCur[0] = 0x0000; // Fake DCC Trailer 2
233  dccCur[7] = 0xAF00; dccCur[6] = 0x0000; dccCur[5] = 0x0000; dccCur[4] = 0x0007; // Fake DCC Trailer 2
234  dccCur += 8;
235 
236  FEDRawData& fedRawData = data->FEDData(fed->first);
237  fedRawData.resize((dccCur-dccBuf)*sizeof(unsigned short));
238  std::copy((unsigned char*)dccBuf,(unsigned char*)dccCur,fedRawData.data());
239  } else {
240  for(std::list<unsigned int>::const_iterator rui=fed->second.begin(); rui!=fed->second.end(); rui++){
241  FEDRawData& fedRawData = data->FEDData(fed->first);
242  fedRawData.resize(ruBufSize[*rui]*sizeof(unsigned short));
243  std::copy((unsigned char*)ruBuf[*rui],(unsigned char*)(ruBuf[*rui]+ruBufSize[*rui]),fedRawData.data());
244  }
245  }
246 
247  return eventNumber;
248 }
dictionary map
Definition: Association.py:205
std::map< unsigned int, std::list< unsigned int > > FED
Definition: CSCFileReader.h:33
#define nRUIs
size_t ruBufSize[40]
Definition: CSCFileReader.h:28
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
void resize(size_t newsize)
Definition: FEDRawData.cc:33
int readRUI(int rui, const unsigned short *&buf, size_t &length)
unsigned short * tmpBuf
Definition: CSCFileReader.h:24
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:29
int currentL1A[40]
Definition: CSCFileReader.h:21
const unsigned short * ruBuf[40]
Definition: CSCFileReader.h:27
int CSCFileReader::fillRawData ( edm::EventID eID,
edm::Timestamp tstamp,
FEDRawDataCollection *&  data 
)
virtual

overload to fill the fed collection to be put in the transient event store. NOTE: the FEDRawDataCollection data must be created (with new) within the method; ownership is passed to the caller.

Implements DaqBaseReader.

Definition at line 345 of file CSCFileReader.cc.

References buildEventFromRUIs(), nActiveFUs, nActiveRUIs, nextEventFromFUs(), and convertSQLiteXML::runNumber.

345  {
346  data = new FEDRawDataCollection();
347 
348  int runNumber = 0; // Unknown at the level of EMu local DAQ
349  int eventNumber =-1; // Will determine below
350 
351  if( !nActiveFUs && nActiveRUIs ){
352  eventNumber = buildEventFromRUIs(data);
353  } else {
354  eventNumber = nextEventFromFUs(data);
355  }
356 
357  if( eventNumber<0 ) return false;
358 
359  eID = edm::EventID(runNumber,1U,eventNumber);
360 
361  return true;
362 }
int buildEventFromRUIs(FEDRawDataCollection *data)
int nextEventFromFUs(FEDRawDataCollection *data)
int CSCFileReader::nextEventFromFUs ( FEDRawDataCollection data)
private

Definition at line 250 of file CSCFileReader.cc.

References filterCSVwithJSON::copy, currentL1A, FEDRawData::data(), end, event(), edm::hlt::Exception, expectedNextL1A, FEDRawDataCollection::FEDData(), fuEvent, fuEventSize, FEDNumbering::MINCSCFEDID, FEDNumbering::MINCSCTFFEDID, nFUs, readFU(), FEDRawData::resize(), dqm_diff::start, tfDDUnumber, and tmpBuf.

Referenced by fillRawData().

250  {
251  int eventNumber =-1; // Will determine below
252 
253  // If this is a first time - read one event from each FU
254  if( expectedNextL1A<0 )
255  for(int fu=0; fu<nFUs; fu++)
256  currentL1A[fu] = readFU(fu,fuEvent[fu],fuEventSize[fu]);
257 
258  // Keep buffers for every FU ready at all times
259  // When buffer from some FU is ready to go as the next event,
260  // release it, but read next one
261  int readyToGo = -1;
262  for(int fu=0; fu<nFUs; fu++){
263  // If FU is readable and (first loop of this cycle or current FU holds smallest L1A)
264  if(currentL1A[fu]>=0 && (eventNumber<0 || currentL1A[fu]<eventNumber)){
265  readyToGo = fu;
266  eventNumber = currentL1A[fu];
267  }
268  }
269  // No readable FUs => fall out
270  if( readyToGo<0 ) return -1;
271 
272  expectedNextL1A = eventNumber + 1;
273 
274  // Compose event from DDC record striped of Track-Finder DDU and a separate TF DDU event
275  unsigned long long *start = (unsigned long long *)fuEvent[readyToGo];
276  unsigned long long *end = 0;
277  enum {Header=1,Trailer=2};
278  unsigned int eventStatus = 0;
279  for(int dduRecord=0; dduRecord<=tfDDUnumber; dduRecord++){
280  unsigned long long word_0=0, word_1=0, word_2=0;
281  size_t dduWordCount = 0;
282  while( !end && dduWordCount<fuEventSize[readyToGo] ){
283  unsigned long long *dduWord = start;
284 
285  while( dduWordCount<fuEventSize[readyToGo] ){
286  word_0 = word_1; // delay by 2 DDU words
287  word_1 = word_2; // delay by 1 DDU word
288  word_2 = *dduWord;// current DDU word
289  if( (word_2&0xFFFFFFFFFFFF0000LL)==0x8000000180000000LL ){
290  if( eventStatus&Header ){ // Second header
291  word_2 = word_1;
292  end = dduWord;
293  break;
294  }
295  start = dduWord;
296  }
297  if( (word_0&0xFFFFFFFFFFFF0000LL)==0x8000FFFF80000000LL ){
298  eventStatus |= Trailer;
299  end = ++dduWord;
300  break;
301  }
302  // Increase counters by one DDU word
303  dduWord++;
304  dduWordCount++;
305  }
306  }
307  // If reach max length
308  if( dduWordCount==fuEventSize[readyToGo] ){
309  end = (unsigned long long *)(fuEvent[readyToGo]+fuEventSize[readyToGo]);
310  break;
311  }
312  }
313  // Include 0x5xxx preHeader if exists
314  if( start>(unsigned long long *)fuEvent[readyToGo] && (*(start-1)&0xF000000000000000LL)==0x5000000000000000LL ) start--;
315 
316  // If Track-Finder DDU was in readout
317  if( tfDDUnumber>=0 ){
318  // Cut out Track-Finder DDU from the buffer
319  if( !end ) throw cms::Exception("CSCFileReader|lookingForTF")<<" Sanity check failed (end==0)! Should never happen";
320 
321  FEDRawData& tfRawData = data->FEDData(FEDNumbering::MINCSCTFFEDID);
322  tfRawData.resize((end-start)*sizeof(unsigned long long));
323  std::copy((unsigned char*)start,(unsigned char*)end,tfRawData.data());
324 
325  // Create a new buffer from everything before and after TF DDU
326  unsigned short *event = tmpBuf;
327  memcpy(event,fuEvent[readyToGo],((unsigned short*)start-fuEvent[readyToGo])*sizeof(unsigned short));
328  event += ((unsigned short*)start-fuEvent[readyToGo]);
329  memcpy(event,end,(fuEvent[readyToGo]+fuEventSize[readyToGo]-(unsigned short*)end)*sizeof(unsigned short));
330  event += fuEvent[readyToGo]+fuEventSize[readyToGo]-(unsigned short*)end;
331  FEDRawData& fedRawData = data->FEDData(FEDNumbering::MINCSCFEDID);
332  fedRawData.resize((fuEventSize[readyToGo]-((unsigned short*)end-(unsigned short*)start))*sizeof(unsigned short));
333  std::copy((unsigned char*)tmpBuf,(unsigned char*)event,fedRawData.data());
334  } else {
335  FEDRawData& fedRawData = data->FEDData(FEDNumbering::MINCSCFEDID);
336  fedRawData.resize((fuEventSize[readyToGo])*sizeof(unsigned short));
337  std::copy((unsigned char*)fuEvent[readyToGo],(unsigned char*)(fuEvent[readyToGo]+fuEventSize[readyToGo]),fedRawData.data());
338  }
339 
340  currentL1A[readyToGo] = readFU(readyToGo,fuEvent[readyToGo],fuEventSize[readyToGo]);
341 
342  return eventNumber;
343 }
const unsigned short * fuEvent[4]
Definition: CSCFileReader.h:25
tuple start
Check for commandline option errors.
Definition: dqm_diff.py:58
#define nFUs
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
void resize(size_t newsize)
Definition: FEDRawData.cc:33
size_t fuEventSize[4]
Definition: CSCFileReader.h:26
#define end
Definition: vmac.h:38
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
unsigned short * tmpBuf
Definition: CSCFileReader.h:24
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:29
int readFU(int fu, const unsigned short *&buf, size_t &length)
int currentL1A[40]
Definition: CSCFileReader.h:21
int CSCFileReader::readFU ( int  fu,
const unsigned short *&  buf,
size_t &  length 
)
private

Definition at line 170 of file CSCFileReader.cc.

References currentFile, end, edm::hlt::Exception, fileNames, FU, FileReaderDCC::next(), and FileReaderDCC::open().

Referenced by nextEventFromFUs().

170  {
171  if( currentFile[fu] == fileNames[fu].end() ) return -1;
172  do {
173  try {
174  length = FU[fu].next(buf);
175  } catch ( std::runtime_error err ){
176  throw cms::Exception("CSCFileReader|reading")<<"EndOfStream: "<<err.what()<<" (errno="<<errno<<")";
177  }
178  if( length==0 ){ // end of file, try next one
179  if( ++currentFile[fu] != fileNames[fu].end() ){
180  try {
181  FU[fu].open(currentFile[fu]->c_str());
182  } catch ( std::runtime_error err ){
183  throw cms::Exception("CSCFileReader|reading")<<"InputFileMissing: "<<err.what()<<" (errno="<<errno<<")";
184  }
185  } else return -1;
186  }
187  } while( length==0 );
188  // Take L1A from first DDU header in the DCC record (shift=8)
189  return buf[2+8]|((buf[3+8]&0xFF)<<16);
190 }
int open(const char *filename)
std::vector< std::string > fileNames[40]
Definition: CSCFileReader.h:17
std::vector< std::string >::const_iterator currentFile[40]
Definition: CSCFileReader.h:18
size_t next(const unsigned short *&buf)
#define end
Definition: vmac.h:38
FileReaderDCC FU[4]
Definition: CSCFileReader.h:31
int CSCFileReader::readRUI ( int  rui,
const unsigned short *&  buf,
size_t &  length 
)
private

Definition at line 149 of file CSCFileReader.cc.

References currentFile, end, edm::hlt::Exception, fileNames, FileReaderDDU::next(), FileReaderDDU::open(), and RUI.

Referenced by buildEventFromRUIs().

149  {
150  if( currentFile[rui] == fileNames[rui].end() ) return -1;
151  do {
152  try {
153  length = RUI[rui].next(buf);
154  } catch ( std::runtime_error err ){
155  throw cms::Exception("CSCFileReader|reading")<<"EndOfStream: "<<err.what()<<" (errno="<<errno<<")";
156  }
157  if( length==0 ){ // end of file, try next one
158  if( ++currentFile[rui] != fileNames[rui].end() ){
159  try {
160  RUI[rui].open(currentFile[rui]->c_str());
161  } catch ( std::runtime_error err ){
162  throw cms::Exception("CSCFileReader|reading")<<"InputFileMissing: "<<err.what()<<" (errno="<<errno<<")";
163  }
164  } else return -1;
165  }
166  } while( length==0 );
167  return buf[2]|((buf[3]&0xFF)<<16);
168 }
std::vector< std::string > fileNames[40]
Definition: CSCFileReader.h:17
std::vector< std::string >::const_iterator currentFile[40]
Definition: CSCFileReader.h:18
#define end
Definition: vmac.h:38
size_t next(const unsigned short *&buf, int prescaling=1)
FileReaderDDU RUI[40]
Definition: CSCFileReader.h:30
int open(const char *filename)

Member Data Documentation

std::vector<std::string>::const_iterator CSCFileReader::currentFile[40]
private

Definition at line 18 of file CSCFileReader.h.

Referenced by CSCFileReader(), readFU(), and readRUI().

int CSCFileReader::currentL1A[40]
private

Definition at line 21 of file CSCFileReader.h.

Referenced by buildEventFromRUIs(), CSCFileReader(), and nextEventFromFUs().

int CSCFileReader::expectedNextL1A
private

Definition at line 21 of file CSCFileReader.h.

Referenced by buildEventFromRUIs(), CSCFileReader(), and nextEventFromFUs().

std::map<unsigned int,std::list<unsigned int> > CSCFileReader::FED
private

Definition at line 33 of file CSCFileReader.h.

Referenced by buildEventFromRUIs(), and CSCFileReader().

std::vector<std::string> CSCFileReader::fileNames[40]
private

Definition at line 17 of file CSCFileReader.h.

Referenced by CSCFileReader(), readFU(), and readRUI().

int CSCFileReader::firstEvent
private

Definition at line 20 of file CSCFileReader.h.

Referenced by buildEventFromRUIs(), and CSCFileReader().

FileReaderDCC CSCFileReader::FU[4]
private

Definition at line 31 of file CSCFileReader.h.

Referenced by CSCFileReader(), and readFU().

const unsigned short* CSCFileReader::fuEvent[4]
private

Definition at line 25 of file CSCFileReader.h.

Referenced by CSCFileReader(), and nextEventFromFUs().

size_t CSCFileReader::fuEventSize[4]
private

Definition at line 26 of file CSCFileReader.h.

Referenced by CSCFileReader(), and nextEventFromFUs().

int CSCFileReader::nActiveFUs
private

Definition at line 22 of file CSCFileReader.h.

Referenced by CSCFileReader(), and fillRawData().

int CSCFileReader::nActiveRUIs
private

Definition at line 22 of file CSCFileReader.h.

Referenced by CSCFileReader(), and fillRawData().

int CSCFileReader::nEvents
private

Definition at line 20 of file CSCFileReader.h.

Referenced by buildEventFromRUIs(), and CSCFileReader().

const unsigned short* CSCFileReader::ruBuf[40]
private

Definition at line 27 of file CSCFileReader.h.

Referenced by buildEventFromRUIs(), and CSCFileReader().

size_t CSCFileReader::ruBufSize[40]
private

Definition at line 28 of file CSCFileReader.h.

Referenced by buildEventFromRUIs(), and CSCFileReader().

FileReaderDDU CSCFileReader::RUI[40]
private

Definition at line 30 of file CSCFileReader.h.

Referenced by CSCFileReader(), and readRUI().

int CSCFileReader::tfDDUnumber
private

Definition at line 20 of file CSCFileReader.h.

Referenced by CSCFileReader(), and nextEventFromFUs().

unsigned short* CSCFileReader::tmpBuf
private