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::EDConsumerBase 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
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

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 ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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_
 
edm::EDGetTokenT
< FEDRawDataCollection
inputRawCollectionToken_
 
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 const int orbitTolerance_ = 80
 
static const 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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 45 of file MatacqProducer.h.

Member Typedef Documentation

typedef FILE* MatacqProducer::FILE_t
private

Definition at line 60 of file MatacqProducer.h.

typedef off_t MatacqProducer::filepos_t
private

Definition at line 59 of file MatacqProducer.h.

Member Enumeration Documentation

Enumerator
laserType 
ledType 
tpType 
pedType 

Definition at line 48 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_, Exception, edm::ParameterSet::getParameter(), inputRawCollectionToken_, 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<edm::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  inputRawCollectionToken_ = consumes<FEDRawDataCollection>(params.getParameter<InputTag>("inputRawCollection"));
119 
120 
121  if(produceDigis_){
122  if(verbosity_>0) cout << "[Matacq " << now() << "] registering new "
123  "EcalMatacqDigiCollection product with instance name '"
124  << digiInstanceName_ << "'\n";
125  produces<EcalMatacqDigiCollection>(digiInstanceName_);
126  }
127 
128  if(produceRaw_){
129  if(verbosity_>0) cout << "[Matacq " << now() << "] registering new FEDRawDataCollection "
130  "product with instance name '"
131  << rawInstanceName_ << "'\n";
132  produces<FEDRawDataCollection>(rawInstanceName_);
133  }
134 
135  startTime_.tv_sec = startTime_.tv_usec = 0;
136  if(orbitOffsetFile_.size()>0){
137  doOrbitOffset_ = true;
138  loadOrbitOffset();
139  } else{
140  doOrbitOffset_ = false;
141  }
142  if(verbosity_>=4) cout << "[Matacq " << now() << "] exiting MatacqProducer ctor" << endl;
143 }
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_
struct MatacqProducer::stats_t stats_
edm::EDGetTokenT< FEDRawDataCollection > inputRawCollectionToken_
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_
static const stats_t stats_init
MatacqProducer::~MatacqProducer ( )

Destructor

Definition at line 767 of file MatacqProducer.cc.

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

767  {
768  mclose();
769  timeval t;
770  gettimeofday(&t, 0);
771  if(logTiming_ && startTime_.tv_sec!=0){
772  //not using logger, to allow timing with different logging options
773  cout << "[Matacq " << now() << "] Time elapsed between first event and "
774  "destruction of MatacqProducer: "
775  << ((t.tv_sec-startTime_.tv_sec)*1.
776  + (t.tv_usec-startTime_.tv_usec)*1.e-6) << "s\n";
777  }
778 }
tuple t
Definition: tree.py:139
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 179 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_, inputRawCollectionToken_, MatacqDataFormatter::interpretRawData(), 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().

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

Referenced by addMatacqData().

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

Definition at line 343 of file MatacqProducer.cc.

References funct::abs(), gather_cfg::cout, data_, MatacqProducer::PosEstimator::eventLength(), Exception, fastRetrievalThresh_, newFWLiteAna::found, MatacqRawEvent::getDccLen(), MatacqRawEvent::getOrbitId(), MatacqRawEvent::getRunNum(), inFileName_, MatacqProducer::PosEstimator::invalid(), lastOrb_, matacq_, mread(), mrewind(), mseek(), msize(), mtell(), now(), hltrates_dqm_sourceclient-live_cfg::offset, orbitTolerance_, MatacqProducer::PosEstimator::pos(), posEstim_, DTTTrigCorrFirst::run, and verbosity_.

Referenced by addMatacqData().

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

544  {
547  if(fileChange!=0) *fileChange = false;
548  return misOpened();
549  }
550 
551  if(fileNames_.size()==0) return 0;
552 
553  const string runNumberFormat = "%08d";
554  string sRunNumber = str(boost::format(runNumberFormat) % runNumber);
555  //cout << "Run number string: " << sRunNumber << "\n";
556  bool found = false;
557  string fname;
558  for(unsigned i=0; i < fileNames_.size() && !found; ++i){
559  fname = fileNames_[i];
560  boost::algorithm::replace_all(fname, "%run_subdir%",
562  boost::algorithm::replace_all(fname, "%run_number%", sRunNumber);
563 
564  if(verbosity_>0) cout << "[Matacq " << now() << "] "
565  << "Looking for a file with path "
566  << fname << "\n";
567 
568  if(mcheck(fname)){
569  LogInfo("Matacq") << "Uses matacq data file: '" << fname << "'\n";
570  found = true;
571  }
572  }
573  if(!found){
574  if(verbosity_>=0) cout << "[Matacq " << now() << "] no matacq file found "
575  "for run " << runNumber << "\n";
578  if(fileChange!=0) *fileChange = false;
579  return 0;
580  }
581 
582  if(!mopen(fname)){
583  LogWarning("Matacq") << "Failed to open file " << fname << "\n";
586  if(fileChange!=0) *fileChange = false;
587  return false;
588  } else{
590  lastOrb_ = 0;
591  posEstim_.init(this);
592  if(fileChange!=0) *fileChange = true;
593  return true;
594  }
595 }
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 602 of file MatacqProducer.cc.

References funct::abs(), FEDRawData::data(), AlCaHLTBitMon_QueryRunRegistry::data, Exception, edm::Event::getByToken(), edm::EventBase::id(), inputRawCollectionToken_, FEDNumbering::inRange(), edm::HandleBase::isValid(), orbitTolerance_, lumiPlot::rawdata, and FEDRawData::size().

Referenced by addMatacqData().

602  {
603  //on CVS HEAD (June 4, 08), class Event has a method orbitNumber()
604  //we could use here. The code would be shorten to:
605  //return ev.orbitNumber();
606  //we have to deal with what we have in current CMSSW releases:
609  if(!(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 const int orbitTolerance_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
edm::EDGetTokenT< FEDRawDataCollection > inputRawCollectionToken_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool isValid() const
Definition: HandleBase.h:75
static bool inRange(int)
edm::EventID id() const
Definition: EventBase.h:60
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
dictionary rawdata
Definition: lumiPlot.py:393
uint32_t MatacqProducer::getRunNumber ( edm::Event ev) const
private

Definition at line 598 of file MatacqProducer.cc.

References edm::Event::run().

Referenced by addMatacqData(), and produce().

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

Loading orbit correction table from file.

See Also
orbitOffsetFile_

Definition at line 780 of file MatacqProducer.cc.

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

Referenced by MatacqProducer().

780  {
781  std::ifstream f(orbitOffsetFile_.c_str());
782  if(f.bad()){
783  throw cms::Exception("Matacq")
784  << "Failed to open orbit ID correction file '"
785  << orbitOffsetFile_ << "'\n";
786  }
787 
788  cout << "[Matacq " << now() << "] "
789  << "Offset to substract to Matacq events Orbit ID: \n"
790  << "#Run Number\t Offset\n";
791 
792  int iline = 0;
793  string s;
794  stringstream buf;
795  while(f.eof()){
796  getline(f, s);
797  ++iline;
798  if(s[0]=='#'){//comment
799  //skip line:
800  f.ignore(numeric_limits<streamsize>::max(), '\n');
801  continue;
802  }
803  buf.str("");
804  buf << s;
805  int run;
806  int orbit;
807  buf >> run;
808  buf >> orbit;
809  if(buf.bad()){
810  throw cms::Exception("Matacq")
811  << "Syntax error in Orbit offset file '"
812  << orbitOffsetFile_ << "'";
813  }
814  cout << run << "\t" << orbit << "\n";
815  orbitOffset_.insert(pair<int, int>(run, orbit));
816  }
817 }
std::map< uint32_t, uint32_t > orbitOffset_
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 1005 of file MatacqProducer.cc.

Referenced by getMatacqFile().

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

Definition at line 1030 of file MatacqProducer.cc.

References inFile_.

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

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

Definition at line 1039 of file MatacqProducer.cc.

References inFile_.

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

Definition at line 1035 of file MatacqProducer.cc.

References inFile_.

Referenced by getMatacqFile().

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

Definition at line 1018 of file MatacqProducer.cc.

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

Referenced by getMatacqFile().

1018  {
1019  if(inFile_!=0) mclose();
1020  inFile_ = fopen(name.c_str(), "r");
1021  if(inFile_!=0){
1022  inFileName_ = name;
1023  return true;
1024  } else{
1025  inFileName_ = "";
1026  return false;
1027  }
1028 }
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 959 of file MatacqProducer.cc.

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

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

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

Definition at line 999 of file MatacqProducer.cc.

References inFile_.

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

999  {
1000  if(0==inFile_) return false;
1001  clearerr(inFile_);
1002  return fseeko(inFile_, 0, SEEK_SET)!=0;
1003 }
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 939 of file MatacqProducer.cc.

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

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

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

Definition at line 987 of file MatacqProducer.cc.

References inFile_.

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

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

Definition at line 952 of file MatacqProducer.cc.

References inFile_.

Referenced by getMatacqEvent().

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

Definition at line 1053 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().

1053  {
1054  runNumber_ = newRun;
1055  eventSkipCounter_ = 0;
1056  logFile_ << "[" << now() << "] Event count for run "
1057  << runNumber_ << ": "
1058  << "total: " << stats_.nEvents << ", "
1059  << "Laser event with Matacq data: "
1060  << stats_.nLaserEventsWithMatacq << ", "
1061  << "Non laser event (according to DCC header) with Matacq data: "
1062  << stats_.nNonLaserEventsWithMatacq << "\n" << flush;
1063 
1064  stats_.nEvents = 0;
1067 
1068 
1069 }
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 147 of file MatacqProducer.cc.

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

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

147  {
148  if(verbosity_>=4) cout << "[Matacq " << now() << "] in MatacqProducer::produce" << endl;
149  if(logTiming_){
150  timeval t;
151  gettimeofday(&t, 0);
152 
153  timeLog_ << t.tv_sec << "."
154  << setfill('0') << setw(3) << (t.tv_usec+500)/1000 << setfill(' ')<< "\t"
155  << (t.tv_usec - timer_.tv_usec)*1.
156  + (t.tv_sec - timer_.tv_sec)*1.e6 << "\t";
157  timer_ = t;
158  }
159 
160  if(startTime_.tv_sec==0) gettimeofday(&startTime_, 0);
161  ++stats_.nEvents;
162  if(disabled_) return;
163  const uint32_t runNumber = getRunNumber(event);
164  if(runNumber!=runNumber_){
165  newRun(runNumber_, runNumber);
166  }
167  addMatacqData(event);
168 
169  if(logTiming_){
170  timeval t;
171  gettimeofday(&t, 0);
172  timeLog_ << (t.tv_usec - timer_.tv_usec)*1.
173  + (t.tv_sec - timer_.tv_sec)*1.e6 << "\n";
174  timer_ = t;
175  }
176 }
tuple t
Definition: tree.py:139
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 1046 of file MatacqProducer.cc.

References cmsPerfStripChart::format, and units().

Referenced by getMatacqFile().

1046  {
1047  int millions = runNumber / (1000*1000);
1048  int thousands = (runNumber-millions*1000*1000) / 1000;
1049  int units = runNumber-millions*1000*1000 - thousands*1000;
1050  return str(boost::format("%03d/%03d/%03d") % millions % thousands % units);
1051 }
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 264 of file MatacqProducer.h.

Referenced by addMatacqData().

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

Definition at line 266 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 212 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 224 of file MatacqProducer.h.

Referenced by produce().

bool MatacqProducer::doOrbitOffset_
private

Switch for orbit ID correction.

See Also
orbitOffsetFile_

Definition at line 289 of file MatacqProducer.h.

Referenced by addMatacqData(), and MatacqProducer().

int MatacqProducer::eventSkipCounter_
private

counter for event skipping

Definition at line 315 of file MatacqProducer.h.

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

int MatacqProducer::fastRetrievalThresh_
private

Definition at line 271 of file MatacqProducer.h.

Referenced by getMatacqEvent().

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

Definition at line 208 of file MatacqProducer.h.

Referenced by getMatacqFile().

MatacqDataFormatter MatacqProducer::formatter_
private

Definition at line 267 of file MatacqProducer.h.

Referenced by addMatacqData().

bool MatacqProducer::ignoreTriggerType_
private

When true look for matacq data independently of trigger type.

Definition at line 256 of file MatacqProducer.h.

Referenced by addMatacqData().

FILE_t MatacqProducer::inFile_
private

Stream of currently opened matacq file

Definition at line 262 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 293 of file MatacqProducer.h.

Referenced by getMatacqEvent(), and mopen().

edm::InputTag MatacqProducer::inputRawCollection_
private

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

Definition at line 241 of file MatacqProducer.h.

edm::EDGetTokenT<FEDRawDataCollection> MatacqProducer::inputRawCollectionToken_
private

EDM token to access the raw data collection the Matacq data must be merge to if merging is enabled.

Definition at line 247 of file MatacqProducer.h.

Referenced by addMatacqData(), getCalibTriggerType(), getOrbitId(), and MatacqProducer().

int32_t MatacqProducer::lastOrb_
private

Definition at line 270 of file MatacqProducer.h.

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

std::ofstream MatacqProducer::logFile_
private

Log file

Definition at line 310 of file MatacqProducer.h.

Referenced by MatacqProducer(), and newRun().

std::string MatacqProducer::logFileName_
private

Log file name

Definition at line 306 of file MatacqProducer.h.

Referenced by MatacqProducer().

bool MatacqProducer::logTiming_
private

Switch for code timing.

Definition at line 334 of file MatacqProducer.h.

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

MatacqRawEvent MatacqProducer::matacq_
private

Definition at line 258 of file MatacqProducer.h.

Referenced by addMatacqData(), and getMatacqEvent().

const int MatacqProducer::matacqFedId_ = 655
staticprivate

Definition at line 295 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 252 of file MatacqProducer.h.

Referenced by addMatacqData().

int MatacqProducer::onErrorDisablingEvtCnt_
private

Number of events to skip in case of error

Definition at line 319 of file MatacqProducer.h.

Referenced by getMatacqFile().

uint32_t MatacqProducer::openedFileRunNumber_
private

Definition at line 269 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 285 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 281 of file MatacqProducer.h.

Referenced by loadOrbitOffset(), and MatacqProducer().

const int MatacqProducer::orbitTolerance_ = 80
staticprivate

Definition at line 268 of file MatacqProducer.h.

Referenced by getMatacqEvent(), and getOrbitId().

PosEstimator MatacqProducer::posEstim_
private

Definition at line 273 of file MatacqProducer.h.

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

bool MatacqProducer::produceDigis_
private

Swictch for Matacq digi producion

Definition at line 232 of file MatacqProducer.h.

Referenced by addMatacqData(), and MatacqProducer().

bool MatacqProducer::produceRaw_
private

Switch for Matacq FED raw data production

Definition at line 236 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 216 of file MatacqProducer.h.

Referenced by addMatacqData(), and MatacqProducer().

uint32_t MatacqProducer::runNumber_
private

Number of the currently processed run

Definition at line 338 of file MatacqProducer.h.

Referenced by newRun(), and produce().

timeval MatacqProducer::startTime_
private

Definition at line 275 of file MatacqProducer.h.

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

struct MatacqProducer::stats_t MatacqProducer::stats_
private

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

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

Definition at line 303 of file MatacqProducer.h.

std::ofstream MatacqProducer::timeLog_
private

Output stream to log code timing

Definition at line 330 of file MatacqProducer.h.

Referenced by MatacqProducer(), and produce().

std::string MatacqProducer::timeLogFile_
private

Name of file to log timing

Definition at line 323 of file MatacqProducer.h.

Referenced by MatacqProducer().

timeval MatacqProducer::timer_
private

Buffer for timing

Definition at line 326 of file MatacqProducer.h.

Referenced by MatacqProducer(), and produce().

bool MatacqProducer::timing_
private

Parameter to switch module timing.

Definition at line 220 of file MatacqProducer.h.

int MatacqProducer::verbosity_
private