File indexing completed on 2024-04-06 12:31:09
0001 #include "SimTransport/PPSProtonTransport/interface/ProtonTransport.h"
0002 #include "FWCore/Utilities/interface/Exception.h"
0003 #include "SimTransport/PPSProtonTransport/interface/HectorTransport.h"
0004 #include "SimTransport/PPSProtonTransport/interface/OpticalFunctionsTransport.h"
0005 #include "SimTransport/PPSProtonTransport/interface/TotemTransport.h"
0006 #include "Utilities/PPS/interface/PPSUnitConversion.h"
0007 #include <cctype>
0008
0009 ProtonTransport::ProtonTransport(const edm::ParameterSet &iConfig, edm::ConsumesCollector iC) {
0010 std::string transportMethod_ = iConfig.getParameter<std::string>("TransportMethod");
0011 for (auto &c : transportMethod_)
0012 c = toupper(c);
0013
0014 if (transportMethod_ == "HECTOR") {
0015 instance_ = std::make_unique<HectorTransport>(iConfig, iC);
0016 } else if (transportMethod_ == "TOTEM") {
0017 instance_ = std::make_unique<TotemTransport>(iConfig);
0018 } else if (transportMethod_ == "OPTICALFUNCTIONS") {
0019 instance_ = std::make_unique<OpticalFunctionsTransport>(iConfig, iC);
0020 } else {
0021 throw cms::Exception("ProtonTransport")
0022 << "Unknow transport method. Is must be either HECTOR, TOTEM or OPTICALFUNCTIONS (case insensitive)";
0023 }
0024 }