diff --git a/Configuration/Generator/python/sherpa_ZtoEE_0j_BlackHat_13TeV_MASTER_cff.py b/Configuration/Generator/python/sherpa_ZtoEE_0j_BlackHat_13TeV_MASTER_cff.py index c7bb38ab0081a..44a1759748108 100644 --- a/Configuration/Generator/python/sherpa_ZtoEE_0j_BlackHat_13TeV_MASTER_cff.py +++ b/Configuration/Generator/python/sherpa_ZtoEE_0j_BlackHat_13TeV_MASTER_cff.py @@ -8,8 +8,8 @@ filterEfficiency = cms.untracked.double(1.0), crossSection = cms.untracked.double(-1), SherpaProcess = cms.string('ZtoEE_0j_BlackHat_13TeV'), - SherpackLocation = cms.string('slc6_amd64_gcc491/sherpa/2.1.1/13TeV'), - SherpackChecksum = cms.string('52628d97d3299f46515fe8c4a3006f34'), + SherpackLocation = cms.string('/cvmfs/cms.cern.ch/phys_generator/gridpacks/slc6_amd64_gcc493/13TeV/sherpa/2.2.0'), + SherpackChecksum = cms.string('214d968be9b50e862ecd8224dd53b7bd'), FetchSherpack = cms.bool(True), SherpaPath = cms.string('./'), SherpaPathPiece = cms.string('./'), @@ -20,8 +20,8 @@ "Run"), MPI_Cross_Sections = cms.vstring( " MPIs in Sherpa, Model = Amisic:", - " semihard xsec = 74.0613 mb,", - " non-diffractive xsec = 18.1593 mb with nd factor = 0.335." + " semihard xsec = 43.6681 mb,", + " non-diffractive xsec = 17.0318 mb with nd factor = 0.3142." ), Run = cms.vstring( "(run){", @@ -39,7 +39,7 @@ "}(run)", "(processes){", " Process 93 93 -> 11 -11 93{NJET};", - " Order_EW 2; CKKW sqr(QCUT/E_CMS);", + " Order(*,2); CKKW sqr(QCUT/E_CMS);", " NLO_QCD_Mode MC@NLO {LJET};", " ME_Generator Amegic {LJET};", " RS_ME_Generator Comix {LJET};", diff --git a/Configuration/Generator/python/sherpa_ZtoEE_0j_OpenLoops_13TeV_MASTER_cff.py b/Configuration/Generator/python/sherpa_ZtoEE_0j_OpenLoops_13TeV_MASTER_cff.py index 1d2e69935ba68..2b8011c31f2e1 100644 --- a/Configuration/Generator/python/sherpa_ZtoEE_0j_OpenLoops_13TeV_MASTER_cff.py +++ b/Configuration/Generator/python/sherpa_ZtoEE_0j_OpenLoops_13TeV_MASTER_cff.py @@ -8,8 +8,8 @@ filterEfficiency = cms.untracked.double(1.0), crossSection = cms.untracked.double(-1), SherpaProcess = cms.string('ZtoEE_0j_OpenLoops_13TeV'), - SherpackLocation = cms.string('slc6_amd64_gcc491/sherpa/2.1.1/13TeV'), - SherpackChecksum = cms.string('100ee88a091480befb360aef2e7f637d'), + SherpackLocation = cms.string('/cvmfs/cms.cern.ch/phys_generator/gridpacks/slc6_amd64_gcc493/13TeV/sherpa/2.2.0'), + SherpackChecksum = cms.string('777066bf69695c51557027c85bf80025'), FetchSherpack = cms.bool(True), SherpaPath = cms.string('./'), SherpaPathPiece = cms.string('./'), @@ -20,8 +20,8 @@ "Run"), MPI_Cross_Sections = cms.vstring( " MPIs in Sherpa, Model = Amisic:", - " semihard xsec = 74.0613 mb,", - " non-diffractive xsec = 18.1593 mb with nd factor = 0.335." + " semihard xsec = 43.6681 mb,", + " non-diffractive xsec = 17.0318 mb with nd factor = 0.3142." ), Run = cms.vstring( "(run){", @@ -40,7 +40,7 @@ "}(run)", "(processes){", " Process 93 93 -> 11 -11 93{NJET};", - " Order_EW 2; CKKW sqr(QCUT/E_CMS);", + " Order(*,2); CKKW sqr(QCUT/E_CMS);", " NLO_QCD_Mode MC@NLO {LJET};", " ME_Generator Amegic {LJET};", " RS_ME_Generator Comix {LJET};", @@ -58,9 +58,13 @@ "(selector){", " Mass 11 -11 66 E_CMS", " Mass 13 -13 66 E_CMS", - "}(selector)" + "}(selector)", + "(mi){", + " MI_HANDLER = Amisic # None or Amisic", + "}(mi)" ), ) ) ProductionFilterSequence = cms.Sequence(generator) + diff --git a/GeneratorInterface/SherpaInterface/BuildFile.xml b/GeneratorInterface/SherpaInterface/BuildFile.xml index befe1d642f528..c8135e3214b49 100644 --- a/GeneratorInterface/SherpaInterface/BuildFile.xml +++ b/GeneratorInterface/SherpaInterface/BuildFile.xml @@ -7,7 +7,6 @@ - diff --git a/GeneratorInterface/SherpaInterface/data/MakeSherpaLibs.sh b/GeneratorInterface/SherpaInterface/data/MakeSherpaLibs.sh index 8f9cb0f90550c..f98cd42c6f45e 100755 --- a/GeneratorInterface/SherpaInterface/data/MakeSherpaLibs.sh +++ b/GeneratorInterface/SherpaInterface/data/MakeSherpaLibs.sh @@ -5,9 +5,9 @@ # library production and cross section calculation # uses: the required SHERPA data cards (+ libraries) [see below] # -# author: Markus Merschmeyer, Sebastian Thueer, RWTH Aachen -# date: 5th July 2013 -# version: 4.3 +# author: Markus Merschmeyer, Philipp Millet, Sebastian Thueer, RWTH Aachen +# date: 5th Nov 2015 +# version: 4.4 # set +o posix @@ -19,7 +19,7 @@ set +o posix print_help() { echo "" && \ - echo "MakeSherpaLibs version 4.3" && echo && \ + echo "MakeSherpaLibs version 4.4" && echo && \ echo "options: -d path (optional) path to your SHERPA installation (otherwise the SHERPA" && \ echo " package belonging to the release under '\$CMSSW_BASE' is used)" && \ echo " -> ( "${shr}" )" && \ @@ -69,23 +69,25 @@ check_occurence() { clean_libs() { DIRS=`find Process -name P?_?`" "`find Process -name P?_??` + BASEDIR=`pwd` for J in $DIRS ; do echo "." echo "======================" echo "$J"; echo "======================" cd $J - make clean +# make clean rm config* Makefile* # rm *.tex - rm aclocal.m4 ChangeLog depcomp install-sh libtool ltmain.sh missing +# rm aclocal.m4 ChangeLog depcomp install-sh libtool ltmain.sh missing + rm aclocal.m4 ChangeLog depcomp install-sh ltmain.sh missing rm AUTHORS COPYING INSTALL NEWS README rm -rf autom4te.cache find ./ -type f -name 'Makefile*' -exec rm -rf {} \; find ./ -type d -name '.deps' -exec rm -rf {} \; find ./ -type f -name '*.C' -exec rm -rf {} \; find ./ -type f -name '*.H' -exec rm -rf {} \; - cd ../.. + cd $BASEDIR done } @@ -489,7 +491,7 @@ if [ "${lbo}" == "LIBS" ] || [ "${lbo}" == "LBCR" ]; then echo " creating library code..." echo " ...Logs stored in ${shrun}/${outflbs}_pass${lbo}.out and ${shrun}/${outflbs}_pass${lbo}.err." - exec_log2 -a ${shrun}/${outflbs}_pass${lbo}.out ${shrun}/${outflbs}_pass${lbo}.err ${sherpaexe} ${multithread_opt} -p ${pth} -r ${dir2} ${SHERPAOPTS} + exec_log2 -a ${shrun}/${outflbs}_pass${lbo}.out ${shrun}/${outflbs}_pass${lbo}.err ${sherpaexe} -p ${pth} -r ${dir2} ${SHERPAOPTS} if [ "${FLGAMEGIC}" == "TRUE" ]; then @@ -501,7 +503,7 @@ if [ "${lbo}" == "LIBS" ] || [ "${lbo}" == "LBCR" ]; then # compile created library code echo " compiling libraries..." echo " ...Logs stored in ${shrun}/${outflbs}_mklib.out and ${shrun}/${outflbs}_mklib.err." - exec_log2 -a ${shrun}/${outflbs}_mklib.out ${shrun}/${outflbs}_mklib.err ./makelibs ${POPTS} + exec_log2 -a ${shrun}/${outflbs}_mklib.out ${shrun}/${outflbs}_mklib.err ./makelibs ${POPTS} -i $SHERPA_INCLUDE_PATH # get gross size of created libraries nf=`du -sh | grep -o "\." | grep -c "\."` lsize=`du -sh | cut -f 1-${nf} -d "."` @@ -517,7 +519,7 @@ if [ "${lbo}" == "LIBS" ] || [ "${lbo}" == "LBCR" ]; then # reinvoke Sherpa echo " re-invoking Sherpa for futher library/cross section calculation..." echo " ...Logs stored in ${shrun}/${outflbs}_pass${lbo}.out and ${shrun}/${outflbs}_pass${lbo}.err." - exec_log2 -a ${shrun}/${outflbs}_pass${lbo}.out ${shrun}/${outflbs}_pass${lbo}.err ${sherpaexe} ${multithread_opt} -p ${pth} -r ${dir2} ${SHERPAOPTS} + exec_log2 -a ${shrun}/${outflbs}_pass${lbo}.out ${shrun}/${outflbs}_pass${lbo}.err ${sherpaexe} -p ${pth} -r ${dir2} ${SHERPAOPTS} # newly created process code by AMEGIC? cd ${dir1} @@ -556,10 +558,10 @@ if [ "${lbo}" == "LBCR" ] || [ "${lbo}" == "CRSS" ]; then SHERPAOPTS="-e 101" echo " calculating cross sections... Logs stored in ${shrun}/${outflbs}_pass${lbo}.out and ${shrun}/${outflbs}_pass${lbo}.err." if [ "$ML_MPICMD" == "" ]; then - exec_log2 ${shrun}/${outflbs}_pass${lbo}.out ${shrun}/${outflbs}_pass${lbo}.err ${sherpaexe} ${multithread_opt} -p ${pth} -r ${dir2} ${SHERPAOPTS} + exec_log2 ${shrun}/${outflbs}_pass${lbo}.out ${shrun}/${outflbs}_pass${lbo}.err ${sherpaexe} -p ${pth} -r ${dir2} ${SHERPAOPTS} else echo " ...using MPI" - exec_log2 ${shrun}/${outflbs}_pass${lbo}.out ${shrun}/${outflbs}_pass${lbo}.err ${ML_MPICMD} ${ML_MPIOPT} ${sherpaexe} ${multithread_opt} -p ${pth} -r ${dir2} ${SHERPAOPTS} + exec_log2 ${shrun}/${outflbs}_pass${lbo}.out ${shrun}/${outflbs}_pass${lbo}.err ${ML_MPICMD} ${ML_MPIOPT} ${sherpaexe} -p ${pth} -r ${dir2} ${SHERPAOPTS} fi fi @@ -574,10 +576,10 @@ if [ "${lbo}" == "EVTS" ]; then fi echo " generating events (${NEVTS})... Logs stored in ${shrun}/${outflbs}_pass${lbo}.out and ${shrun}/${outflbs}_pass${lbo}.err." if [ "$ML_MPICMD" == "" ]; then - exec_log2 ${shrun}/${outflbs}_pass${lbo}.out ${shrun}/${outflbs}_pass${lbo}.err ${sherpaexe} ${multithread_opt} -p ${pth} -r ${dir2} ${SHEVTOPT} + exec_log2 ${shrun}/${outflbs}_pass${lbo}.out ${shrun}/${outflbs}_pass${lbo}.err ${sherpaexe} -p ${pth} -r ${dir2} ${SHEVTOPT} else echo " ...using MPI" - exec_log2 ${shrun}/${outflbs}_pass${lbo}.out ${shrun}/${outflbs}_pass${lbo}.err ${ML_MPICMD} ${ML_MPIOPT} ${sherpaexe} ${multithread_opt} -p ${pth} -r ${dir2} ${SHEVTOPT} + exec_log2 ${shrun}/${outflbs}_pass${lbo}.out ${shrun}/${outflbs}_pass${lbo}.err ${ML_MPICMD} ${ML_MPIOPT} ${sherpaexe} -p ${pth} -r ${dir2} ${SHEVTOPT} fi fi diff --git a/GeneratorInterface/SherpaInterface/data/PrepareSherpaLibs.sh b/GeneratorInterface/SherpaInterface/data/PrepareSherpaLibs.sh index c3805ffe53bbd..732d33b43000c 100755 --- a/GeneratorInterface/SherpaInterface/data/PrepareSherpaLibs.sh +++ b/GeneratorInterface/SherpaInterface/data/PrepareSherpaLibs.sh @@ -96,7 +96,8 @@ function build_python_cff() { mv ${file}.tmp2 ${file}.tmp1 sed '/^$/d' < ${file}.tmp1 > ${file}.tmp2 # remove empty lines mv ${file}.tmp2 ${file}.tmp1 - sed -e 's/^/ /g;s/ (/(/;s/ }/}/' < ${file}.tmp1 > ${file}.tmp2 # add single space in front of parameters + #sed -e 's/^/ /g;s/ (/(/;s/ }/}/' < ${file}.tmp1 > ${file}.tmp2 # add single space in front of parameters + sed -e 's/^/ /g;s/ }/}/' < ${file}.tmp1 > ${file}.tmp2 # add single space in front of parameters mv ${file}.tmp2 ${file}.tmp1 ### sed -e 's/\"/\\"/g' < ${file}.tmp1 > ${file}.tmp2 # protect existing '"' by '\"' diff --git a/GeneratorInterface/SherpaInterface/interface/SherpackFetcher.h b/GeneratorInterface/SherpaInterface/interface/SherpackFetcher.h index 963fe08be58a7..983099457afe9 100644 --- a/GeneratorInterface/SherpaInterface/interface/SherpackFetcher.h +++ b/GeneratorInterface/SherpaInterface/interface/SherpackFetcher.h @@ -6,21 +6,13 @@ #include #include #include -#include #include -#include "frontier_client/frontier-cpp.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" -#include "FWCore/Catalog/interface/SiteLocalConfig.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "FWCore/Services/src/SiteLocalConfigService.h" -#include "FWCore/ServiceRegistry/interface/ServiceRegistry.h" #include "FWCore/Utilities/interface/Exception.h" - #include "GeneratorInterface/SherpaInterface/interface/SherpackUtilities.h" namespace spf { @@ -30,7 +22,7 @@ class SherpackFetcher { SherpackFetcher(edm::ParameterSet const&); int Fetch(); ~SherpackFetcher(); - int FnFileGet(std::string); + int CopyFile(std::string pathstring); const char *classname() const { return "SherpackFetcher"; } private: diff --git a/GeneratorInterface/SherpaInterface/src/SherpaHadronizer.cc b/GeneratorInterface/SherpaInterface/src/SherpaHadronizer.cc index a3fdd4b3c08d0..595afefd7803b 100644 --- a/GeneratorInterface/SherpaInterface/src/SherpaHadronizer.cc +++ b/GeneratorInterface/SherpaInterface/src/SherpaHadronizer.cc @@ -160,8 +160,6 @@ SherpaHadronizer::SherpaHadronizer(const edm::ParameterSet ¶ms) : std::string shRes = "RESULT_DIRECTORY=" + SherpaResultDir; // from Sherpa 1.2.0 on //Name of the external random number class std::string shRng = "EXTERNAL_RNG=CMS_SHERPA_RNG"; - //switch off multithreading - std::string shNoMT = "-j1"; //create the command line arguments.push_back(shRun.c_str()); @@ -169,7 +167,6 @@ SherpaHadronizer::SherpaHadronizer(const edm::ParameterSet ¶ms) : arguments.push_back(shPathPiece.c_str()); arguments.push_back(shRes.c_str()); arguments.push_back(shRng.c_str()); - arguments.push_back(shNoMT.c_str()); isInitialized=false; //initialization of Sherpa moved to initializeForInternalPartons } diff --git a/GeneratorInterface/SherpaInterface/src/SherpackFetcher.cc b/GeneratorInterface/SherpaInterface/src/SherpackFetcher.cc index ce04ab108db1d..41aa40a9eb2ef 100644 --- a/GeneratorInterface/SherpaInterface/src/SherpackFetcher.cc +++ b/GeneratorInterface/SherpaInterface/src/SherpackFetcher.cc @@ -1,29 +1,19 @@ -/* Based on the cmsGetFnConnect and fn-fileget implementation by Dave Dykstra - * CMSSW/ FWCore/ Services/ bin/ cmsGetFnConnect.cc - * http://cdcvs.fnal.gov/cgi-bin/public-cvs/cvsweb-public.cgi/~checkout~/frontier/client/fn-fileget.c?rev=1.1&content-type=text/plain -*/ - - -//~ #include "SherpackFetcher.h" #include "GeneratorInterface/SherpaInterface/interface/SherpackFetcher.h" -#include - -//~ #include namespace spf { SherpackFetcher::SherpackFetcher(edm::ParameterSet const& pset) { - if (!pset.exists("SherpaProcess")) SherpaProcess=""; - else SherpaProcess=pset.getParameter("SherpaProcess"); - if (!pset.exists("SherpackLocation")) SherpackLocation=""; - else SherpackLocation=pset.getParameter("SherpackLocation"); - if (!pset.exists("SherpackChecksum")) SherpackChecksum=""; - else SherpackChecksum=pset.getParameter("SherpackChecksum"); - if (!pset.exists("FetchSherpack")) FetchSherpack=false; - else FetchSherpack=pset.getParameter("FetchSherpack"); - if (!pset.exists("SherpaPath")) SherpaPath=""; - else SherpaPath=pset.getParameter("SherpaPath"); + if (!pset.exists("SherpaProcess")) SherpaProcess=""; + else SherpaProcess=pset.getParameter("SherpaProcess"); + if (!pset.exists("SherpackLocation")) SherpackLocation=""; + else SherpackLocation=pset.getParameter("SherpackLocation"); + if (!pset.exists("SherpackChecksum")) SherpackChecksum=""; + else SherpackChecksum=pset.getParameter("SherpackChecksum"); + if (!pset.exists("FetchSherpack")) FetchSherpack=false; + else FetchSherpack=pset.getParameter("FetchSherpack"); + if (!pset.exists("SherpaPath")) SherpaPath=""; + else SherpaPath=pset.getParameter("SherpaPath"); } @@ -36,180 +26,83 @@ int SherpackFetcher::Fetch() std::string sherpackunzip = "sherpa_" + SherpaProcess + "_MASTER.tar"; std::string path = SherpackLocation + "/" + sherpack; - //create the command line - - //~ //fn-fileget -c "`cmsGetFnConnect frontier://smallfiles`" slc5_ia32_gcc434/sherpa/1.2.2-cms3/8TeV/EWK/sherpa_8TeV_ewk_Zleptons5jetsincl_50_mll_8000_MASTER.tgz if(FetchSherpack == true){ - std::cout << "SherpackFetcher: Trying to fetch the Sherpack " << sherpack << std::endl; - int res =FnFileGet(path); - if (res!=1) { - std::cout <<"SherpackFetcher: Fetching of Sherpack did not succeed, terminating" << std::endl; - return -1; - } - std::cout << "SherpackFetcher: Fetching successful" << std::endl; + std::cout << "SherpackFetcher: Trying to fetch the Sherpack " << sherpack << std::endl; + int res=-1; + + res =CopyFile(path); + + if (res!=1) { + throw cms::Exception("SherpaInterface") <<"SherpackFetcher: Fetching of Sherpack did not succeed, terminating" << std::endl; + return -1; + } + std::cout << "SherpackFetcher: Fetching successful" << std::endl; } std::ifstream my_file(sherpack.c_str()); - if (!my_file.good()) - { - std::cout << "SherpackFetcher: No Sherpack found" << std::endl; + if (!my_file.good()) + { + throw cms::Exception("SherpaInterface") << "SherpackFetcher: No Sherpack found" << std::endl; return -2; - } + } my_file.close(); std::cout << "SherpackFetcher: Sherpack found" << std::endl; if(SherpackChecksum!=""){ - char md5checksum[33]; - spu::md5_File(sherpack, md5checksum); - for (int k=0; k<33; k++){ - if (md5checksum[k]!= SherpackChecksum[k]) { - std::cout << "SherpackFetcher: failure, calculated and specified checksums differ!" << std::endl; - return -3; - } - } - std::cout << "SherpackFetcher: Calculated checksum of the Sherpack is " << md5checksum << " and matches" << std::endl; + char md5checksum[33]; + spu::md5_File(sherpack, md5checksum); + for (int k=0; k<33; k++){ + if (md5checksum[k]!= SherpackChecksum[k]) { + throw cms::Exception("SherpaInterface") << "SherpackFetcher: failure, calculated and specified checksums differ!" << std::endl; + return -3; + } + } + std::cout << "SherpackFetcher: Calculated checksum of the Sherpack is " << md5checksum << " and matches" << std::endl; } else { - std::cout << "SherpackFetcher: Ignoring Checksum" << std::endl; + std::cout << "SherpackFetcher: Ignoring Checksum" << std::endl; } std::cout << "SherpackFetcher: Trying to unzip the Sherpack" << std::endl; int res=spu::Unzip(sherpack,sherpackunzip); if (res!=0) { - std::cout << "SherpackFetcher: Decompressing failed " << std::endl; - return -4; + throw cms::Exception("SherpaInterface") << "SherpackFetcher: Decompressing failed " << std::endl; + return -4; } std::cout << "SherpackFetcher: Decompressing successful " << std::endl; FILE *file = fopen(const_cast(sherpackunzip.c_str()),"r"); if( file ) { - std::cout << "SherpackFetcher: Decompressed Sherpack exists with name " << sherpackunzip << " starting to untar it"< slcptr(new edm::service::SiteLocalConfigService(edm::ParameterSet())); - auto slc = std::make_shared >(slcptr); - edm::ServiceToken slcToken = edm::ServiceRegistry::createContaining(slc); - edm::ServiceRegistry::Operate operate(slcToken); - - edm::Service localconfservice; - localconfservice->lookupCalibConnect("frontier://smallfiles"); - connectstr=localconfservice->lookupCalibConnect("frontier://smallfiles"); - } catch(cms::Exception const& e) { - std::cerr << e.explainSelf() << std::endl; - return 2; + //No need to backwards compatibility with the FnFileGet method, throw exception if only the relative path is given + if ( (pathstring.find("slc6_amd64_gcc")==0) || (pathstring.find("slc5_amd64_gcc")==0) ){ + throw cms::Exception("SherpaInterface") << "Old method of sherpack retrieving used, please use /cvmfs to store files and specify the full path to the sherpack directory"; } - - if(frontier_init(malloc,free)!=0) - { - fprintf(stderr,"Error initializing frontier client: %s\n",frontier_getErrorMsg()); - return 2; - } - ec=FRONTIER_OK; - //~ config=frontierConfig_get(connectstr,"",&ec); - config=frontierConfig_get(connectstr.c_str(),"",&ec); - if(ec!=FRONTIER_OK) - { - fprintf(stderr,"Error getting frontierConfig object: %s\n",frontier_getErrorMsg()); - return 2; - } - channel=frontier_createChannel2(config,&ec); - if(ec!=FRONTIER_OK) - { - fprintf(stderr,"Error creating frontier channel: %s\n",frontier_getErrorMsg()); - return 2; - } - - - char uribuf[4096]; - FrontierRSBlob *frsb; - int fd; - int n; - char *p; - const char *localname; - - const char *path=pathstring.c_str(); - snprintf(uribuf,sizeof(uribuf)-1, "Frontier/type=frontier_file:1:DEFAULT&encoding=BLOB&p1=%s",path); - ec=frontier_getRawData(channel,uribuf); - if(ec!=FRONTIER_OK) - { - fprintf(stderr,"Error getting data for %s: %s\n",path,frontier_getErrorMsg()); - return 3; - } - frsb=frontierRSBlob_open(channel,0,1,&ec); - if(ec!=FRONTIER_OK) - { - fprintf(stderr,"Error opening result blob for %s: %s\n",path,frontier_getErrorMsg()); - return 3; - } - // ignore the result type, will always be an array - (void)frontierRSBlob_getByte(frsb,&ec); - if(ec!=FRONTIER_OK) - { - fprintf(stderr,"Error getting result type for %s: %s\n",path,frontier_getErrorMsg()); - return 3; - } - n=frontierRSBlob_getInt(frsb,&ec); - if(ec!=FRONTIER_OK) - { - fprintf(stderr,"Error getting result size for %s: %s\n",path,frontier_getErrorMsg()); - return 3; - } - p=frontierRSBlob_getByteArray(frsb,n,&ec); - if(ec!=FRONTIER_OK) - { - fprintf(stderr,"Error getting result data for %s: %s\n",path,frontier_getErrorMsg()); - return 3; - } - localname=strrchr(path,'/'); - if(localname==NULL) - localname=pathstring.c_str(); - else - localname++; - fd=open(localname,O_CREAT|O_TRUNC|O_WRONLY,0666); - if(fd==-1) - { - fprintf(stderr,"Error creating %s: %s\n",localname,strerror(errno)); - ec=-1; - return 3; - } - if(write(fd,p,n)<0) - { - fprintf(stderr,"Error writing to %s: %s\n",localname,strerror(errno)); - ec=-1; - close(fd); - return 3; - } - close(fd); - printf("%d bytes written to %s\n",n,localname); - frontierRSBlob_close(frsb,&ec); - - - frontier_closeChannel(channel); - - return (ec==FRONTIER_OK); + std::cout << "Trying to copy file " << pathstring << std::endl; + std::string command="cp " +pathstring + " ."; + FILE *pipe = popen(command.c_str(), "r"); + if(!pipe) + throw cms::Exception("SherpaInterface") << "failed to copy Sherpack "; + pclose(pipe); + return 1; } + SherpackFetcher::~SherpackFetcher() { } - - } // end of namespace definition //~ using spf::SherpackFetcher;