コード例 #1
0
shared_ptr<const XdmfGridCollectionType>
XdmfGridCollectionType::New(const std::map<std::string, std::string> & itemProperties)
{
  std::map<std::string, std::string>::const_iterator type =
    itemProperties.find("CollectionType");
  if(type == itemProperties.end()) {
    XdmfError::message(XdmfError::FATAL, 
                       "'CollectionType' not in itemProperties in "
                       "XdmfGridCollectionType::New");
  }

  const std::string & typeVal = type->second;
  if(typeVal.compare("None") == 0) {
    return NoCollectionType();
  }
  else if(typeVal.compare("Spatial") == 0) {
    return Spatial();
  }
  else if(typeVal.compare("Temporal") == 0) {
    return Temporal();
  }

  XdmfError::message(XdmfError::FATAL, 
                     "'CollectionType' not of 'None', 'Spatial', or "
                     "'Temporal' in XdmfGridCollectionType::New");

  // unreachable
  return shared_ptr<const XdmfGridCollectionType>();
}
コード例 #2
0
ファイル: fxparticle_mc.cpp プロジェクト: Ambrevar/fr_public
void RNMarchingCubesBase<T>::Prepare(Wz4RenderContext *ctx)
{
  PInfo.Reset();
  Source->Func(PInfo,Time,0);


  Spatial();
  Render();
}
コード例 #3
0
Jet MuXboostedBTagging::Core(std::vector<Jet> const &core_candidates,  std::vector<Lepton> const &muons) const
{
    INFO0;
    auto hardest_muon = *boost::range::max_element(muons, [](Lepton const & muon_1, Lepton const & muon_2) {
        return muon_1.Pt() > muon_2.Pt();
    });
    auto min_delta_mass = std::numeric_limits<Mass>::max(); // Default to infinity
    auto core = core_candidates.front();  // Default to hardest core

    for (auto const &core_candidate : core_candidates) {
        if (core_candidate.Energy() == 0_eV) continue;
        auto g = sqr(MassOf(Id::Dpm) / core_candidate.Energy());
        // Make sure we still have sufficient boost after muon subtraction
        if (g * sqr(core_min_boost_) > 1.) continue;
        auto y = core_candidate.Spatial().Tan2(hardest_muon.Spatial());

        // The core has the mass closest to fSubjetMassHypothesis
        auto radicant = 1. - ((g - y) + g * y);
        if (radicant < 0) continue;
        auto denom = 1. + y + sqrt(radicant);
        if (denom == 0) continue;
        auto radicant2 = sqr(MassOf(Id::Dpm)) + (4. * hardest_muon.Energy() * core_candidate.Energy() * (g + y)) / denom;
        if (radicant2 < 0_eV * eV) continue;
        auto delta_mass = abs(sqrt(radicant2) - MassOf(Id::B0));

        if (delta_mass > min_delta_mass) continue;
        min_delta_mass = delta_mass;
        core = core_candidate;
    }

    if (core.ModP2() ==  0_eV * eV) return core;
    // The current mass depends more on the granularity of the CAL more than anything else
    // To fix the mass, We need to scale the momentum of the core (but not the energy)
    core.ScaleMomentum(sqrt((core.Energy() - MassOf(Id::Dpm)) * (core.Energy() + MassOf(Id::Dpm)) / core.ModP2()));
    return core;
}