CMS 3D CMS Logo

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

#include <MatacqProducer.h>

Inheritance diagram for MatacqProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Classes

struct  MatacqEventId
 
class  PosEstimator
 
struct  stats_t
 

Public Types

enum  calibTrigType_t { laserType = 4, ledType = 5, tpType = 6, pedType = 7 }
 
- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 

Public Member Functions

 MatacqProducer (const edm::ParameterSet &params)
 
virtual void produce (edm::Event &event, const edm::EventSetup &eventSetup)
 
 ~MatacqProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Types

typedef FILE * FILE_t
 
typedef off_t filepos_t
 

Private Member Functions

void addMatacqData (edm::Event &event)
 
int getCalibTriggerType (edm::Event &ev) const
 
bool getMatacqEvent (uint32_t runNumber, int32_t orbitId, bool fileChange)
 
bool getMatacqFile (uint32_t runNumber, uint32_t orbitId, bool *fileChange=0)
 
uint32_t getOrbitId (edm::Event &ev) const
 
uint32_t getRunNumber (edm::Event &ev) const
 
void loadOrbitOffset ()
 
bool mcheck (const std::string &name)
 
void mclose ()
 
bool meof ()
 
bool misOpened ()
 
bool mopen (const std::string &name)
 
bool mread (char *buf, size_t n, const char *mess=0, bool peek=false)
 
bool mrewind ()
 
bool mseek (filepos_t offset, int whence=SEEK_SET, const char *mess=0)
 
bool msize (filepos_t &s)
 
bool mtell (filepos_t &pos)
 
void newRun (int prevRun, int newRun)
 

Static Private Member Functions

static std::string runSubDir (uint32_t runNumber)
 

Private Attributes

std::vector< unsigned char > data_
 
std::string digiInstanceName_
 
bool disabled_
 
bool doOrbitOffset_
 
int eventSkipCounter_
 
int fastRetrievalThresh_
 
std::vector< std::string > fileNames_
 
MatacqDataFormatter formatter_
 
bool ignoreTriggerType_
 
FILE_t inFile_
 
std::string inFileName_
 
edm::InputTag inputRawCollection_
 
int32_t lastOrb_
 
std::ofstream logFile_
 
std::string logFileName_
 
bool logTiming_
 
MatacqRawEvent matacq_
 
bool mergeRaw_
 
int onErrorDisablingEvtCnt_
 
uint32_t openedFileRunNumber_
 
std::map< uint32_t, uint32_t > orbitOffset_
 
std::string orbitOffsetFile_
 
PosEstimator posEstim_
 
bool produceDigis_
 
bool produceRaw_
 
std::string rawInstanceName_
 
uint32_t runNumber_
 
timeval startTime_
 
struct MatacqProducer::stats_t stats_
 
std::ofstream timeLog_
 
std::string timeLogFile_
 
timeval timer_
 
bool timing_
 
int verbosity_
 

Static Private Attributes

static const int bufferSize = 30000
 
static const int matacqFedId_ = 655
 
static int orbitTolerance_ = 80
 
static stats_t stats_init = {0,0,0}
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 43 of file MatacqProducer.h.

Member Typedef Documentation

typedef FILE* MatacqProducer::FILE_t
private

Definition at line 58 of file MatacqProducer.h.

typedef off_t MatacqProducer::filepos_t
private

Definition at line 57 of file MatacqProducer.h.

Member Enumeration Documentation

Enumerator
laserType 
ledType 
tpType 
pedType 

Definition at line 46 of file MatacqProducer.h.

Constructor & Destructor Documentation

MatacqProducer::MatacqProducer ( const edm::ParameterSet params)
explicit

Constructor

Parameters
paramsseletive readout parameters

Definition at line 65 of file MatacqProducer.cc.

References gather_cfg::cout, digiInstanceName_, doOrbitOffset_, edm::hlt::Exception, loadOrbitOffset(), logFile_, logFileName_, logTiming_, now(), orbitOffsetFile_, dbtoconf::out, posEstim_, produceDigis_, produceRaw_, rawInstanceName_, startTime_, timeLog_, timeLogFile_, timer_, MatacqProducer::PosEstimator::verbosity(), and verbosity_.

65  :
66  fileNames_(params.getParameter<std::vector<std::string> >("fileNames")),
67  digiInstanceName_(params.getParameter<string>("digiInstanceName")),
68  rawInstanceName_(params.getParameter<string>("rawInstanceName")),
69  timing_(params.getUntrackedParameter<bool>("timing", false)),
70  disabled_(params.getParameter<bool>("disabled")),
71  verbosity_(params.getUntrackedParameter<int>("verbosity", 0)),
72  produceDigis_(params.getParameter<bool>("produceDigis")),
73  produceRaw_(params.getParameter<bool>("produceRaw")),
74  inputRawCollection_(params.getParameter<InputTag>("inputRawCollection")),
75  mergeRaw_(params.getParameter<bool>("mergeRaw")),
76  ignoreTriggerType_(params.getParameter<bool>("ignoreTriggerType")),
77  matacq_(0, 0),
78  inFile_(0),
81  lastOrb_(0),
83  orbitOffsetFile_(params.getUntrackedParameter<std::string>("orbitOffsetFile",
84  "")),
85  inFileName_(""),
87  logFileName_(params.getUntrackedParameter<std::string>("logFileName",
88  "matacqProducer.log")),
90  onErrorDisablingEvtCnt_(params.getParameter<int>("onErrorDisablingEvtCnt")),
91  timeLogFile_(params.getUntrackedParameter<std::string>("timeLogFile", "")),
92  runNumber_(0)
93 {
94  if(verbosity_>=4) cout << "[Matacq " << now() << "] in MatacqProducer ctor" << endl;
95 
96  gettimeofday(&timer_, 0);
97 
98  if(timeLogFile_.size()>0){
99  timeLog_.open(timeLogFile_.c_str());
100  if(timeLog_.fail()){
101  cout << "[LaserSorter " << now() << "] "
102  << "Failed to open file " << timeLogFile_ << " to log timing.\n";
103  logTiming_ = false;
104  } else{
105  logTiming_ = true;
106  }
107  }
108 
110 
111  logFile_.open(logFileName_.c_str(), ios::app | ios::out);
112 
113  if(logFile_.bad()){
114  throw cms::Exception("FileOpen") << "Failed to open file "
115  << logFileName_ << " for logging.\n";
116  }
117 
118  if(produceDigis_){
119  if(verbosity_>0) cout << "[Matacq " << now() << "] registering new "
120  "EcalMatacqDigiCollection product with instance name '"
121  << digiInstanceName_ << "'\n";
122  produces<EcalMatacqDigiCollection>(digiInstanceName_);
123  }
124 
125  if(produceRaw_){
126  if(verbosity_>0) cout << "[Matacq " << now() << "] registering new FEDRawDataCollection "
127  "product with instance name '"
128  << rawInstanceName_ << "'\n";
129  produces<FEDRawDataCollection>(rawInstanceName_);
130  }
131 
132  startTime_.tv_sec = startTime_.tv_usec = 0;
133  if(orbitOffsetFile_.size()>0){
134  doOrbitOffset_ = true;
135  loadOrbitOffset();
136  } else{
137  doOrbitOffset_ = false;
138  }
139  if(verbosity_>=4) cout << "[Matacq " << now() << "] exiting MatacqProducer ctor" << endl;
140 }
std::string inFileName_
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
uint32_t runNumber_
std::ofstream logFile_
std::ofstream timeLog_
std::vector< std::string > fileNames_
std::string digiInstanceName_
static stats_t stats_init
struct MatacqProducer::stats_t stats_
edm::InputTag inputRawCollection_
std::string orbitOffsetFile_
tuple out
Definition: dbtoconf.py:99
std::string timeLogFile_
uint32_t openedFileRunNumber_
PosEstimator posEstim_
static const int bufferSize
static std::string now()
MatacqRawEvent matacq_
std::string rawInstanceName_
tuple cout
Definition: gather_cfg.py:121
std::string logFileName_
std::vector< unsigned char > data_
MatacqProducer::~MatacqProducer ( )

Destructor

Definition at line 766 of file MatacqProducer.cc.

References gather_cfg::cout, logTiming_, mclose(), now(), startTime_, and lumiQTWidget::t.

766  {
767  mclose();
768  timeval t;
769  gettimeofday(&t, 0);
770  if(logTiming_ && startTime_.tv_sec!=0){
771  //not using logger, to allow timing with different logging options
772  cout << "[Matacq " << now() << "] Time elapsed between first event and "
773  "destruction of MatacqProducer: "
774  << ((t.tv_sec-startTime_.tv_sec)*1.
775  + (t.tv_usec-startTime_.tv_usec)*1.e-6) << "s\n";
776  }
777 }
static std::string now()
tuple cout
Definition: gather_cfg.py:121

Member Function Documentation

void MatacqProducer::addMatacqData ( edm::Event event)
private

Add matacq digi to the event

Parameters
eventthe event
digiInstanceName_name to give to the matacq digi instance

Definition at line 176 of file MatacqProducer.cc.

References bufferSize, filterCSVwithJSON::copy, gather_cfg::cout, data_, digiInstanceName_, doOrbitOffset_, eventSkipCounter_, formatter_, getCalibTriggerType(), MatacqRawEvent::getDccLen(), getMatacqEvent(), getMatacqFile(), getOrbitId(), MatacqRawEvent::getOrbitId(), MatacqRawEvent::getParsedLen(), getRunNumber(), ignoreTriggerType_, inputRawCollection_, edm::InputTag::instance(), MatacqDataFormatter::interpretRawData(), edm::InputTag::label(), laserType, matacq_, matacqFedId_, mergeRaw_, MatacqProducer::stats_t::nLaserEventsWithMatacq, MatacqProducer::stats_t::nNonLaserEventsWithMatacq, now(), orbitOffset_, produceDigis_, produceRaw_, rawInstanceName_, convertSQLiteXML::runNumber, stats_, and verbosity_.

Referenced by produce().

176  {
178  if(inputRawCollection_.label().size() == 0
179  && inputRawCollection_.instance().size() == 0){
180  event.getByType(sourceColl);
181  } else{
182  event.getByLabel(inputRawCollection_, sourceColl);
183  }
184 
185  std::auto_ptr<FEDRawDataCollection> rawColl;
186  if(produceRaw_){
187  if(mergeRaw_){
188  rawColl = auto_ptr<FEDRawDataCollection>(new FEDRawDataCollection(*sourceColl));
189  } else{
190  rawColl = auto_ptr<FEDRawDataCollection>(new FEDRawDataCollection());
191  }
192  }
193 
194  std::auto_ptr<EcalMatacqDigiCollection>
195  digiColl(new EcalMatacqDigiCollection());
196 
197  if(eventSkipCounter_==0){
198  if(sourceColl->FEDData(matacqFedId_).size()>4 && !produceRaw_){
199  //input raw data collection already contains matacqData
200  formatter_.interpretRawData(sourceColl->FEDData(matacqFedId_),
201  *digiColl);
202  } else{
203  bool isLaserEvent = (getCalibTriggerType(event) == laserType);
204 
205 
206  // cout << "---> " << (ignoreTriggerType_?"yes":"no") << " " << getCalibTriggerType(event) << endl;
207 
208  if(isLaserEvent || ignoreTriggerType_){
209 
210  const uint32_t runNumber = getRunNumber(event);
211  const uint32_t orbitId = getOrbitId(event);
212 
213  LogInfo("Matacq") << "Run " << runNumber << "\t Orbit " << orbitId << "\n";
214 
215  bool fileChange;
216  if(doOrbitOffset_){
217  map<uint32_t,uint32_t>::iterator it = orbitOffset_.find(runNumber);
218  if(it == orbitOffset_.end()){
219  LogWarning("Matacq") << "Orbit offset not found for run "
220  << runNumber
221  << ". No orbit correction will be applied.";
222  }
223  }
224 
225  if(getMatacqFile(runNumber, orbitId, &fileChange)){
226  //matacq file retrieval succeeded
227  LogInfo("Matacq") << "Matacq data file found for "
228  << "run " << runNumber << " orbit " << orbitId;
229  if(getMatacqEvent(runNumber, orbitId, fileChange)){
230  if(produceDigis_){
231  formatter_.interpretRawData(matacq_, *digiColl);
232  }
233  if(produceRaw_){
234  uint32_t dataLen64 = matacq_.getParsedLen();
235  if(dataLen64 > bufferSize*8 || matacq_.getDccLen()!= dataLen64){
236  LogWarning("Matacq") << " Error in Matacq event fragment length! "
237  << "DCC len: " << matacq_.getDccLen()
238  << "*8 Bytes, Parsed len: "
239  << matacq_.getParsedLen() << "*8 Bytes. "
240  << "Matacq data will not be included for this event.\n";
241  } else{
242  rawColl->FEDData(matacqFedId_).resize(dataLen64*8);
243  copy(data_.begin(), data_.begin() + dataLen64*8,
244  rawColl->FEDData(matacqFedId_).data());
245  }
246  }
247  LogInfo("Matacq") << "Associating matacq data with orbit id "
248  << matacq_.getOrbitId()
249  << " to dcc event with orbit id "
250  << orbitId << std::endl;
251  if(isLaserEvent){
253  } else{
255  }
256  } else{
257  if(isLaserEvent){
258  LogWarning("Matacq") << "No matacq data found for laser event "
259  << "of run " << runNumber << " orbit "
260  << orbitId;
261  }
262  }
263  } else{
264  LogWarning("Matacq") << "No matacq file found for event "
265  << event.id();
266  }
267  }
268  }
269  if(eventSkipCounter_>0){ //error occured for this events
270  // and some events will be skipped following
271  // to this error.
272  LogInfo("Matacq") << " [" << now() << "] "
274  << " next events will be skipped, following to an "
275  << "error on the last processed event, "
276  << "which is expected to be persistant.";
277  }
278  } else{
280  }
281 
282  if(produceRaw_){
283  if(verbosity_>1) cout << "[Matacq " << now() << "] "
284  << "Adding FEDRawDataCollection collection "
285  << " to event.\n";
286  event.put(rawColl, rawInstanceName_);
287  }
288 
289  if(produceDigis_){
290  if(verbosity_>1) cout << "[Matacq " << now() << "] "
291  << "Adding EcalMatacqDigiCollection collection "
292  << " to event.\n";
293  event.put(digiColl, digiInstanceName_);
294  }
295 }
std::map< uint32_t, uint32_t > orbitOffset_
static const int matacqFedId_
edm::SortedCollection< EcalMatacqDigi > EcalMatacqDigiCollection
static unsigned getOrbitId(unsigned char *data, size_t size)
std::string digiInstanceName_
uint32_t getRunNumber(edm::Event &ev) const
unsigned getDccLen() const
uint32_t getOrbitId(edm::Event &ev) const
struct MatacqProducer::stats_t stats_
edm::InputTag inputRawCollection_
int getCalibTriggerType(edm::Event &ev) const
MatacqDataFormatter formatter_
std::string const & label() const
Definition: InputTag.h:25
static const int bufferSize
static std::string now()
MatacqRawEvent matacq_
std::string rawInstanceName_
void interpretRawData(const FEDRawData &data, EcalMatacqDigiCollection &matacqDigiCollection)
tuple cout
Definition: gather_cfg.py:121
std::vector< unsigned char > data_
bool getMatacqFile(uint32_t runNumber, uint32_t orbitId, bool *fileChange=0)
std::string const & instance() const
Definition: InputTag.h:26
bool getMatacqEvent(uint32_t runNumber, int32_t orbitId, bool fileChange)
int MatacqProducer::getCalibTriggerType ( edm::Event ev) const
private

Definition at line 647 of file MatacqProducer.cc.

References Majority< T >::add(), FEDRawData::data(), data, edm::hlt::Exception, edm::Event::getByType(), errorMatrix2Lands_multiChannel::id, FEDNumbering::inRange(), edm::HandleBase::isValid(), AlCaHLTBitMon_ParallelJobs::p, lumiPlot::rawdata, Majority< T >::result(), and FEDRawData::size().

Referenced by addMatacqData().

647  {
649  if(!(ev.getByType(rawdata) && rawdata.isValid())){
650  throw cms::Exception("NotFound")
651  << "No FED raw data collection found. ECAL raw data are "
652  "required to retrieve the trigger type";
653  }
654 
655  Majority<int> stat;
656  for(int id=601; id<=654; ++id){
657  if(!FEDNumbering::inRange(id)) continue;
658  const FEDRawData& data = rawdata->FEDData(id);
659  const int detailedTrigger32 = 5;
660  if(data.size()>=4*(detailedTrigger32+1)){
661  const unsigned char* pTType = data.data() + detailedTrigger32*4;
662  int tType = pTType[1] & 0x7;
663  stat.add(tType);
664  }
665  }
666  double p;
667  int tType = stat.result(&p);
668  if(p<0){
669  //throw cms::Exception("NotFound") << "No ECAL DCC data found\n";
670  LogWarning("NotFound") << "No ECAL DCC data found\n";
671  tType = -1;
672  }
673  if(p<.8){
674  //throw cms::Exception("EventCorruption") << "Inconsitency in detailed trigger type indicated in ECAL DCC data headers\n";
675  LogWarning("EventCorruption") << "Inconsitency in detailed trigger type indicated in ECAL DCC data headers\n";
676  tType = -1;
677  }
678  return tType;
679 }
bool getByType(Handle< PROD > &result) const
Definition: Event.h:398
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:49
void add(const T &value)
Definition: Majority.h:25
bool isValid() const
Definition: HandleBase.h:76
static bool inRange(int)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:29
dictionary rawdata
Definition: lumiPlot.py:393
T result(double *proba) const
Definition: Majority.h:30
bool MatacqProducer::getMatacqEvent ( uint32_t  runNumber,
int32_t  orbitId,
bool  fileChange 
)
private

Definition at line 344 of file MatacqProducer.cc.

References abs, gather_cfg::cout, data_, MatacqProducer::PosEstimator::eventLength(), edm::hlt::Exception, fastRetrievalThresh_, newFWLiteAna::found, MatacqRawEvent::getDccLen(), MatacqRawEvent::getOrbitId(), MatacqRawEvent::getRunNum(), inFileName_, MatacqProducer::PosEstimator::invalid(), lastOrb_, matacq_, mread(), mrewind(), mseek(), msize(), mtell(), now(), evf::evtn::offset(), orbitTolerance_, pos, MatacqProducer::PosEstimator::pos(), posEstim_, DTTTrigCorrFirst::run, evf::utils::state, and verbosity_.

Referenced by addMatacqData().

346  {
347  filepos_t startPos;
348  if(!mtell(startPos)) return false;
349 
350  int32_t startOrb = -1;
351  const size_t headerSize = 8*8;
352  if(mread((char*)&data_[0], headerSize, "Reading matacq header", true)){
353  startOrb = MatacqRawEvent::getOrbitId(&data_[0], headerSize);
354  if(startOrb<0) startOrb = 0;
355  } else{
356  if(verbosity_>2){
357  cout << "[Matacq " << now() << "] Failed to read matacq header. Moved to start of "
358  " the file.\n";
359  }
360  mrewind();
361  if(mread((char*)&data_[0], headerSize, "Reading matacq header", true)){
362  startPos = 0;
363  startOrb = MatacqRawEvent::getOrbitId(&data_[0], headerSize);
364  } else{
365  if(verbosity_>2) cout << "[Matacq " << now() << "] Looks like matacq file is empty"
366  << "\n";
367  return false;
368  }
369  }
370 
371  if(verbosity_>2) cout << "[Matacq " << now() << "] Last read orbit: " << lastOrb_
372  << " looking for orbit " << orbitId
373  << ". Current file position: " << startPos
374  << " Orbit at current position: " << startOrb << "\n";
375 
376  // f.clear();
377  bool didCoarseMove = false;
378 
379  //FIXME: case where posEtim_.invalid() is false
380  if(!posEstim_.invalid()
381  && (abs(lastOrb_-orbitId) > fastRetrievalThresh_)){
382  filepos_t pos = posEstim_.pos(orbitId);
383 
384  // struct stat st;
385  filepos_t fsize;
386  // if(0==stat(inFileName_.c_str(), &st)){
387  if(msize(fsize)){
388  // const int64_t fsize = st.st_size;
389  if(0!=posEstim_.eventLength() && pos > fsize){
390  //estimated position is beyong end of file
391  //-> move to beginning of last event:
392  int64_t evtSize = posEstim_.eventLength()*sizeof(uint64_t);
393  pos = ((int64_t)fsize/evtSize-1)*evtSize;
394  if(verbosity_>2){
395  cout << "[Matacq " << now() << "] Estimated position was beyond end of file. "
396  "Changed to " << pos << "\n";
397  }
398  }
399  } else{
400  LogWarning("Matacq") << "Failed to access file " << inFileName_ << ".";
401  }
402  if(pos>=0){
403  if(verbosity_>2) cout << "[Matacq " << now() << "] jumping to estimated position "
404  << pos << "\n";
405  mseek(pos, SEEK_SET, "Jumping to estimated event position");
406  if(mread((char*)&data_[0], headerSize, "Reading matacq header", true)){
407  didCoarseMove = true;
408  } else{
409  //estimated position might have been beyond the end of the file,
410  //try, with original position:
411  didCoarseMove = false;
412  if(!mread((char*)&data_[0], headerSize, "Reading event header", true)){
413  return false;
414  }
415  }
416  } else{
417  if(verbosity_) cout << "[Matacq " << now() << "] Event orbit outside of orbit range "
418  "of matacq data file events\n";
419  return false;
420  }
421  }
422 
423  int32_t orb = MatacqRawEvent::getOrbitId(&data_[0], headerSize);
424 
425  if(didCoarseMove){
426  //autoadjustement of threshold for coarse move:
427  if(abs(orb-orbitId) > fastRetrievalThresh_){
428  if(verbosity_>2) cout << "[Matacq " << now() << "] Fast retrieval threshold increased from "
430  fastRetrievalThresh_ = 2*abs(orb-orbitId);
431  if(verbosity_>2) cout << " to " << fastRetrievalThresh_ << "\n";
432  }
433 
434  //if coarse move did not improve situation, rolls back:
435  if(startOrb > 0
436  && (abs(orb-orbitId) > abs(startOrb-orbitId))){
437  if(verbosity_>2) cout << "[Matacq " << now() << "] Estimation (-> orbit " << orb << ") "
438  "was worst than original position (-> orbit "
439  << startOrb
440  << "). Restoring position (" << startPos << ").\n";
441  mseek(startPos, SEEK_SET);
442  mread((char*)&data_[0], headerSize, "Reading event header", true);
443  orb = MatacqRawEvent::getOrbitId(&data_[0], headerSize);
444  }
445  }
446 
447  bool searchBackward = (orb>orbitId)?true:false;
448  //BEWARE: len must be signed, because we are using latter in the code (-len)
449  //expression
450  int len = (int)MatacqRawEvent::getDccLen(&data_[0], headerSize);
451 
452  if(len==0){
453  cout << "[Matacq " << now() << "] read DCC length is null! Cancels matacq event search "
454  << " and move matacq file pointer to beginning of the file. "
455  << "(" << __FILE__ << ":" << __LINE__ << ")."
456  << "\n";
457  //rewind(f);
458  mrewind();
459  return false;
460  }
461 
462  enum state_t { searching, found, failed } state = searching;
463 
464  while(state == searching){
465  orb = MatacqRawEvent::getOrbitId(&data_[0], headerSize);
466  len = (int)MatacqRawEvent::getDccLen(&data_[0], headerSize);
467  uint32_t run = MatacqRawEvent::getRunNum(&data_[0], headerSize);
468  if(verbosity_>3){
469  filepos_t pos;
470  mtell(pos);
471  cout << "[Matacq " << now() << "] Header read at file position "
472  << pos
473  << ": orbit = " << orb
474  << " len = " << len << "x8 Byte"
475  << " run = " << run << "\n";
476  }
477  if((abs(orb-orbitId) < orbitTolerance_)
478  && (runNumber==0 || runNumber==run)){
479  state = found;
480  lastOrb_ = orb;
481  //reads the rest of the event:
482  if((int)data_.size() < len*8){
483  throw cms::Exception("Matacq") << "Buffer overflow";
484  }
485  if(verbosity_>2) cout << "[Matacq " << now() << "] Event found. Reading "
486  " matacq event." << "\n";
487  if(!mread((char*)&data_[0], len*8, "Reading matacq event")){
488  if(verbosity_>2) cout << "[Matacq " << now() << "] Failed to read matacq event."
489  << "\n";
490  state = failed;
491  }
492  matacq_ = MatacqRawEvent((unsigned char*)&data_[0], len*8);
493  } else {
494  if((searchBackward && (orb < orbitId))
495  || (!searchBackward && (orb > orbitId))){ //search ended
496  lastOrb_ = orb;
497  state = failed;
498  if(verbosity_>2) cout << "[Matacq " << now()
499  << "] No matacq data found for run " << run
500  << ", orbit ID " << orbitId << "." << "\n";
501  } else{
502  off_t offset = (searchBackward?-len:len)*8;
503  lastOrb_ = orb;
504  if(verbosity_>3){
505  cout << "[Matacq " << now() << "] In matacq file, moving "
506  << abs(offset) << " byte " << (offset>0?"forward":"backward")
507  << ".\n";
508  }
509 
510  if(mseek(offset, SEEK_CUR,
511  (searchBackward?"Moving to previous event":
512  "Moving to next event"))
513  && mread((char*)&data_[0], headerSize, "Reading event header",
514  true)){
515  } else{
516  if(!searchBackward) mseek(-len*8, SEEK_CUR,
517  "Moving to start of last complete event");
518  state = failed;
519  }
520  }
521  }
522  }
523 
524  if(state==found){
525  filepos_t pos;
526  filepos_t fsize;
527  mtell(pos);
528  msize(fsize);
529  if(pos==fsize-1){ //last byte.
530  if(verbosity_>2){
531  cout << "[Matacq " << now() << "] Event found was at the end of the file. Moving "
532  "stream position to beginning of this event."
533  << "\n";
534  }
535  mseek(-(int)len*8-1, SEEK_CUR,
536  "Moving to beginning of last matacq event");
537  }
538  }
539  return (state==found);
540 }
std::string inFileName_
static int orbitTolerance_
unsigned getRunNum() const
#define abs(x)
Definition: mlp_lapack.h:159
uint32_t getOrbitId() const
unsigned getDccLen() const
int64_t pos(int orb) const
bool mread(char *buf, size_t n, const char *mess=0, bool peek=false)
unsigned int offset(bool)
unsigned long long uint64_t
Definition: Time.h:15
PosEstimator posEstim_
bool mtell(filepos_t &pos)
char state
Definition: procUtils.cc:75
static std::string now()
bool mseek(filepos_t offset, int whence=SEEK_SET, const char *mess=0)
MatacqRawEvent matacq_
tuple cout
Definition: gather_cfg.py:121
bool msize(filepos_t &s)
std::vector< unsigned char > data_
bool MatacqProducer::getMatacqFile ( uint32_t  runNumber,
uint32_t  orbitId,
bool *  fileChange = 0 
)
private

Retrieve the file containing a given matacq event

Parameters
runNumberNumber of the run the matacq event is looking from
orbitIdId of the orbit of the matacq event
fileChangeif not null pointer, set to true if the file changed.
Returns
true if file retrieval succeeded, false otherwise. found.

Definition at line 544 of file MatacqProducer.cc.

References gather_cfg::cout, eventSkipCounter_, fileNames_, alignmentValidation::fname, cmsPerfStripChart::format, newFWLiteAna::found, i, MatacqProducer::PosEstimator::init(), lastOrb_, mcheck(), misOpened(), mopen(), now(), onErrorDisablingEvtCnt_, openedFileRunNumber_, posEstim_, convertSQLiteXML::runNumber, runSubDir(), and verbosity_.

Referenced by addMatacqData().

545  {
548  if(fileChange!=0) *fileChange = false;
549  return misOpened();
550  }
551 
552  if(fileNames_.size()==0) return 0;
553 
554  const string runNumberFormat = "%08d";
555  string sRunNumber = str(boost::format(runNumberFormat) % runNumber);
556  //cout << "Run number string: " << sRunNumber << "\n";
557  bool found = false;
558  string fname;
559  for(unsigned i=0; i < fileNames_.size() && !found; ++i){
560  fname = fileNames_[i];
561  boost::algorithm::replace_all(fname, "%run_subdir%",
563  boost::algorithm::replace_all(fname, "%run_number%", sRunNumber);
564 
565  if(verbosity_>0) cout << "[Matacq " << now() << "] "
566  << "Looking for a file with path "
567  << fname << "\n";
568 
569  if(mcheck(fname)){
570  LogInfo("Matacq") << "Uses matacq data file: '" << fname << "'\n";
571  found = true;
572  }
573  }
574  if(!found){
575  if(verbosity_>=0) cout << "[Matacq " << now() << "] no matacq file found "
576  "for run " << runNumber << "\n";
579  if(fileChange!=0) *fileChange = false;
580  return 0;
581  }
582 
583  if(!mopen(fname)){
584  LogWarning("Matacq") << "Failed to open file " << fname << "\n";
587  if(fileChange!=0) *fileChange = false;
588  return false;
589  } else{
591  lastOrb_ = 0;
592  posEstim_.init(this);
593  if(fileChange!=0) *fileChange = true;
594  return true;
595  }
596 }
int i
Definition: DBlmapReader.cc:9
std::vector< std::string > fileNames_
string format
Some error handling for the usage.
bool mcheck(const std::string &name)
static std::string runSubDir(uint32_t runNumber)
uint32_t openedFileRunNumber_
PosEstimator posEstim_
void init(MatacqProducer *mp)
string fname
main script
static std::string now()
tuple cout
Definition: gather_cfg.py:121
bool mopen(const std::string &name)
uint32_t MatacqProducer::getOrbitId ( edm::Event ev) const
private

Definition at line 603 of file MatacqProducer.cc.

References abs, FEDRawData::data(), data, edm::hlt::Exception, edm::Event::getByType(), edm::EventBase::id(), errorMatrix2Lands_multiChannel::id, FEDNumbering::inRange(), edm::HandleBase::isValid(), orbitTolerance_, lumiPlot::rawdata, and FEDRawData::size().

Referenced by addMatacqData().

603  {
604  //on CVS HEAD (June 4, 08), class Event has a method orbitNumber()
605  //we could use here. The code would be shorten to:
606  //return ev.orbitNumber();
607  //we have to deal with what we have in current CMSSW releases:
609  if(!(ev.getByType(rawdata) && rawdata.isValid())){
610  throw cms::Exception("NotFound")
611  << "No FED raw data collection found. ECAL raw data are "
612  "required to retrieve the orbit ID";
613  }
614 
615  int orbit = 0;
616  for(int id=601; id<=654; ++id){
617  if(!FEDNumbering::inRange(id)) continue;
618  const FEDRawData& data = rawdata->FEDData(id);
619  const int orbitIdOffset64 = 3;
620  if(data.size()>=8*(orbitIdOffset64+1)){//orbit id is in 4th 64-bit word
621  const unsigned char* pOrbit = data.data() + orbitIdOffset64*8;
622  int thisOrbit = pOrbit[0]
623  | (pOrbit[1] <<8)
624  | (pOrbit[2] <<16)
625  | (pOrbit[3] <<24);
626  if(orbit!=0 && thisOrbit!=0 && abs(orbit-thisOrbit)>orbitTolerance_){
627  //throw cms::Exception("EventCorruption")
628  // << "Orbit ID inconsitency in DCC headers";
629  LogWarning("EventCorruption")
630  << "Orbit ID inconsitency in DCC headers";
631  orbit = 0;
632  break;
633  }
634  if(thisOrbit!=0) orbit = thisOrbit;
635  }
636  }
637 
638  if(orbit==0){
639  // throw cms::Exception("NotFound")
640  // << "Failed to retrieve orbit ID of event "<< ev.id();
641  LogWarning("NotFound") << "Failed to retrieve orbit ID of event "
642  << ev.id();
643  }
644  return orbit;
645 }
static int orbitTolerance_
#define abs(x)
Definition: mlp_lapack.h:159
bool getByType(Handle< PROD > &result) const
Definition: Event.h:398
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:49
bool isValid() const
Definition: HandleBase.h:76
static bool inRange(int)
edm::EventID id() const
Definition: EventBase.h:56
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:29
dictionary rawdata
Definition: lumiPlot.py:393
uint32_t MatacqProducer::getRunNumber ( edm::Event ev) const
private

Definition at line 599 of file MatacqProducer.cc.

References edm::Event::run().

Referenced by addMatacqData(), and produce().

599  {
600  return ev.run();
601 }
RunNumber_t run() const
Definition: Event.h:67
void MatacqProducer::loadOrbitOffset ( )
private

Loading orbit correction table from file.

See Also
orbitOffsetFile_

Definition at line 779 of file MatacqProducer.cc.

References gather_cfg::cout, edm::hlt::Exception, f, ntuplemaker::iline, max(), now(), orbitOffset_, orbitOffsetFile_, DTTTrigCorrFirst::run, and alignCSCRings::s.

Referenced by MatacqProducer().

779  {
780  ifstream f(orbitOffsetFile_.c_str());
781  if(f.bad()){
782  throw cms::Exception("Matacq")
783  << "Failed to open orbit ID correction file '"
784  << orbitOffsetFile_ << "'\n";
785  }
786 
787  cout << "[Matacq " << now() << "] "
788  << "Offset to substract to Matacq events Orbit ID: \n"
789  << "#Run Number\t Offset\n";
790 
791  int iline = 0;
792  string s;
793  stringstream buf;
794  while(f.eof()){
795  getline(f, s);
796  ++iline;
797  if(s[0]=='#'){//comment
798  //skip line:
799  f.ignore(numeric_limits<streamsize>::max(), '\n');
800  continue;
801  }
802  buf.str("");
803  buf << s;
804  int run;
805  int orbit;
806  buf >> run;
807  buf >> orbit;
808  if(buf.bad()){
809  throw cms::Exception("Matacq")
810  << "Syntax error in Orbit offset file '"
811  << orbitOffsetFile_ << "'";
812  }
813  cout << run << "\t" << orbit << "\n";
814  orbitOffset_.insert(pair<int, int>(run, orbit));
815  }
816 }
std::map< uint32_t, uint32_t > orbitOffset_
const T & max(const T &a, const T &b)
double f[11][100]
std::string orbitOffsetFile_
static std::string now()
tuple cout
Definition: gather_cfg.py:121
bool MatacqProducer::mcheck ( const std::string &  name)
private

Definition at line 1004 of file MatacqProducer.cc.

Referenced by getMatacqFile().

1004  {
1005  struct stat dummy;
1006  return 0==stat(name.c_str(), &dummy);
1007 // if(stat(name.c_str(), &dummy)==0){
1008 // return true;
1009 // } else{
1010 // cout << "[Matacq " << now() << "] Failed to stat file '"
1011 // << name.c_str() << "'. "
1012 // << "Error " << errno << ": " << strerror(errno) << "\n";
1013 // return false;
1014 // }
1015 }
void MatacqProducer::mclose ( )
private

Definition at line 1029 of file MatacqProducer.cc.

References inFile_.

Referenced by mopen(), and ~MatacqProducer().

1029  {
1030  if(inFile_!=0) fclose(inFile_);
1031  inFile_ = 0;
1032 }
bool MatacqProducer::meof ( )
private

Definition at line 1038 of file MatacqProducer.cc.

References inFile_.

1038  {
1039  if(0==inFile_) return true;
1040  return feof(inFile_)==0;
1041 }
bool MatacqProducer::misOpened ( )
private

Definition at line 1034 of file MatacqProducer.cc.

References inFile_.

Referenced by getMatacqFile().

1034  {
1035  return inFile_!=0;
1036 }
bool MatacqProducer::mopen ( const std::string &  name)
private

Definition at line 1017 of file MatacqProducer.cc.

References inFile_, inFileName_, mclose(), and mergeVDriftHistosByStation::name.

Referenced by getMatacqFile().

1017  {
1018  if(inFile_!=0) mclose();
1019  inFile_ = fopen(name.c_str(), "r");
1020  if(inFile_!=0){
1021  inFileName_ = name;
1022  return true;
1023  } else{
1024  inFileName_ = "";
1025  return false;
1026  }
1027 }
std::string inFileName_
bool MatacqProducer::mread ( char *  buf,
size_t  n,
const char *  mess = 0,
bool  peek = false 
)
private

Read a data block from input file. On failure file position is restored and if position restoring fails, file is rewind.

Parameters
bufbuffer to store read data
nsize of data block
messtext to insert in the eventual error message.
peekif true file position is restored after the data read
Returns
true on success, false on failure

Definition at line 958 of file MatacqProducer.cc.

References gather_cfg::cout, inFile_, lastOrb_, mrewind(), now(), and verbosity_.

Referenced by getMatacqEvent(), and MatacqProducer::PosEstimator::init().

958  {
959  if(0==inFile_) return false;
960  off_t pos = ftello(inFile_);
961  bool rc = (pos!=-1) && (1==fread(buf, n, 1, inFile_));
962  if(!rc){
963  if(verbosity_){
964  cout << "[Matacq " << now() << "] ";
965  if(mess) cout << mess << ". ";
966  cout << "Read failure from input matacq file.\n";
967  }
968  clearerr(inFile_);
969  }
970  if(peek || !rc){//need to restore file position
971  if(0!=fseeko(inFile_, pos, SEEK_SET)){
972  if(verbosity_){
973  cout << "[Matacq " << now() << "] ";
974  if(mess) cout << mess << ". ";
975  cout << "Failed to restore file position of "
976  "before read error. Rewind file.\n";
977  }
978  //rewind(inFile_.get());
979  mrewind();
980  lastOrb_ = 0;
981  }
982  }
983  return rc;
984 }
static std::string now()
tuple cout
Definition: gather_cfg.py:121
bool MatacqProducer::mrewind ( )
private

Definition at line 998 of file MatacqProducer.cc.

References inFile_.

Referenced by getMatacqEvent(), MatacqProducer::PosEstimator::init(), mread(), and mseek().

998  {
999  if(0==inFile_) return false;
1000  clearerr(inFile_);
1001  return fseeko(inFile_, 0, SEEK_SET)!=0;
1002 }
bool MatacqProducer::mseek ( filepos_t  offset,
int  whence = SEEK_SET,
const char *  mess = 0 
)
private

Move input file read pointer. On failure file is rewind.

Parameters
bufbuffer to store read data
nsize of data block
messtext to insert in the eventual error message.
Returns
true on success, false on failure

Definition at line 938 of file MatacqProducer.cc.

References gather_cfg::cout, inFile_, mrewind(), now(), and verbosity_.

Referenced by getMatacqEvent(), and MatacqProducer::PosEstimator::init().

938  {
939  if(0==inFile_) return false;
940  const int rc = fseeko(inFile_, offset, whence);
941  if(rc!=0 && verbosity_){
942  cout << "[Matacq " << now() << "] ";
943  if(mess) cout << mess << ". ";
944  cout << "Random access error on input matacq file. "
945  "Rewind file.\n";
946  mrewind();
947  }
948  return rc==0;
949 }
unsigned int offset(bool)
static std::string now()
tuple cout
Definition: gather_cfg.py:121
bool MatacqProducer::msize ( filepos_t s)
private

Definition at line 986 of file MatacqProducer.cc.

References inFile_.

Referenced by getMatacqEvent(), and MatacqProducer::PosEstimator::init().

986  {
987  if(0==inFile_) return false;
988  struct stat buf;
989  if(0!=fstat(fileno(inFile_), &buf)){
990  s = 0;
991  return false;
992  } else{
993  s = buf.st_size;
994  return true;
995  }
996 }
bool MatacqProducer::mtell ( filepos_t pos)
private

Definition at line 951 of file MatacqProducer.cc.

References inFile_.

Referenced by getMatacqEvent().

951  {
952  if(0==inFile_) return false;
953  pos = ftello(inFile_);
954  return pos != -1;
955 
956 }
void MatacqProducer::newRun ( int  prevRun,
int  newRun 
)
private

Definition at line 1052 of file MatacqProducer.cc.

References eventSkipCounter_, logFile_, MatacqProducer::stats_t::nEvents, MatacqProducer::stats_t::nLaserEventsWithMatacq, MatacqProducer::stats_t::nNonLaserEventsWithMatacq, now(), runNumber_, and stats_.

Referenced by produce().

1052  {
1053  runNumber_ = newRun;
1054  eventSkipCounter_ = 0;
1055  logFile_ << "[" << now() << "] Event count for run "
1056  << runNumber_ << ": "
1057  << "total: " << stats_.nEvents << ", "
1058  << "Laser event with Matacq data: "
1059  << stats_.nLaserEventsWithMatacq << ", "
1060  << "Non laser event (according to DCC header) with Matacq data: "
1061  << stats_.nNonLaserEventsWithMatacq << "\n" << flush;
1062 
1063  stats_.nEvents = 0;
1066 
1067 
1068 }
uint32_t runNumber_
std::ofstream logFile_
struct MatacqProducer::stats_t stats_
static std::string now()
void newRun(int prevRun, int newRun)
void MatacqProducer::produce ( edm::Event event,
const edm::EventSetup eventSetup 
)
virtual

Produces the EDM products

Parameters
CMSevent
eventSetupevent conditions

Implements edm::EDProducer.

Definition at line 144 of file MatacqProducer.cc.

References addMatacqData(), gather_cfg::cout, disabled_, getRunNumber(), logTiming_, MatacqProducer::stats_t::nEvents, newRun(), now(), convertSQLiteXML::runNumber, runNumber_, startTime_, stats_, lumiQTWidget::t, timeLog_, timer_, and verbosity_.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

144  {
145  if(verbosity_>=4) cout << "[Matacq " << now() << "] in MatacqProducer::produce" << endl;
146  if(logTiming_){
147  timeval t;
148  gettimeofday(&t, 0);
149 
150  timeLog_ << t.tv_sec << "."
151  << setfill('0') << setw(3) << (t.tv_usec+500)/1000 << setfill(' ')<< "\t"
152  << (t.tv_usec - timer_.tv_usec)*1.
153  + (t.tv_sec - timer_.tv_sec)*1.e6 << "\t";
154  timer_ = t;
155  }
156 
157  if(startTime_.tv_sec==0) gettimeofday(&startTime_, 0);
158  ++stats_.nEvents;
159  if(disabled_) return;
160  const uint32_t runNumber = getRunNumber(event);
161  if(runNumber!=runNumber_){
162  newRun(runNumber_, runNumber);
163  }
164  addMatacqData(event);
165 
166  if(logTiming_){
167  timeval t;
168  gettimeofday(&t, 0);
169  timeLog_ << (t.tv_usec - timer_.tv_usec)*1.
170  + (t.tv_sec - timer_.tv_sec)*1.e6 << "\n";
171  timer_ = t;
172  }
173 }
uint32_t runNumber_
std::ofstream timeLog_
uint32_t getRunNumber(edm::Event &ev) const
struct MatacqProducer::stats_t stats_
void addMatacqData(edm::Event &event)
static std::string now()
tuple cout
Definition: gather_cfg.py:121
void newRun(int prevRun, int newRun)
std::string MatacqProducer::runSubDir ( uint32_t  runNumber)
staticprivate

Definition at line 1045 of file MatacqProducer.cc.

References cmsPerfStripChart::format, and units().

Referenced by getMatacqFile().

1045  {
1046  int millions = runNumber / (1000*1000);
1047  int thousands = (runNumber-millions*1000*1000) / 1000;
1048  int units = runNumber-millions*1000*1000 - thousands*1000;
1049  return str(boost::format("%03d/%03d/%03d") % millions % thousands % units);
1050 }
string format
Some error handling for the usage.
TString units(TString variable, Char_t axis)

Member Data Documentation

const int MatacqProducer::bufferSize = 30000
staticprivate

Definition at line 256 of file MatacqProducer.h.

Referenced by addMatacqData().

std::vector<unsigned char> MatacqProducer::data_
private

Definition at line 258 of file MatacqProducer.h.

Referenced by addMatacqData(), and getMatacqEvent().

std::string MatacqProducer::digiInstanceName_
private

Instance name to use for the produced Matacq digi collection

Definition at line 210 of file MatacqProducer.h.

Referenced by addMatacqData(), and MatacqProducer().

bool MatacqProducer::disabled_
private

Parameter to disable matacq data production. For timing purpose.

Definition at line 222 of file MatacqProducer.h.

Referenced by produce().

bool MatacqProducer::doOrbitOffset_
private

Switch for orbit ID correction.

See Also
orbitOffsetFile_

Definition at line 281 of file MatacqProducer.h.

Referenced by addMatacqData(), and MatacqProducer().

int MatacqProducer::eventSkipCounter_
private

counter for event skipping

Definition at line 307 of file MatacqProducer.h.

Referenced by addMatacqData(), getMatacqFile(), and newRun().

int MatacqProducer::fastRetrievalThresh_
private

Definition at line 263 of file MatacqProducer.h.

Referenced by getMatacqEvent().

std::vector<std::string> MatacqProducer::fileNames_
private

Definition at line 206 of file MatacqProducer.h.

Referenced by getMatacqFile().

MatacqDataFormatter MatacqProducer::formatter_
private

Definition at line 259 of file MatacqProducer.h.

Referenced by addMatacqData().

bool MatacqProducer::ignoreTriggerType_
private

When true look for matacq data independently of trigger type.

Definition at line 248 of file MatacqProducer.h.

Referenced by addMatacqData().

FILE_t MatacqProducer::inFile_
private

Stream of currently opened matacq file

Definition at line 254 of file MatacqProducer.h.

Referenced by mclose(), meof(), misOpened(), mopen(), mread(), mrewind(), mseek(), msize(), and mtell().

std::string MatacqProducer::inFileName_
private

Name of currently opened matacq file

Definition at line 285 of file MatacqProducer.h.

Referenced by getMatacqEvent(), and mopen().

edm::InputTag MatacqProducer::inputRawCollection_
private

Name of raw data collection the Matacq data must be merge to if merging is enabled.

Definition at line 239 of file MatacqProducer.h.

Referenced by addMatacqData().

int32_t MatacqProducer::lastOrb_
private

Definition at line 262 of file MatacqProducer.h.

Referenced by getMatacqEvent(), getMatacqFile(), and mread().

std::ofstream MatacqProducer::logFile_
private

Log file

Definition at line 302 of file MatacqProducer.h.

Referenced by MatacqProducer(), and newRun().

std::string MatacqProducer::logFileName_
private

Log file name

Definition at line 298 of file MatacqProducer.h.

Referenced by MatacqProducer().

bool MatacqProducer::logTiming_
private

Switch for code timing.

Definition at line 326 of file MatacqProducer.h.

Referenced by MatacqProducer(), produce(), and ~MatacqProducer().

MatacqRawEvent MatacqProducer::matacq_
private

Definition at line 250 of file MatacqProducer.h.

Referenced by addMatacqData(), and getMatacqEvent().

const int MatacqProducer::matacqFedId_ = 655
staticprivate

Definition at line 287 of file MatacqProducer.h.

Referenced by addMatacqData().

bool MatacqProducer::mergeRaw_
private

Switch for merging Matacq raw data with existing raw data collection.

Definition at line 244 of file MatacqProducer.h.

Referenced by addMatacqData().

int MatacqProducer::onErrorDisablingEvtCnt_
private

Number of events to skip in case of error

Definition at line 311 of file MatacqProducer.h.

Referenced by getMatacqFile().

uint32_t MatacqProducer::openedFileRunNumber_
private

Definition at line 261 of file MatacqProducer.h.

Referenced by getMatacqFile().

std::map<uint32_t,uint32_t> MatacqProducer::orbitOffset_
private

Orbit offset table.

See Also
orbitOffsetFile_

Definition at line 277 of file MatacqProducer.h.

Referenced by addMatacqData(), and loadOrbitOffset().

std::string MatacqProducer::orbitOffsetFile_
private

File name of table with orbit offset between matacq event and DCC. Used to recover data suffering from orbit miss-synchonization

Definition at line 273 of file MatacqProducer.h.

Referenced by loadOrbitOffset(), and MatacqProducer().

int MatacqProducer::orbitTolerance_ = 80
staticprivate

Definition at line 260 of file MatacqProducer.h.

Referenced by getMatacqEvent(), and getOrbitId().

PosEstimator MatacqProducer::posEstim_
private

Definition at line 265 of file MatacqProducer.h.

Referenced by getMatacqEvent(), getMatacqFile(), and MatacqProducer().

bool MatacqProducer::produceDigis_
private

Swictch for Matacq digi producion

Definition at line 230 of file MatacqProducer.h.

Referenced by addMatacqData(), and MatacqProducer().

bool MatacqProducer::produceRaw_
private

Switch for Matacq FED raw data production

Definition at line 234 of file MatacqProducer.h.

Referenced by addMatacqData(), and MatacqProducer().

std::string MatacqProducer::rawInstanceName_
private

Instance name to use for the produced Matacq raw data collection

Definition at line 214 of file MatacqProducer.h.

Referenced by addMatacqData(), and MatacqProducer().

uint32_t MatacqProducer::runNumber_
private

Number of the currently processed run

Definition at line 330 of file MatacqProducer.h.

Referenced by newRun(), and produce().

timeval MatacqProducer::startTime_
private

Definition at line 267 of file MatacqProducer.h.

Referenced by MatacqProducer(), produce(), and ~MatacqProducer().

struct MatacqProducer::stats_t MatacqProducer::stats_
private

Referenced by addMatacqData(), newRun(), and produce().

MatacqProducer::stats_t MatacqProducer::stats_init = {0,0,0}
staticprivate

Definition at line 295 of file MatacqProducer.h.

std::ofstream MatacqProducer::timeLog_
private

Output stream to log code timing

Definition at line 322 of file MatacqProducer.h.

Referenced by MatacqProducer(), and produce().

std::string MatacqProducer::timeLogFile_
private

Name of file to log timing

Definition at line 315 of file MatacqProducer.h.

Referenced by MatacqProducer().

timeval MatacqProducer::timer_
private

Buffer for timing

Definition at line 318 of file MatacqProducer.h.

Referenced by MatacqProducer(), and produce().

bool MatacqProducer::timing_
private

Parameter to switch module timing.

Definition at line 218 of file MatacqProducer.h.

int MatacqProducer::verbosity_
private