CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTCalibrationMap.h
Go to the documentation of this file.
1 #ifndef DTCalibration_DTCalibrationMap_H
2 #define DTCalibration_DTCalibrationMap_H
3 
17 
18 
19 #include <string>
20 #include <map>
21 #include <vector>
22 
23 
24 
25 namespace edm {
26  class ParameterSet;
27 }
28 
30 public:
33 
35  virtual ~DTCalibrationMap();
36 
37  // Operations
38 
40  float tTrig(DTWireId wireId) const;
41 
43  float sigma_tTrig(DTWireId wireId) const;
44 
46  float kFactor(DTWireId wireId) const;
47 
49  float meanVDrift(DTWireId wireId) const;
50 
52  float sigma_meanVDrift(DTWireId wireId) const;
53 
54  typedef std::vector<float> CalibConsts;
55  typedef DTWireId Key;
56  typedef std::map<Key, CalibConsts>::const_iterator const_iterator;
57 
58  // Clean the map
59  void cleanTheConsts() {
60  theMap.clear();
61  }
62 
63  // Get a particular number (field) between all the calibration
64  // constants available for a particluar wire
65  float getField(DTWireId wireId, int field) const;
66 
67  // Get from the map the calibration constants for a particular wire
68  const CalibConsts* getConsts(DTWireId wireId) const;
69 
70 
71  // Add to the map the calibration consts for a given key
72  void addCell(Key wireId, const CalibConsts& calibConst);
73 
74  // Write the calibration consts to a file
75  void writeConsts(const std::string& outputFileName) const;
76 
77  // Get a key to read calibration constants for a particular wire
78  // with the given granularity
79  Key getKey(DTWireId wireId) const;
80 
82  return theMap.begin();
83  }
84 
86  return theMap.end();
87  }
88 
89 
90 protected:
91 
92 private:
93 
94  // Specify the granularity for the calibration constants
97 
98 
99  // Read the calibration consts from a file
100  void readConsts(const std::string& inputFileName);
101 
102 
103  // Check the consistency of a given key with the selected granularity
104  bool checkGranularity(Key aKey) const;
105 
106 
107  // The number of fields (calibration numbers) to be read from file
108  unsigned int nFields;
109 
110  // The name of the file containing the calibration constants
112 
113  // Define the granularity to be used for t0
115 
116  // The map between the Key and the calibration constants
117  std::map<Key, CalibConsts> theMap;
118 
119 };
120 
121 #endif
122 
Key getKey(DTWireId wireId) const
void writeConsts(const std::string &outputFileName) const
std::map< Key, CalibConsts >::const_iterator const_iterator
const_iterator keyAndConsts_begin() const
const_iterator keyAndConsts_end() const
DTCalibrationMap(const edm::ParameterSet &pset)
Constructor.
std::map< Key, CalibConsts > theMap
float kFactor(DTWireId wireId) const
Return the kfactor for a particular wire.
CalibGranularity theGranularity
std::string calibConstGranularity
std::string calibConstFileName
float meanVDrift(DTWireId wireId) const
Return the mean drift velocity for a particular wire (cm/ns)
float getField(DTWireId wireId, int field) const
std::vector< float > CalibConsts
bool checkGranularity(Key aKey) const
virtual ~DTCalibrationMap()
Destructor.
void addCell(Key wireId, const CalibConsts &calibConst)
float sigma_tTrig(DTWireId wireId) const
Return the sigma of the t_trig (ns) for a particular wire.
float tTrig(DTWireId wireId) const
Return the t_trig (ns) for a particular wire.
unsigned int nFields
float sigma_meanVDrift(DTWireId wireId) const
Return the sigma of the mean drift velocity for a particular wire (cm/ns)
const CalibConsts * getConsts(DTWireId wireId) const
void readConsts(const std::string &inputFileName)