CMS 3D CMS Logo

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

#include <DaqSource.h>

Inheritance diagram for edm::DaqSource:
edm::InputSource evf::ModuleWeb edm::ProductRegistryHelper

Public Member Functions

 DaqSource (const ParameterSet &pset, const InputSourceDescription &desc)
 
virtual ~DaqSource ()
 
- Public Member Functions inherited from edm::InputSource
boost::shared_ptr
< ActivityRegistry
actReg () const
 Accessor for Activity Registry. More...
 
void closeFile (boost::shared_ptr< FileBlock >, bool cleaningUpAfterException)
 close current file More...
 
void doBeginJob ()
 Called by framework at beginning of job. More...
 
void doBeginLumi (LuminosityBlockPrincipal &lbp)
 Called by framework at beginning of lumi block. More...
 
void doBeginRun (RunPrincipal &rp)
 Called by framework at beginning of run. More...
 
void doEndJob ()
 Called by framework at end of job. More...
 
void doEndLumi (LuminosityBlockPrincipal &lbp, bool cleaningUpAfterException)
 Called by framework at end of lumi block. More...
 
void doEndRun (RunPrincipal &rp, bool cleaningUpAfterException)
 Called by framework at end of run. More...
 
void doPostForkReacquireResources (boost::shared_ptr< multicore::MessageReceiverForSource >)
 
void doPreForkReleaseResources ()
 Called by the framework before forking the process. More...
 
ProcessingController::ForwardState forwardState () const
 
bool goToEvent (EventID const &eventID)
 
 InputSource (ParameterSet const &, InputSourceDescription const &)
 Constructor. More...
 
void issueReports (EventID const &eventID)
 issue an event report More...
 
LuminosityBlockNumber_t luminosityBlock () const
 Accessor for current luminosity block number. More...
 
boost::shared_ptr
< LuminosityBlockAuxiliary
luminosityBlockAuxiliary () const
 Called by the framework to merge or insert lumi in principal cache. More...
 
int markLumi ()
 Mark lumi as read. More...
 
int markRun ()
 Mark run as read. More...
 
int maxEvents () const
 
int maxLuminosityBlocks () const
 
ModuleDescription const & moduleDescription () const
 Accessor for 'module' description. More...
 
ItemType nextItemType ()
 
bool primary () const
 Accessor for primary input source flag. More...
 
ProcessConfiguration const & processConfiguration () const
 Accessor for Process Configuration. More...
 
std::string const & processGUID () const
 Accessor for global process identifier. More...
 
ProcessingMode processingMode () const
 RunsLumisAndEvents (default), RunsAndLumis, or Runs. More...
 
boost::shared_ptr
< ProductRegistry const > 
productRegistry () const
 Accessor for product registry. More...
 
bool randomAccess () const
 
void readAndCacheLumi (bool merge, HistoryAppender &historyAppender)
 Read next luminosity block. More...
 
void readAndCacheRun (bool merge, HistoryAppender &historyAppender)
 Read next run. More...
 
EventPrincipalreadEvent (boost::shared_ptr< LuminosityBlockPrincipal > lbCache)
 
EventPrincipalreadEvent (EventID const &)
 Read a specific event. More...
 
boost::shared_ptr< FileBlockreadFile ()
 Read next file. More...
 
boost::shared_ptr
< LuminosityBlockAuxiliary
readLuminosityBlockAuxiliary ()
 Read next luminosity block Auxilary. More...
 
boost::shared_ptr< RunAuxiliaryreadRunAuxiliary ()
 Read next run Auxiliary. More...
 
ProcessHistoryID const & reducedProcessHistoryID () const
 
void registerProducts ()
 Register any produced products. More...
 
int remainingEvents () const
 
int remainingLuminosityBlocks () const
 
void repeat ()
 Reset the remaining number of events/lumis to the maximum number. More...
 
ProcessingController::ReverseState reverseState () const
 
void rewind ()
 Begin again at the first event. More...
 
RunNumber_t run () const
 Accessor for current run number. More...
 
boost::shared_ptr< RunAuxiliaryrunAuxiliary () const
 Called by the framework to merge or insert run in principal cache. More...
 
void setLuminosityBlockNumber_t (LuminosityBlockNumber_t lb)
 Set the luminosity block ID. More...
 
void setRunNumber (RunNumber_t r)
 Set the run number. More...
 
void skipEvents (int offset)
 
Timestamp const & timestamp () const
 Accessor for the current time, as seen by the input source. More...
 
virtual ~InputSource ()
 Destructor. More...
 

Private Member Functions

virtual void closeBackDoor ()
 
void defaultWebPage (xgi::Input *in, xgi::Output *out)
 
int doMyBeginRun ()
 
virtual ItemType getNextItemType ()
 
virtual void openBackDoor (unsigned int, bool *)
 
virtual void publish (xdata::InfoSpace *)
 
virtual void publishForkInfo (evf::moduleweb::ForkInfoObj *forkInfoObj)
 
virtual void publishToXmas (xdata::InfoSpace *)
 
virtual EventPrincipalreadEvent_ ()
 
virtual EventPrincipalreadIt (EventID const &eventID)
 
virtual boost::shared_ptr
< LuminosityBlockAuxiliary
readLuminosityBlockAuxiliary_ ()
 
virtual boost::shared_ptr
< RunAuxiliary
readRunAuxiliary_ ()
 
virtual void setLumi (LuminosityBlockNumber_t lb)
 
virtual void setRun (RunNumber_t r)
 
virtual void signalWaitingThreadAndBlock ()
 
virtual void skip (int offset)
 
- Private Member Functions inherited from evf::ModuleWeb
 ModuleWeb (const std::string &)
 
virtual ~ModuleWeb ()
 

Private Attributes

bool alignLsToLast_
 
bool beginRunTiming_
 
pthread_cond_t cond_
 
int count
 
DaqProvenanceHelper daqProvenanceHelper_
 
bool eventCached_
 
unsigned int eventCounter_
 
bool fakeLSid_
 
evf::moduleweb::ForkInfoObjforkInfo_
 
bool goToStopping
 
bool immediateStop
 
xdata::InfoSpace * is_
 
bool keepUsingPsidFromTrigger_
 
xdata::UnsignedInteger32 * lastLumiPrescaleIndex_
 
xdata::UnsignedInteger32 * lastLumiUsingEol_
 
xdata::Boolean * lsTimedOut_
 
xdata::Boolean * lsToBeRecovered_
 
LuminosityBlockNumber_t luminosityBlockNumber_
 
xdata::UnsignedInteger32 * lumiSectionIndex_
 
unsigned int lumiSegmentSizeInEvents_
 
xdata::InfoSpace * mis_
 
pthread_mutex_t mutex_
 
bool newLumi_
 
bool newRun_
 
bool noMoreEvents_
 
ProcessHistoryID phid_
 
xdata::UnsignedInteger32 * prescaleSetIndex_
 
DaqBaseReaderreader_
 
bool runFork_
 
RunNumber_t runNumber_
 
pthread_mutex_t signal_lock_
 
unsigned int thisEventLSid
 
timeval tvStat_
 
bool useEventCounter_
 
- Private Attributes inherited from evf::ModuleWeb
std::string moduleName_
 

Additional Inherited Members

- Public Types inherited from edm::InputSource
enum  ItemType {
  IsInvalid, IsStop, IsFile, IsRun,
  IsLumi, IsEvent, IsRepeat
}
 
enum  ProcessingMode { Runs, RunsAndLumis, RunsLumisAndEvents }
 
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::InputSource
static const std::string & baseType ()
 
static void fillDescription (ParameterSetDescription &desc)
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::InputSource
void decreaseRemainingEventsBy (int iSkipped)
 
EventPrincipaleventPrincipalCache ()
 
boost::shared_ptr
< LuminosityBlockPrincipal >
const 
luminosityBlockPrincipal () const
 
PrincipalCache const & principalCache () const
 
PrincipalCacheprincipalCache ()
 
ProductRegistryproductRegistryUpdate () const
 
void reset () const
 
void resetLuminosityBlockAuxiliary () const
 
void resetRunAuxiliary () const
 
boost::shared_ptr
< RunPrincipal > const 
runPrincipal () const
 
void setLuminosityBlockAuxiliary (LuminosityBlockAuxiliary *lbp)
 
void setRunAuxiliary (RunAuxiliary *rp)
 
void setTimestamp (Timestamp const &theTime)
 To set the current time, as seen by the input source. More...
 
ItemType state () const
 

Detailed Description

Definition at line 36 of file DaqSource.h.

Constructor & Destructor Documentation

DaqSource::DaqSource ( const ParameterSet pset,
const InputSourceDescription desc 
)
explicit

Definition at line 56 of file DaqSource.cc.

References edm::Timestamp::beginOfTime(), cms::Exception::category(), cond_, count, edm::DaqProvenanceHelper::daqInit(), daqProvenanceHelper_, alignCSCRings::e, reco::get(), edm::ParameterSet::getUntrackedParameter(), mutex_, phid_, edm::InputSource::productRegistryUpdate(), matplotRender::reader, reader_, runNumber_, DaqBaseReader::setRunNumber(), edm::InputSource::setTimestamp(), and signal_lock_.

58  : InputSource(pset,desc)
59  , evf::ModuleWeb("DaqSource")
60  , reader_(0)
61  , lumiSegmentSizeInEvents_(pset.getUntrackedParameter<unsigned int>("evtsPerLS",0))
62  , useEventCounter_(pset.getUntrackedParameter<bool>("useEventCounter",false))
63  , eventCounter_(0)
64  , keepUsingPsidFromTrigger_(pset.getUntrackedParameter<bool>("keepUsingPsidFromTrigger",false))
69  , noMoreEvents_(false)
70  , newRun_(true)
71  , newLumi_(true)
72  , eventCached_(false)
73  , alignLsToLast_(false)
74  , is_(0)
75  , mis_(0)
76  , thisEventLSid(0)
77  , goToStopping(false)
78  , immediateStop(false)
79  , forkInfo_(nullptr)
80  , runFork_(false)
81  , beginRunTiming_(false)
82  {
83  count = 0;
84  pthread_mutex_init(&mutex_,0);
85  pthread_mutex_init(&signal_lock_,0);
86  pthread_cond_init(&cond_,0);
87 
88 
90 
91  // Instantiate the requested data source
92  std::string reader = pset.getUntrackedParameter<std::string>("readerPluginName");
93 
94  try{
95  reader_=
96  DaqReaderPluginFactory::get()->create(reader,
97  pset.getUntrackedParameter<ParameterSet>("readerPset"));
99  }
100  catch(edm::Exception &e) {
101  if(e.category() == "Configuration" && reader_ == 0) {
102  reader_ = DaqReaderPluginFactoryU::get()->create(reader);
103  if(reader_ == 0) throw;
105  }
106  else {
107  throw;
108  }
109  }
110 
111  // Initialize metadata, and save the process history ID for use every event.
113 
114  }
DaqBaseReader * reader_
Definition: DaqSource.h:66
xdata::InfoSpace * mis_
Definition: DaqSource.h:93
ProcessHistoryID phid_
Definition: DaqSource.h:76
evf::moduleweb::ForkInfoObj * forkInfo_
Definition: DaqSource.h:98
static LuminosityBlockID firstValidLuminosityBlock()
LuminosityBlockNumber_t luminosityBlockNumber_
Definition: DaqSource.h:74
unsigned int eventCounter_
Definition: DaqSource.h:69
DaqProvenanceHelper daqProvenanceHelper_
Definition: DaqSource.h:75
std::string const & category() const
Definition: Exception.cc:183
void setTimestamp(Timestamp const &theTime)
To set the current time, as seen by the input source.
Definition: InputSource.h:293
RunNumber_t run() const
Accessor for current run number.
Definition: InputSource.cc:606
RunNumber_t runNumber_
Definition: DaqSource.h:73
static RunID firstValidRun()
Definition: RunID.h:82
pthread_cond_t cond_
Definition: DaqSource.h:85
ProcessHistoryID daqInit(ProductRegistry &productRegistry) const
pthread_mutex_t signal_lock_
Definition: DaqSource.h:84
bool fakeLSid_
Definition: DaqSource.h:71
bool keepUsingPsidFromTrigger_
Definition: DaqSource.h:70
bool goToStopping
Definition: DaqSource.h:96
LuminosityBlockNumber_t luminosityBlock() const
Accessor for current luminosity block number.
Definition: InputSource.cc:612
bool beginRunTiming_
Definition: DaqSource.h:101
ProductRegistry & productRegistryUpdate() const
Definition: InputSource.h:295
unsigned int lumiSegmentSizeInEvents_
Definition: DaqSource.h:67
bool useEventCounter_
Definition: DaqSource.h:68
static Timestamp const & beginOfTime()
Definition: Timestamp.cc:96
pthread_mutex_t mutex_
Definition: DaqSource.h:83
virtual void setRunNumber(edm::RunNumber_t runNumber)
set the run number
Definition: DaqBaseReader.h:37
bool eventCached_
Definition: DaqSource.h:80
unsigned int thisEventLSid
Definition: DaqSource.h:95
bool noMoreEvents_
Definition: DaqSource.h:77
InputSource(ParameterSet const &, InputSourceDescription const &)
Constructor.
Definition: InputSource.cc:54
bool immediateStop
Definition: DaqSource.h:97
xdata::InfoSpace * is_
Definition: DaqSource.h:92
T get(const Candidate &c)
Definition: component.h:56
bool alignLsToLast_
Definition: DaqSource.h:81
DaqSource::~DaqSource ( )
virtual

Definition at line 117 of file DaqSource.cc.

References reader_.

117  {
118  delete reader_;
119  }
DaqBaseReader * reader_
Definition: DaqSource.h:66

Member Function Documentation

void DaqSource::closeBackDoor ( )
privatevirtual

Reimplemented from evf::ModuleWeb.

Definition at line 634 of file DaqSource.cc.

References cond_, count, lsTimedOut_, mutex_, and signal_lock_.

635  {
636  count--;
637  pthread_cond_signal(&cond_);
638  pthread_mutex_unlock(&mutex_);
639  pthread_mutex_lock(&signal_lock_);
640  lsTimedOut_->value_ = false;
641  }
xdata::Boolean * lsTimedOut_
Definition: DaqSource.h:90
pthread_cond_t cond_
Definition: DaqSource.h:85
pthread_mutex_t signal_lock_
Definition: DaqSource.h:84
pthread_mutex_t mutex_
Definition: DaqSource.h:83
void DaqSource::defaultWebPage ( xgi::Input in,
xgi::Output out 
)
privatevirtual

Reimplemented from evf::ModuleWeb.

Definition at line 656 of file DaqSource.cc.

References alignCSCRings::e, cppFunctionSkipper::exception, edm::first(), goToStopping, LaserDQM_cfg::input, evf::ModuleWeb::moduleName_, scaleCards::path, pos, o2o::query, and edm::second().

657  {
658  std::string path;
659  std::string urn;
660  std::string mname;
661  std::string query;
662  std::string original_referrer_;
663  try
664  {
665  cgicc::Cgicc cgi(in);
666  if ( xgi::Utils::hasFormElement(cgi,"gotostopping") )
667  {
668  goToStopping=true;
669  }
670  if ( xgi::Utils::hasFormElement(cgi,"module") )
671  mname = xgi::Utils::getFormElement(cgi, "module")->getValue();
672  cgicc::CgiEnvironment cgie(in);
673  if(original_referrer_ == "")
674  original_referrer_ = cgie.getReferrer();
675  path = cgie.getPathInfo();
676  query = cgie.getQueryString();
677  }
678  catch (const std::exception & e)
679  {
680  // don't care if it did not work
681  }
682 
683  using std::endl;
684  *out << "<html>" << endl;
685  *out << "<head>" << endl;
686 
687 
688  *out << "<STYLE type=\"text/css\"> #T1 {border-width: 2px; border: solid blue; text-align: center} </STYLE> " << endl;
689  *out << "<link type=\"text/css\" rel=\"stylesheet\"";
690  *out << " href=\"/" << urn
691  << "/styles.css\"/>" << endl;
692 
693  *out << "<title>" << moduleName_
694  << " MAIN</title>" << endl;
695 
696  *out << "</head>" << endl;
697  *out << "<body onload=\"loadXMLDoc()\">" << endl;
698  *out << "<table border=\"0\" width=\"100%\">" << endl;
699  *out << "<tr>" << endl;
700  *out << " <td align=\"left\">" << endl;
701  *out << " <img" << endl;
702  *out << " align=\"middle\"" << endl;
703  *out << " src=\"/evf/images/bugicon.jpg\"" << endl;
704  *out << " alt=\"main\"" << endl;
705  *out << " width=\"90\"" << endl;
706  *out << " height=\"64\"" << endl;
707  *out << " border=\"\"/>" << endl;
708  *out << " <b>" << endl;
709  *out << moduleName_ << endl;
710  *out << " </b>" << endl;
711  *out << " </td>" << endl;
712  *out << " <td width=\"32\">" << endl;
713  *out << " <a href=\"/urn:xdaq-application:lid=3\">" << endl;
714  *out << " <img" << endl;
715  *out << " align=\"middle\"" << endl;
716  *out << " src=\"/hyperdaq/images/HyperDAQ.jpg\"" << endl;
717  *out << " alt=\"HyperDAQ\"" << endl;
718  *out << " width=\"32\"" << endl;
719  *out << " height=\"32\"" << endl;
720  *out << " border=\"\"/>" << endl;
721  *out << " </a>" << endl;
722  *out << " </td>" << endl;
723  *out << " <td width=\"32\">" << endl;
724  *out << " </td>" << endl;
725  *out << " <td width=\"32\">" << endl;
726  *out << " <a href=\"" << original_referrer_ << "\">" << endl;
727  *out << " <img" << endl;
728  *out << " align=\"middle\"" << endl;
729  *out << " src=\"/evf/images/spoticon.jpg\"" << endl;
730  *out << " alt=\"main\"" << endl;
731  *out << " width=\"32\"" << endl;
732  *out << " height=\"32\"" << endl;
733  *out << " border=\"\"/>" << endl;
734  *out << " </a>" << endl;
735  *out << " </td>" << endl;
736  *out << "</tr>" << endl;
737  *out << "</table>" << endl;
738 
739  *out << "<hr/>" << endl;
740 
741  *out << cgicc::form().set("method","GET").set("action", path )
742  << std::endl;
743  boost::char_separator<char> sep("&");
744  boost::tokenizer<boost::char_separator<char> > tokens(query, sep);
745  for (boost::tokenizer<boost::char_separator<char> >::iterator tok_iter = tokens.begin();
746  tok_iter != tokens.end(); ++tok_iter){
747  size_t pos = (*tok_iter).find_first_of("=");
748  if(pos != std::string::npos){
749  std::string first = (*tok_iter).substr(0 , pos);
750  std::string second = (*tok_iter).substr(pos+1, (*tok_iter).length()-pos-1);
751  *out << cgicc::input().set("type","hidden").set("name",first).set("value", second)
752  << std::endl;
753  }
754  }
755 
756  *out << cgicc::input().set("type","hidden").set("name","gotostopping").set("value","true")
757  << std::endl;
758  *out << cgicc::input().set("type","submit").set("value","Go To Stopping") << std::endl;
759  *out << cgicc::form() << std::endl;
760 
761  *out << "</body>" << endl;
762  *out << "</html>" << endl;
763  }
boost::tokenizer< boost::char_separator< char > > tokenizer
U second(std::pair< T, U > const &p)
list path
Definition: scaleCards.py:51
bool goToStopping
Definition: DaqSource.h:96
std::string moduleName_
Definition: ModuleWeb.h:61
tuple out
Definition: dbtoconf.py:99
tuple query
Definition: o2o.py:269
T first(std::pair< T, U > const &p)
int DaqSource::doMyBeginRun ( )
private

Definition at line 134 of file DaqSource.cc.

References beginRunTiming_, evf::moduleweb::ForkInfoObj::control_sem_, gather_cfg::cout, evf::moduleweb::ForkInfoObj::forkHandler, forkInfo_, evf::moduleweb::ForkInfoObj::forkParams, evf::moduleweb::ForkInfoObj::fuAddr, immediateStop, evf::moduleweb::ForkParams::isMaster, evf::moduleweb::ForkInfoObj::lock(), newRun_, NULL, evf::moduleweb::ForkInfoObj::receivedStop_, evf::moduleweb::ForkParams::restart, evf::moduleweb::ForkParams::slotId, evf::moduleweb::ForkInfoObj::stopCondition, tvStat_, and evf::moduleweb::ForkInfoObj::unlock().

Referenced by getNextItemType().

134  {
135 
136  if (forkInfo_) {
137  while (!immediateStop) {
138  //queue new run to Framework (causes EP beginRun to be executed)
139  if (newRun_) {
140  beginRunTiming_=true;
141  gettimeofday(&tvStat_, NULL);
142  return 2;
143  }
144  //measure time in fwk beginRun
145  if (beginRunTiming_) {
146  timeval tsTmp;
147  gettimeofday(&tsTmp,NULL);
148  long tusecs = (tsTmp.tv_sec-tvStat_.tv_sec)*1000000 + tsTmp.tv_usec - tvStat_.tv_usec;
149  double tsecs = ((double)(tusecs/10000))/100.;
150  std::cout << "DaqSource: FWK beginRun elapsed time: " << tsecs << " seconds in master EP"<< std::endl;
151  edm::LogInfo("DaqSource") << "FWK beginRun elapsed time: " << tsecs << " seconds in master EP";
152  beginRunTiming_=false;
153  usleep(10000);//short sleep before fork
154  }
155  //first or new run init
156  if (forkInfo_->forkParams.isMaster==-1) {
157  forkInfo_->lock();//keeping it locked during init!
158  forkInfo_->forkHandler(forkInfo_->fuAddr); //fork all slaves
159  }
160  if (forkInfo_->forkParams.isMaster==-1) {
161  forkInfo_->unlock();
162  std::cout << "ERROR (DaqSource): not notified to be either in master or slave process after fork" << std::endl;
163  return -2;
164  }
165 
166  //slave process after fork: exit all this
167  if (forkInfo_->forkParams.isMaster==0) {
168  forkInfo_->unlock();
169  return 1;
170  }
171 
172  //master process after fork:
173  if (forkInfo_->forkParams.isMaster==1) {
174  forkInfo_->unlock();
175  int slotToRestart=-1;
176  sem_wait(forkInfo_->control_sem_);
177  forkInfo_->lock();
178 
179  //got unblocked due to next run
180  if (forkInfo_->forkParams.isMaster==-1) {
181  forkInfo_->unlock();
182  continue; // check here for newRun_?
183  }
184  //check if asked to stop
186  if (immediateStop) {
187  forkInfo_->receivedStop_=true;
188  break;
189  }
190 
191  //check if asked to restart
192  slotToRestart = forkInfo_->forkParams.slotId;
193 
194  if (slotToRestart==-1 && forkInfo_->forkParams.restart==0) {
195  //this will deal with spurious semaphore signals when slave is killed
196  forkInfo_->unlock();
197  continue;
198  }
199  //restart single slave
201  }
202  }
203  //loop exit
204  forkInfo_->unlock();
205  return 0;
206  }
207  return -1; //no forkInfo_
208  }
evf::moduleweb::ForkInfoObj * forkInfo_
Definition: DaqSource.h:98
timeval tvStat_
Definition: DaqSource.h:100
#define NULL
Definition: scimark2.h:8
void(* forkHandler)(void *)
Definition: ModuleWeb.h:44
unsigned int stopCondition
Definition: ModuleWeb.h:46
bool beginRunTiming_
Definition: DaqSource.h:101
tuple cout
Definition: gather_cfg.py:121
bool immediateStop
Definition: DaqSource.h:97
InputSource::ItemType DaqSource::getNextItemType ( )
privatevirtual

Implements edm::InputSource.

Definition at line 213 of file DaqSource.cc.

References alignLsToLast_, beginRunTiming_, cond_, edm::DaqProvenanceHelper::constBranchDescription_, gather_cfg::cout, daqProvenanceHelper_, FEDRawData::data(), doMyBeginRun(), edm::DaqProvenanceHelper::dummyProvenance_, edm::EventID::event(), eventCached_, eventCounter_, edm::InputSource::eventPrincipalCache(), evf::evtn::evm_board_sense(), edm::hlt::Exception, fakeLSid_, FEDRawDataCollection::FEDData(), edm::EventPrincipal::fillEventPrincipal(), DaqBaseReader::fillRawData(), forkInfo_, evf::evtn::getevtyp(), evf::evtn::getfdlbx(), evf::evtn::getfdlpsc(), evf::evtn::getgpshigh(), evf::evtn::getgpslow(), evf::evtn::getlbn(), evf::evtn::getorbit(), goToStopping, evf::evtn::gtpe_board_sense(), evf::evtn::gtpe_getbx(), evf::evtn::gtpe_getlbn(), evf::evtn::gtpe_getorbit(), edm::daqsource::gtpeId_, edm::daqsource::gtpEvmId_, immediateStop, edm::EventAuxiliary::invalidBunchXing, edm::EventAuxiliary::invalidStoreNumber, edm::Timestamp::invalidTimestamp(), edm::InputSource::IsEvent, edm::InputSource::IsLumi, edm::InputSource::IsRun, edm::InputSource::IsStop, keepUsingPsidFromTrigger_, lastLumiPrescaleIndex_, lastLumiUsingEol_, edm::errors::LogicError, lsToBeRecovered_, edm::InputSource::luminosityBlock(), edm::InputSource::luminosityBlockAuxiliary(), luminosityBlockNumber_, lumiSectionIndex_, lumiSegmentSizeInEvents_, mutex_, newLumi_, newRun_, noMoreEvents_, NULL, phid_, edm::EventAuxiliary::PhysicsTrigger, prescaleSetIndex_, edm::InputSource::processGUID(), edm::EventPrincipal::put(), reader_, edm::InputSource::resetLuminosityBlockAuxiliary(), runFork_, runNumber_, edm::InputSource::setLuminosityBlockAuxiliary(), edm::InputSource::setTimestamp(), signalWaitingThreadAndBlock(), FEDRawData::size(), thisEventLSid, cond::rpcobgas::time, edm::InputSource::timestamp(), tvStat_, edm::EventAuxiliary::Undefined, and useEventCounter_.

213  {
214  // std::cout << getpid() << " enter getNextItemType " << std::endl;
215  if (runFork_) {
216  runFork_=false;
217  int queueNext = doMyBeginRun();
218  //check if new run (requires returning IsRun once)
219  if (queueNext == 2) runFork_=true;
220  }
221 
222  //get initial time before beginRun (used with old forking)
223  if (!forkInfo_ && newRun_) {
224  beginRunTiming_=true;
225  gettimeofday(&tvStat_, NULL);
226  }
227 
228  if (immediateStop) return IsStop;
229 
230  // --------------
231  if(goToStopping){noMoreEvents_ = true; goToStopping=false;}
232  if (noMoreEvents_) {
233  pthread_mutex_lock(&mutex_);
234  pthread_cond_signal(&cond_);
235  pthread_mutex_unlock(&mutex_);
236  return IsStop;
237  }
238  if (newRun_) {
239  return IsRun;
240  }
241 
242  //calculate and print the beginRun the timing
243  if (beginRunTiming_) {
244  timeval tsTmp;
245  gettimeofday(&tsTmp,NULL);
246  long tusecs = (tsTmp.tv_sec-tvStat_.tv_sec)*1000000 + tsTmp.tv_usec - tvStat_.tv_usec;
247  double tsecs = ((double)(tusecs/10000))/100.;
248  std::cout << "DaqSource (slave pid "<< getpid() << " ): FWK beginRun elapsed time: "
249  << tsecs << " seconds "<< std::endl;
250  edm::LogInfo("DaqSource") << "DaqSource (slave pid "<< getpid() << " ): FWK beginRun elapsed time: "
251  << tsecs << " seconds ";
252  beginRunTiming_=false;
253  }
254 
256  // std::cout << "newLumi & lumiblock valid " << std::endl;
257  return IsLumi;
258  }
259  if (alignLsToLast_) { //here we are recovering from a gap in Ls number so an event may already be cached but
260  // we hold onto it until we have issued all the necessary endLumi/beginLumi
261  // std::cout << getpid() << "alignLsToLast was set and ls number is "
262  // << luminosityBlockNumber_ << " before signaling" << std::endl;
265  // std::cout << getpid() << "alignLsToLast signaled and incremented "
266  // << luminosityBlockNumber_ << " eventcached "
267  // << eventCached_ << std::endl;
268  newLumi_ = true;
272  {
273  alignLsToLast_ = false;
274  }
276  setLuminosityBlockAuxiliary(new LuminosityBlockAuxiliary(
278  luminosityBlockAuxiliary()->setProcessHistoryID(phid_);
279 
280  // std::cout << "nextItemType: dealt with new lumi block principal, retval is " << retval << std::endl;
281  }
282  return IsLumi;
283  }
284  if (eventCached_) {
285  // std::cout << "read event already cached " << std::endl;
286  return IsEvent;
287  }
288  if(reader_ == 0) {
290  << "DaqSource is used without a reader. Check your configuration !";
291  }
292  EventID eventId;
293  TimeValue_t time = 0LL;
294  timeval stv;
295  gettimeofday(&stv,0);
296  time = stv.tv_sec;
297  time = (time << 32) + stv.tv_usec;
298  Timestamp tstamp(time);
299 
300  int bunchCrossing = EventAuxiliary::invalidBunchXing;
301  int orbitNumber = EventAuxiliary::invalidBunchXing;
302 
303  // pass a 0 pointer to fillRawData()!
304  FEDRawDataCollection* fedCollection(0);
305 
307 
308  // let reader_ fill the fedCollection
309  int retval = reader_->fillRawData(eventId, tstamp, fedCollection);
310  if(retval==0) {
311  // fillRawData() failed, clean up the fedCollection in case it was allocated!
312  if (0 != fedCollection) delete fedCollection;
313  noMoreEvents_ = true;
314  pthread_mutex_lock(&mutex_);
315  pthread_cond_signal(&cond_);
316  pthread_mutex_unlock(&mutex_);
317  return IsStop;
318  }
319  else if(retval<0)
320  {
321 
322  unsigned int nextLsFromSignal = (-1)*retval+1;
323 // std::cout << getpid() << "::got end-of-lumi for " << (-1)*retval
324 // << " was " << luminosityBlockNumber_ << std::endl;
325  if(luminosityBlockNumber_ == (nextLsFromSignal-1) )
326  {
327  lastLumiUsingEol_->value_ = nextLsFromSignal;
328  if(lsToBeRecovered_->value_){
329 // std::cout << getpid() << "eol::recover ls::for " << (-1)*retval << std::endl;
332  newLumi_ = true;
335  thisEventLSid = nextLsFromSignal - 1;
337  alignLsToLast_ = true;
338  // std::cout << getpid() << "eol::::alignLsToLast_ " << alignLsToLast_ << std::endl;
339  }
340  else{
341  // std::cout << getpid() << "eol::realign ls::for " << (-1)*retval << std::endl;
342  luminosityBlockNumber_ = nextLsFromSignal;
343  newLumi_ = true;
346  }
347  }
348  else {
349  if(nextLsFromSignal >(luminosityBlockNumber_+100) ) {
350  edm::LogError("DaqSource") << "Got EOL event with value " << retval
351  << " nextLS would be " << nextLsFromSignal
352  << " while we expected " << luminosityBlockNumber_+1 << " - disregarding... ";
353  }
354  if (nextLsFromSignal > luminosityBlockNumber_+2) //recover on delta > 2
355  {
356  lastLumiUsingEol_->value_ = nextLsFromSignal;
357  thisEventLSid=nextLsFromSignal-1;//set new LS
360  newLumi_ = true;
362  alignLsToLast_ = true;
363 
364  //set new lumi block
366  setLuminosityBlockAuxiliary(new LuminosityBlockAuxiliary(
368  luminosityBlockAuxiliary()->setProcessHistoryID(phid_);
369  }
370 
371  }
372  // else
373  // std::cout << getpid() << "::skipping end-of-lumi for " << (-1)*retval << std::endl;
374  }
375  else
376  {
377  if (eventId.event() == 0) {
379  << "The reader used with DaqSource has returned an invalid (zero) event number!\n"
380  << "Event numbers must begin at 1, not 0.";
381  }
382  EventSourceSentry(*this);
383  setTimestamp(tstamp);
384 
385  unsigned char *gtpFedAddr = fedCollection->FEDData(daqsource::gtpEvmId_).size()!=0 ? fedCollection->FEDData(daqsource::gtpEvmId_).data() : 0;
386  uint32_t gtpsize = 0;
387  if(gtpFedAddr !=0) gtpsize = fedCollection->FEDData(daqsource::gtpEvmId_).size();
388  unsigned char *gtpeFedAddr = fedCollection->FEDData(daqsource::gtpeId_).size()!=0 ? fedCollection->FEDData(daqsource::gtpeId_).data() : 0;
389 
390  unsigned int nextFakeLs = 0;
391  eventCounter_++;
392  if (fakeLSid_)
395  (nextFakeLs = useEventCounter_ ? ((eventCounter_-1)/lumiSegmentSizeInEvents_ + 1) :
396  ((eventId.event() - 1)/lumiSegmentSizeInEvents_ + 1))) {
397  lastLumiPrescaleIndex_->value_ = prescaleSetIndex_->value_;
398  prescaleSetIndex_->value_ = 0; // since we do not know better but we want to be able to run
399 
400  if(luminosityBlockNumber_ == nextFakeLs-1)
402  luminosityBlockNumber_ = nextFakeLs;
403  thisEventLSid = nextFakeLs-1;
404  newLumi_ = true;
408  gtpFedAddr!=0 && evf::evtn::evm_board_sense(gtpFedAddr,gtpsize)){
409  prescaleSetIndex_->value_ = (evf::evtn::getfdlpsc(gtpFedAddr) & 0xffff);
410  }
411  }
412  else if(!fakeLSid_){
413 
414  if(gtpFedAddr!=0 && evf::evtn::evm_board_sense(gtpFedAddr,gtpsize)){
415  lastLumiPrescaleIndex_->value_ = prescaleSetIndex_->value_;
416  thisEventLSid = evf::evtn::getlbn(gtpFedAddr);
417  prescaleSetIndex_->value_ = (evf::evtn::getfdlpsc(gtpFedAddr) & 0xffff);
420  {
421  //late event,throw fwk exception
422  std::ostringstream excptmsg;
423  excptmsg << "DaqSource::event with late LS (" << thisEventLSid + 1 << ")received.";
424  throw edm::Exception(errors::LogicError,excptmsg.str());
425  }
426  if(luminosityBlockNumber_ != (thisEventLSid + 1)){
427  // we got here in a running process and some Ls might have been skipped so set the flag,
428  // increase by one, check and if appropriate set the flag then continue
429  if(lsToBeRecovered_->value_){
430  // std::cout << getpid() << "eve::recover ls::for " << thisEventLSid << std::endl;
433  newLumi_ = true;
436  if(luminosityBlockNumber_ != thisEventLSid+1) alignLsToLast_ = true;
437  // std::cout << getpid() << "eve::::alignLsToLast_ " << alignLsToLast_ << std::endl;
438  }
439  else{ // we got here because the process was restarted. just realign the ls id and proceed with this event
440  // std::cout << getpid() << "eve::realign ls::for " << thisEventLSid << std::endl;
441  luminosityBlockNumber_ = thisEventLSid + 1;
442  newLumi_ = true;
445  lsToBeRecovered_->value_ = true;
446  }
447  }
448  }
449  else if(gtpeFedAddr!=0 && evf::evtn::gtpe_board_sense(gtpeFedAddr)){
450  lastLumiPrescaleIndex_->value_ = prescaleSetIndex_->value_;
451  thisEventLSid = evf::evtn::gtpe_getlbn(gtpeFedAddr);
452  prescaleSetIndex_->value_ = 0; //waiting to get a PS index from gtpe
454  if(luminosityBlockNumber_ != (thisEventLSid + 1)){
455  if(luminosityBlockNumber_ == thisEventLSid)
457  luminosityBlockNumber_ = thisEventLSid + 1;
458  newLumi_ = true;
461  }
462  }
463  }
464  if(gtpFedAddr!=0 && evf::evtn::evm_board_sense(gtpFedAddr,gtpsize)){
465  bunchCrossing = int(evf::evtn::getfdlbx(gtpFedAddr));
466  orbitNumber = int(evf::evtn::getorbit(gtpFedAddr));
467  TimeValue_t time = evf::evtn::getgpshigh(gtpFedAddr);
468  time = (time << 32) + evf::evtn::getgpslow(gtpFedAddr);
469  Timestamp tstamp(time);
470  setTimestamp(tstamp);
471  }
472  else if(gtpeFedAddr!=0 && evf::evtn::gtpe_board_sense(gtpeFedAddr)){
473  bunchCrossing = int(evf::evtn::gtpe_getbx(gtpeFedAddr));
474  orbitNumber = int(evf::evtn::gtpe_getorbit(gtpeFedAddr));
475  }
476  }
477 
478  // std::cout << "lumiblockaux = " << luminosityBlockAuxiliary() << std::endl;
479  // If there is no luminosity block principal, make one.
481  newLumi_ = true;
482  setLuminosityBlockAuxiliary(new LuminosityBlockAuxiliary(
484  luminosityBlockAuxiliary()->setProcessHistoryID(phid_);
485 
486  // std::cout << "nextItemType: dealt with new lumi block principal, retval is " << retval << std::endl;
487  }
488  // std::cout << "here retval = " << retval << std::endl;
489  if(retval<0){
490  // std::cout << getpid() << " returning from getnextitem because retval < 0 - IsLumi "
491  // << IsLumi << std::endl;
492  if(newLumi_) return IsLumi; else return getNextItemType();
493  }
494 
495  // make a brand new event principal
496  eventId = EventID(runNumber_,thisEventLSid+1, eventId.event());
497  EventAuxiliary eventAux(eventId, processGUID(),
498  timestamp(),
499  true,
500  evttype,
501  bunchCrossing,
503  orbitNumber);
504  eventAux.setProcessHistoryID(phid_);
505  eventPrincipalCache()->fillEventPrincipal(eventAux, boost::shared_ptr<LuminosityBlockPrincipal>());
506  eventCached_ = true;
507 
508  // have fedCollection managed by a std::auto_ptr<>
509  std::auto_ptr<FEDRawDataCollection> bare_product(fedCollection);
510 
511  WrapperOwningHolder edp(new Wrapper<FEDRawDataCollection>(bare_product), Wrapper<FEDRawDataCollection>::getInterface());
513 
514 /*
515  Event e(*eventPrincipalCache(), md_);
516  // put the fed collection into the transient event store
517  e.put(bare_product);
518  // The commit is needed to complete the "put" transaction.
519  e.commit_();
520 */
521  if (newLumi_) {
522  return IsLumi;
523  }
524  return IsEvent;
525  }
DaqBaseReader * reader_
Definition: DaqSource.h:66
int doMyBeginRun()
Definition: DaqSource.cc:134
ProcessHistoryID phid_
Definition: DaqSource.h:76
unsigned int getgpshigh(const unsigned char *)
evf::moduleweb::ForkInfoObj * forkInfo_
Definition: DaqSource.h:98
LuminosityBlockNumber_t luminosityBlockNumber_
Definition: DaqSource.h:74
ProductProvenance dummyProvenance_
unsigned int getfdlbx(const unsigned char *)
bool gtpe_board_sense(const unsigned char *p)
virtual ItemType getNextItemType()
Definition: DaqSource.cc:213
xdata::UnsignedInteger32 * lumiSectionIndex_
Definition: DaqSource.h:86
unsigned int eventCounter_
Definition: DaqSource.h:69
xdata::Boolean * lsToBeRecovered_
Definition: DaqSource.h:91
timeval tvStat_
Definition: DaqSource.h:100
DaqProvenanceHelper daqProvenanceHelper_
Definition: DaqSource.h:75
boost::shared_ptr< LuminosityBlockAuxiliary > luminosityBlockAuxiliary() const
Called by the framework to merge or insert lumi in principal cache.
Definition: InputSource.h:238
#define NULL
Definition: scimark2.h:8
void setTimestamp(Timestamp const &theTime)
To set the current time, as seen by the input source.
Definition: InputSource.h:293
xdata::UnsignedInteger32 * lastLumiUsingEol_
Definition: DaqSource.h:89
constexpr unsigned int gtpEvmId_
Definition: DaqSource.cc:51
RunNumber_t runNumber_
Definition: DaqSource.h:73
void put(ConstBranchDescription const &bd, WrapperOwningHolder const &edp, ProductProvenance const &productProvenance)
unsigned int getfdlpsc(const unsigned char *)
pthread_cond_t cond_
Definition: DaqSource.h:85
std::string const & processGUID() const
Accessor for global process identifier.
Definition: InputSource.h:190
void resetLuminosityBlockAuxiliary() const
Definition: InputSource.h:302
static int const invalidBunchXing
unsigned int getlbn(const unsigned char *)
ConstBranchDescription constBranchDescription_
bool fakeLSid_
Definition: DaqSource.h:71
xdata::UnsignedInteger32 * prescaleSetIndex_
Definition: DaqSource.h:87
void setLuminosityBlockAuxiliary(LuminosityBlockAuxiliary *lbp)
Definition: InputSource.h:298
virtual void signalWaitingThreadAndBlock()
Definition: DaqSource.cc:643
bool keepUsingPsidFromTrigger_
Definition: DaqSource.h:70
bool evm_board_sense(const unsigned char *p, size_t size)
bool goToStopping
Definition: DaqSource.h:96
void fillEventPrincipal(EventAuxiliary const &aux, boost::shared_ptr< LuminosityBlockPrincipal > lbp, boost::shared_ptr< EventSelectionIDVector > eventSelectionIDs=boost::shared_ptr< EventSelectionIDVector >(), boost::shared_ptr< BranchListIndexes > branchListIndexes=boost::shared_ptr< BranchListIndexes >(), boost::shared_ptr< BranchMapper > mapper=boost::shared_ptr< BranchMapper >(new BranchMapper), DelayedReader *reader=0)
constexpr unsigned int gtpeId_
Definition: DaqSource.cc:52
LuminosityBlockNumber_t luminosityBlock() const
Accessor for current luminosity block number.
Definition: InputSource.cc:612
unsigned int getorbit(const unsigned char *)
unsigned int gtpe_getorbit(const unsigned char *)
bool beginRunTiming_
Definition: DaqSource.h:101
static Timestamp const & invalidTimestamp()
Definition: Timestamp.cc:83
virtual int fillRawData(edm::EventID &eID, edm::Timestamp &tstamp, FEDRawDataCollection *&data)=0
unsigned int lumiSegmentSizeInEvents_
Definition: DaqSource.h:67
Timestamp const & timestamp() const
Accessor for the current time, as seen by the input source.
Definition: InputSource.h:215
unsigned int getevtyp(const unsigned char *)
bool useEventCounter_
Definition: DaqSource.h:68
static int const invalidStoreNumber
unsigned int gtpe_getbx(const unsigned char *)
pthread_mutex_t mutex_
Definition: DaqSource.h:83
bool eventCached_
Definition: DaqSource.h:80
tuple cout
Definition: gather_cfg.py:121
unsigned int thisEventLSid
Definition: DaqSource.h:95
unsigned int gtpe_getlbn(const unsigned char *)
bool noMoreEvents_
Definition: DaqSource.h:77
EventPrincipal * eventPrincipalCache()
Definition: InputSource.cc:139
unsigned int getgpslow(const unsigned char *)
bool immediateStop
Definition: DaqSource.h:97
unsigned long long TimeValue_t
xdata::UnsignedInteger32 * lastLumiPrescaleIndex_
Definition: DaqSource.h:88
bool alignLsToLast_
Definition: DaqSource.h:81
void DaqSource::openBackDoor ( unsigned int  timeout_sec,
bool *  running 
)
privatevirtual

Reimplemented from evf::ModuleWeb.

Definition at line 612 of file DaqSource.cc.

References CLOCK_REALTIME, cond_, count, lsTimedOut_, mutex_, NULL, and signal_lock_.

613  {
614  count++;
615  if(count==2) throw;
616  pthread_mutex_lock(&mutex_);
617  if (running) *running=true;
618  pthread_mutex_unlock(&signal_lock_);
619  timespec ts;
620 #if _POSIX_TIMERS > 0
621  clock_gettime(CLOCK_REALTIME, &ts);
622 #else
623  struct timeval tv;
624  gettimeofday(&tv, NULL);
625  ts.tv_sec = tv.tv_sec + 0;
626  ts.tv_nsec = 0;
627 #endif
628  ts.tv_sec += timeout_sec;
629 
630  int rc = pthread_cond_timedwait(&cond_, &mutex_, &ts);
631  if(rc == ETIMEDOUT) lsTimedOut_->value_ = true;
632  }
xdata::Boolean * lsTimedOut_
Definition: DaqSource.h:90
#define NULL
Definition: scimark2.h:8
pthread_cond_t cond_
Definition: DaqSource.h:85
pthread_mutex_t signal_lock_
Definition: DaqSource.h:84
pthread_mutex_t mutex_
Definition: DaqSource.h:83
#define CLOCK_REALTIME
Definition: TimerService.h:28
void DaqSource::publish ( xdata::InfoSpace *  is)
privatevirtual

Implements evf::ModuleWeb.

Definition at line 597 of file DaqSource.cc.

References is_, lastLumiPrescaleIndex_, lastLumiUsingEol_, lsTimedOut_, lsToBeRecovered_, lumiSectionIndex_, and prescaleSetIndex_.

598  {
599  is_ = is;
600  lumiSectionIndex_ = (xdata::UnsignedInteger32*)is_->find("lumiSectionIndex");
601  prescaleSetIndex_ = (xdata::UnsignedInteger32*)is_->find("prescaleSetIndex");
602  lastLumiPrescaleIndex_ = (xdata::UnsignedInteger32*)is_->find("lastLumiPrescaleIndex");
603  lastLumiUsingEol_ = (xdata::UnsignedInteger32*)is_->find("lastLumiUsingEol");
604  lsTimedOut_ = (xdata::Boolean*)is_->find("lsTimedOut");
605  lsToBeRecovered_ = (xdata::Boolean*)is_->find("lsToBeRecovered");
606  }
xdata::Boolean * lsTimedOut_
Definition: DaqSource.h:90
xdata::UnsignedInteger32 * lumiSectionIndex_
Definition: DaqSource.h:86
xdata::Boolean * lsToBeRecovered_
Definition: DaqSource.h:91
xdata::UnsignedInteger32 * lastLumiUsingEol_
Definition: DaqSource.h:89
xdata::UnsignedInteger32 * prescaleSetIndex_
Definition: DaqSource.h:87
xdata::InfoSpace * is_
Definition: DaqSource.h:92
xdata::UnsignedInteger32 * lastLumiPrescaleIndex_
Definition: DaqSource.h:88
void DaqSource::publishForkInfo ( evf::moduleweb::ForkInfoObj forkInfoObj)
privatevirtual

Reimplemented from evf::ModuleWeb.

Definition at line 121 of file DaqSource.cc.

References forkInfo_, immediateStop, noMoreEvents_, and runFork_.

121  {
122  forkInfo_ = forkInfoObj;
123  runFork_=true;
124  immediateStop=false;
125  noMoreEvents_=false;
126  }
evf::moduleweb::ForkInfoObj * forkInfo_
Definition: DaqSource.h:98
bool noMoreEvents_
Definition: DaqSource.h:77
bool immediateStop
Definition: DaqSource.h:97
void DaqSource::publishToXmas ( xdata::InfoSpace *  is)
privatevirtual

Reimplemented from evf::ModuleWeb.

Definition at line 607 of file DaqSource.cc.

References mis_.

608  {
609  mis_ = is;
610  }
xdata::InfoSpace * mis_
Definition: DaqSource.h:93
EventPrincipal * DaqSource::readEvent_ ( )
privatevirtual

Implements edm::InputSource.

Definition at line 561 of file DaqSource.cc.

References eventCached_, edm::InputSource::eventPrincipalCache(), edm::InputSource::luminosityBlockPrincipal(), newLumi_, newRun_, noMoreEvents_, and edm::EventPrincipal::setLuminosityBlockPrincipal().

561  {
562  // std::cout << "assert not newRun " << std::endl;
563  assert(!newRun_);
564  // std::cout << "assert not newLumi " << std::endl;
565  assert(!newLumi_);
566  // std::cout << "assert not noMoreEvents " << std::endl;
567  assert(!noMoreEvents_);
568  // std::cout << "assert eventCached " << std::endl;
569  assert(eventCached_);
570  // std::cout << "asserts done " << std::endl;
571  eventCached_ = false;
573  return eventPrincipalCache();
574  }
void setLuminosityBlockPrincipal(boost::shared_ptr< LuminosityBlockPrincipal > const &lbp)
boost::shared_ptr< LuminosityBlockPrincipal > const luminosityBlockPrincipal() const
Definition: InputSource.cc:281
bool eventCached_
Definition: DaqSource.h:80
bool noMoreEvents_
Definition: DaqSource.h:77
EventPrincipal * eventPrincipalCache()
Definition: InputSource.cc:139
EventPrincipal * DaqSource::readIt ( EventID const &  eventID)
privatevirtual

Reimplemented from edm::InputSource.

Definition at line 584 of file DaqSource.cc.

References edm::hlt::Exception, and edm::errors::LogicError.

584  {
585  throw edm::Exception(errors::LogicError,"DaqSource::readIt(EventID const& eventID)")
586  << "Random access read cannot be used for DaqSource.\n"
587  << "Contact a Framework developer.\n";
588  }
boost::shared_ptr< LuminosityBlockAuxiliary > DaqSource::readLuminosityBlockAuxiliary_ ( )
privatevirtual

Implements edm::InputSource.

Definition at line 549 of file DaqSource.cc.

References edm::InputSource::luminosityBlockAuxiliary(), newLumi_, newRun_, and noMoreEvents_.

549  {
550  assert(!newRun_);
551  assert(newLumi_);
552  assert(!noMoreEvents_);
553  assert(luminosityBlockAuxiliary());
554  //assert(eventCached_); //the event may or may not be cached - rely on
555  // the call to getNextItemType to detect that.
556  newLumi_ = false;
557  return luminosityBlockAuxiliary();
558  }
boost::shared_ptr< LuminosityBlockAuxiliary > luminosityBlockAuxiliary() const
Called by the framework to merge or insert lumi in principal cache.
Definition: InputSource.h:238
bool noMoreEvents_
Definition: DaqSource.h:77
boost::shared_ptr< RunAuxiliary > DaqSource::readRunAuxiliary_ ( )
privatevirtual

Implements edm::InputSource.

Definition at line 539 of file DaqSource.cc.

References edm::Timestamp::invalidTimestamp(), newRun_, noMoreEvents_, phid_, runNumber_, and edm::InputSource::timestamp().

539  {
540  assert(newRun_);
541  assert(!noMoreEvents_);
542  newRun_ = false;
543  boost::shared_ptr<RunAuxiliary> ra(new RunAuxiliary(runNumber_, timestamp(), Timestamp::invalidTimestamp()));
544  ra->setProcessHistoryID(phid_);
545  return ra;
546  }
ProcessHistoryID phid_
Definition: DaqSource.h:76
RunNumber_t runNumber_
Definition: DaqSource.h:73
static Timestamp const & invalidTimestamp()
Definition: Timestamp.cc:83
Timestamp const & timestamp() const
Accessor for the current time, as seen by the input source.
Definition: InputSource.h:215
bool noMoreEvents_
Definition: DaqSource.h:77
void DaqSource::setLumi ( LuminosityBlockNumber_t  lb)
privatevirtual

Reimplemented from edm::InputSource.

Definition at line 577 of file DaqSource.cc.

References edm::hlt::Exception, and edm::errors::LogicError.

577  {
578  throw edm::Exception(errors::LogicError,"DaqSource::setLumi(LuminosityBlockNumber_t lumiNumber)")
579  << "The luminosity block number cannot be set externally for DaqSource.\n"
580  << "Contact a Framework developer.\n";
581  }
void DaqSource::setRun ( RunNumber_t  r)
privatevirtual

Reimplemented from edm::InputSource.

Definition at line 528 of file DaqSource.cc.

References eventCached_, newLumi_, newRun_, noMoreEvents_, alignCSCRings::r, reader_, edm::InputSource::reset(), edm::InputSource::resetLuminosityBlockAuxiliary(), runNumber_, and DaqBaseReader::setRunNumber().

528  {
529  assert(!eventCached_);
530  reset();
531  newRun_ = newLumi_ = true;
532  runNumber_ = r;
534  noMoreEvents_ = false;
536  }
DaqBaseReader * reader_
Definition: DaqSource.h:66
RunNumber_t runNumber_
Definition: DaqSource.h:73
void resetLuminosityBlockAuxiliary() const
Definition: InputSource.h:302
void reset() const
Definition: InputSource.h:305
virtual void setRunNumber(edm::RunNumber_t runNumber)
set the run number
Definition: DaqBaseReader.h:37
bool eventCached_
Definition: DaqSource.h:80
bool noMoreEvents_
Definition: DaqSource.h:77
void DaqSource::signalWaitingThreadAndBlock ( )
privatevirtual

Definition at line 643 of file DaqSource.cc.

References cond_, mutex_, and signal_lock_.

Referenced by getNextItemType().

644  {
645  pthread_mutex_lock(&signal_lock_);
646  pthread_mutex_lock(&mutex_);
647  pthread_mutex_unlock(&signal_lock_);
648  // std::cout << getpid() << " DS::signal from evloop " << std::endl;
649  pthread_cond_signal(&cond_);
650  // std::cout << getpid() << " DS::go to wait for scalers wl " << std::endl;
651  pthread_cond_wait(&cond_, &mutex_);
652  pthread_mutex_unlock(&mutex_);
653  ::usleep(1000);//allow other thread to lock
654  }
pthread_cond_t cond_
Definition: DaqSource.h:85
pthread_mutex_t signal_lock_
Definition: DaqSource.h:84
pthread_mutex_t mutex_
Definition: DaqSource.h:83
void DaqSource::skip ( int  offset)
privatevirtual

Reimplemented from edm::InputSource.

Definition at line 591 of file DaqSource.cc.

References edm::hlt::Exception, and edm::errors::LogicError.

591  {
592  throw edm::Exception(errors::LogicError,"DaqSource::skip(int offset)")
593  << "Random access skip cannot be used for DaqSource\n"
594  << "Contact a Framework developer.\n";
595  }

Member Data Documentation

bool edm::DaqSource::alignLsToLast_
private

Definition at line 81 of file DaqSource.h.

Referenced by getNextItemType().

bool edm::DaqSource::beginRunTiming_
private

Definition at line 101 of file DaqSource.h.

Referenced by doMyBeginRun(), and getNextItemType().

pthread_cond_t edm::DaqSource::cond_
private
int edm::DaqSource::count
private

Definition at line 94 of file DaqSource.h.

Referenced by closeBackDoor(), DaqSource(), and openBackDoor().

DaqProvenanceHelper edm::DaqSource::daqProvenanceHelper_
private

Definition at line 75 of file DaqSource.h.

Referenced by DaqSource(), and getNextItemType().

bool edm::DaqSource::eventCached_
private

Definition at line 80 of file DaqSource.h.

Referenced by getNextItemType(), readEvent_(), and setRun().

unsigned int edm::DaqSource::eventCounter_
private

Definition at line 69 of file DaqSource.h.

Referenced by getNextItemType().

bool edm::DaqSource::fakeLSid_
private

Definition at line 71 of file DaqSource.h.

Referenced by getNextItemType().

evf::moduleweb::ForkInfoObj* edm::DaqSource::forkInfo_
private

Definition at line 98 of file DaqSource.h.

Referenced by doMyBeginRun(), getNextItemType(), and publishForkInfo().

bool edm::DaqSource::goToStopping
private

Definition at line 96 of file DaqSource.h.

Referenced by defaultWebPage(), and getNextItemType().

bool edm::DaqSource::immediateStop
private

Definition at line 97 of file DaqSource.h.

Referenced by doMyBeginRun(), getNextItemType(), and publishForkInfo().

xdata::InfoSpace* edm::DaqSource::is_
private

Definition at line 92 of file DaqSource.h.

Referenced by publish().

bool edm::DaqSource::keepUsingPsidFromTrigger_
private

Definition at line 70 of file DaqSource.h.

Referenced by getNextItemType().

xdata::UnsignedInteger32* edm::DaqSource::lastLumiPrescaleIndex_
private

Definition at line 88 of file DaqSource.h.

Referenced by getNextItemType(), and publish().

xdata::UnsignedInteger32* edm::DaqSource::lastLumiUsingEol_
private

Definition at line 89 of file DaqSource.h.

Referenced by getNextItemType(), and publish().

xdata::Boolean* edm::DaqSource::lsTimedOut_
private

Definition at line 90 of file DaqSource.h.

Referenced by closeBackDoor(), openBackDoor(), and publish().

xdata::Boolean* edm::DaqSource::lsToBeRecovered_
private

Definition at line 91 of file DaqSource.h.

Referenced by getNextItemType(), and publish().

LuminosityBlockNumber_t edm::DaqSource::luminosityBlockNumber_
private

Definition at line 74 of file DaqSource.h.

Referenced by getNextItemType().

xdata::UnsignedInteger32* edm::DaqSource::lumiSectionIndex_
private

Definition at line 86 of file DaqSource.h.

Referenced by getNextItemType(), and publish().

unsigned int edm::DaqSource::lumiSegmentSizeInEvents_
private

Definition at line 67 of file DaqSource.h.

Referenced by getNextItemType().

xdata::InfoSpace* edm::DaqSource::mis_
private

Definition at line 93 of file DaqSource.h.

Referenced by publishToXmas().

pthread_mutex_t edm::DaqSource::mutex_
private
bool edm::DaqSource::newLumi_
private

Definition at line 79 of file DaqSource.h.

Referenced by getNextItemType(), readEvent_(), readLuminosityBlockAuxiliary_(), and setRun().

bool edm::DaqSource::newRun_
private
bool edm::DaqSource::noMoreEvents_
private
ProcessHistoryID edm::DaqSource::phid_
private

Definition at line 76 of file DaqSource.h.

Referenced by DaqSource(), getNextItemType(), and readRunAuxiliary_().

xdata::UnsignedInteger32* edm::DaqSource::prescaleSetIndex_
private

Definition at line 87 of file DaqSource.h.

Referenced by getNextItemType(), and publish().

DaqBaseReader* edm::DaqSource::reader_
private

Definition at line 66 of file DaqSource.h.

Referenced by DaqSource(), getNextItemType(), setRun(), and ~DaqSource().

bool edm::DaqSource::runFork_
private

Definition at line 99 of file DaqSource.h.

Referenced by getNextItemType(), and publishForkInfo().

RunNumber_t edm::DaqSource::runNumber_
private

Definition at line 73 of file DaqSource.h.

Referenced by DaqSource(), getNextItemType(), readRunAuxiliary_(), and setRun().

pthread_mutex_t edm::DaqSource::signal_lock_
private

Definition at line 84 of file DaqSource.h.

Referenced by closeBackDoor(), DaqSource(), openBackDoor(), and signalWaitingThreadAndBlock().

unsigned int edm::DaqSource::thisEventLSid
private

Definition at line 95 of file DaqSource.h.

Referenced by getNextItemType().

timeval edm::DaqSource::tvStat_
private

Definition at line 100 of file DaqSource.h.

Referenced by doMyBeginRun(), and getNextItemType().

bool edm::DaqSource::useEventCounter_
private

Definition at line 68 of file DaqSource.h.

Referenced by getNextItemType().