24 nFields =
pset.getUntrackedParameter<
int>(
"nFields", 5);
25 calibConstFileName =
pset.getUntrackedParameter<
string>(
"calibConstFileName",
"dummy.txt");
26 calibConstGranularity =
pset.getUntrackedParameter<
string>(
"calibConstGranularity",
"bySL");
29 if (calibConstGranularity ==
"byWire") {
30 theGranularity = byWire;
31 }
else if (calibConstGranularity ==
"byLayer") {
32 theGranularity = byLayer;
33 }
else if (calibConstGranularity ==
"bySL") {
34 theGranularity = bySL;
36 theGranularity = byChamber;
37 if (!(calibConstGranularity ==
"byChamber")) {
38 cout <<
"[DTCalibrationMap]###Warning: Check parameter calibConstGranularity: " << calibConstGranularity
39 <<
" options not available!" << endl;
42 readConsts(calibConstFileName);
65 if (theGranularity == byChamber) {
67 }
else if (theGranularity == bySL) {
69 }
else if (theGranularity == byLayer) {
79 static pair<Key, CalibConsts>
cache;
82 Key theKey = getKey(wireId);
85 if (theKey ==
cache.first) {
86 return &(
cache.second);
90 map<Key, CalibConsts>::const_iterator
res = theMap.find(theKey);
91 if (
res != theMap.end()) {
93 return &((*res).second);
103 if (cals ==
nullptr) {
104 throw cms::Exception(
"NoCalibConsts") <<
"DTCalibrationMap:" << endl
105 <<
"No parameters for wire: " << wireId << endl
106 <<
"Check the " << calibConstFileName <<
" file!" << endl;
108 return (*(cals))[field];
117 cout <<
"[DTCalibrationMap]***Warning: File: " <<
inputFileName <<
" not found in current directory!!!" << endl;
126 int superlayer_id = 0;
134 stringstream linestr;
137 pair<Key, CalibConsts> wireCalib;
139 linestr >> wheel_id >> station_id >> sector_id >> superlayer_id >> layer_id >> wire_id;
142 wireCalib.first =
Key(wheel_id, station_id, sector_id, superlayer_id, layer_id, wire_id);
144 if (!checkGranularity(wireCalib.first))
145 cout <<
"[DTCalibrationMap]***Warning: the CalibConstFile is not consistent with the selected granularity!" 149 copy(istream_iterator<float>(linestr), istream_iterator<float>(), back_inserter(wireCalib.second));
151 if (wireCalib.second.size() < nFields) {
152 cout <<
"[DTCalibrationMap]***Warning: the CalibConstFile is not consistent with the number of fields!" << endl;
155 theMap.insert(wireCalib);
161 if (!checkGranularity(theKey))
163 <<
"The added key is not compatible with the selected granularity" << endl;
165 theMap[theKey] = calibConst;
171 for (map<Key, CalibConsts>::const_iterator iter = theMap.begin(); iter != theMap.end(); ++iter) {
172 out << (*iter).first.wheel() <<
' ' << (*iter).first.station() <<
' ' << (*iter).first.sector() <<
' ' 173 << (*iter).first.superlayer() <<
' ' << (*iter).first.layer() <<
' ' << (*iter).first.wire() <<
' ';
174 copy((*iter).second.begin(), (*iter).second.end(), ostream_iterator<float>(
out,
" "));
184 if (theGranularity == byChamber) {
188 }
else if (theGranularity == bySL) {
192 }
else if (theGranularity == byLayer) {
196 }
else if (theGranularity == byWire) {
197 if (aKey.
wire() == 0) {
float tTrig(DTWireId wireId) const
Return the t_trig (ns) for a particular wire.
float sigma_meanVDrift(DTWireId wireId) const
Return the sigma of the mean drift velocity for a particular wire (cm/ns)
int wire() const
Return the wire number.
DTCalibrationMap(const edm::ParameterSet &pset)
Constructor.
ret
prodAgent to be discontinued
DTChamberId chamberId() const
Return the corresponding ChamberId.
float kFactor(DTWireId wireId) const
Return the kfactor for a particular wire.
float meanVDrift(DTWireId wireId) const
Return the mean drift velocity for a particular wire (cm/ns)
const CalibConsts * getConsts(DTWireId wireId) const
std::vector< float > CalibConsts
virtual ~DTCalibrationMap()
Destructor.
constexpr unsigned getField(const uint32_t u, const unsigned mask, const unsigned offset)
void addCell(Key wireId, const CalibConsts &calibConst)
Key getKey(DTWireId wireId) const
bool checkGranularity(Key aKey) const
int superlayer() const
Return the superlayer number (deprecated method name)
void writeConsts(const std::string &outputFileName) const
int layer() const
Return the layer number.
float sigma_tTrig(DTWireId wireId) const
Return the sigma of the t_trig (ns) for a particular wire.
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
DTLayerId layerId() const
Return the corresponding LayerId.
void readConsts(const std::string &inputFileName)
float getField(DTWireId wireId, int field) const