AlignableIndexer

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
#ifndef Alignment_CommonAlignment_Counters_H
#define Alignment_CommonAlignment_Counters_H

/** \class AlignableIndexer
 *
 *  Class to store a list of index functions.
 *
 *  A counter is a pointer to a function that returns the number of an
 *  alignable based on its id.
 *  The number of an alignable is given by its position within its parent.
 *  User gets a counter using its structure type via AlignableIndexer::get(type).
 *  Each sub-system has its own concrete counter class implementation.
 *  
 *  $Date: 2007/10/18 09:41:07 $
 *  $Revision: 1.2 $
 *  \author Chung Khim Lae
 *
 *  Last Update: Max Stark
 *         Date: Wed, 17 Feb 2016 15:39:06 CET
 */

#include <map>
#include <functional>

#include "Alignment/CommonAlignment/interface/StructureType.h"
#include "Alignment/CommonAlignment/interface/AlignableObjectId.h"
#include "CondFormats/Alignment/interface/Definitions.h"

class TrackerTopology;
namespace align {
  using Counter = std::function<unsigned int(align::ID)>;
}

class AlignableIndexer {
public:
  /// Build the counters map.
  AlignableIndexer() = default;
  AlignableIndexer(const AlignableIndexer&) = default;
  AlignableIndexer& operator=(const AlignableIndexer&) = default;
  AlignableIndexer(AlignableIndexer&&) = default;
  AlignableIndexer& operator=(AlignableIndexer&&) = default;
  virtual ~AlignableIndexer() = default;

  /// Get a counter based on its structure type.
  virtual align::Counter get(align::StructureType, const AlignableObjectId&) const;

protected:
  std::map<align::StructureType, align::Counter> theCounters;
};

#endif