当前位置: 首页>>代码示例>>C++>>正文


C++ Messenger::detail方法代码示例

本文整理汇总了C++中Messenger::detail方法的典型用法代码示例。如果您正苦于以下问题:C++ Messenger::detail方法的具体用法?C++ Messenger::detail怎么用?C++ Messenger::detail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Messenger的用法示例。


在下文中一共展示了Messenger::detail方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SanityCheck

void Globals::SanityCheck() {
    Messenger m;
    std::stringstream ss;

    if (!(revision_ == "A" || revision_ == "D" || revision_ == "F")) {
        ss << "Globals: unknown revision version named "
           << revision_;
        throw GeneralException(ss.str());
    }

    if (clockInSeconds_ <= 0) {
        ss << "Globals: illegal value of clockInSeconds "
            << clockInSeconds_;
        throw GeneralException(ss.str());
    }

    if (adcClockInSeconds_ <= 0) {
        ss << "Globals: illegal value of adcClockInSeconds "
            << adcClockInSeconds_;
        throw GeneralException(ss.str());
    }

    if (filterClockInSeconds_ <= 0) {
        ss << "Globals: illegal value of filterClockInSeconds "
            << filterClockInSeconds_;
        throw GeneralException(ss.str());
    }

    if (eventInSeconds_ <= 0) {
        ss << "Globals: illegal value of eventInSeconds "
            << eventInSeconds_;
        throw GeneralException(ss.str());
    }

    if (hasReject_) {
        ss << "Total number of rejection regions: " << reject_.size();
        m.detail(ss.str());
    } else {
        ss << "Not using rejection regions";
        m.detail(ss.str());
    }

    ss.str("");
    if (energyContraction_ <= 0) {
        ss << "Globals: Surely you don't want to use Energy contraction = "
            << energyContraction_ << ". I'd better stop the program.";
        throw GeneralException(ss.str());
    } else {
        ss << "Energy contraction: " << energyContraction_;
        m.detail(ss.str());
    }

    m.done();
}
开发者ID:gottardo7,项目名称:pixie_scan,代码行数:54,代码来源:Globals.cpp

示例2: createPlace

void TreeCorrelator::createPlace(std::map<std::string, std::string>& params,
                                 bool verbose) {
    bool replace = false;
    if (params["replace"] != "")
        replace = strings::to_bool(params["replace"]);

    vector<string> names = split_names(params["name"]);
    for (vector<string>::iterator it = names.begin();
         it != names.end();
         ++it) {

        if (params["type"] != "") {
            if (replace) {
                if (places_.count((*it)) != 1) {
                    stringstream ss;
                    ss << "TreeCorrelator: cannot replace Place " << (*it)
                       << ", it doesn't exist";
                    throw TreeCorrelatorException(ss.str());
                }
                delete places_[(*it)];
                if (verbose) {
                    Messenger m;
                    stringstream ss;
                    ss << "Replacing place " << (*it);
                    m.detail(ss.str(), 1);
                }
            } else {
                if (places_.count((*it)) == 1) {
                    stringstream ss;
                    ss << "TreeCorrelator: place" << (*it) << " already exists";
                    throw TreeCorrelatorException(ss.str());
                }
                if (verbose) {
                    Messenger m;
                    stringstream ss;
                    ss << "Creating place " << (*it);
                    m.detail(ss.str(), 1);
                }
            }
            Place* current = builder.create(params, verbose);
            places_[(*it)] = current;
            if (strings::to_bool(params["init"]))
                current->activate(0.0);
        }

        if (params["parent"] != "root") {
            bool coincidence = strings::to_bool(params["coincidence"]);
            addChild(params["parent"], (*it), coincidence, verbose);
        }

    }
}
开发者ID:akeeler,项目名称:pixie_scan,代码行数:52,代码来源:TreeCorrelator.cpp

示例3: IOException

Notebook::Notebook() {
    pugi::xml_node note = XmlInterface::get()->GetDocument()->child("Configuration").child("Notebook");

    file_name_ = std::string(note.attribute("file").as_string());
    mode_ = std::string(note.attribute("mode").as_string("a"));

    Messenger m;
    m.detail("Notebook: " + file_name_ + " mode: " + mode_);

    std::ofstream note_file;

    if (mode_ == "r") {
        note_file.open(file_name_.c_str(), std::ios::out);
    } else if (mode_ == "a") {
        note_file.open(file_name_.c_str(), std::ios::out | std::ios::app);
    } else {
        std::stringstream ss;
        ss << "Notebook: unknown mode";
        ss << " : " << mode_;
        throw IOException(ss.str());
    }

    if (!note_file.good()) {
        std::stringstream ss;
        ss << "Notebook: error opening output file";
        ss << " : " << file_name_;
        throw IOException(ss.str());
    }
    note_file << "# Starting notebook on : " << currentDateTime() << std::endl;
    note_file.close();
}
开发者ID:spaulaus,项目名称:paass,代码行数:31,代码来源:Notebook.cpp

示例4: DetectorSummary

DetectorSummary *RawEvent::GetSummary(const std::string &s, bool construct) {
    map<string, DetectorSummary>::iterator it = sumMap.find(s);
    static set <string> nullSummaries;

    Messenger m;
    stringstream ss;
    if (it == sumMap.end()) {
        if (construct) {
            // construct the summary
            ss << "Constructing detector summary for type " << s;
            m.detail(ss.str());
            sumMap.insert(make_pair(s, DetectorSummary(s, eventList)));
            it = sumMap.find(s);
        } else {
            if (nullSummaries.count(s) == 0) {
                ss << "Returning NULL detector summary for type " << s;
                m.detail(ss.str());
                nullSummaries.insert(s);
            }
            return NULL;
        }
    }
    return &(it->second);
}
开发者ID:spaulaus,项目名称:paass,代码行数:24,代码来源:RawEvent.cpp

示例5: addChild

void TreeCorrelator::addChild(std::string parent, std::string child,
                             bool coin, bool verbose) {
    if (places_.count(parent) == 1 && places_.count(child) == 1) {
        place(parent)->addChild(place(child), coin);
        if (verbose) {
            Messenger m;
            stringstream ss;
            ss << "Setting " << child
                 << " as a child of " << parent;
            m.detail(ss.str(), 1);
        }
    } else {
        stringstream ss;
        ss << "TreeCorrelator: could not set " << child
           << " as a child of " << parent << endl;
        throw TreeCorrelatorException(ss.str());
    }
}
开发者ID:akeeler,项目名称:pixie_scan,代码行数:18,代码来源:TreeCorrelator.cpp

示例6: ReadWalkXml

void DetectorDriver::ReadWalkXml() {
    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 GeneralException(ss.str());
    }

    Messenger m;
    m.start("Loading Walk Corrections");

    pugi::xml_node map = doc.child("Configuration").child("Map");
    /** See comment in the similiar place at ReadCalXml() */
    bool verbose = map.attribute("verbose_walk").as_bool();
    for (pugi::xml_node module = map.child("Module"); module;
         module = module.next_sibling("Module")) {
        int module_number = module.attribute("number").as_int(-1);
        for (pugi::xml_node channel = module.child("Channel"); channel;
             channel = channel.next_sibling("Channel")) {
            int ch_number = channel.attribute("number").as_int(-1);
            Identifier chanID = DetectorLibrary::get()->at(module_number,
                                                           ch_number);
            bool corrected = false;
            for (pugi::xml_node walkcorr = channel.child("WalkCorrection");
                walkcorr; walkcorr = walkcorr.next_sibling("WalkCorrection")) {
                string model = walkcorr.attribute("model").as_string("None");
                double min = walkcorr.attribute("min").as_double(0);
                double max =
                  walkcorr.attribute("max").as_double(
                                              numeric_limits<double>::max());

                stringstream pars(walkcorr.text().as_string());
                vector<double> parameters;
                while (true) {
                    double p;
                    pars >> p;
                    if (pars)
                        parameters.push_back(p);
                    else
                        break;
                }
                if (verbose) {
                    stringstream ss;
                    ss << "Module " << module_number
                       << ", channel " << ch_number << ": ";
                    ss << " model: " << model;
                    for (vector<double>::iterator it = parameters.begin();
                         it != parameters.end(); ++it)
                        ss << " " << (*it);
                    m.detail(ss.str(), 1);
                }
                walk.AddChannel(chanID, model, min, max, parameters);
                corrected = true;
            }
            if (!corrected && verbose) {
                stringstream ss;
                ss << "Module " << module_number << ", channel "
                << ch_number << ": ";
                ss << " not corrected for walk";
                m.detail(ss.str(), 1);
            }
        }
    }
    m.done();
}
开发者ID:akeeler,项目名称:pixie_scan,代码行数:68,代码来源:DetectorDriver.cpp

示例7: ReadCalXml

void DetectorDriver::ReadCalXml() {
    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 GeneralException(ss.str());
    }

    Messenger m;
    m.start("Loading Calibration");

    pugi::xml_node map = doc.child("Configuration").child("Map");

    /** Note that before this reading in of the xml file, it was already
     * processed for the purpose of creating the channels map.
     * Some sanity checks (module and channel number) were done there
     * so they are not repeated here/
     */
    bool verbose = map.attribute("verbose_calibration").as_bool();
    for (pugi::xml_node module = map.child("Module"); module;
         module = module.next_sibling("Module")) {
        int module_number = module.attribute("number").as_int(-1);
        for (pugi::xml_node channel = module.child("Channel"); channel;
             channel = channel.next_sibling("Channel")) {
            int ch_number = channel.attribute("number").as_int(-1);
            Identifier chanID = DetectorLibrary::get()->at(module_number,
                                                           ch_number);
            bool calibrated = false;
            for (pugi::xml_node cal = channel.child("Calibration");
                cal; cal = cal.next_sibling("Calibration")) {
                string model = cal.attribute("model").as_string("None");
                double min = cal.attribute("min").as_double(0);
                double max =
                  cal.attribute("max").as_double(numeric_limits<double>::max());

                stringstream pars(cal.text().as_string());
                vector<double> parameters;
                while (true) {
                    double p;
                    pars >> p;
                    if (pars)
                        parameters.push_back(p);
                    else
                        break;
                }
                if (verbose) {
                    stringstream ss;
                    ss << "Module " << module_number << ", channel "
                       << ch_number << ": ";
                    ss << " model-" << model;
                    for (vector<double>::iterator it = parameters.begin();
                         it != parameters.end(); ++it)
                        ss << " " << (*it);
                    m.detail(ss.str(), 1);
                }
                cali.AddChannel(chanID, model, min, max, parameters);
                calibrated = true;
            }
            if (!calibrated && verbose) {
                stringstream ss;
                ss << "Module " << module_number << ", channel "
                   << ch_number << ": ";
                ss << " non-calibrated";
                m.detail(ss.str(), 1);
            }
        }
    }
    m.done();
}
开发者ID:akeeler,项目名称:pixie_scan,代码行数:72,代码来源:DetectorDriver.cpp

示例8: 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") {
//.........这里部分代码省略.........
开发者ID:akeeler,项目名称:pixie_scan,代码行数:101,代码来源:DetectorDriver.cpp

示例9: GeneralException

Globals::Globals() {
    clockInSeconds_ = -1;
    adcClockInSeconds_ = -1;
    filterClockInSeconds_ = -1;
    eventInSeconds_ = -1;
    energyContraction_ = 1.0;
    hasReject_ = false;
    revision_ = "None";
    numTraces_  = 16;

    try {
        pugi::xml_document doc;
        pugi::xml_parse_result result = doc.load_file("Config.xml");

        std::stringstream ss;
        if (!result) {
            ss << "Globals : error parsing file " << "Config.xml";
            ss << " : " << result.description();
            throw GeneralException(ss.str());
        }

        Messenger m;
        pugi::xml_node description =
            doc.child("Configuration").child("Description");
        std::string desc_text = description.text().get();
        m.detail("Experiment: " + desc_text);

        m.start("Loading global parameters");
        pugi::xml_node global = doc.child("Configuration").child("Global");
        for (pugi::xml_node_iterator it = global.begin();
                                    it != global.end(); ++it) {
            if (std::string(it->name()).compare("Revision") == 0) {
                revision_ = it->attribute("version").as_string();
                ss << "Revision: " << revision_;
                m.detail(ss.str());
                ss.str("");

                if (revision_ == "A") {
                    clockInSeconds_ = 10e-9;
                    adcClockInSeconds_ = 10e-9;
                    filterClockInSeconds_ = 10e-9;
                    maxWords_ = IO_BUFFER_LENGTH;
                } else if (revision_ == "D") {
                    clockInSeconds_ = 10e-9;
                    adcClockInSeconds_ = 10e-9;
                    filterClockInSeconds_ = 10e-9;
                    maxWords_ = EXTERNAL_FIFO_LENGTH;
                } else if (revision_ == "F" || revision_ == "DF") {
                    clockInSeconds_ = 8e-9;
                    adcClockInSeconds_ = 4e-9;
                    filterClockInSeconds_ = 8e-9;
                    maxWords_ = EXTERNAL_FIFO_LENGTH;
                } else {
                    throw GeneralException("Globals: unknown revision version "
                                           + revision_);
                }

            } else if (std::string(it->name()).compare("EventWidth") == 0) {

                std::string units = it->attribute("unit").as_string("None");
                double value = it->attribute("value").as_double(-1);

                if (units == "ns")
                    value *= 1e-9;
                else if (units == "us")
                    value *= 1e-6;
                else if (units == "ms")
                    value *= 1e-3;
                else if (units == "s")
                    value *= 1.0;
                else
                    throw GeneralException("Globals: unknown units " + units);

                eventInSeconds_ = value;
                eventWidth_ = (int)(eventInSeconds_ / clockInSeconds_);
                ss << "Event width: " << eventInSeconds_ * 1e6
                   << " us" << ", i.e. " << eventWidth_
                   << " pixie16 clock tics.";
                m.detail(ss.str());
                ss.str("");
            } else if (std::string(it->name()).compare("EnergyContraction") == 0) {
                energyContraction_ = it->attribute("value").as_double(1);
            } else if (std::string(it->name()).compare("Path") == 0) {
                configPath_ =  it->text().get();
                m.detail("Path to other configuration files: " + configPath_);
            } else if (std::string(it->name()).compare("NumOfTraces") == 0) {
                numTraces_ =  it->attribute("value").as_uint();
            } else
                WarnOfUnknownParameter(m, it);
        }

        unsigned int power2 = 1;
        unsigned int maxDammSize = 16384;
        while (power2 < numTraces_ && power2 < maxDammSize) {
            power2 *= 2;
        }
        ss << "Number of traces set to " << power2 << " ("
           << numTraces_ << ")";
        m.detail(ss.str());
        ss.str("");
//.........这里部分代码省略.........
开发者ID:gottardo7,项目名称:pixie_scan,代码行数:101,代码来源:Globals.cpp

示例10: 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)
//.........这里部分代码省略.........
开发者ID:kmiernik,项目名称:pixie_scan,代码行数:101,代码来源:PixieStd.cpp

示例11: if

extern "C" void hissub_(unsigned short *ibuf[],unsigned short *nhw)
#endif
{
    static float hz = sysconf(_SC_CLK_TCK); // get the number of clock ticks per second
    static clock_t clockBegin; // initialization time
    static struct tms tmsBegin;

    vector<ChanEvent*> eventList; // vector to hold the events

    /* Pointer to singleton DetectorLibrary class */
    DetectorLibrary* modChan = DetectorLibrary::get();
    /* Pointer to singleton DetectorDriver class */
    DetectorDriver* driver = DetectorDriver::get();
    /* Screen messenger */
    Messenger messenger;
    stringstream ss;

    // local version of ibuf pointer
    word_t *lbuf;

    int retval = 0; // return value from various functions

    unsigned long bufLen;

    /*
      Various event counters
    */
    unsigned long numEvents = 0;
    static int counter = 0; // the number of times this function is called
    static int evCount;     // the number of times data is passed to ScanList
    static unsigned int lastVsn; // the last vsn read from the data
    time_t theTime = 0;

    /*
      Assign the local variable lbuf to the variable ibuf which is passed into
      the routine.  The difference between the new and old pixie16 readouts is
      the type of the variable and source of the variable ibuf.

      In the new readout ibuf is from a C++ function and is of type unsigned int*
      In the old readout ibuf is from a Fortran function and is of type
      unsigned short*

      This results in two different assignment statements depending on
      the readout.
    */
#ifdef newreadout
    lbuf=(word_t *)ibuf[0];
#else
    lbuf=(word_t *)ibuf; //old readout
#endif

    /* Initialize the scan program before the first event */
    if (counter==0) {
        /* Retrieve the current time for use later to determine the total
        * running time of the analysis.
        */
        messenger.start("Initializing scan");

        string revision = Globals::get()->revision();
        // Initialize function pointer to point to
        // correct version of ReadBuffData
        if (revision == "D" || revision == "F")
            ReadBuffData = ReadBuffDataDF;
        else if (revision == "A")
            ReadBuffData = ReadBuffDataA;

        clockBegin = times(&tmsBegin);

        ss << "First buffer at " << clockBegin << " sys time";
        messenger.detail(ss.str());
        ss.str("");

        /* After completion the descriptions of all channels are in the modChan
        * vector, the DetectorDriver and rawevent have been initialized with the
        * detectors that will be used in this analysis.
        */
        modChan->PrintUsedDetectors(rawev);
        driver->Init(rawev);

        /* Make a last check to see that everything is in order for the driver
        * before processing data. SanityCheck function throws exception if
        * something went wrong.
        */
        try {
            driver->SanityCheck();
        } catch (GeneralException &e) {
            messenger.fail();
            cout << "Exception caught while checking DetectorDriver"
                 << " sanity in PixieStd" << endl;
            cout << "\t" << e.what() << endl;
            exit(EXIT_FAILURE);
        } catch (GeneralWarning &w) {
            cout << "Warning caught during checking DetectorDriver"
                 << " at PixieStd" << endl;
            cout << "\t" << w.what() << endl;
        }

        lastVsn=-1; // set last vsn to -1 so we expect vsn 0 first

        ss << "Init at " << times(&tmsBegin) << " sys time.";
//.........这里部分代码省略.........
开发者ID:kmiernik,项目名称:pixie_scan,代码行数:101,代码来源:PixieStd.cpp


注:本文中的Messenger::detail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。