W-DHCAL Marlin Utility Classes

There are several classes available in DHCalMarlin (see TungstenDHCALCode) that provide convenience methods useful to more than a single processor. This page lists some of the available functionality.


This is in fact not a class but just a namespace with a collection of widely used convenience methods. These methods include
  • applyEnergyCut - Removes all calorimeter hits below the given energy cut
  • selectMinHitsClusters - Removes all clusters with less hits than the minimum from the vector of clusters
  • selectMaxHitsClusters - Removes all clusters with more hits than the maximum from the vector clusters
  • leastSquaresRegression - A generic two dimensional linear regression, allowing weights for the dependent variable to incorporate errors
  • straightLineTrackFit - A track fit taking hits or 3D positions as input and using two independent 2D least square linear regressions
  • calculateStandardDeviation - Calculates the standard deviation of list of (weighted) values
  • calculateClusterProperties - Calculates and sets several cluster properties (position, covariance, etc.) using the cluster hits
  • calculatePrincipalComponent - Calculates the principal component of a list of hits
  • buildHitMap - Generic tool for creating a map of index to hit, given an identifier string from the cell ID encoding
  • buildColumnHitMap - Creates a map of column to hits
  • buildRowHitMap - Creates a map of row to hits
  • buildLayerHitMap - Creates a map of layer index to hits
  • buildLayerClusterMap - Creates a map of layer index to clusters, where the layer index of a cluster is identified as the first layer with a hit from that cluster
  • compareU, compareV, compareUV, compareLayer, compareX, compareY, compareXY, compareZ, compareXYZ - Compare two hits in the specific variable (true if first lower than second)
  • consistentInU, consistentInV, consistentInUV, consistentInLayer, consistentInX, consistentInY, consistentInXY, consistentInZ, consistentInXYZ - Checks if two hits are consistent in the specific variable, given a certain maximum distance


This class gives access to geometry information of the DHCAL prototype and provides conversion methods from cell ID to position and vice versa. It defines Enums for the different module positions as well as front end board positions and provides conversion to these module positions from cell ID as well as hit positions.

This class only has a single global instance and has to be accessed like in the following example

#include "DhcalMapping.hh"
#include <iostream>

DhcalMapping* mapping = DhcalMapping::instance();
TVector3 layerPosition = mapping->getLayerPosition(10);
std::cout << "Position of layer 10" << layerPosition.z() << std::endl;


A base class to define comparison methods between two hits, allowing to write generic clustering algorithms that use the specific comparator for the metric. It also overloads the () operator to allow it to be used a the comparison method for std::sort.

The comparators can be nested. This allows to chain several simple comparisons into a complex comparison with a well defined order, e.g. sort hits by layer, row and column. Any new comparator just has to implement the myCompare and myConsistent methods. Available comparators:

The following example shows how to set up a comparator which would sort hits first in radius (x-y) and then in layer. The consistent method for two hits would return true if they are with 20 mm of each other in the XY projection and within a distance of 2 layers of each other.

#include "CalorimeterHitComparator.hh"
CalorimeterHitComparatorXY comparatorXY;
CalorimeterHitComparatorLayer comparatorLayer;


A generic nearest neighbor clustering algorithm. Takes CalorimeterHit collections as input and allows to cluster them using different typical metrics.
  • Distance in UV and Layer
  • Distance in XY and Layer
  • Distance in XYZ
In addition, any CalorimeterHitComparator can be used to define the metric (see above).


A container class for a simple 2D straight line fit including uncertainties. It provides access to y and its uncertainty using standard error propagation for any given x.


A convenience class to propagate a straight line in 3D.
  • Calculate distance of closest approach of the line to a given point
  • Calculate the point on the line with the closest distance to a given point
  • Calculate the intersection point with a given plane
Edit | Attach | Watch | Print version | History: r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r1 - 2013-07-02 - ChristianGrefe
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    CLIC All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback