CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DaqSource.cc
Go to the documentation of this file.
1 
8 #include "DaqSource.h"
9 
13 
16 
26 
27 #include <string>
28 #include <iostream>
29 #include <time.h>
30 #include <sys/time.h>
31 #include <sys/types.h>
32 
33 #include "xgi/Method.h"
34 #include "xgi/Utils.h"
35 
36 #include "cgicc/Cgicc.h"
37 #include "cgicc/FormEntry.h"
38 #include "cgicc/HTMLClasses.h"
39 
40 #include "boost/tokenizer.hpp"
41 
42 
44 // construction/destruction
46 
47 
48 
49 namespace edm {
50  namespace daqsource{
53  }
54 
55  //______________________________________________________________________________
57  const InputSourceDescription& desc)
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))
65  , fakeLSid_(lumiSegmentSizeInEvents_ != 0)
66  , runNumber_(RunID::firstValidRun().run())
67  , luminosityBlockNumber_(LuminosityBlockID::firstValidLuminosityBlock().luminosityBlock())
68  , daqProvenanceHelper_(TypeID(typeid(FEDRawDataCollection)))
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  }
115 
116  //______________________________________________________________________________
118  delete reader_;
119  }
120 
122  forkInfo_ = forkInfoObj;
123  runFork_=true;
124  immediateStop=false;
125  noMoreEvents_=false;
126  }
127 
129  // implementation of member functions
131 
132 
133  //______________________________________________________________________________
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  }
209 
210 
211  //______________________________________________________________________________
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  }
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
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  }
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;
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;
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
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;
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 
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  }
526 
527  void
529  assert(!eventCached_);
530  reset();
531  newRun_ = newLumi_ = true;
532  runNumber_ = r;
534  noMoreEvents_ = false;
536  }
537 
538  boost::shared_ptr<RunAuxiliary>
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  }
547 
548  boost::shared_ptr<LuminosityBlockAuxiliary>
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  }
559 
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  }
575 
576  void
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  }
582 
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  }
589 
590  void
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  }
596 
597  void DaqSource::publish(xdata::InfoSpace *is)
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  }
607  void DaqSource::publishToXmas(xdata::InfoSpace *is)
608  {
609  mis_ = is;
610  }
611 
612  void DaqSource::openBackDoor(unsigned int timeout_sec, bool *running)
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  }
633 
635  {
636  count--;
637  pthread_cond_signal(&cond_);
638  pthread_mutex_unlock(&mutex_);
639  pthread_mutex_lock(&signal_lock_);
640  lsTimedOut_->value_ = false;
641  }
642 
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  }
655 
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  }
764 }
DaqBaseReader * reader_
Definition: DaqSource.h:66
static const char runNumber_[]
xdata::InfoSpace * mis_
Definition: DaqSource.h:93
void setLuminosityBlockPrincipal(boost::shared_ptr< LuminosityBlockPrincipal > const &lbp)
EventNumber_t event() const
Definition: EventID.h:44
int doMyBeginRun()
Definition: DaqSource.cc:134
T getUntrackedParameter(std::string const &, T const &) const
ProcessHistoryID phid_
Definition: DaqSource.h:76
xdata::Boolean * lsTimedOut_
Definition: DaqSource.h:90
unsigned int getgpshigh(const unsigned char *)
evf::moduleweb::ForkInfoObj * forkInfo_
Definition: DaqSource.h:98
#define Input(cl)
Definition: vmac.h:189
LuminosityBlockNumber_t luminosityBlockNumber_
Definition: DaqSource.h:74
ProductProvenance dummyProvenance_
unsigned int getfdlbx(const unsigned char *)
bool gtpe_board_sense(const unsigned char *p)
virtual void closeBackDoor()
Definition: DaqSource.cc:634
virtual ItemType getNextItemType()
Definition: DaqSource.cc:213
xdata::UnsignedInteger32 * lumiSectionIndex_
Definition: DaqSource.h:86
virtual boost::shared_ptr< LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_()
Definition: DaqSource.cc:549
unsigned int eventCounter_
Definition: DaqSource.h:69
xdata::Boolean * lsToBeRecovered_
Definition: DaqSource.h:91
virtual void publish(xdata::InfoSpace *)
Definition: DaqSource.cc:597
timeval tvStat_
Definition: DaqSource.h:100
#define nullptr
boost::tokenizer< boost::char_separator< char > > tokenizer
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
virtual void publishToXmas(xdata::InfoSpace *)
Definition: DaqSource.cc:607
std::string const & category() const
Definition: Exception.cc:183
#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
void(* forkHandler)(void *)
Definition: ModuleWeb.h:44
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
unsigned int LuminosityBlockNumber_t
Definition: EventID.h:31
boost::shared_ptr< LuminosityBlockPrincipal > const luminosityBlockPrincipal() const
Definition: InputSource.cc:281
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:49
std::string const & processGUID() const
Accessor for global process identifier.
Definition: InputSource.h:190
ProcessHistoryID daqInit(ProductRegistry &productRegistry) const
U second(std::pair< T, U > const &p)
void resetLuminosityBlockAuxiliary() const
Definition: InputSource.h:302
list path
Definition: scaleCards.py:51
pthread_mutex_t signal_lock_
Definition: DaqSource.h:84
unsigned int stopCondition
Definition: ModuleWeb.h:46
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
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
unsigned long long TimeValue_t
Definition: Timestamp.h:27
virtual void publishForkInfo(evf::moduleweb::ForkInfoObj *forkInfoObj)
Definition: DaqSource.cc:121
bool evm_board_sense(const unsigned char *p, size_t size)
bool goToStopping
Definition: DaqSource.h:96
std::string moduleName_
Definition: ModuleWeb.h:61
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)
DaqSource(const ParameterSet &pset, const InputSourceDescription &desc)
Definition: DaqSource.cc:56
constexpr unsigned int gtpeId_
Definition: DaqSource.cc:52
tuple out
Definition: dbtoconf.py:99
LuminosityBlockNumber_t luminosityBlock() const
Accessor for current luminosity block number.
Definition: InputSource.cc:612
virtual void skip(int offset)
Definition: DaqSource.cc:591
virtual void setRun(RunNumber_t r)
Definition: DaqSource.cc:528
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
void defaultWebPage(xgi::Input *in, xgi::Output *out)
Definition: DaqSource.cc:656
virtual int fillRawData(edm::EventID &eID, edm::Timestamp &tstamp, FEDRawDataCollection *&data)=0
ProductRegistry & productRegistryUpdate() const
Definition: InputSource.h:295
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
virtual void openBackDoor(unsigned int, bool *)
Definition: DaqSource.cc:612
unsigned int getevtyp(const unsigned char *)
virtual EventPrincipal * readIt(EventID const &eventID)
Definition: DaqSource.cc:584
bool useEventCounter_
Definition: DaqSource.h:68
static int const invalidStoreNumber
static Timestamp const & beginOfTime()
Definition: Timestamp.cc:96
unsigned int gtpe_getbx(const unsigned char *)
void reset() const
Definition: InputSource.h:305
#define Output(cl)
Definition: vmac.h:193
virtual ~DaqSource()
Definition: DaqSource.cc:117
pthread_mutex_t mutex_
Definition: DaqSource.h:83
virtual void setRunNumber(edm::RunNumber_t runNumber)
set the run number
Definition: DaqBaseReader.h:37
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:29
bool eventCached_
Definition: DaqSource.h:80
tuple query
Definition: o2o.py:269
tuple cout
Definition: gather_cfg.py:121
unsigned int thisEventLSid
Definition: DaqSource.h:95
unsigned int RunNumber_t
Definition: EventRange.h:32
unsigned int gtpe_getlbn(const unsigned char *)
bool noMoreEvents_
Definition: DaqSource.h:77
T first(std::pair< T, U > const &p)
virtual void setLumi(LuminosityBlockNumber_t lb)
Definition: DaqSource.cc:577
EventPrincipal * eventPrincipalCache()
Definition: InputSource.cc:139
virtual boost::shared_ptr< RunAuxiliary > readRunAuxiliary_()
Definition: DaqSource.cc:539
unsigned int getgpslow(const unsigned char *)
bool immediateStop
Definition: DaqSource.h:97
xdata::InfoSpace * is_
Definition: DaqSource.h:92
T get(const Candidate &c)
Definition: component.h:56
#define CLOCK_REALTIME
Definition: TimerService.h:28
#define constexpr
xdata::UnsignedInteger32 * lastLumiPrescaleIndex_
Definition: DaqSource.h:88
virtual EventPrincipal * readEvent_()
Definition: DaqSource.cc:561
bool alignLsToLast_
Definition: DaqSource.h:81