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

250 {}

Member Function Documentation

◆ getCls()

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

Definition at line 235 of file RPCCalibSetUp.cc.

References Exception.

Referenced by RPCFakeCalibration::makeCls().

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

◆ getClsMap()

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

Definition at line 226 of file RPCCalibSetUp.cc.

References Exception.

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

◆ getEff()

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

Definition at line 199 of file RPCCalibSetUp.cc.

References Exception.

Referenced by RPCFakeCalibration::makeNoise().

199  {
200  map<uint32_t, std::vector<float>>::iterator iter = _mapDetIdEff.find(id);
201  if (iter == _mapDetIdEff.end()) {
202  throw cms::Exception("DataCorrupt") << "Exception comming from RPCCalibSetUp - no efficiency information "
203  "for DetId\t"
204  << id << std::endl;
205  }
206  if ((iter->second).size() != 96) {
207  throw cms::Exception("DataCorrupt") << "Exception comming from RPCCalibSetUp - efficiency information in a "
208  "wrong format for DetId\t"
209  << id << std::endl;
210  }
211  return iter->second;
212 }
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 189 of file RPCCalibSetUp.cc.

References Exception.

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

◆ getTime()

float RPCCalibSetUp::getTime ( uint32_t  id)

Definition at line 214 of file RPCCalibSetUp.cc.

References Exception, and DetId::rawId().

Referenced by RPCFakeCalibration::makeNoise().

214  {
215  RPCDetId rpcid(id);
216 
217  std::map<RPCDetId, float>::iterator iter = _bxmap.find(rpcid);
218  if (iter == _bxmap.end()) {
219  throw cms::Exception("DataCorrupt") << "Exception comming from RPCCalibSetUp - no timing information for "
220  "rpcid.rawId()\t"
221  << rpcid.rawId() << std::endl;
222  }
223  return iter->second;
224 }
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().