diff --git a/analyses/pluginATLAS/ATLAS_2017_I1514251_EL.plot b/analyses/pluginATLAS/ATLAS_2017_I1514251_EL.plot --- a/analyses/pluginATLAS/ATLAS_2017_I1514251_EL.plot +++ b/analyses/pluginATLAS/ATLAS_2017_I1514251_EL.plot @@ -1,97 +1,97 @@ # BEGIN PLOT /ATLAS_2017_I1514251_EL/d.. XTwosidedTicks=1 YTwosidedTicks=1 LeftMargin=1.5 XMinorTickMarks=0 LogY=1 LegendAlign=r Title=$Z \rightarrow \ell^+ \ell^-$, dressed level # END PLOT # BEGIN PLOT /ATLAS_2017_I1514251_EL/d0[4-6] XLabel=$N_\text{jets}$ XCustomMajorTicks=0 $\ge0$ 1 $\ge1$ 2 $\ge2$ 3 $\ge3$ 4 $\ge4$ 5 $\ge5$ 6 $\ge6$ 7 $\ge7$ YLabel=$\sigma(Z + \geq N_\text{jets})$ [pb] # END PLOT # BEGIN PLOT /ATLAS_2017_I1514251_EL/d0[7-9] LogY=0 XLabel=$N_\text{jets}$ XCustomMajorTicks=0 $\ge$1/$\ge$0 1 $\ge$2/$\ge$1 2 $\ge$3/$\ge$2 3 $\ge$4/$\ge$3 4 $\ge$5/$\ge$4 5 $\ge$6/$\ge$5 6 $\ge$7/$\ge$6 LegendYPos=0.3 YLabel=$\sigma(Z + \geq N_\text{jets}+1) / \sigma(Z + \geq N_\text{jets})$ # END PLOT -# BEGIN PLOT /ATLAS_2017_I1514251_EL/d0[1-3 +# BEGIN PLOT /ATLAS_2017_I1514251_EL/d0[1-3] XLabel=$N_\text{jets}$ YLabel=$\sigma(Z + N_\text{jets})$ [pb] # END PLOT # BEGIN PLOT /ATLAS_2017_I1514251_EL/d28 YLabel=d$\sigma/$d$H_\text{T}$ [pb/GeV] XLabel=$H_\text{T}$ [GeV] # END PLOT # BEGIN PLOT /ATLAS_2017_I1514251_EL/d29 YLabel=d$\sigma/$d$H_\text{T}$ [pb/GeV] XLabel=$H_\text{T}$ [GeV] # END PLOT # BEGIN PLOT /ATLAS_2017_I1514251_EL/d30 YLabel=d$\sigma/$d$H_\text{T}$ [pb/GeV] XLabel=$H_\text{T}$ [GeV] # END PLOT # BEGIN PLOT /ATLAS_2017_I1514251_EL/d2[5-7] YLabel=d$\sigma/$d$y^\text{jet}$ [pb] XLabel=$y^\text{jet}$ (leading jet) # END PLOT # BEGIN PLOT /ATLAS_2017_I1514251_EL/d1[0-2] YLabel=d$\sigma/$d$p_\text{T}^\text{jet}$ [pb/GeV] XLabel=$p_\text{T}^\text{jet}$ (== 1 jet) [GeV] # END PLOT # BEGIN PLOT /ATLAS_2017_I1514251_EL/d1[3-5] YLabel=d$\sigma/$d$p_\text{T}^\text{jet}$ [pb/GeV] XLabel=$p_\text{T}^\text{jet}$ (leading jet, $\ge$ 1 jet) [GeV] # END PLOT # BEGIN PLOT /ATLAS_2017_I1514251_EL/d1[6-8] YLabel=d$\sigma/$d$p_\text{T}^\text{jet}$ [pb/GeV] XLabel=$p_\text{T}^\text{jet}$ (leading jet, $\ge$ 2 jet) [GeV] # END PLOT # BEGIN PLOT /ATLAS_2017_I1514251_EL/d19 YLabel=d$\sigma/$d$p_\text{T}^\text{jet}$ [pb/GeV] XLabel=$p_\text{T}^\text{jet}$ (leading jet, $\ge$ 3 jet) [GeV] # END PLOT # BEGIN PLOT /ATLAS_2017_I1514251_EL/d20 YLabel=d$\sigma/$d$p_\text{T}^\text{jet}$ [pb/GeV] XLabel=$p_\text{T}^\text{jet}$ (leading jet, $\ge$ 3 jet) [GeV] # END PLOT # BEGIN PLOT /ATLAS_2017_I1514251_EL/d21 YLabel=d$\sigma/$d$p_\text{T}^\text{jet}$ [pb/GeV] XLabel=$p_\text{T}^\text{jet}$ (leading jet, $\ge$ 3 jet) [GeV] # END PLOT # BEGIN PLOT /ATLAS_2017_I1514251_EL/d2[2-4] YLabel=d$\sigma/$d$p_\text{T}^\text{jet}$ [pb/GeV] XLabel=$p_\text{T}^\text{jet}$ (leading jet, $\ge$ 4 jet) [GeV] # END PLOT # BEGIN PLOT /ATLAS_2017_I1514251_EL/d3[1-3] YLabel=d$\sigma/$d$\Delta\phi$ [pb] XLabel=$\Delta\phi$(leading, second jet) LegendAlign=l LegendXPos=0.05 # END PLOT # BEGIN PLOT /ATLAS_2017_I1514251_EL/d3[4-6] YLabel=d$\sigma/$d$M$ [pb/GeV] XLabel=$M$(leading, second jet) [GeV] # END PLOT diff --git a/analyses/pluginATLAS/ATLAS_2017_I1514251_MU.plot b/analyses/pluginATLAS/ATLAS_2017_I1514251_MU.plot --- a/analyses/pluginATLAS/ATLAS_2017_I1514251_MU.plot +++ b/analyses/pluginATLAS/ATLAS_2017_I1514251_MU.plot @@ -1,97 +1,97 @@ # BEGIN PLOT /ATLAS_2017_I1514251_MU/d.. XTwosidedTicks=1 YTwosidedTicks=1 LeftMargin=1.5 XMinorTickMarks=0 LogY=1 LegendAlign=r Title=$Z \rightarrow \ell^+ \ell^-$, dressed level # END PLOT # BEGIN PLOT /ATLAS_2017_I1514251_MU/d0[4-6] XLabel=$N_\text{jets}$ XCustomMajorTicks=0 $\ge0$ 1 $\ge1$ 2 $\ge2$ 3 $\ge3$ 4 $\ge4$ 5 $\ge5$ 6 $\ge6$ 7 $\ge7$ YLabel=$\sigma(Z + \geq N_\text{jets})$ [pb] # END PLOT # BEGIN PLOT /ATLAS_2017_I1514251_MU/d0[7-9] LogY=0 XLabel=$N_\text{jets}$ XCustomMajorTicks=0 $\ge$1/$\ge$0 1 $\ge$2/$\ge$1 2 $\ge$3/$\ge$2 3 $\ge$4/$\ge$3 4 $\ge$5/$\ge$4 5 $\ge$6/$\ge$5 6 $\ge$7/$\ge$6 LegendYPos=0.3 YLabel=$\sigma(Z + \geq N_\text{jets}+1) / \sigma(Z + \geq N_\text{jets})$ # END PLOT -# BEGIN PLOT /ATLAS_2017_I1514251_MU/d0[1-3 +# BEGIN PLOT /ATLAS_2017_I1514251_MU/d0[1-3] XLabel=$N_\text{jets}$ YLabel=$\sigma(Z + N_\text{jets})$ [pb] # END PLOT # BEGIN PLOT /ATLAS_2017_I1514251_MU/d28 YLabel=d$\sigma/$d$H_\text{T}$ [pb/GeV] XLabel=$H_\text{T}$ [GeV] # END PLOT # BEGIN PLOT /ATLAS_2017_I1514251_MU/d29 YLabel=d$\sigma/$d$H_\text{T}$ [pb/GeV] XLabel=$H_\text{T}$ [GeV] # END PLOT # BEGIN PLOT /ATLAS_2017_I1514251_MU/d30 YLabel=d$\sigma/$d$H_\text{T}$ [pb/GeV] XLabel=$H_\text{T}$ [GeV] # END PLOT # BEGIN PLOT /ATLAS_2017_I1514251_MU/d2[5-7] YLabel=d$\sigma/$d$y^\text{jet}$ [pb] XLabel=$y^\text{jet}$ (leading jet) # END PLOT # BEGIN PLOT /ATLAS_2017_I1514251_MU/d1[0-2] YLabel=d$\sigma/$d$p_\text{T}^\text{jet}$ [pb/GeV] XLabel=$p_\text{T}^\text{jet}$ (== 1 jet) [GeV] # END PLOT # BEGIN PLOT /ATLAS_2017_I1514251_MU/d1[3-5] YLabel=d$\sigma/$d$p_\text{T}^\text{jet}$ [pb/GeV] XLabel=$p_\text{T}^\text{jet}$ (leading jet, $\ge$ 1 jet) [GeV] # END PLOT # BEGIN PLOT /ATLAS_2017_I1514251_MU/d1[6-8] YLabel=d$\sigma/$d$p_\text{T}^\text{jet}$ [pb/GeV] XLabel=$p_\text{T}^\text{jet}$ (leading jet, $\ge$ 2 jet) [GeV] # END PLOT # BEGIN PLOT /ATLAS_2017_I1514251_MU/d19 YLabel=d$\sigma/$d$p_\text{T}^\text{jet}$ [pb/GeV] XLabel=$p_\text{T}^\text{jet}$ (leading jet, $\ge$ 3 jet) [GeV] # END PLOT # BEGIN PLOT /ATLAS_2017_I1514251_MU/d20 YLabel=d$\sigma/$d$p_\text{T}^\text{jet}$ [pb/GeV] XLabel=$p_\text{T}^\text{jet}$ (leading jet, $\ge$ 3 jet) [GeV] # END PLOT # BEGIN PLOT /ATLAS_2017_I1514251_MU/d21 YLabel=d$\sigma/$d$p_\text{T}^\text{jet}$ [pb/GeV] XLabel=$p_\text{T}^\text{jet}$ (leading jet, $\ge$ 3 jet) [GeV] # END PLOT # BEGIN PLOT /ATLAS_2017_I1514251_MU/d2[2-4] YLabel=d$\sigma/$d$p_\text{T}^\text{jet}$ [pb/GeV] XLabel=$p_\text{T}^\text{jet}$ (leading jet, $\ge$ 4 jet) [GeV] # END PLOT # BEGIN PLOT /ATLAS_2017_I1514251_MU/d3[1-3] YLabel=d$\sigma/$d$\Delta\phi$ [pb] XLabel=$\Delta\phi$(leading, second jet) LegendAlign=l LegendXPos=0.05 # END PLOT # BEGIN PLOT /ATLAS_2017_I1514251_MU/d3[4-6] YLabel=d$\sigma/$d$M$ [pb/GeV] XLabel=$M$(leading, second jet) [GeV] # END PLOT diff --git a/bin/rivet-buildplugin.in b/bin/rivet-buildplugin.in old mode 100644 new mode 100755 --- a/bin/rivet-buildplugin.in +++ b/bin/rivet-buildplugin.in @@ -1,302 +1,302 @@ #!/usr/bin/env bash ## -*- sh -*- ## @configure_input@ ## Get program name PROG=$(basename $0) ## Default value for num_jobs is all available cores let num_jobs=$(getconf _NPROCESSORS_ONLN) function usage { cat <<-EOF $PROG: Compile a Rivet analysis plugin library from one or more sources Usage: $PROG [options] [libname] source1 [...] [compiler_flags] can be a path, provided the filename is of the form 'Rivet*.so' If is not specified, the default name is 'RivetAnalysis.so'. To make special build variations you can add appropriate compiler flags to the arguments and these will be passed directly to the compiler. For example, for a debug build of your plugin library, add '-g', and for a 32 bit build on a 64 bit system add '-m32'. Options: -h | --help: display this help message -j NUM number of parallel compile jobs [$num_jobs] -r | --with-root: add ROOT link options (requires root-config on system) -n | --cmd | --dry-run: just print the generated commands, do not execute -k | --keep: keep intermediate files -v | --verbose: write out debug info EOF } ################## ## Option handling # http://www.bahmanm.com/blogs/command-line-options-how-to-parse-in-bash-using-getopt ## Translate long options to short # https://stackoverflow.com/a/5255468 args=() for arg do case "$arg" in # translate our long options --help ) args+=("-h");; --with-root ) args+=("-r");; --cmd | --dry-run ) args+=("-n");; --keep ) args+=("-k");; --verbose ) args+=("-v");; # pass through anything else * ) args+=("$arg");; esac done ## Reset the translated args set -- "${args[@]}" ## Now we can process with getopt while getopts ":hj:rnkv" opt; do case $opt in h) usage; exit 0 ;; j) num_jobs=$OPTARG ;; r) with_root=yes ;; n) only_show=yes ;; k) keep_tmps=yes ;; v) debug=yes ;; \?) echo "Unknown option -$OPTARG" >&2; exit 1 ;; :) echo "Option -$OPTARG requires an argument" >&2; exit 1 ;; esac done ## Remove options shift $((OPTIND-1)) ## Check num_jobs is a number if [[ ! $num_jobs -eq $num_jobs ]]; then echo "Unknown argument to -j" >&2; exit 1 fi if [[ $num_jobs -lt 1 ]]; then echo "Number of jobs must be positive" >&2; exit 1 fi #echo "$with_root" #echo "$only_show" #echo "$@" ## Need some args left at this point if [[ $# -lt 1 ]]; then usage >&2 exit 1 fi ## Get and check the target library name libname="$1" match1=$(basename "$libname" | egrep '^.*\.so') match2=$(basename "$libname" | egrep '^Rivet.*\.so') if test -n "$match1"; then if test -z "$match2"; then echo "Library name '$libname' does not have the required 'Rivet*.so' name pattern" >&2 exit 1 fi ## If we're using the first arg as the library name, shift it off the positional list shift else if [[ -z $only_show ]]; then echo "Using default library name 'RivetAnalysis.so'" fi libname="RivetAnalysis.so" fi ## Again need some args left at this point if [[ $# -lt 1 ]]; then usage >&2 exit 1 fi ################## ## Now assemble the build flags ## These variables need to exist, may be used in later substitutions ## Note no use of $DESTDIR... we ignore it so that destdir can be used ## for temp installs later copied to / prefix="@prefix@" exec_prefix="@exec_prefix@" datarootdir="@datarootdir@" ## Work out shared library build flags by platform if [[ $(uname) == "Darwin" ]]; then ## Mac OS X shared_flags="-undefined dynamic_lookup -bundle" else ## Unix shared_flags="-shared -fPIC" fi ## Get Rivet system C++ compiler (fall back to $CXX and then g++ if needed) mycxx=g++ rivetcxx=$(which $(echo "@RIVETCXX@" | awk '{print $1}') 2> /dev/null) abscxx=$(which "$CXX" 2> /dev/null) if [[ -x "$rivetcxx" ]]; then mycxx="@CXX@" elif [[ -x "$abscxx" ]]; then mycxx="$CXX" fi ## Get Rivet system C++ compiler flags if [[ -n "@AM_CXXFLAGS@" ]]; then mycxxflags="@AM_CXXFLAGS@" fi if [[ -n "@RIVETCXXFLAGS@" ]]; then mycxxflags="$mycxxflags @RIVETCXXFLAGS@" fi ## Get Rivet system C preprocessor flags (duplicating that in rivet-config.in) if [[ -n "$RIVET_BUILDPLUGIN_BEFORE_INSTALL" ]]; then irivet="@top_srcdir@/include" else irivet="@includedir@" fi test -n "$irivet" && mycppflags="$mycppflags -I${irivet}" +iyoda="@YODAINCPATH@" +test -n "$iyoda" && mycppflags="$mycppflags -I${iyoda}" ihepmc="@HEPMCINCPATH@" test -n "$ihepmc" && mycppflags="$mycppflags -I${ihepmc}" -iyoda="@YODAINCPATH@" -test -n "$iyoda" && mycppflags="$mycppflags -I${iyoda}" ifastjet="@FASTJETINCPATH@" test -n "$ifastjet" && mycppflags="$mycppflags -I${ifastjet}" # igsl="@GSLINCPATH@" # test -n "$igsl" && mycppflags="$mycppflags -I${igsl}" # iboost="@BOOST_CPPFLAGS@" # test -n "$iboost" && mycppflags="$mycppflags ${iboost}" ## Get Rivet system linker flags (duplicating that in rivet-config.in) myldflags="" if [[ -n "$RIVET_BUILDPLUGIN_BEFORE_INSTALL" ]]; then lrivet="@top_builddir@/src/.libs" else lrivet="@libdir@" fi test -n "$lrivet" && myldflags="$myldflags -L${lrivet}" lhepmc="@HEPMCLIBPATH@" test -n "$lhepmc" && myldflags="$myldflags -L${lhepmc}" lyoda="@YODALIBPATH@" test -n "$lyoda" && myldflags="$myldflags -L${lyoda}" lfastjet="@FASTJETCONFIGLIBADD@" test -n "$lfastjet" && myldflags="$myldflags ${lfastjet}" ## Detect whether the linker accepts the --no-as-needed flag and prepend the linker flag with it if possible if (cd /tmp && echo -e 'int main() { return 0; }' > $$.cc; $mycxx -Wl,--no-as-needed $$.cc -o $$ 2> /dev/null); then myldflags="-Wl,--no-as-needed $myldflags" fi ## Get ROOT flags if needed if [[ -n $with_root ]]; then rootcxxflags=$(root-config --cflags 2> /dev/null) rootldflags=$(root-config --libs 2> /dev/null) fi ################## ## Assemble and run build machinery ## Split sources into buckets, one for each core let idx=1 sources="" for src in "$@" do if [[ -s "$src" ]]; then sources="$sources $src" buckets[$idx]="${buckets[$idx]} $src" let idx=(idx%$num_jobs)+1 else if [[ ${src:0:1} == "-" ]]; then ## Found a user option usercxxflags="$usercxxflags $src" else echo "Warning: $src not found" >&2 fi fi done ## May be less than num_jobs let num_buckets=${#buckets[@]} if [[ $num_buckets -lt 1 ]]; then echo "Error: no source files found" >&2 exit 2 fi ## Loop over buckets for idx in $(seq 1 $num_buckets); do # DO NOT SIMPLIFY, the OS X mktemp can't deal with suffixes directly tmpfile="$(mktemp tmp.XXXXXXXX)" mv "$tmpfile" "$tmpfile.cc" tmpfile="$tmpfile.cc" for i in $(echo ${buckets[$idx]}); do #< find the real way to do this! echo "#line 1 \"$i\"" >> "$tmpfile" cat "$i" >> "$tmpfile" done if [[ -s "$tmpfile" ]]; then srcnames[$idx]="$tmpfile" fi done objnames=("${srcnames[@]/.cc/.o}") if [[ -z "$debug" ]]; then silencer="@"; fi tmpmakefile=$(mktemp Makefile.tmp.XXXXXXXXXX) cat > "$tmpmakefile" < range) { return x >= range.first && ( x < range.second || ( x == 100.0 && x == range.second ) ); } /// @brief Copy information from @a other PercentileBase void copyFrom(const PercentileBase & other) { _ana = other._ana; _projName = other._projName; _cent = other._cent; } /// @brief check if @a other PercentileBase is compatible with this. bool compatible(const PercentileBase & other) const { return ( _ana == other._ana && _projName == other._projName && _cent == other._cent ); } /// @breif return the list of centrality bins. /// /// The size of this vector is the same as number of internal /// analysis objects in the sub class PercentileTBase. const vector< pair > & centralities() const { return _cent; } protected: /// The Analysis object to which This object is assigned. Analysis * _ana; /// The name of the CentralityProjection. string _projName; /// The list of indices of the analysis objects that are to be /// filled in the current event. vector _activeBins; /// The list of centrality intervals, one for each included analysis /// object. vector > _cent; }; /// @brief PercentileTBase is the base class of all Percentile classes. /// /// This base class contains all template-dependent variables and /// infrastructure needed for Percentile and PercentileXaxis. template class PercentileTBase : public PercentileBase { public: /// Convenient typedef. typedef typename T::Ptr TPtr; /// @brief the main constructor /// /// requiring a pointer, @a ana, to the Analysis to which this /// object belongs and the name of the CentralityProjection, @a /// projname, to be used. PercentileTBase(Analysis * ana, string projName) : PercentileBase(ana, projName), _histos() {} /// @brief Default constructor. PercentileTBase() {} /// @brief Empty destructor. ~PercentileTBase() {} /// @brief add a new percentile bin. /// /// Add an analysis objects which are clones of @a temp that should /// be active for events in the given centrality bin @a /// cent. Several analysis objects may be added depending on the /// number of alternative centrality definitions in the /// CentralityProjection @a proj. This function is common for /// Percentile and PecentileXaxis, but for the latter the @a cent /// argument should be left to its default. void add(shared_ptr ao, CounterPtr cnt, pair cent = {0.0, 100.0} ) { _cent.push_back(cent); _histos.push_back( { ao, cnt } ); } /// @brief Copy the information from an @a other Percentile object. /// /// This function differs from a simple assignement as the @a other /// analysis objects are not copied, but supplied separately through /// @a tv. bool add(const PercentileBase & other, const vector & tv) { copyFrom(other); if ( tv.size() != _cent.size() ) return false; for ( auto t : tv ) _histos.push_back( { t, make_shared() } ); return true; } /// @brief initialize for a new event. Select which AnalysisObjects /// should be filled for this event. Keeps track of the number of /// events seen for each centrality bin and AnalysisAbject. - void init(const Event & event) { + bool init(const Event & event) { selectBins(event); for (const auto bin : _activeBins) _histos[bin].second->fill(event.weight()); + return !_activeBins.empty(); } /// @brief Normalize each AnalysisObject /// /// by dividing by the sum of the events seen for each centrality /// bin. void normalizePerEvent() { for (const auto &hist : _histos) if ( hist.second->numEntries() > 0 && hist.first->numEntries() > 0) hist.first->scaleW(1./hist.second->val()); } /// Simple scaling of each AnalysisObject. void scale(float scale) { for (const auto hist : _histos) hist.first->scaleW(scale); } /// Execute a function for each AnalysisObject. void exec(function f) { for ( auto hist : _histos) f(hist); } /// @brief Access the underlyng AnalysisObjects /// /// The returned vector contains a pair, where the first member is /// the AnalysisObject and the second is a counter keeping track of /// the sum of event weights for which the AnalysisObject has been /// active. const vector, shared_ptr > > & analysisObjects() const{ return _histos; } protected: /// The returned vector contains a pair, where the first member is /// the AnalysisObject and the second is a counter keeping track of /// the sum of event weights for which the AnalysisObject has been /// active. vector, shared_ptr > > _histos; }; /// @brief The Percentile class for centrality binning. /// /// The Percentile class automatically handles the selection of which /// AnalysisObject(s) should be filled depending on the centrality of /// an event. It cointains a list of AnalysisObjects, one for each /// centrality bin requested (note that these bins may be overlapping) /// and each centrality definition is available in the assigned /// CentralityProjection. template class Percentile : public PercentileTBase { public: /// @brief the main constructor /// /// requiring a pointer, @a ana, to the Analysis to which this /// object belongs and the name of the CentralityProjection, @a /// projname, to be used. Percentile(Analysis * ana, string projName) : PercentileTBase(ana, projName) {} /// @brief Default constructor. Percentile() {} /// @brief Empty destructor. ~Percentile() {} /// Needed to access members of the templated base class. using PercentileTBase::_histos; /// Needed to access members of the templated base class. using PercentileTBase::_activeBins; /// Fill each AnalysisObject selected in the last call to /// PercentileTBaseinit template void fill(Args... args) { for (const auto bin : _activeBins) { _histos[bin].first->fill(args...); } } /// Subtract the contents fro another Pecentile. Percentile &operator-=(const Percentile &rhs) { const int nCent = _histos.size(); for (int iCent = 0; iCent < nCent; ++iCent) { *_histos[iCent].first -= *rhs._histos[iCent].first; } } /// Add the contents fro another Pecentile. Percentile &operator+=(const Percentile &rhs) { const int nCent = _histos.size(); for (int iCent = 0; iCent < nCent; ++iCent) { *_histos[iCent].first += *rhs._histos[iCent].first; /// @todo should this also add the Counter? } } /// Make this object look like a pointer. Percentile *operator->() { return this; } /// Pointer to member operator. Percentile &operator->*(function f) { exec(f); return *this; } }; /// @brief The PercentileXaxis class for centrality binning. /// /// The PercentileXaxis class automatically handles the x-axis of an /// AnalysisObject when the x-axis is to be the centrality of an /// event. This could also be done by eg. filling directly a Histo1D /// with the result of a CentralityProjection. However, since the /// CentralityProjection may handle several centrality definitions at /// the same time it is reasonable to instead use /// PercentileXaxis which will fill one histogram for each /// centrality definition. /// /// Operationally this class works like the Percentile class, but only /// one centrality bin (0-100) is included. When fill()ed the first /// argument is always given by the assigned CentralityProjection. template class PercentileXaxis : public PercentileTBase { public: /// @brief the main constructor /// /// requiring a pointer, @a ana, to the Analysis to which this /// object belongs and the name of the CentralityProjection, @a /// projname, to be used. PercentileXaxis(Analysis * ana, string projName) : PercentileTBase(ana, projName) {} /// @brief Default constructor. PercentileXaxis() {} /// @brief Empty destructor. ~PercentileXaxis() {} /// Needed to access members of the templated base class. using PercentileTBase::_histos; /// Needed to access members of the templated base class. using PercentileTBase::_activeBins; /// Fill each AnalysisObject selected in the last call to /// PercentileTBaseinit template void fill(Args... args) { for (const auto bin : _activeBins) { _histos[bin].first->fill(bin, args...); } } /// Subtract the contents fro another PecentileXaxis. PercentileXaxis &operator-=(const PercentileXaxis &rhs) { const int nCent = _histos.size(); for (int iCent = 0; iCent < nCent; ++iCent) { *_histos[iCent].first -= *rhs._histos[iCent].first; } } /// Add the contents fro another PecentileXaxis. PercentileXaxis &operator+=(const PercentileXaxis &rhs) { const int nCent = this->_histos.size(); for (int iCent = 0; iCent < nCent; ++iCent) { *_histos[iCent].first += *rhs._histos[iCent].first; } } /// Make this object look like a pointer. PercentileXaxis *operator->() { return this; } /// Pointer to member operator. PercentileXaxis &operator->*(function f) { exec(f); return *this; } }; /// @name Combining Percentiles following the naming of functions for // the underlying AnalysisObjects: global operators // @{ template Percentile::RefT> divide(const Percentile numer, const Percentile denom) { typedef typename ReferenceTraits::RefT ScatT; Percentile ret; vector scatters; assert( numer.compatible(denom) ); for ( int i = 0, N = numer.analysisObjects().size(); i < N; ++i ) scatters.push_back(make_shared(divide(*numer.analysisObjects()[i].first, *denom.analysisObjects()[i].first))); ret.add(numer, scatters); return ret; } template Percentile::RefT> divide(const Percentile numer, const Percentile::RefT> denom) { typedef typename ReferenceTraits::RefT ScatT; Percentile ret; vector scatters; assert( numer.compatible(denom) ); for ( int i = 0, N = numer.analysisObjects().size(); i < N; ++i ) scatters.push_back(make_shared(divide(*numer.analysisObjects()[i].first, *denom.analysisObjects()[i].first))); ret.add(numer, scatters); return ret; } template Percentile::RefT> divide(const Percentile::RefT> numer, const Percentile denom) { typedef typename ReferenceTraits::RefT ScatT; Percentile::RefT> ret; vector scatters; assert( numer.compatible(denom) ); for ( int i = 0, N = numer.analysisObjects().size(); i < N; ++i ) scatters.push_back(make_shared(divide(*numer.analysisObjects()[i].first, *denom.analysisObjects()[i].first))); ret.add(numer, scatters); return ret; } template Percentile add(const Percentile pctla, const Percentile pctlb) { Percentile ret; vector aos; assert( pctla.compatible(pctlb) ); for ( int i = 0, N = pctla.analysisObjects().size(); i < N; ++i ) aos.push_back(make_shared(add(*pctla.analysisObjects()[i].first, *pctlb.analysisObjects()[i].first))); ret.add(pctla, aos); return ret; } template Percentile::RefT> add(const Percentile pctla, const Percentile::RefT> pctlb) { typedef typename ReferenceTraits::RefT ScatT; Percentile ret; vector scatters; assert( pctla.compatible(pctlb) ); for ( int i = 0, N = pctla.analysisObjects().size(); i < N; ++i ) scatters.push_back(make_shared(add(*pctla.analysisObjects()[i].first, *pctlb.analysisObjects()[i].first))); ret.add(pctla, scatters); return ret; } template Percentile::RefT> add(const Percentile::RefT> pctla, const Percentile pctlb) { typedef typename ReferenceTraits::RefT ScatT; Percentile ret; vector scatters; assert( pctla.compatible(pctlb) ); for ( int i = 0, N = pctla.analysisObjects().size(); i < N; ++i ) scatters.push_back(make_shared(add(*pctla.analysisObjects()[i].first, *pctlb.analysisObjects()[i].first))); ret.add(pctla, scatters); return ret; } template Percentile subtract(const Percentile pctla, const Percentile pctlb) { Percentile ret; vector aos; assert( pctla.compatible(pctlb) ); for ( int i = 0, N = pctla.analysisObjects().size(); i < N; ++i ) aos.push_back(make_shared(subtract(*pctla.analysisObjects()[i].first, *pctlb.analysisObjects()[i].first))); ret.add(pctla, aos); return ret; } template Percentile::RefT> subtract(const Percentile pctla, const Percentile::RefT> pctlb) { typedef typename ReferenceTraits::RefT ScatT; Percentile ret; vector scatters; assert( pctla.compatible(pctlb) ); for ( int i = 0, N = pctla.analysisObjects().size(); i < N; ++i ) scatters.push_back(make_shared(subtract(*pctla.analysisObjects()[i].first, *pctlb.analysisObjects()[i].first))); ret.add(pctla, scatters); return ret; } template Percentile::RefT> subtract(const Percentile::RefT> pctla, const Percentile pctlb) { typedef typename ReferenceTraits::RefT ScatT; Percentile ret; vector scatters; assert( pctla.compatible(pctlb) ); for ( int i = 0, N = pctla.analysisObjects().size(); i < N; ++i ) scatters.push_back(make_shared(subtract(*pctla.analysisObjects()[i].first, *pctlb.analysisObjects()[i].first))); ret.add(pctla, scatters); return ret; } template Percentile::RefT> multiply(const Percentile pctla, const Percentile::RefT> pctlb) { typedef typename ReferenceTraits::RefT ScatT; Percentile ret; vector scatters; assert( pctla.compatible(pctlb) ); for ( int i = 0, N = pctla.analysisObjects().size(); i < N; ++i ) scatters.push_back(make_shared(multiply(*pctla.analysisObjects()[i].first, *pctlb.analysisObjects()[i].first))); ret.add(pctla, scatters); return ret; } template Percentile::RefT> multiply(const Percentile::RefT> pctla, const Percentile pctlb) { typedef typename ReferenceTraits::RefT ScatT; Percentile ret; vector scatters; assert( pctla.compatible(pctlb) ); for ( int i = 0, N = pctla.analysisObjects().size(); i < N; ++i ) scatters.push_back(make_shared(multiply(*pctla.analysisObjects()[i].first, *pctlb.analysisObjects()[i].first))); ret.add(pctla, scatters); return ret; } template PercentileXaxis::RefT> divide(const PercentileXaxis numer, const PercentileXaxis denom) { typedef typename ReferenceTraits::RefT ScatT; PercentileXaxis ret; vector scatters; assert( numer.compatible(denom) ); for ( int i = 0, N = numer.analysisObjects().size(); i < N; ++i ) scatters.push_back(make_shared(divide(*numer.analysisObjects()[i].first, *denom.analysisObjects()[i].first))); ret.add(numer, scatters); return ret; } template PercentileXaxis::RefT> divide(const PercentileXaxis numer, const PercentileXaxis::RefT> denom) { typedef typename ReferenceTraits::RefT ScatT; PercentileXaxis ret; vector scatters; assert( numer.compatible(denom) ); for ( int i = 0, N = numer.analysisObjects().size(); i < N; ++i ) scatters.push_back(make_shared(divide(*numer.analysisObjects()[i].first, *denom.analysisObjects()[i].first))); ret.add(numer, scatters); return ret; } template PercentileXaxis::RefT> divide(const PercentileXaxis::RefT> numer, const PercentileXaxis denom) { typedef typename ReferenceTraits::RefT ScatT; PercentileXaxis::RefT> ret; vector scatters; assert( numer.compatible(denom) ); for ( int i = 0, N = numer.analysisObjects().size(); i < N; ++i ) scatters.push_back(make_shared(divide(*numer.analysisObjects()[i].first, *denom.analysisObjects()[i].first))); ret.add(numer, scatters); return ret; } template PercentileXaxis add(const PercentileXaxis pctla, const PercentileXaxis pctlb) { PercentileXaxis ret; vector aos; assert( pctla.compatible(pctlb) ); for ( int i = 0, N = pctla.analysisObjects().size(); i < N; ++i ) aos.push_back(make_shared(add(*pctla.analysisObjects()[i].first, *pctlb.analysisObjects()[i].first))); ret.add(pctla, aos); return ret; } template PercentileXaxis::RefT> add(const PercentileXaxis pctla, const PercentileXaxis::RefT> pctlb) { typedef typename ReferenceTraits::RefT ScatT; PercentileXaxis ret; vector scatters; assert( pctla.compatible(pctlb) ); for ( int i = 0, N = pctla.analysisObjects().size(); i < N; ++i ) scatters.push_back(make_shared(add(*pctla.analysisObjects()[i].first, *pctlb.analysisObjects()[i].first))); ret.add(pctla, scatters); return ret; } template PercentileXaxis::RefT> add(const PercentileXaxis::RefT> pctla, const PercentileXaxis pctlb) { typedef typename ReferenceTraits::RefT ScatT; PercentileXaxis ret; vector scatters; assert( pctla.compatible(pctlb) ); for ( int i = 0, N = pctla.analysisObjects().size(); i < N; ++i ) scatters.push_back(make_shared(add(*pctla.analysisObjects()[i].first, *pctlb.analysisObjects()[i].first))); ret.add(pctla, scatters); return ret; } template PercentileXaxis subtract(const PercentileXaxis pctla, const PercentileXaxis pctlb) { PercentileXaxis ret; vector aos; assert( pctla.compatible(pctlb) ); for ( int i = 0, N = pctla.analysisObjects().size(); i < N; ++i ) aos.push_back(make_shared(subtract(*pctla.analysisObjects()[i].first, *pctlb.analysisObjects()[i].first))); ret.add(pctla, aos); return ret; } template PercentileXaxis::RefT> subtract(const PercentileXaxis pctla, const PercentileXaxis::RefT> pctlb) { typedef typename ReferenceTraits::RefT ScatT; PercentileXaxis ret; vector scatters; assert( pctla.compatible(pctlb) ); for ( int i = 0, N = pctla.analysisObjects().size(); i < N; ++i ) scatters.push_back(make_shared(subtract(*pctla.analysisObjects()[i].first, *pctlb.analysisObjects()[i].first))); ret.add(pctla, scatters); return ret; } template PercentileXaxis::RefT> subtract(const PercentileXaxis::RefT> pctla, const PercentileXaxis pctlb) { typedef typename ReferenceTraits::RefT ScatT; PercentileXaxis ret; vector scatters; assert( pctla.compatible(pctlb) ); for ( int i = 0, N = pctla.analysisObjects().size(); i < N; ++i ) scatters.push_back(make_shared(subtract(*pctla.analysisObjects()[i].first, *pctlb.analysisObjects()[i].first))); ret.add(pctla, scatters); return ret; } template PercentileXaxis::RefT> multiply(const PercentileXaxis pctla, const PercentileXaxis::RefT> pctlb) { typedef typename ReferenceTraits::RefT ScatT; PercentileXaxis ret; vector scatters; assert( pctla.compatible(pctlb) ); for ( int i = 0, N = pctla.analysisObjects().size(); i < N; ++i ) scatters.push_back(make_shared(multiply(*pctla.analysisObjects()[i].first, *pctlb.analysisObjects()[i].first))); ret.add(pctla, scatters); return ret; } template PercentileXaxis::RefT> multiply(const PercentileXaxis::RefT> pctla, const PercentileXaxis pctlb) { typedef typename ReferenceTraits::RefT ScatT; PercentileXaxis ret; vector scatters; assert( pctla.compatible(pctlb) ); for ( int i = 0, N = pctla.analysisObjects().size(); i < N; ++i ) scatters.push_back(make_shared(multiply(*pctla.analysisObjects()[i].first, *pctlb.analysisObjects()[i].first))); ret.add(pctla, scatters); return ret; } template Percentile operator+(const Percentile pctla, const Percentile pctlb) { return add(pctla, pctlb); } template Percentile operator-(const Percentile pctla, const Percentile pctlb) { return subtract(pctla, pctlb); } template Percentile::RefT> operator/(const Percentile numer, const Percentile denom) { return divide(numer, denom); } template PercentileXaxis operator+(const PercentileXaxis pctla, const PercentileXaxis pctlb) { return add(pctla, pctlb); } template PercentileXaxis operator-(const PercentileXaxis pctla, const PercentileXaxis pctlb) { return subtract(pctla, pctlb); } template PercentileXaxis::RefT> operator/(const PercentileXaxis numer, const PercentileXaxis denom) { return divide(numer, denom); } } #endif