![]() |
|
|||
File indexing completed on 2024-04-06 11:58:25
0001 #ifndef DTCalibration_DTCalibrationMap_H 0002 #define DTCalibration_DTCalibrationMap_H 0003 0004 /** \class DTCalibrationMap 0005 * Allow saving and retrieving of calibration constants to/from txt file. 0006 * This was originally provided for backward compatibility with the ORCA MuBarDigiParameters file. 0007 * Can be used to save an arbitrary number of constants with the 0008 * needed granularity and to retrieve them back using the wireId. 0009 * Current field allocation: fields for each key are allocated to: 0010 * --First block: legacy descriptors-- 0011 * [0] ttrig 0012 * [1] sigma_ttrig (obsolete) 0013 * [2] kfactor (obsolete) 0014 * [3] vdrift 0015 * [4] sigma_vdrift (obsolete, was formerly hacked to include reoslution) 0016 * [5] t0 0017 * [6] t0rms 0018 * [7] noisy or dead flag 0019 * [8-9] left for future usage 0020 * --Second block (optional): free fields 0021 * [10] Encoded information of free fields: (1000*version)+(100*type)+(number of fields); type is: ttrig=0, vdrift=1, uncertainties=3 0022 * [11-end] free fields 0023 * 0024 * \author G. Cerminara - INFN Torino 0025 */ 0026 0027 #include "DataFormats/MuonDetId/interface/DTWireId.h" 0028 0029 #include <string> 0030 #include <map> 0031 #include <vector> 0032 0033 namespace edm { 0034 class ParameterSet; 0035 } 0036 0037 class DTCalibrationMap { 0038 public: 0039 /// Constructor 0040 DTCalibrationMap(const edm::ParameterSet& pset); 0041 0042 /// Destructor 0043 virtual ~DTCalibrationMap(); 0044 0045 // Operations 0046 0047 /// Return the t_trig (ns) for a particular wire 0048 float tTrig(DTWireId wireId) const; 0049 0050 /// Return the sigma of the t_trig (ns) for a particular wire 0051 float sigma_tTrig(DTWireId wireId) const; 0052 0053 /// Return the kfactor for a particular wire 0054 float kFactor(DTWireId wireId) const; 0055 0056 /// Return the mean drift velocity for a particular wire (cm/ns) 0057 float meanVDrift(DTWireId wireId) const; 0058 0059 /// Return the sigma of the mean drift velocity for a particular wire (cm/ns) 0060 float sigma_meanVDrift(DTWireId wireId) const; 0061 0062 typedef std::vector<float> CalibConsts; 0063 typedef DTWireId Key; 0064 typedef std::map<Key, CalibConsts>::const_iterator const_iterator; 0065 0066 // Clean the map 0067 void cleanTheConsts() { theMap.clear(); } 0068 0069 // Get a particular number (field) between all the calibration 0070 // constants available for a particluar wire 0071 float getField(DTWireId wireId, int field) const; 0072 0073 // Get from the map the calibration constants for a particular wire 0074 const CalibConsts* getConsts(DTWireId wireId) const; 0075 0076 // Add to the map the calibration consts for a given key 0077 void addCell(Key wireId, const CalibConsts& calibConst); 0078 0079 // Write the calibration consts to a file 0080 void writeConsts(const std::string& outputFileName) const; 0081 0082 // Get a key to read calibration constants for a particular wire 0083 // with the given granularity 0084 Key getKey(DTWireId wireId) const; 0085 0086 const_iterator keyAndConsts_begin() const { return theMap.begin(); } 0087 0088 const_iterator keyAndConsts_end() const { return theMap.end(); } 0089 0090 protected: 0091 private: 0092 // Specify the granularity for the calibration constants 0093 enum CalibGranularity { byChamber, bySL, byLayer, byWire }; 0094 CalibGranularity theGranularity; 0095 0096 // Read the calibration consts from a file 0097 void readConsts(const std::string& inputFileName); 0098 0099 // Check the consistency of a given key with the selected granularity 0100 bool checkGranularity(Key aKey) const; 0101 0102 // The number of fields (calibration numbers) to be read from file 0103 unsigned int nFields; 0104 0105 // The name of the file containing the calibration constants 0106 std::string calibConstFileName; 0107 0108 // Define the granularity to be used for t0 0109 std::string calibConstGranularity; 0110 0111 // The map between the Key and the calibration constants 0112 std::map<Key, CalibConsts> theMap; 0113 }; 0114 0115 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.2.1 LXR engine. The LXR team |
![]() ![]() |