diff --git a/analyses/pluginCMS/CMS_2017_I1598460.cc b/analyses/pluginCMS/CMS_2017_I1598460.cc --- a/analyses/pluginCMS/CMS_2017_I1598460.cc +++ b/analyses/pluginCMS/CMS_2017_I1598460.cc @@ -1,88 +1,73 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/FastJets.hh" -#include -/// @todo Include more projections as required, e.g. ChargedFinalState, FastJets, ZFinder... namespace Rivet { class CMS_2017_I1598460 : public Analysis { public: /// Constructor - CMS_2017_I1598460() - : Analysis("CMS_2017_I1598460") - { } + RIVET_DEFAULT_CTOR(CMS_2017_I1598460); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { const FinalState fs; - declare(fs,"FinalState"); + declare(fs, "FinalState"); FastJets fj07(fs, FastJets::ANTIKT, 0.7); - declare(fj07,"Jets"); + declare(fj07, "Jets"); /// @todo Book histograms here, e.g.: - for (int i=0; i<6; i++) - {Histo1DPtr tmp; _h_ybys.push_back(book(tmp, i+1,1,1));} + for (int i = 0; i < 6; i++) { + Histo1DPtr tmp; _h_ybys.push_back(book(tmp, i+1,1,1)); + } } /// Perform the per-event analysis void analyze(const Event& event) { const FastJets& fj = apply(event,"Jets"); - const Jets& jets = fj.jetsByPt(Cuts::pt>50.*GeV && Cuts::absrap < 5.); + const Jets& jets = fj.jetsByPt(Cuts::pt > 50*GeV && Cuts::absrap < 5); + // Require two jets - if (jets.size() < 2) - return; + if (jets.size() < 2) vetoEvent; + // Veto events if one of two leading jets |y|>3.0, otherwise // the subleading jets can become the leading jets through jet selection - if (jets[0].absrap() > 3. || jets[1].absrap() > 3.) - return; + if (jets[0].absrap() > 3 || jets[1].absrap() > 3) vetoEvent; double ystar = 0.5 * std::abs(jets[0].rap() - jets[1].rap()); double yboost = 0.5 * std::abs(jets[0].rap() + jets[1].rap()); double ptavg = 0.5 * (jets[0].pT() + jets[1].pT()); + // Compute index of histogram to be filled: yb0ys0 --> 0 yb0ys1 --> 1 ... size_t i = (size_t)yboost; size_t j = (size_t)ystar; - // index of histogram to be filled - // yb0ys0 --> 0 yb0ys1 --> 1 ... size_t idx = j + 3*i - i*(i-1)/2; - _h_ybys[idx]->fill(ptavg); + _h_ybys[idx]->fill(ptavg/GeV); } + /// Normalise histograms etc., after the run void finalize() { - - /// @todo Normalise, scale and otherwise manipulate histograms here - for (size_t k = 0; k < _h_ybys.size(); ++k) { - scale(_h_ybys[k], crossSection()/sumOfWeights()); - } + scale(_h_ybys, crossSection()/sumOfWeights()); } //@} - private: - - //@{ - std::vector _h_ybys; - //@} - + vector _h_ybys; }; - - // The hook for the plugin system DECLARE_RIVET_PLUGIN(CMS_2017_I1598460); - } diff --git a/analyses/pluginCMS/CMS_2018_I1708620.info b/analyses/pluginCMS/CMS_2018_I1708620.info --- a/analyses/pluginCMS/CMS_2018_I1708620.info +++ b/analyses/pluginCMS/CMS_2018_I1708620.info @@ -1,49 +1,51 @@ Name: CMS_2018_I1708620 Year: 2018 Summary: Energy density vs pseudorapidity in proton-proton collisions at $\sqrt{s} = 13$ TeV Experiment: CMS Collider: LHC InspireID: 1708620 Status: VALIDATED Authors: - Deniz Sunar Cerci - Sercan Sen - Salim Cerci - Caglar Zorbilmez - Ilknur Hos References: - CMS-FSQ-15-006 - CERN-EP-2018-308 - arXiv:1812.04095 [hep-ex] RunInfo: 'Inelastic, single-diffractive and non-single diffractive events at $\sqrt{s} = 13$~TeV.' Luminosity_fb: 6e-8 #Luminosity: 0.06 / nb NumEvents: 1000000 NeedCrossSection: no Beams: [p+, p+] Energies: [13000] PtCuts: Description: 'A measurement of the energy density in proton-proton collisions at a centre-of-mass energy of $\sqrt{s} = 13$ TeV is presented. The data have been recorded with the CMS experiment at the LHC during low luminosity operations in 2015. The energy density is studied as a function of pseudorapidity in the ranges $-6.6 < \eta < -5.2$ and $3.15 < |\eta| < 5.20$. The results are compared with the predictions of several models. All the models considered suggest a different shape of the pseudorapidity dependence compared to that observed in the data. A comparison with LHC proton-proton collision data at $\sqrt{s} = 0.9$ and 7 TeV confirms the compatibility of the data with the hypothesis of limiting fragmentation.' BibKey: Sirunyan:2018jwn BibTeX: '@article{Sirunyan:2018jwn, author = "Sirunyan, Albert M and others", title = "{Measurement of the energy density as a function of pseudorapidity in proton-proton collisions at $\sqrt{s}= 13$ TeV}", collaboration = "CMS", year = "2018", eprint = "1812.04095", archivePrefix = "arXiv", primaryClass = "hep-ex"", reportNumber = "CMS-FSQ-15-006, CERN-EP-2018-308", SLACcitation = "%%CITATION = ARXIV:1812.04095;%%" }' +ReleaseTests: + - $A LHC-13-Minbias diff --git a/bin/rivet-mkvaldir b/bin/rivet-mkvaldir --- a/bin/rivet-mkvaldir +++ b/bin/rivet-mkvaldir @@ -1,330 +1,330 @@ #! /usr/bin/env python """ -Build a directory with a Makefile for running a validation suit. +Build a directory with a Makefile for running an analysis validation suite """ import os, sys, shutil, commands ## Load the rivet module try: import rivet except: ## If rivet loading failed, try to bootstrap the Python path! try: # TODO: Is this a good idea? Maybe just notify the user that # their PYTHONPATH is wrong? modname = sys.modules[__name__].__file__ binpath = os.path.dirname(modname) rivetconfigpath = os.path.join(binpath, "rivet-config") rivetpypath = commands.getoutput(rivetconfigpath + " --pythonpath") sys.path.append(rivetpypath) import rivet except: sys.stderr.write("The rivet Python module could not be loaded: " + \ "is your PYTHONPATH set correctly?\n") sys.exit(5) rivet.util.check_python_version() rivet.util.set_process_name("rivet-merge") import time, datetime, logging, signal ## Parse command line options import argparse parser = argparse.ArgumentParser(description=__doc__) extragroup = parser.add_argument_group("Run settings") extragroup.add_argument("VALDIR", nargs=1, help="directory where the " + \ "Makefile for running the validation will be written") extragroup.add_argument("--hepmc-dir", dest="HEPMCDIR", default="", help="specify the directory where the HepMC files used for " + \ "the validation should be downloaded") extragroup.add_argument("--ref-dir", dest="REFDIR", default="", help="specify the directory where the reference " + \ - "yodas are located.") + ".yoda files are located.") args = parser.parse_args() #################################################### ## create and configure validation directory valdir = str(args.VALDIR[0]) hepmcdir = valdir + "/HEPMC" if not os.path.exists(valdir) and not os.path.realpath(valdir)==os.getcwd(): try: os.makedirs(valdir) except: print("Error: failed to make new directory '%s'" % valdir) sys.exit(1) if not args.HEPMCDIR : if not os.path.exists(hepmcdir): try: os.makedirs(hepmcdir) except: print("Error: failed to make new directory '%s'" % hepmcdir) sys.exit(1) else: if os.path.exists(hepmcdir) and os.path.islink(hepmcdir): out = commands.getstatusoutput("rm -f " + hepmcdir) if os.path.exists(hepmcdir): print("Error: please remove directory '" + hepmcdir + \ - "' before spicifying a new location for HepMC files") + "' before specifying a new location for HepMC files") sys.exit(1) if not os.path.exists(args.HEPMCDIR): try: os.makedirs(args.HEPMCDIR) except: print("Error: failed to make new directory '%s'" % args.HEPMCDIR) sys.exit(1) out = commands.getstatusoutput("ln -sf " + os.path.relpath(args.HEPMCDIR, valdir) + " " + hepmcdir) if os.path.exists(valdir + "/tmp"): shutil.rmtree(valdir + "/tmp") try: os.makedirs(valdir + "/tmp") except: - print("Error: failed to make tmo directory '%s'" % valdir + "/tmp") + print("Error: failed to make temp directory '%s'" % valdir + "/tmp") sys.exit(1) refdir = args.REFDIR if not refdir : rivetdatapath = commands.getoutput("rivet-config --datadir") refdir = rivetdatapath + "/refyodas" out = commands.getstatusoutput("rm -f " + valdir + "/refyodas") out = commands.getstatusoutput("ln -s " + os.path.relpath(refdir, valdir) + " " + valdir + "/refyodas") ####################################### ## Collect information from .info files valtargets = dict() hepmctargets = dict() reentranttargets = set() ## Get all analysis names all_analyses = rivet.AnalysisLoader.analysisNames() for ananame in all_analyses: ana = rivet.AnalysisLoader.getAnalysis(ananame) for line in ana.validation(): line = line.replace("$A", ananame) sublines = line.split(";"); targets = sublines[0].split(" ") targetname = targets.pop(0) if ana.reentrant(): reentranttargets.add(targetname) hepmcname = targets.pop(0) options = ""; if len(targets) > 0 : options = targets[0].strip() if len(options) > 0 and options[0] == ":": targets.pop(0) else: options = "" if len(sublines) == 1: valtargets[targetname] = "tmp/" + hepmcname + ".yoda " + \ " ".join(targets) + "\n\t$(V)echo extracting " + \ targetname + ".yoda\n\t$(V)echo " + hepmcname + " > tmp/" + \ targetname + ".log\n\t$(V)yoda2yoda -m '/_XSEC|/_EVTCOUNT|/" +\ ananame + options + \ "/' tmp/" + hepmcname + ".yoda " + targetname + ".yoda >> tmp/" + \ targetname + ".log 2>&1\n" if not hepmctargets.has_key(hepmcname): hepmctargets[hepmcname] = ananame + options else: hepmctargets[hepmcname] += " " + ananame + options else: valtargets[targetname] = "HEPMC/" + hepmcname + ".hepmc.gz " +\ " ".join(targets) if len(sublines) > 1: valtargets[targetname] += "\n\t$(V)echo running " + \ targetname + ".yoda\n\t$(V)echo " + hepmcname + " > tmp/" + \ targetname + ".log\n\t$(V)" + sublines[1].strip() +\ " >> tmp/" + targetname + ".log 2>&1\n" for subline in sublines[2:]: valtargets[targetname] += "\t" + subline.strip() + \ " >> tmp/" + targetname + ".log 2>&1\n" if len(sublines) > 1: valtargets[targetname] += "\t$(V)echo done " + \ targetname + ".yoda\n" - - + + ############################# ## Write the Makefile - + mf = open(valdir + "/Makefile", 'w') ## Header and default and help targets. mf.write("""# # This Makefile administers the validation for Rivet. # # Usage: make check # # For more information use: make help # # This Makefile was produced by rivet-mkvaldir which scanned all # analysis .info files and parsed the "Validation:" section for # determining how to use the existing HepMC validation files to obtain # a set of reference YODA files that should be reproduced. The # directory where these reference files are stored is linked to # ./refyodas . The HepMC files are stored in ./HEPMC and will be # automatically downloaded if missing. In the end of running 'make # check', the newly produced YODA files will be compared with the # reference ones. If differences are found in any histogram, the # corresponing plot will be produced by rivet-mkhtml and can be # accessed from the index.html file. # # The syntax for specifying a reference YODA in the .info file looks # as follows: # # - YODA-name HEPMC-name [:option=val] [dependencies] [[; commandline] ...] # # the YODA-name should be given without the .yoda suffix and typically # is constructed from the analysis name with some number appended if # there are more than one reference YODA for an analysis. Note that # the sting "$A" can be used anywher and will be expanded to the # analysis name. HEPMC-name should given without the ".hepmc.gz" # suffix. "dependencies" can eg. include the reference YODA from # another analysis that are referenced in any of the # "commandline"s. If no commandline is given the analysis will be run # together with a bunch of other analyses and the YODA-name.yoda will # be extracted form the resulting yoda. In this case the analysis will # be run using the "options" if present. The command lines will be used # as "make" recipes where the output YODA file can be given by $@ and the # HepMC file by $< possible options must then be included by explicitly # # When submitting a new analysis to Rivet, the "ReleaseTests:" section # of the .info file must be present and all the corresponding YODA # reference file should be be included in the submission. If a # non-standard HepMC file is needed to reproduce the reference YODA, # this must be included as well. # V=@ all: $(V)head -7 $(firstword $(MAKEFILE_LIST)) help: $(V)head -44 $(firstword $(MAKEFILE_LIST)) | grep -v "# For more information" """) ## target for comparing the generated yodas with the reference ones mf.write(""" %.diff: %.yoda $(V)rm -rf $@ $(V)if [ -e refyodas/$< ]; then \\ if ! yodadiff $< refyodas/$< -t 1e-2 -q; then \\ echo $< differs from reference yoda; \\ only=""; \\ for plot in `yodadiff $< refyodas/$< -t 1e-2 -l`; do \\ only="$$only -m $$plot"; \\ done; \\ rivet-mkhtml $$only -o $@ $< refyodas/$<:Title=ref > /dev/null 2>&1; \\ else \\ echo $< is the same as reference yoda; \\ touch $@; \\ fi \\ else \\ echo $< has no reference yoda; \\ echo "$< has no reference yoda.
" > $@; \\ fi %.reent: %.yoda $(V)rm -rf $@ $(V)logfile=$<; logfile="tmp/$${logfile/.yoda/.log}"; \\ if rivet-merge $< -o $<.yoda >> $$logfile 2>&1; then\\ if yodadiff -q $< $<.yoda ; then \\ echo $< is reentrant; \\ touch $@; \\ else \\ echo $< is NOT reentrant; \\ echo "$< was declared reentrant but is not.
" > $@; \\ fi \\ fi $(V)rm -rf $<.yoda """) ## the main check target mf.write("VALYODAS =") for ana in valtargets: mf.write(" " + ana + ".yoda") mf.write("\n\nVALDIFFS =") for ana in valtargets: mf.write(" " + ana + ".diff") mf.write("\n\nREENTRANTS =") for ana in reentranttargets: mf.write(" " + ana + ".reent") mf.write("\n\nHEPMCYODAS =") for hepmc in hepmctargets: mf.write(" tmp/" + hepmc + ".yoda") mf.write("""\n .PRECIOUS: $(VALYODAS) $(HEPMCYODAS) check: $(VALDIFFS) $(REENTRANTS) $(V)echo "

Problematic analyses in Rivet validation

" > index.html $(V)for dir in $^; do \\ if [ -d $$dir ]; then \\ for subdir in `ls $$dir`; do \\ if [ -f $$dir/$$subdir/index.html ]; then\\ echo -n "$${dir/.diff/} (" >> index.html; \\ echo -n `head -1 tmp/$${dir/.diff/.log}` >> index.html; \\ echo ")
" >> index.html; \\ fi \\ done \\ elif [ -s $$dir ]; then \\ cat $$dir >> index.html; \\ fi \\ done $(V)echo "" $(V)if test `cat index.html | wc -l` -gt 1; then \\ echo "Differences found, open index.html to inspect plots."; \\ else \\ echo "No differences found!"; \\ fi clean: rm -f $(VALYODAS) $(REENTRANTS) rm -rf tmp mkdir tmp rm -rf $(VALDIFFS) rm -f index.html %.recheck: %.yoda rm -f $< hepmc=tmp/$<; rm -f tmp/`head -1 $${hepmc/.yoda/.log}`".yoda" $(MAKE) check """) ## targets for hepmc files with several analyses for hepmc in hepmctargets: mf.write("tmp/" + hepmc + ".yoda: HEPMC/" + hepmc + ".hepmc.gz\n") mf.write("\t$(V)echo running " + hepmc + "\n") cmd = "\t$(V)rivet HEPMC/" + hepmc + ".hepmc.gz -o tmp/" + hepmc + ".yoda" for ana in hepmctargets[hepmc].split(" "): cmd += " -a " + ana mf.write(cmd + " > tmp/" + hepmc + ".log 2>&1\n") mf.write("\t$(V)echo done " + hepmc + "\n\n") ## targets for the .yoda files to be compared to the reference ones for ana in valtargets: mf.write(ana + ".yoda: " + valtargets[ana] + "\n") mf.write("\n") ## target for fetching the standard HepMC files from cernbox mf.write("HEPMC/%.hepmc.gz:\n") mf.write("\twget 'http://rivetval.web.cern.ch/rivetval/$(@F)' -O $@\n\n")