[Rivet] CMS rivet analyses

Hendrik Hoeth hendrik.hoeth at cern.ch
Mon Jul 18 16:33:16 BST 2011


Hi Albert,

thanks for the analyses. I've cleaned up the first one now
(CMS_2011_S8884919) and put it into the Rivet repository. The others
will follow. Just some comments for the future:

  - There is no need to specify histogram titles and axis labels
    in the .cc file. They go into the .plot file.

  - Use units. For example write
      fuzzyEquals(sqrtS()/GeV, 900)
    rather than
      fuzzyEquals(sqrtS(), 900)

  - I've mentioned this before, but to no avail. The histogram
    titles are really meant to be useful titles. Imagine looking at
    an analysis you are not very familiar with. There is a "$n$" on
    the x-axis and a $P_n$ on the y-axis. Which title line would you
    consider more useful:
      $|eta| < 1.5$
    or
      Charged hadron multiplicity, $|eta| < 1.5$
    Oh, and there is no need for a space before a comma in typesetting.

  - You can group things together in the .plot files, using regular
    expressions or partial names. If for example all your histograms
    have the same XLabel and YLabel, just do
      # BEGIN PLOT /CMS_2011_S8884919/d
      XLabel=n
      YLabel=$P_{n}$
      # END PLOT
    and omit those parameters in the individual PLOT sections.

  - There is no need to declare init(), analyze() and finalize() if you
    implement them three lines further down in the code, and you can
    also omit the "return;" at the end of void functions.

  - Avoid scattering unused variables throughout your code, like nch_max
    in CMS_2011_S8884919 (you set it to 400 and then never use it).
    Other examples are _h_KNO_eta05 and _h_KNO_eta24.

  - Make local variables local (rather than global member variables),
    like _sumpt in CMS_2011_S8884919. Same for _nch_in_Evt and
    _nch_in_Evt_pt500.

  - Don't include headers you don't need, like HadronicFinalState.hh.

  - Delete dead code rather than putting it into a comment. There is no
    need for someting like
      //This cut is not needed
      /*if (charged.particles().size()<1) {
        vetoEvent;
      }*/
    in the official final version of your analysis. It just makes the
    whole thing more difficult to read.

  - Think twice if you really need a _Nevt_after_cuts just for
    outputting the sum of weights as a log message in finalize() --
    especially if your analysis doesn't contain *any* cuts. If you still
    want such an output, we provide sumOfWeights() for you.

I know this might seem pedantic, but we need to maintain the analyses in
the most readable and maintainable way, and I managed to cut down that
analysis by 1/3 in size without changing any functionality.

Cheers,

   Hendrik & Andy

-- 
A man without a dream in his heart already has one foot in the grave.


More information about the Rivet mailing list