CMS 3D CMS Logo

DTCalibrationMap.h
Go to the documentation of this file.
1 #ifndef DTCalibration_DTCalibrationMap_H
2 #define DTCalibration_DTCalibrationMap_H
3 
28 
29 
30 #include <string>
31 #include <map>
32 #include <vector>
33 
34 
35 
36 namespace edm {
37  class ParameterSet;
38 }
39 
41 public:
44 
46  virtual ~DTCalibrationMap();
47 
48  // Operations
49 
51  float tTrig(DTWireId wireId) const;
52 
54  float sigma_tTrig(DTWireId wireId) const;
55 
57  float kFactor(DTWireId wireId) const;
58 
60  float meanVDrift(DTWireId wireId) const;
61 
63  float sigma_meanVDrift(DTWireId wireId) const;
64 
65  typedef std::vector<float> CalibConsts;
66  typedef DTWireId Key;
67  typedef std::map<Key, CalibConsts>::const_iterator const_iterator;
68 
69  // Clean the map
70  void cleanTheConsts() {
71  theMap.clear();
72  }
73 
74  // Get a particular number (field) between all the calibration
75  // constants available for a particluar wire
76  float getField(DTWireId wireId, int field) const;
77 
78  // Get from the map the calibration constants for a particular wire
79  const CalibConsts* getConsts(DTWireId wireId) const;
80 
81 
82  // Add to the map the calibration consts for a given key
83  void addCell(Key wireId, const CalibConsts& calibConst);
84 
85  // Write the calibration consts to a file
86  void writeConsts(const std::string& outputFileName) const;
87 
88  // Get a key to read calibration constants for a particular wire
89  // with the given granularity
90  Key getKey(DTWireId wireId) const;
91 
92  const_iterator keyAndConsts_begin() const {
93  return theMap.begin();
94  }
95 
96  const_iterator keyAndConsts_end() const {
97  return theMap.end();
98  }
99 
100 
101 protected:
102 
103 private:
104 
105  // Specify the granularity for the calibration constants
106  enum CalibGranularity {byChamber,bySL,byLayer,byWire};
108 
109 
110  // Read the calibration consts from a file
111  void readConsts(const std::string& inputFileName);
112 
113 
114  // Check the consistency of a given key with the selected granularity
115  bool checkGranularity(Key aKey) const;
116 
117 
118  // The number of fields (calibration numbers) to be read from file
119  unsigned int nFields;
120 
121  // The name of the file containing the calibration constants
123 
124  // Define the granularity to be used for t0
126 
127  // The map between the Key and the calibration constants
128  std::map<Key, CalibConsts> theMap;
129 
130 };
131 
132 #endif
133 
std::map< Key, CalibConsts >::const_iterator const_iterator
const_iterator keyAndConsts_begin() const
const_iterator keyAndConsts_end() const
std::map< Key, CalibConsts > theMap
CalibGranularity theGranularity
std::string calibConstGranularity
std::string calibConstFileName
std::vector< float > CalibConsts
constexpr unsigned getField(const uint32_t u, const unsigned mask, const unsigned offset)
unsigned int nFields
HLT enums.