本文整理汇总了C++中Messenger::warning方法的典型用法代码示例。如果您正苦于以下问题:C++ Messenger::warning方法的具体用法?C++ Messenger::warning怎么用?C++ Messenger::warning使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Messenger
的用法示例。
在下文中一共展示了Messenger::warning方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadProcessors
void DetectorDriver::LoadProcessors(Messenger& m) {
pugi::xml_document doc;
pugi::xml_parse_result result = doc.load_file("Config.xml");
if (!result) {
stringstream ss;
ss << "DetectorDriver: error parsing file Config.xml";
ss << " : " << result.description();
throw IOException(ss.str());
}
DetectorLibrary::get();
pugi::xml_node driver = doc.child("Configuration").child("DetectorDriver");
for (pugi::xml_node processor = driver.child("Processor"); processor;
processor = processor.next_sibling("Processor")) {
string name = processor.attribute("name").value();
m.detail("Loading " + name);
if (name == "BetaScintProcessor") {
double gamma_beta_limit =
processor.attribute("gamma_beta_limit").as_double(200.e-9);
if (gamma_beta_limit == 200.e-9)
m.warning("Using default gamme_beta_limit = 200e-9", 1);
double energy_contraction =
processor.attribute("energy_contraction").as_double(1.0);
if (energy_contraction == 1)
m.warning("Using default energy contraction = 1", 1);
vecProcess.push_back(new BetaScintProcessor(gamma_beta_limit,
energy_contraction));
} else if (name == "GeProcessor") {
double gamma_threshold =
processor.attribute("gamma_threshold").as_double(1.0);
if (gamma_threshold == 1.0)
m.warning("Using default gamma_threshold = 1.0", 1);
double low_ratio =
processor.attribute("low_ratio").as_double(1.0);
if (low_ratio == 1.0)
m.warning("Using default low_ratio = 1.0", 1);
double high_ratio =
processor.attribute("high_ratio").as_double(3.0);
if (high_ratio == 3.0)
m.warning("Using default high_ratio = 3.0", 1);
double sub_event =
processor.attribute("sub_event").as_double(100.e-9);
if (sub_event == 100.e-9)
m.warning("Using default sub_event = 100e-9", 1);
double gamma_beta_limit =
processor.attribute("gamma_beta_limit").as_double(200.e-9);
if (gamma_beta_limit == 200.e-9)
m.warning("Using default gamme_beta_limit = 200e-9", 1);
double gamma_gamma_limit =
processor.attribute("gamma_gamma_limit").as_double(200.e-9);
if (gamma_gamma_limit == 200.e-9)
m.warning("Using default gamma_gamma_limit = 200e-9", 1);
double cycle_gate1_min =
processor.attribute("cycle_gate1_min").as_double(0.0);
if (cycle_gate1_min == 0.0)
m.warning("Using default cycle_gate1_min = 0.0", 1);
double cycle_gate1_max =
processor.attribute("cycle_gate1_max").as_double(0.0);
if (cycle_gate1_max == 0.0)
m.warning("Using default cycle_gate1_max = 0.0", 1);
double cycle_gate2_min =
processor.attribute("cycle_gate2_min").as_double(0.0);
if (cycle_gate2_min == 0.0)
m.warning("Using default cycle_gate2_min = 0.0", 1);
double cycle_gate2_max =
processor.attribute("cycle_gate2_max").as_double(0.0);
if (cycle_gate2_max == 0.0)
m.warning("Using default cycle_gate2_max = 0.0", 1);
vecProcess.push_back(new GeProcessor(gamma_threshold, low_ratio,
high_ratio, sub_event, gamma_beta_limit, gamma_gamma_limit,
cycle_gate1_min, cycle_gate1_max, cycle_gate2_min,
cycle_gate2_max));
} else if (name == "GeCalibProcessor") {
double gamma_threshold =
processor.attribute("gamma_threshold").as_double(1);
double low_ratio =
processor.attribute("low_ratio").as_double(1);
double high_ratio =
processor.attribute("high_ratio").as_double(3);
vecProcess.push_back(new GeCalibProcessor(gamma_threshold,
low_ratio, high_ratio));
} else if (name == "Hen3Processor") {
vecProcess.push_back(new Hen3Processor());
} else if (name == "IonChamberProcessor") {
vecProcess.push_back(new IonChamberProcessor());
} else if (name == "LiquidScintProcessor") {
vecProcess.push_back(new LiquidScintProcessor());
} else if (name == "LogicProcessor") {
vecProcess.push_back(new LogicProcessor());
} else if (name == "NeutronScintProcessor") {
vecProcess.push_back(new NeutronScintProcessor());
} else if (name == "PositionProcessor") {
vecProcess.push_back(new PositionProcessor());
} else if (name == "PulserProcessor") {
vecProcess.push_back(new PulserProcessor());
} else if (name == "SsdProcessor") {
vecProcess.push_back(new SsdProcessor());
} else if (name == "VandleProcessor") {
//.........这里部分代码省略.........
示例2: WarnOfUnknownParameter
void Globals::WarnOfUnknownParameter(Messenger &m,
pugi::xml_node_iterator &it) {
std::stringstream ss;
ss << "Unknown parameter in Config.xml : " << it->path();
m.warning(ss.str());
}
示例3: ScanList
/** \brief event by event analysis
*
* ScanList() operates on the time sorted list of all channels that triggered in
* a given spill. Starting from the begining of the list and continuing to the
* end, an individual channel event time is compared with the previous channel
* event time to determine if they occur within a time period defined by the
* diff_t variable (time is in units of 10 ns). Depending on the answer,
* different actions are performed:
* - yes - the two channels are grouped together as belonging to the same event
* and the current channel is added to the list of channels for the rawevent
* - no - the previous rawevent is sent for processing and once finished, the
* rawevent is zeroed and the current channel placed inside it.
* \param [in] eventList : The event list to scan
* \param [in] rawev : the raw event to read */
void ScanList(vector<ChanEvent*> &eventList, RawEvent& rawev) {
unsigned long chanTime, eventTime;
DetectorLibrary* modChan = DetectorLibrary::get();
DetectorDriver* driver = DetectorDriver::get();
Messenger messenger;
stringstream ss;
/** Rejection regions */
vector< pair<int, int> > rejectRegions = Globals::get()->rejectRegions();
// local variable for the detectors used in a given event
set<string> usedDetectors;
vector<ChanEvent*>::iterator iEvent = eventList.begin();
// local variables for the times of the current event, previous
// event and time difference between the two
double diffTime = 0;
//set last_t to the time of the first event
double lastTime = (*iEvent)->GetTime();
double currTime = lastTime;
unsigned int id = (*iEvent)->GetID();
/* KM
* Save time of the beginning of the file,
* this is needed for the rejection regions */
static double firstTime = lastTime;
HistoStats(id, diffTime, lastTime, BUFFER_START);
//loop over the list of channels that fired in this buffer
for(; iEvent != eventList.end(); iEvent++) {
id = (*iEvent)->GetID();
if (id == pixie::U_DELIMITER) {
ss << "pattern 0 ignore";
messenger.warning(ss.str());
ss.str("");
continue;
}
if ((*modChan)[id].GetType() == "ignore") {
continue;
}
// this is a channel we're interested in
chanTime = (*iEvent)->GetTrigTime();
eventTime = (*iEvent)->GetEventTimeLo();
/* retrieve the current event time and determine the time difference
between the current and previous events.
*/
currTime = (*iEvent)->GetTime();
diffTime = currTime - lastTime;
/* KM: rejection of bad regions
* If time (in sec) is within the 'bad' region
* just drop the rest of this for loop and go for another buffer
*
* Do checks only if hasReject flag is True.
*/
if (Globals::get()->hasReject()) {
double bufferTime = (currTime - firstTime) *
Globals::get()->clockInSeconds();
bool rejectBuffer = false;
for (vector< pair<int, int> >::iterator region = rejectRegions.begin();
region != rejectRegions.end();
++region ) {
/** If event time is within a rejection region
* set rejectBuffer flag true and stop checking */
if (bufferTime > region->first &&
bufferTime < region->second) {
rejectBuffer = true;
break;
}
}
if (rejectBuffer)
continue;
}
/* end KM */
/* if the time difference between the current and previous event is
larger than the event width, finalize the current event, otherwise
treat this as part of the current event
*/
if ( diffTime > Globals::get()->eventWidth() ) {
if(rawev.Size() > 0) {
/* detector driver accesses rawevent externally in order to
//.........这里部分代码省略.........
示例4: HistoStats
/**
* At various points in the processing of data in ScanList(), HistoStats() is
* called to increment some low level pixie16 informational and diagnostic
* spectra. The list of spectra filled includes runtime in second and
* milliseconds, the deadtime, time between events, and time width of an event.
* \param [in] id : the id of the channel
* \param [in] diff : The difference between current clock and last one
* \param [in] clock : The current clock
* \param [in] event : The type of event we are dealing with
*/
void HistoStats(unsigned int id, double diff, double clock, HistoPoints event) {
static const int specNoBins = SE;
static double start, stop;
static int count;
static double firstTime = 0.;
static double bufStart;
double runTimeSecs = (clock - firstTime) *
Globals::get()->clockInSeconds();
int rowNumSecs = int(runTimeSecs / specNoBins);
double remainNumSecs = runTimeSecs - rowNumSecs * specNoBins;
double runTimeMsecs = runTimeSecs * 1000;
int rowNumMsecs = int(runTimeMsecs / specNoBins);
double remainNumMsecs = runTimeMsecs - rowNumMsecs * specNoBins;
static double bufEnd = 0, bufLength = 0;
// static double deadTime = 0 // not used
DetectorDriver* driver = DetectorDriver::get();
Messenger messenger;
stringstream ss;
if (firstTime > clock) {
ss << "Backwards clock jump detected: prior start " << firstTime
<< ", now " << clock;
messenger.warning(ss.str());
ss.str("");
// detect a backwards clock jump which occurs when some of the
// last buffers of a previous run sneak into the beginning of the
// next run, elapsed time of last buffers is usually small but
// just in case make some room for it
double elapsed = stop - firstTime;
// make an artificial 10 second gap by
// resetting the first time accordingly
firstTime = clock - 10 / Globals::get()->clockInSeconds() - elapsed;
ss << elapsed * Globals::get()->clockInSeconds()
<< " prior seconds elapsed "
<< ", resetting first time to " << firstTime;
messenger.detail(ss.str());
ss.str("");
}
switch (event) {
case BUFFER_START:
bufStart = clock;
if(firstTime == 0.) {
firstTime = clock;
} else if (bufLength != 0.){
//plot time between buffers as a function
//of time - dead time spectrum
// deadTime += (clock - bufEnd)*pixie::clockInSeconds;
// plot(DD_DEAD_TIME_CUMUL,remainNumSecs,rownum,int(deadTime/runTimeSecs));
driver->plot(dammIds::raw::DD_BUFFER_START_TIME, remainNumSecs,
rowNumSecs, (clock-bufEnd)/bufLength*1000.);
}
break;
case BUFFER_END:
driver->plot(D_BUFFER_END_TIME, (stop - bufStart) *
Globals::get()->clockInSeconds() * 1000);
bufEnd = clock;
bufLength = clock - bufStart;
case EVENT_START:
driver->plot(D_EVENT_LENGTH, stop - start);
driver->plot(D_EVENT_GAP, diff);
driver->plot(D_EVENT_MULTIPLICITY, count);
start = stop = clock; // reset the counters
count = 1;
break;
case EVENT_CONTINUE:
count++;
if(diff > 0.) {
driver->plot(D_SUBEVENT_GAP, diff + 100);
}
stop = clock;
break;
default:
ss << "Unexpected type " << event << " given to HistoStats";
messenger.warning(ss.str());
ss.str("");
}
//fill these spectra on all events, id plots and runtime.
// Exclude event type 0/1 since it will also appear as an
// event type 11
if ( event != BUFFER_START && event != BUFFER_END ){
driver->plot(DD_RUNTIME_SEC, remainNumSecs, rowNumSecs);
driver->plot(DD_RUNTIME_MSEC, remainNumMsecs, rowNumMsecs);
//fill scalar spectrum (per second)
//.........这里部分代码省略.........
示例5: if
//.........这里部分代码省略.........
if (lenRec == pixie::U_DELIMITER) {
nWords += 2; // increment two whole words and try again
continue;
}
// Buffer with vsn 1000 was inserted with
// the time for superheavy exp't
if (vsn == pixie::clockVsn) {
memcpy(&theTime, &lbuf[nWords+2], sizeof(time_t));
nWords += lenRec;
}
/* If the record length is 6, this is an empty channel.
* Skip this vsn and continue with the next
*/
//! Revision specific, so move to ReadBuffData
if (lenRec == 6) {
nWords += lenRec+1; // one additional word for delimiter
lastVsn=vsn;
continue;
}
/* If both the current vsn inspected is within an
* acceptable range, begin reading the buffer.
*/
if ( vsn < modChan->GetPhysicalModules() ) {
if ( lastVsn != pixie::U_DELIMITER) {
// the modules should be read out cyclically
if ( ((lastVsn+1) % modChan->GetPhysicalModules() ) !=
vsn ) {
#ifdef VERBOSE
ss << " MISSING BUFFER " << vsn << "/"
<< modChan->GetPhysicalModules()
<< " -- lastVsn = " << lastVsn << " "
<< ", length = " << lenRec;
messenger.warning(ss.str());
ss.str("");
#endif
RemoveList(eventList);
fullSpill=true;
}
}
/* Read the buffer. After read, the vector eventList will
contain pointers to all channels that fired in this buffer
*/
retval= (*ReadBuffData)(&lbuf[nWords], &bufLen, eventList);
/* If the return value is less than the error code,
reading the buffer failed for some reason.
Print error message and reset variables if necessary
*/
if ( retval <= readbuff::ERROR ) {
ss << " READOUT PROBLEM " << retval
<< " in event " << counter;
messenger.warning(ss.str());
ss.str("");
if ( retval == readbuff::ERROR ) {
ss << " Remove list " << lastVsn
<< " " << vsn;
RemoveList(eventList);
messenger.warning(ss.str());
ss.str("");
}
return;
} else if ( retval == 0 ) {
// empty buffers are regular in Rev. D data
// cout << " EMPTY BUFFER" << endl;
nWords += lenRec + 1;
lastVsn = vsn;