CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
RPCCalibSetUp Class Reference

#include <RPCCalibSetUp.h>

Public Member Functions

std::vector< double > getCls (uint32_t id)
 
std::map< int, std::vector< double > > getClsMap ()
 
std::vector< float > getEff (uint32_t id)
 
const RPCGeometrygetGeometry ()
 
std::vector< float > getNoise (uint32_t id)
 
float getTime (uint32_t id)
 
 RPCCalibSetUp (const edm::ParameterSet &ps)
 
void setGeometry (const RPCGeometry *geom)
 sets geometry More...
 
virtual ~RPCCalibSetUp ()
 

Public Attributes

std::map< RPCDetId, float > _bxmap
 
std::map< int, std::vector< double > > _clsMap
 
std::map< uint32_t, std::vector< double > > _mapDetClsMap
 
std::map< uint32_t, std::vector< float > > _mapDetIdEff
 
std::map< uint32_t, std::vector< float > > _mapDetIdNoise
 
const RPCGeometrytheGeometry
 

Detailed Description

Definition at line 22 of file RPCCalibSetUp.h.

Constructor & Destructor Documentation

◆ RPCCalibSetUp()

RPCCalibSetUp::RPCCalibSetUp ( const edm::ParameterSet ps)
explicit

Definition at line 24 of file RPCCalibSetUp.cc.

References edmScanValgrind::buffer, gather_cfg::cout, Exception, edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), mps_fire::i, recoMuon::in, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, ecalMatacq_cfi::timing, and relativeConstraints::value.

24  {
25  _mapDetIdNoise.clear();
26  _mapDetIdEff.clear();
27  _bxmap.clear();
28  _mapDetClsMap.clear();
29 
30  //------------------------ Noise Reading ----------------------------
31 
32  edm::FileInPath fp1 = ps.getParameter<edm::FileInPath>("noisemapfile");
33  std::ifstream _infile1(fp1.fullPath().c_str(), std::ios::in);
34 
35  std::vector<float> vnoise;
36 
37  int rpcdetid = 0;
38  std::string buff;
39 
40  std::vector<std::string> words;
41 
42  while (getline(_infile1, buff, '\n')) {
43  words.clear();
44  vnoise.clear();
45 
46  stringstream ss;
47  std::string chname;
48  ss << buff;
49  ss >> chname >> rpcdetid;
50 
51  std::string::size_type pos = 0, prev_pos = 0;
52 
53  while ((pos = buff.find(" ", pos)) != string::npos) {
54  words.push_back(buff.substr(prev_pos, pos - prev_pos));
55  prev_pos = ++pos;
56  }
57  words.push_back(buff.substr(prev_pos, pos - prev_pos));
58 
59  for (unsigned int i = 2; i < words.size(); ++i) {
60  float value = atof(((words)[i]).c_str());
61  vnoise.push_back(value);
62  }
63 
64  _mapDetIdNoise.insert(make_pair(static_cast<uint32_t>(rpcdetid), vnoise));
65  }
66  _infile1.close();
67 
68  //------------------------ Eff Reading ----------------------------
69 
70  edm::FileInPath fp2 = ps.getParameter<edm::FileInPath>("effmapfile");
71  std::ifstream _infile2(fp2.fullPath().c_str(), std::ios::in);
72 
73  std::vector<float> veff;
74  rpcdetid = 0;
75 
76  while (getline(_infile2, buff, '\n')) {
77  words.clear();
78  veff.clear();
79 
80  stringstream ss;
81  std::string chname;
82  ss << buff;
83  ss >> chname >> rpcdetid;
84 
85  std::string::size_type pos = 0, prev_pos = 0;
86  while ((pos = buff.find(" ", pos)) != string::npos) {
87  words.push_back(buff.substr(prev_pos, pos - prev_pos));
88  prev_pos = ++pos;
89  }
90  words.push_back(buff.substr(prev_pos, pos - prev_pos));
91 
92  for (unsigned int i = 2; i < words.size(); ++i) {
93  float value = atof(((words)[i]).c_str());
94  veff.push_back(value);
95  }
96  _mapDetIdEff.insert(make_pair(static_cast<uint32_t>(rpcdetid), veff));
97  }
98  _infile2.close();
99 
100  //---------------------- Timing reading ------------------------------------
101 
102  edm::FileInPath fp3 = ps.getParameter<edm::FileInPath>("timingMap");
103  std::ifstream _infile3(fp3.fullPath().c_str(), std::ios::in);
104 
105  uint32_t detUnit = 0;
106  float timing = 0.;
107  while (!_infile3.eof()) {
108  _infile3 >> detUnit >> timing;
109  _bxmap[RPCDetId(detUnit)] = timing;
110  }
111  _infile3.close();
112 
113  //---------------------- Cluster size --------------------------------------
114 
115  edm::FileInPath fp4 = ps.getParameter<edm::FileInPath>("clsmapfile");
116  std::ifstream _infile4(fp4.fullPath().c_str(), ios::in);
117 
118  string buffer;
119  double sum = 0;
120  unsigned int counter = 1;
121  unsigned int row = 1;
122  std::vector<double> sum_clsize;
123 
124  while (_infile4 >> buffer) {
125  const char *buffer1 = buffer.c_str();
126  double dato = atof(buffer1);
127  sum += dato;
128  sum_clsize.push_back(sum);
129 
130  if (counter == row * 20) {
131  _clsMap[row] = sum_clsize;
132  row++;
133  sum = 0;
134  sum_clsize.clear();
135  }
136  counter++;
137  }
138  _infile4.close();
139 
140  //---------------------- Cluster size Chamber by Chamber -------------------
141 
142  edm::FileInPath fp5 = ps.getParameter<edm::FileInPath>("clsidmapfile");
143  std::ifstream _infile5(fp5.fullPath().c_str(), ios::in);
144 
145  std::vector<double> vClsDistrib;
146  rpcdetid = 0;
147 
148  while (getline(_infile5, buff, '\n')) {
149  words.clear();
150  vClsDistrib.clear();
151 
152  stringstream ss1;
153  ss1 << buff;
154  ss1 >> rpcdetid;
155 
156  std::string::size_type pos = 0, prev_pos = 0;
157  while ((pos = buff.find(" ", pos)) != string::npos) {
158  words.push_back(buff.substr(prev_pos, pos - prev_pos));
159  prev_pos = ++pos;
160  }
161  words.push_back(buff.substr(prev_pos, pos - prev_pos));
162 
163  float clusterSizeSumData(0.);
164 
165  for (unsigned int i = 1; i < words.size(); ++i) {
166  float value = atof(((words)[i]).c_str());
167 
168  clusterSizeSumData += value;
169  vClsDistrib.push_back(clusterSizeSumData);
170  if (!(i % 20)) {
171  clusterSizeSumData = 0.;
172  }
173  }
174  if (vClsDistrib.size() != 100) {
175  throw cms::Exception("DataCorrupt") << "Exception comming from RPCCalibSetUp - cluster size - a wrong "
176  "format "
177  << std::endl;
178  }
179  _mapDetClsMap.insert(make_pair(static_cast<uint32_t>(rpcdetid), vClsDistrib));
180  std::cout << "_mapDetClsMap.size()\t" << _mapDetClsMap.size() << std::endl;
181  }
182 
183  _infile5.close();
184 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::string fullPath() const
Definition: FileInPath.cc:161
uint16_t size_type
std::map< uint32_t, std::vector< float > > _mapDetIdNoise
Definition: RPCCalibSetUp.h:40
Definition: value.py:1
std::map< int, std::vector< double > > _clsMap
Definition: RPCCalibSetUp.h:43
std::map< RPCDetId, float > _bxmap
Definition: RPCCalibSetUp.h:42
std::map< uint32_t, std::vector< float > > _mapDetIdEff
Definition: RPCCalibSetUp.h:41
std::map< uint32_t, std::vector< double > > _mapDetClsMap
Definition: RPCCalibSetUp.h:44

◆ ~RPCCalibSetUp()

RPCCalibSetUp::~RPCCalibSetUp ( )
virtual

Definition at line 247 of file RPCCalibSetUp.cc.

247 {}

Member Function Documentation

◆ getCls()

std::vector< double > RPCCalibSetUp::getCls ( uint32_t  id)

Definition at line 232 of file RPCCalibSetUp.cc.

References Exception.

Referenced by RPCFakeCalibration::makeCls().

232  {
233  std::map<uint32_t, std::vector<double>>::iterator iter = _mapDetClsMap.find(id);
234  if (iter == _mapDetClsMap.end()) {
235  throw cms::Exception("DataCorrupt") << "Exception comming from RPCCalibSetUp - no cluster size information "
236  "for DetId\t"
237  << id << std::endl;
238  }
239  if ((iter->second).size() != 100) {
240  throw cms::Exception("DataCorrupt") << "Exception comming from RPCCalibSetUp - cluster size information in "
241  "a wrong format for DetId\t"
242  << id << std::endl;
243  }
244  return iter->second;
245 }
std::map< uint32_t, std::vector< double > > _mapDetClsMap
Definition: RPCCalibSetUp.h:44

◆ getClsMap()

std::map< int, std::vector< double > > RPCCalibSetUp::getClsMap ( )

Definition at line 223 of file RPCCalibSetUp.cc.

References Exception.

223  {
224  if (_clsMap.size() != 5) {
225  throw cms::Exception("DataCorrupt") << "Exception comming from RPCCalibSetUp - cluster size - a wrong "
226  "format "
227  << std::endl;
228  }
229  return _clsMap;
230 }
std::map< int, std::vector< double > > _clsMap
Definition: RPCCalibSetUp.h:43

◆ getEff()

std::vector< float > RPCCalibSetUp::getEff ( uint32_t  id)

Definition at line 196 of file RPCCalibSetUp.cc.

References Exception.

Referenced by RPCFakeCalibration::makeNoise().

196  {
197  map<uint32_t, std::vector<float>>::iterator iter = _mapDetIdEff.find(id);
198  if (iter == _mapDetIdEff.end()) {
199  throw cms::Exception("DataCorrupt") << "Exception comming from RPCCalibSetUp - no efficiency information "
200  "for DetId\t"
201  << id << std::endl;
202  }
203  if ((iter->second).size() != 96) {
204  throw cms::Exception("DataCorrupt") << "Exception comming from RPCCalibSetUp - efficiency information in a "
205  "wrong format for DetId\t"
206  << id << std::endl;
207  }
208  return iter->second;
209 }
std::map< uint32_t, std::vector< float > > _mapDetIdEff
Definition: RPCCalibSetUp.h:41

◆ getGeometry()

const RPCGeometry* RPCCalibSetUp::getGeometry ( )
inline

Definition at line 36 of file RPCCalibSetUp.h.

References theGeometry.

36 { return theGeometry; }
const RPCGeometry * theGeometry
Definition: RPCCalibSetUp.h:38

◆ getNoise()

std::vector< float > RPCCalibSetUp::getNoise ( uint32_t  id)

Definition at line 186 of file RPCCalibSetUp.cc.

References Exception.

186  {
187  map<uint32_t, std::vector<float>>::iterator iter = _mapDetIdNoise.find(id);
188  if (iter == _mapDetIdNoise.end()) {
189  throw cms::Exception("DataCorrupt") << "Exception comming from RPCCalibSetUp - no noise information for "
190  "DetId\t"
191  << id << std::endl;
192  }
193  return (iter->second);
194 }
std::map< uint32_t, std::vector< float > > _mapDetIdNoise
Definition: RPCCalibSetUp.h:40

◆ getTime()

float RPCCalibSetUp::getTime ( uint32_t  id)

Definition at line 211 of file RPCCalibSetUp.cc.

References Exception, and DetId::rawId().

Referenced by RPCFakeCalibration::makeNoise().

211  {
212  RPCDetId rpcid(id);
213 
214  std::map<RPCDetId, float>::iterator iter = _bxmap.find(rpcid);
215  if (iter == _bxmap.end()) {
216  throw cms::Exception("DataCorrupt") << "Exception comming from RPCCalibSetUp - no timing information for "
217  "rpcid.rawId()\t"
218  << rpcid.rawId() << std::endl;
219  }
220  return iter->second;
221 }
std::map< RPCDetId, float > _bxmap
Definition: RPCCalibSetUp.h:42

◆ setGeometry()

void RPCCalibSetUp::setGeometry ( const RPCGeometry geom)
inline

sets geometry

Definition at line 35 of file RPCCalibSetUp.h.

References relativeConstraints::geom, and theGeometry.

35 { theGeometry = geom; }
const RPCGeometry * theGeometry
Definition: RPCCalibSetUp.h:38

Member Data Documentation

◆ _bxmap

std::map<RPCDetId, float> RPCCalibSetUp::_bxmap

Definition at line 42 of file RPCCalibSetUp.h.

◆ _clsMap

std::map<int, std::vector<double> > RPCCalibSetUp::_clsMap

Definition at line 43 of file RPCCalibSetUp.h.

Referenced by RPCFakeCalibration::makeNoise().

◆ _mapDetClsMap

std::map<uint32_t, std::vector<double> > RPCCalibSetUp::_mapDetClsMap

Definition at line 44 of file RPCCalibSetUp.h.

Referenced by RPCFakeCalibration::makeCls().

◆ _mapDetIdEff

std::map<uint32_t, std::vector<float> > RPCCalibSetUp::_mapDetIdEff

Definition at line 41 of file RPCCalibSetUp.h.

◆ _mapDetIdNoise

std::map<uint32_t, std::vector<float> > RPCCalibSetUp::_mapDetIdNoise

Definition at line 40 of file RPCCalibSetUp.h.

Referenced by RPCFakeCalibration::makeNoise().

◆ theGeometry

const RPCGeometry* RPCCalibSetUp::theGeometry

Definition at line 38 of file RPCCalibSetUp.h.

Referenced by getGeometry(), and setGeometry().