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 23 of file RPCCalibSetUp.h.

Constructor & Destructor Documentation

◆ RPCCalibSetUp()

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

Definition at line 25 of file RPCCalibSetUp.cc.

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

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.

◆ ~RPCCalibSetUp()

RPCCalibSetUp::~RPCCalibSetUp ( )
virtual

Definition at line 251 of file RPCCalibSetUp.cc.

251 {}

Member Function Documentation

◆ getCls()

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

Definition at line 236 of file RPCCalibSetUp.cc.

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

References Exception.

Referenced by RPCFakeCalibration::makeCls().

◆ getClsMap()

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

Definition at line 227 of file RPCCalibSetUp.cc.

227  {
228  if (_clsMap.size() != 5) {
229  throw cms::Exception("DataCorrupt") << "Exception comming from RPCCalibSetUp - cluster size - a wrong "
230  "format "
231  << std::endl;
232  }
233  return _clsMap;
234 }

References Exception.

◆ getEff()

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

Definition at line 200 of file RPCCalibSetUp.cc.

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

References Exception.

Referenced by RPCFakeCalibration::makeNoise().

◆ getGeometry()

const RPCGeometry* RPCCalibSetUp::getGeometry ( )
inline

Definition at line 37 of file RPCCalibSetUp.h.

37 { return theGeometry; }

References theGeometry.

◆ getNoise()

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

Definition at line 190 of file RPCCalibSetUp.cc.

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

References Exception.

◆ getTime()

float RPCCalibSetUp::getTime ( uint32_t  id)

Definition at line 215 of file RPCCalibSetUp.cc.

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

References Exception, and DetId::rawId().

Referenced by RPCFakeCalibration::makeNoise().

◆ setGeometry()

void RPCCalibSetUp::setGeometry ( const RPCGeometry geom)
inline

sets geometry

Definition at line 36 of file RPCCalibSetUp.h.

36 { theGeometry = geom; }

References relativeConstraints::geom, and theGeometry.

Member Data Documentation

◆ _bxmap

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

Definition at line 43 of file RPCCalibSetUp.h.

◆ _clsMap

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

Definition at line 44 of file RPCCalibSetUp.h.

Referenced by RPCFakeCalibration::makeNoise().

◆ _mapDetClsMap

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

Definition at line 45 of file RPCCalibSetUp.h.

Referenced by RPCFakeCalibration::makeCls().

◆ _mapDetIdEff

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

Definition at line 42 of file RPCCalibSetUp.h.

◆ _mapDetIdNoise

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

Definition at line 41 of file RPCCalibSetUp.h.

Referenced by RPCFakeCalibration::makeNoise().

◆ theGeometry

const RPCGeometry* RPCCalibSetUp::theGeometry

Definition at line 39 of file RPCCalibSetUp.h.

Referenced by getGeometry(), and setGeometry().

counter
Definition: counter.py:1
mps_fire.i
i
Definition: mps_fire.py:428
RPCDetId
Definition: RPCDetId.h:16
gather_cfg.cout
cout
Definition: gather_cfg.py:144
pos
Definition: PixelAliasList.h:18
RPCCalibSetUp::_bxmap
std::map< RPCDetId, float > _bxmap
Definition: RPCCalibSetUp.h:43
edmScanValgrind.buffer
buffer
Definition: edmScanValgrind.py:171
RPCCalibSetUp::_clsMap
std::map< int, std::vector< double > > _clsMap
Definition: RPCCalibSetUp.h:44
RPCCalibSetUp::_mapDetIdEff
std::map< uint32_t, std::vector< float > > _mapDetIdEff
Definition: RPCCalibSetUp.h:42
RPCCalibSetUp::_mapDetClsMap
std::map< uint32_t, std::vector< double > > _mapDetClsMap
Definition: RPCCalibSetUp.h:45
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
edm::FileInPath
Definition: FileInPath.h:64
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
recoMuon::in
Definition: RecoMuonEnumerators.h:6
value
Definition: value.py:1
RPCCalibSetUp::theGeometry
const RPCGeometry * theGeometry
Definition: RPCCalibSetUp.h:39
ecalMatacq_cfi.timing
timing
Definition: ecalMatacq_cfi.py:26
relativeConstraints.value
value
Definition: relativeConstraints.py:53
Exception
Definition: hltDiff.cc:246
RPCCalibSetUp::_mapDetIdNoise
std::map< uint32_t, std::vector< float > > _mapDetIdNoise
Definition: RPCCalibSetUp.h:41
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:163