Skip to content

unintuitive behavior in multiple-dimension hists that have multiple input collections #165

@btcardwell

Description

@btcardwell

When constructing multi-dimensional histograms with more than one input collection, the framework currently constucts the list of unique combinations of objects separately for each axis (see [0]). This implementation choice leads to unintuitive behavior in multi-dimensional histograms that use the same input collection in more than one axis expression.

If one plots muon d0 vs muon pT when using a dimuon selection, for example, one would generally want two entries per event (one for each muon). With the current implementation, the resulting plot has four entries per event: (pt_1, d0_1), (pt_1, d0_2), (pt_2, d0_1), and (pt_2, d0_2).

This undesirable behavior can be avoided by specifying an index for each axis (only plot the leading or subleading object, for example), but in the long run, it would probably be better to restructure the implementation to construct unique object combinations before evaluating the axis expressions.

[0]

// If there is more than one input collection, then fill the 2D histogram for each combination of objects.
// Warning: This histogram may be difficult to interpret!
for(vector<Leaf>::const_iterator leafX = definition.valueLookupTrees.at (0)->evaluate ().begin (); leafX != definition.valueLookupTrees.at (0)->evaluate ().end (); leafX++){
for(vector<Leaf>::const_iterator leafY = definition.valueLookupTrees.at (1)->evaluate ().begin (); leafY != definition.valueLookupTrees.at (1)->evaluate ().end (); leafY++){
double valueX = boost::get<double> (*leafX),
valueY = boost::get<double> (*leafY);
if (!IS_INVALID(definition.indexX) && leafX - definition.valueLookupTrees.at(0)->evaluate().begin() != definition.indexX)
continue;
if (!IS_INVALID(definition.indexY) && leafY - definition.valueLookupTrees.at(1)->evaluate().begin() != definition.indexY)
continue;
fill2DHistogram(definition, valueX, valueY, weight);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions