11 #include "Rivet/AnalysisHandler.hh"
12 #include "Rivet/Analysis.hh"
13 #include "Rivet/Tools/RivetYODA.hh"
22 using namespace Rivet;
28 _fileNames(pset.getParameter<std::vector<std::
string> >(
"FilesToHarvest")),
29 _sumOfWeights(pset.getParameter<std::vector<double> >(
"VSumOfWeights")),
30 _crossSections(pset.getParameter<std::vector<double> >(
"VCrossSections")),
31 _outFileName(pset.getParameter<std::
string>(
"OutputFile")),
33 _hepmcCollection(pset.getParameter<edm::
InputTag>(
"HepMCCollection")),
34 _analysisNames(pset.getParameter<std::vector<std::
string> >(
"AnalysisNames"))
48 const std::set< AnaHandle, CmpAnaHandle > & analyses =
_analysisHandler.analyses();
50 std::set< AnaHandle, CmpAnaHandle >::const_iterator ibeg = analyses.begin();
51 std::set< AnaHandle, CmpAnaHandle >::const_iterator iend = analyses.end();
52 std::set< AnaHandle, CmpAnaHandle >::const_iterator iana;
53 double xsection = -1.;
55 for (iana = ibeg; iana != iend; ++iana){
56 if ((*iana)->needsCrossSection())
57 (*iana)->setCrossSection(xsection);
76 char * cmsswbase = getenv(
"CMSSW_BASE");
77 char * cmsswrelease = getenv(
"CMSSW_RELEASE_BASE");
79 rivetref =
"RIVET_REF_PATH=" +
string(cmsswbase) +
"/src/GeneratorInterface/RivetInterface/data:" +
string(cmsswrelease) +
"/src/GeneratorInterface/RivetInterface/data";
80 rivetinfo =
"RIVET_INFO_PATH=" +
string(cmsswbase) +
"/src/GeneratorInterface/RivetInterface/data:" +
string(cmsswrelease) +
"/src/GeneratorInterface/RivetInterface/data";
81 putenv(strdup(rivetref.c_str()));
82 putenv(strdup(rivetinfo.c_str()));
99 const HepMC::GenEvent *myGenEvent = evt->GetEvent();
200 if (!yodaN)
throw cms::Exception(
"RivetHarvesting") <<
"Couldn't get <yoda> root element";
203 const string plotname = dpsE->
Attribute(
"name");
204 const string plotpath = dpsE->
Attribute(
"path");
205 if (plotpath != path && plotname != name)
214 vector<Point2D> points;
218 if (xMeasN && yMeasN) {
221 const string xcentreStr = xMeasE->
Attribute(
"value");
222 const string xerrplusStr = xMeasE->
Attribute(
"errorPlus");
223 const string xerrminusStr = xMeasE->
Attribute(
"errorMinus");
224 const string ycentreStr = yMeasE->
Attribute(
"value");
225 const string yerrplusStr = yMeasE->
Attribute(
"errorPlus");
226 const string yerrminusStr = yMeasE->
Attribute(
"errorMinus");
230 istringstream xssC(xcentreStr);
231 istringstream xssP(xerrplusStr);
232 istringstream xssM(xerrminusStr);
233 istringstream yssC(ycentreStr);
234 istringstream yssP(yerrplusStr);
235 istringstream yssM(yerrminusStr);
236 double xcentre, xerrplus, xerrminus, ycentre, yerrplus, yerrminus;
237 xssC >> xcentre; xssP >> xerrplus; xssM >> xerrminus;
238 yssC >> ycentre; yssP >> yerrplus; yssM >> yerrminus;
240 Point2D pt(xcentre, xerrminus, xerrplus, ycentre, yerrminus, yerrplus);
241 points.push_back(pt);
243 cerr <<
"Couldn't get <measurement> tag" << endl;
255 cerr << e.what() << endl;
259 throw cms::Exception(
"RivetHarvesting") <<
"could not find " << path <<
"/" << name <<
" in file " <<
filename;
T getParameter(std::string const &) const
std::vector< double > _lumis
virtual const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null not of the requested type.
virtual void beginRun(const edm::Run &, const edm::EventSetup &)
#define DEFINE_FWK_MODULE(type)
bool LoadFile(TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
virtual void endRun(const edm::Run &, const edm::EventSetup &)
std::vector< YODA::Point2D > getPoint2DValsErrs(std::string filename, std::string path, std::string name)
virtual ~RivetHarvesting()
edm::InputTag _hepmcCollection
std::vector< double > _crossSections
RivetHarvesting(const edm::ParameterSet &)
std::vector< std::string > _fileNames
const TiXmlNode * FirstChild() const
The first child of this node. Will be null if there are no children.
const char * ErrorDesc() const
Contains a textual (english) description of the error if one occurs.
std::vector< double > _sumOfWeights
const TiXmlNode * NextSibling(const std::string &_value) const
STL std::string form.
Rivet::AnalysisHandler _analysisHandler
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
virtual const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null if not of the requested type.
virtual void analyze(const edm::Event &, const edm::EventSetup &)
const char * Value() const
std::vector< std::string > _analysisNames
const char * Attribute(const char *name) const