32 #include <sys/types.h>
34 #include "xgi/Method.h"
35 #include "xgi/Utils.h"
37 #include "cgicc/Cgicc.h"
38 #include "cgicc/FormEntry.h"
39 #include "cgicc/HTMLClasses.h"
41 #include "boost/tokenizer.hpp"
60 , evf::ModuleWeb(
"DaqSource")
62 , lumiSegmentSizeInEvents_(pset.getUntrackedParameter<unsigned int>(
"evtsPerLS",0))
63 , useEventCounter_(pset.getUntrackedParameter<bool>(
"useEventCounter",
false))
65 , keepUsingPsidFromTrigger_(pset.getUntrackedParameter<bool>(
"keepUsingPsidFromTrigger",
false))
66 , fakeLSid_(lumiSegmentSizeInEvents_ != 0)
68 , luminosityBlockNumber_(
LuminosityBlockID::firstValidLuminosityBlock().luminosityBlock())
69 , noMoreEvents_(
false)
73 , alignLsToLast_(
false)
80 pthread_mutex_init(&
mutex_,0);
82 pthread_cond_init(&
cond_,0);
83 produces<FEDRawDataCollection>();
123 pthread_mutex_lock(&
mutex_);
124 pthread_cond_signal(&
cond_);
125 pthread_mutex_unlock(&
mutex_);
167 <<
"DaqSource is used without a reader. Check your configuration !";
172 gettimeofday(&stv,0);
174 time = (time << 32) + stv.tv_usec;
189 if (0 != fedCollection)
delete fedCollection;
191 pthread_mutex_lock(&
mutex_);
192 pthread_cond_signal(&
cond_);
193 pthread_mutex_unlock(&
mutex_);
199 unsigned int nextLsFromSignal = (-1)*retval+1;
226 edm::LogError(
"DaqSource") <<
"Got EOL event with value " << retval
227 <<
" nextLS would be " << nextLsFromSignal
235 if (eventId.
event() == 0) {
237 <<
"The reader used with DaqSource has returned an invalid (zero) event number!\n"
238 <<
"Event numbers must begin at 1, not 0.";
244 uint32_t gtpsize = 0;
248 unsigned int nextFakeLs = 0;
347 std::auto_ptr<EventAuxiliary> eventAux(
359 std::auto_ptr<FEDRawDataCollection> bare_product(fedCollection);
363 e->put(bare_product);
383 boost::shared_ptr<RunAuxiliary>
391 boost::shared_ptr<LuminosityBlockAuxiliary>
421 <<
"The luminosity block number cannot be set externally for DaqSource.\n"
422 <<
"Contact a Framework developer.\n";
428 <<
"Random access read cannot be used for DaqSource.\n"
429 <<
"Contact a Framework developer.\n";
435 <<
"Random access skip cannot be used for DaqSource\n"
436 <<
"Contact a Framework developer.\n";
458 pthread_mutex_lock(&
mutex_);
461 #if _POSIX_TIMERS > 0
462 clock_gettime(CLOCK_REALTIME, &ts);
465 gettimeofday(&tv,
NULL);
466 ts.tv_sec = tv.tv_sec + 0;
469 ts.tv_sec += timeout_sec;
471 int rc = pthread_cond_timedwait(&
cond_, &
mutex_, &ts);
478 pthread_cond_signal(&
cond_);
479 pthread_mutex_unlock(&
mutex_);
487 pthread_mutex_lock(&
mutex_);
490 pthread_cond_signal(&
cond_);
493 pthread_mutex_unlock(&
mutex_);
503 std::string original_referrer_;
506 cgicc::Cgicc cgi(in);
507 if ( xgi::Utils::hasFormElement(cgi,
"gotostopping") )
511 if ( xgi::Utils::hasFormElement(cgi,
"module") )
512 mname = xgi::Utils::getFormElement(cgi,
"module")->getValue();
513 cgicc::CgiEnvironment cgie(in);
514 if(original_referrer_ ==
"")
515 original_referrer_ = cgie.getReferrer();
516 path = cgie.getPathInfo();
517 query = cgie.getQueryString();
525 *out <<
"<html>" << endl;
526 *out <<
"<head>" << endl;
529 *out <<
"<STYLE type=\"text/css\"> #T1 {border-width: 2px; border: solid blue; text-align: center} </STYLE> " << endl;
530 *out <<
"<link type=\"text/css\" rel=\"stylesheet\"";
531 *out <<
" href=\"/" << urn
532 <<
"/styles.css\"/>" << endl;
535 <<
" MAIN</title>" << endl;
537 *out <<
"</head>" << endl;
538 *out <<
"<body onload=\"loadXMLDoc()\">" << endl;
539 *out <<
"<table border=\"0\" width=\"100%\">" << endl;
540 *out <<
"<tr>" << endl;
541 *out <<
" <td align=\"left\">" << endl;
542 *out <<
" <img" << endl;
543 *out <<
" align=\"middle\"" << endl;
544 *out <<
" src=\"/evf/images/bugicon.jpg\"" << endl;
545 *out <<
" alt=\"main\"" << endl;
546 *out <<
" width=\"90\"" << endl;
547 *out <<
" height=\"64\"" << endl;
548 *out <<
" border=\"\"/>" << endl;
549 *out <<
" <b>" << endl;
551 *out <<
" </b>" << endl;
552 *out <<
" </td>" << endl;
553 *out <<
" <td width=\"32\">" << endl;
554 *out <<
" <a href=\"/urn:xdaq-application:lid=3\">" << endl;
555 *out <<
" <img" << endl;
556 *out <<
" align=\"middle\"" << endl;
557 *out <<
" src=\"/hyperdaq/images/HyperDAQ.jpg\"" << endl;
558 *out <<
" alt=\"HyperDAQ\"" << endl;
559 *out <<
" width=\"32\"" << endl;
560 *out <<
" height=\"32\"" << endl;
561 *out <<
" border=\"\"/>" << endl;
562 *out <<
" </a>" << endl;
563 *out <<
" </td>" << endl;
564 *out <<
" <td width=\"32\">" << endl;
565 *out <<
" </td>" << endl;
566 *out <<
" <td width=\"32\">" << endl;
567 *out <<
" <a href=\"" << original_referrer_ <<
"\">" << endl;
568 *out <<
" <img" << endl;
569 *out <<
" align=\"middle\"" << endl;
570 *out <<
" src=\"/evf/images/spoticon.jpg\"" << endl;
571 *out <<
" alt=\"main\"" << endl;
572 *out <<
" width=\"32\"" << endl;
573 *out <<
" height=\"32\"" << endl;
574 *out <<
" border=\"\"/>" << endl;
575 *out <<
" </a>" << endl;
576 *out <<
" </td>" << endl;
577 *out <<
"</tr>" << endl;
578 *out <<
"</table>" << endl;
580 *out <<
"<hr/>" << endl;
582 *out << cgicc::form().set(
"method",
"GET").set(
"action", path )
584 boost::char_separator<char> sep(
"&");
585 boost::tokenizer<boost::char_separator<char> >
tokens(query, sep);
586 for (
boost::tokenizer<boost::char_separator<char> >::iterator tok_iter = tokens.begin();
587 tok_iter != tokens.end(); ++tok_iter){
588 size_t pos = (*tok_iter).find_first_of(
"=");
589 if(pos != std::string::npos){
590 std::string
first = (*tok_iter).substr(0 , pos);
591 std::string
second = (*tok_iter).substr(pos+1, (*tok_iter).length()-pos-1);
592 *out <<
cgicc::input().set(
"type",
"hidden").set(
"name",first).set(
"value", second)
597 *out <<
cgicc::input().set(
"type",
"hidden").set(
"name",
"gotostopping").set(
"value",
"true")
599 *out <<
cgicc::input().set(
"type",
"submit").set(
"value",
"Go To Stopping") << std::endl;
600 *out << cgicc::form() << std::endl;
602 *out <<
"</body>" << endl;
603 *out <<
"</html>" << endl;
static const char runNumber_[]
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) const
virtual void openBackDoor(unsigned int)
xdata::Boolean * lsTimedOut_
unsigned int getgpshigh(const unsigned char *)
LuminosityBlockNumber_t luminosityBlockNumber_
unsigned int getfdlbx(const unsigned char *)
bool gtpe_board_sense(const unsigned char *p)
virtual void closeBackDoor()
virtual ItemType getNextItemType()
xdata::UnsignedInteger32 * lumiSectionIndex_
virtual boost::shared_ptr< LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_()
unsigned int eventCounter_
xdata::Boolean * lsToBeRecovered_
virtual void publish(xdata::InfoSpace *)
boost::tokenizer< boost::char_separator< char > > tokenizer
virtual void publishToXmas(xdata::InfoSpace *)
xdata::UnsignedInteger32 * lastLumiUsingEol_
unsigned int getfdlpsc(const unsigned char *)
unsigned int LuminosityBlockNumber_t
size_t size() const
Lenght of the data buffer in bytes.
static unsigned int gtpeId_
U second(std::pair< T, U > const &p)
pthread_mutex_t signal_lock_
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
static int const invalidBunchXing
unsigned int getlbn(const unsigned char *)
xdata::UnsignedInteger32 * prescaleSetIndex_
virtual void signalWaitingThreadAndBlock()
bool keepUsingPsidFromTrigger_
unsigned long long TimeValue_t
bool evm_board_sense(const unsigned char *p, size_t size)
DaqSource(const ParameterSet &pset, const InputSourceDescription &desc)
virtual void skip(int offset)
virtual void setRun(RunNumber_t r)
unsigned int getorbit(const unsigned char *)
static unsigned int gtpEvmId_
void fillEventPrincipal(std::auto_ptr< EventAuxiliary > aux, boost::shared_ptr< LuminosityBlockPrincipal > lbp, boost::shared_ptr< EventSelectionIDVector > eventSelectionIDs=boost::shared_ptr< EventSelectionIDVector >(new EventSelectionIDVector), boost::shared_ptr< BranchListIndexes > branchListIndexes=boost::shared_ptr< BranchListIndexes >(new BranchListIndexes), boost::shared_ptr< BranchMapper > mapper=boost::shared_ptr< BranchMapper >(new BranchMapper), boost::shared_ptr< DelayedReader > rtrv=boost::shared_ptr< DelayedReader >(new NoDelayedReader))
unsigned int gtpe_getorbit(const unsigned char *)
static Timestamp const & invalidTimestamp()
void defaultWebPage(xgi::Input *in, xgi::Output *out)
virtual int fillRawData(edm::EventID &eID, edm::Timestamp &tstamp, FEDRawDataCollection *&data)=0
unsigned int lumiSegmentSizeInEvents_
unsigned int getevtyp(const unsigned char *)
virtual EventPrincipal * readIt(EventID const &eventID)
static int const invalidStoreNumber
static Timestamp const & beginOfTime()
unsigned int gtpe_getbx(const unsigned char *)
virtual void setRunNumber(edm::RunNumber_t runNumber)
set the run number
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
unsigned int thisEventLSid
unsigned int gtpe_getlbn(const unsigned char *)
T first(std::pair< T, U > const &p)
virtual void setLumi(LuminosityBlockNumber_t lb)
virtual boost::shared_ptr< RunAuxiliary > readRunAuxiliary_()
unsigned int getgpslow(const unsigned char *)
T get(const Candidate &c)
xdata::UnsignedInteger32 * lastLumiPrescaleIndex_
virtual EventPrincipal * readEvent_()
std::string category() const