CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes
RPCSimSetUp Class Reference

#include <RPCSimSetUp.h>

Public Member Functions

const std::vector< double > & getAsymmetricClsDistribution (uint32_t id, uint32_t slice)
 
const std::vector< double > & getAsymmetryForCls (uint32_t id, uint32_t slice, uint32_t cls)
 
const std::vector< double > & getCls (uint32_t id)
 
const std::map< int,
std::vector< double > > & 
getClsMap ()
 
const std::vector< float > & getEff (uint32_t id)
 
const RPCGeometrygetGeometry ()
 
const std::vector< float > & getNoise (uint32_t id)
 
float getTime (uint32_t id)
 
 RPCSimSetUp (const edm::ParameterSet &ps)
 
void setGeometry (const RPCGeometry *geom)
 sets geometry More...
 
void setRPCSetUp (const std::vector< RPCStripNoises::NoiseItem > &vnoise, const std::vector< float > &vcls)
 
void setRPCSetUp (const std::vector< RPCStripNoises::NoiseItem > &vnoise, const std::vector< RPCClusterSize::ClusterSizeItem > &vClusterSize)
 
virtual ~RPCSimSetUp ()
 

Public Attributes

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

Detailed Description

Definition at line 28 of file RPCSimSetUp.h.

Constructor & Destructor Documentation

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

Definition at line 37 of file RPCSimSetUp.cc.

37  {
38 
39  _mapDetIdNoise.clear();
40  _mapDetIdEff.clear();
41  _bxmap.clear();
42  _clsMap.clear();
43 }
std::map< RPCDetId, float > _bxmap
Definition: RPCSimSetUp.h:56
std::map< int, std::vector< double > > _clsMap
Definition: RPCSimSetUp.h:57
std::map< uint32_t, std::vector< float > > _mapDetIdEff
Definition: RPCSimSetUp.h:55
std::map< uint32_t, std::vector< float > > _mapDetIdNoise
Definition: RPCSimSetUp.h:54
RPCSimSetUp::~RPCSimSetUp ( )
virtual

Definition at line 360 of file RPCSimSetUp.cc.

360 {}

Member Function Documentation

const std::vector< double > & RPCSimSetUp::getAsymmetricClsDistribution ( uint32_t  id,
uint32_t  slice 
)

Definition at line 231 of file RPCSimSetUp.cc.

References counter, edm::hlt::Exception, i, getDQMSummary::iter, and j.

Referenced by RPCSimAsymmetricCls::getClSize().

231  {
232 
233  map<uint32_t,std::vector<double> >::const_iterator iter = _mapDetClsMap.find(id);
234  if(iter == _mapDetClsMap.end()){
235  throw cms::Exception("DataCorrupt")
236  << "Exception comming from RPCSimSetUp - no cluster size information for DetId\t"<<id<< std::endl;
237  }
238  if((iter->second).size() != 120){
239  throw cms::Exception("DataCorrupt")
240  << "Exception comming from RPCSimSetUp - cluster size information in a wrong format for DetId\t"<<id<< std::endl;
241  }
242 // return iter->second;
243 
244 std::vector<double> dataForAsymmCls = iter->second;
245  if(slice>4){
246  throw cms::Exception("DataCorrupt")
247  << "Exception comming from RPCSimSetUp - slice variable not in the range"<< std::endl;
248  }
249 
250  _DetClsAsymmetric.clear();
251 
252 
253  vector<double> clsFewStripsDistribution;
254  vector<double> clsDistribution;
255  vector<double> clsAccumulativeDistribution;
256 
257  std::map< int, std::vector<double> > mapSliceVsDistribution;
258 
259  const int slices=5;
260  const int distributionFewStrips=24;
261 
262  double sliceVsFewStripsDistribution[slices][distributionFewStrips];
263 
264  for(int j = 0; j < distributionFewStrips; j++){
265  for(int i = 0; i < slices; i++){
266  sliceVsFewStripsDistribution[i][j]=dataForAsymmCls[j*slices+i];
267  }
268  }
269 
270 double control=0;
271 for(int j = 0 ; j < distributionFewStrips; j++){
272 control+=sliceVsFewStripsDistribution[0][j];
273 }
274 
275 double control1=0;
276  for(int j = 0; j < distributionFewStrips; j++){
277  for(int i = 0; i < slices; i++){
278  control1+=dataForAsymmCls[j*slices+i];
279  }
280  }
281 
282  int i = slice;
283  double sum=0;
284  int counter = 0 ;
285  for(int j = 0; j < distributionFewStrips; j++){
286  counter++;
287  sum+=sliceVsFewStripsDistribution[i][j];
288  if(counter%4==0){
289  _DetClsAsymmetric.push_back(sum);
290  }
291  }
292  return _DetClsAsymmetric;
293 }
int i
Definition: DBlmapReader.cc:9
std::vector< double > _DetClsAsymmetric
Definition: RPCSimSetUp.h:60
int j
Definition: DBlmapReader.cc:9
std::map< uint32_t, std::vector< double > > _mapDetClsMap
Definition: RPCSimSetUp.h:58
static std::atomic< unsigned int > counter
const std::vector< double > & RPCSimSetUp::getAsymmetryForCls ( uint32_t  id,
uint32_t  slice,
uint32_t  cls 
)

Definition at line 295 of file RPCSimSetUp.cc.

References edm::hlt::Exception, i, getDQMSummary::iter, j, findQualityFiles::size, and relativeConstraints::value.

Referenced by RPCSimAsymmetricCls::simulate().

295  {
296 
297  map<uint32_t,std::vector<double> >::const_iterator iter = _mapDetClsMap.find(id);
298  if(iter == _mapDetClsMap.end()){
299  throw cms::Exception("DataCorrupt")
300  << "Exception comming from RPCSimSetUp - no cluster size information for DetId\t"<<id<< std::endl;
301  }
302  if((iter->second).size() != 120){
303  throw cms::Exception("DataCorrupt")
304  << "Exception comming from RPCSimSetUp - cluster size information in a wrong format for DetId\t"<<id<<'\t'<<(iter->second).size()<< std::endl;
305  }
306 
307 std::vector<double> dataForAsymmCls = iter->second;
308 
309 if(slice>4){
310  throw cms::Exception("DataCorrupt")
311  << "Exception comming from RPCSimSetUp - slice variable not in the range"<< std::endl;
312  }
313 
314  _DetAsymmetryForCls.clear();
315 
316  vector<double> clsFewStripsDistribution;
317  vector<double> clsDistribution;
318  vector<double> clsAccumulativeDistribution;
319 vector<double> clsDetAsymmetryForCls;
320  clsDetAsymmetryForCls.clear();
321 
322  std::map< int, std::vector<double> > mapSliceVsDistribution;
323 
324  const int slices=5;
325  const int distributionFewStrips=24;
326 
327  double sliceVsFewStripsDistribution[slices][distributionFewStrips];
328 
329  for(int j = 0; j < distributionFewStrips; j++){
330  for(int i = 0; i < slices; i++){
331  sliceVsFewStripsDistribution[i][j]=dataForAsymmCls[j*slices+i];
332  }
333  }
334 
335  int vector_lenght;
336  switch(cls){
337  case 1: case 3: case 5: vector_lenght =3; break;
338  case 2: case 4: vector_lenght =4; break;
339  case 6: default: vector_lenght = 1; break;
340  }
341 
342  float sum=0;
343  float value;
344  for(int i = 0; i < vector_lenght ; i ++){
345  value = sliceVsFewStripsDistribution[slice][(cls-1)*4+i];
346  clsDetAsymmetryForCls.push_back(value);
347  sum +=value;
348  // std::cout<<"value\t"<<value<<std::endl;
349  // std::cout<<"sum\t"<<sum<<std::endl;
350  }
351 
352  float accum=0;
353  for(int i = clsDetAsymmetryForCls.size()-1; i>-1; i--){
354  accum += clsDetAsymmetryForCls[i];
355  _DetAsymmetryForCls.push_back(accum/sum);
356  }
357 return _DetAsymmetryForCls;
358 }
int i
Definition: DBlmapReader.cc:9
std::vector< double > _DetAsymmetryForCls
Definition: RPCSimSetUp.h:61
int j
Definition: DBlmapReader.cc:9
std::map< uint32_t, std::vector< double > > _mapDetClsMap
Definition: RPCSimSetUp.h:58
tuple size
Write out results.
const std::vector< double > & RPCSimSetUp::getCls ( uint32_t  id)

Definition at line 216 of file RPCSimSetUp.cc.

References edm::hlt::Exception, and getDQMSummary::iter.

Referenced by RPCSimAverageNoiseEffCls::getClSize().

217 {
218 
219  map<uint32_t,std::vector<double> >::iterator iter = _mapDetClsMapLegacy.find(id);
220  if(iter == _mapDetClsMapLegacy.end()){
221  throw cms::Exception("DataCorrupt")
222  << "Exception comming from RPCSimSetUp - no cluster size information for DetId\t"<<id<< std::endl;
223  }
224  if((iter->second).size() != 100){
225  throw cms::Exception("DataCorrupt")
226  << "Exception comming from RPCSimSetUp - cluster size information in a wrong format for DetId\t"<<id<< std::endl;
227  }
228  return iter->second;
229 }
std::map< uint32_t, std::vector< double > > _mapDetClsMapLegacy
Definition: RPCSimSetUp.h:59
const std::map< int, std::vector< double > > & RPCSimSetUp::getClsMap ( )

Definition at line 205 of file RPCSimSetUp.cc.

References edm::hlt::Exception.

Referenced by RPCSimAverage::getClSize(), RPCSimAverageNoise::getClSize(), RPCSimAverageNoiseEff::getClSize(), RPCSimAverageNoiseEffCls::getClSize(), and RPCSimAsymmetricCls::getClSize().

206 {
207  if(_clsMap.size()!=5){
208  throw cms::Exception("DataCorrupt")
209  << "Exception comming from RPCSimSetUp - cluster size - a wrong format "<< std::endl;
210  }
211  return _clsMap;
212 }
std::map< int, std::vector< double > > _clsMap
Definition: RPCSimSetUp.h:57
const std::vector< float > & RPCSimSetUp::getEff ( uint32_t  id)

Definition at line 180 of file RPCSimSetUp.cc.

References edm::hlt::Exception, and getDQMSummary::iter.

181 {
182  map<uint32_t,std::vector<float> >::iterator iter = _mapDetIdEff.find(id);
183  if(iter == _mapDetIdEff.end()){
184  throw cms::Exception("DataCorrupt")
185  << "Exception comming from RPCSimSetUp - no efficiency information for DetId\t"<<id<< std::endl;
186  }
187  if((iter->second).size() != 96){
188  throw cms::Exception("DataCorrupt")
189  << "Exception comming from RPCSimSetUp - efficiency information in a wrong format for DetId\t"<<id<< std::endl;
190  }
191  return iter->second;
192 }
std::map< uint32_t, std::vector< float > > _mapDetIdEff
Definition: RPCSimSetUp.h:55
const RPCGeometry* RPCSimSetUp::getGeometry ( )
inline

Definition at line 50 of file RPCSimSetUp.h.

References theGeometry.

Referenced by RPCSynchronizer::getSimHitBx().

50 { return theGeometry; }
const RPCGeometry * theGeometry
Definition: RPCSimSetUp.h:52
const std::vector< float > & RPCSimSetUp::getNoise ( uint32_t  id)

Definition at line 170 of file RPCSimSetUp.cc.

References edm::hlt::Exception, and getDQMSummary::iter.

171 {
172  map<uint32_t,std::vector<float> >::iterator iter = _mapDetIdNoise.find(id);
173  if(iter == _mapDetIdNoise.end()){
174  throw cms::Exception("DataCorrupt")
175  << "Exception comming from RPCSimSetUp - no noise information for DetId\t"<<id<< std::endl;
176  }
177  return iter->second;
178 }
std::map< uint32_t, std::vector< float > > _mapDetIdNoise
Definition: RPCSimSetUp.h:54
float RPCSimSetUp::getTime ( uint32_t  id)

Definition at line 194 of file RPCSimSetUp.cc.

References edm::hlt::Exception, getDQMSummary::iter, and DetId::rawId().

Referenced by RPCSynchronizer::getSimHitBx().

195 {
196  RPCDetId rpcid(id);
197  std::map<RPCDetId, float>::iterator iter = _bxmap.find(rpcid);
198  if(iter == _bxmap.end()){
199  throw cms::Exception("DataCorrupt")
200  << "Exception comming from RPCSimSetUp - no timing information for rpcid.rawId()\t"<<rpcid.rawId()<< std::endl;
201  }
202  return iter->second;
203 }
std::map< RPCDetId, float > _bxmap
Definition: RPCSimSetUp.h:56
void RPCSimSetUp::setGeometry ( const RPCGeometry geom)
inline

sets geometry

Definition at line 48 of file RPCSimSetUp.h.

References relativeConstraints::geom, and theGeometry.

Referenced by RPCDigiProducer::beginRun().

48 {theGeometry = geom;}
const RPCGeometry * theGeometry
Definition: RPCSimSetUp.h:52
void RPCSimSetUp::setRPCSetUp ( const std::vector< RPCStripNoises::NoiseItem > &  vnoise,
const std::vector< float > &  vcls 
)

Definition at line 45 of file RPCSimSetUp.cc.

References counter, gen::n, RPCDetId, and groupFilesInBlocks::temp.

Referenced by RPCDigiProducer::beginRun().

45  {
46 
47  unsigned int counter = 1;
48  unsigned int row = 1;
49  std::vector<double> sum_clsize;
50 
51  for(unsigned int n = 0; n < vcls.size(); ++n){
52 
53  sum_clsize.push_back(vcls[n]);
54 
55  if(counter == row*20) {
56 
57  _clsMap[row] = sum_clsize;
58  row++;
59  sum_clsize.clear();
60  }
61  counter++;
62  }
63 
64  unsigned int n = 0;
65  uint32_t temp = 0;
66  std::vector<float> veff, vvnoise;
67  veff.clear();
68  vvnoise.clear();
69 
70  for(std::vector<RPCStripNoises::NoiseItem>::const_iterator it = vnoise.begin(); it != vnoise.end(); ++it){
71  if(n%96 == 0) {
72  if(n > 0 ){
73  _mapDetIdNoise[temp]= vvnoise;
74  _mapDetIdEff[temp] = veff;
75  _bxmap[RPCDetId(it->dpid)] = it->time;
76 
77  veff.clear();
78  vvnoise.clear();
79  vvnoise.push_back((it->noise));
80  veff.push_back((it->eff));
81  }
82  else if(n == 0 ){
83  vvnoise.push_back((it->noise));
84  veff.push_back((it->eff));
85  _bxmap[RPCDetId(it->dpid)] = it->time;
86  }
87  } else if (n == vnoise.size()-1 ){
88  temp = it->dpid;
89  vvnoise.push_back((it->noise));
90  veff.push_back((it->eff));
91  _mapDetIdNoise[temp]= vvnoise;
92  _mapDetIdEff[temp] = veff;
93  } else {
94  temp = it->dpid;
95  vvnoise.push_back((it->noise));
96  veff.push_back((it->eff));
97  }
98  n++;
99  }
100 }
std::map< RPCDetId, float > _bxmap
Definition: RPCSimSetUp.h:56
std::map< int, std::vector< double > > _clsMap
Definition: RPCSimSetUp.h:57
std::map< uint32_t, std::vector< float > > _mapDetIdEff
Definition: RPCSimSetUp.h:55
static std::atomic< unsigned int > counter
std::map< uint32_t, std::vector< float > > _mapDetIdNoise
Definition: RPCSimSetUp.h:54
void RPCSimSetUp::setRPCSetUp ( const std::vector< RPCStripNoises::NoiseItem > &  vnoise,
const std::vector< RPCClusterSize::ClusterSizeItem > &  vClusterSize 
)

Definition at line 102 of file RPCSimSetUp.cc.

References gen::n, RPCDetId, and groupFilesInBlocks::temp.

102  {
103 
104  std::vector<RPCClusterSize::ClusterSizeItem>::const_iterator itCls;
105  uint32_t detId;
106  int clsCounter(1);
107  std::vector<double> clsVect;
108 
109  for(itCls = vClusterSize.begin(); itCls != vClusterSize.end(); ++itCls){
110  clsVect.push_back(((double)(itCls->clusterSize)));
111  if((!(clsCounter%120)) && (clsCounter!=0)){
112  detId=itCls->dpid;
113  _mapDetClsMap[detId]=clsVect;
114  clsVect.clear();
115  clsCounter=0;
116  }
117  ++clsCounter;
118  }
119 
120  // the same loop (but till 100) to allow old format to be used
121  for(itCls = vClusterSize.begin(); itCls != vClusterSize.end(); ++itCls){
122  clsVect.push_back(((double)(itCls->clusterSize)));
123  if((!(clsCounter%100)) && (clsCounter!=0)){
124  detId=itCls->dpid;
125  _mapDetClsMapLegacy[detId]=clsVect;
126  clsVect.clear();
127  clsCounter=0;
128  }
129  ++clsCounter;
130  }
131 
132  unsigned int n = 0;
133  uint32_t temp = 0;
134  std::vector<float> veff, vvnoise;
135  veff.clear();
136  vvnoise.clear();
137 
138  for(std::vector<RPCStripNoises::NoiseItem>::const_iterator it = vnoise.begin(); it != vnoise.end(); ++it){
139  if(n%96 == 0) {
140  if(n > 0 ){
141  _mapDetIdNoise[temp]= vvnoise;
142  _mapDetIdEff[temp] = veff;
143  _bxmap[RPCDetId(it->dpid)] = it->time;
144 
145  veff.clear();
146  vvnoise.clear();
147  vvnoise.push_back((it->noise));
148  veff.push_back((it->eff));
149  }
150  else if(n == 0 ){
151  vvnoise.push_back((it->noise));
152  veff.push_back((it->eff));
153  _bxmap[RPCDetId(it->dpid)] = it->time;
154  }
155  } else if (n == vnoise.size()-1 ){
156  temp = it->dpid;
157  vvnoise.push_back((it->noise));
158  veff.push_back((it->eff));
159  _mapDetIdNoise[temp]= vvnoise;
160  _mapDetIdEff[temp] = veff;
161  } else {
162  temp = it->dpid;
163  vvnoise.push_back((it->noise));
164  veff.push_back((it->eff));
165  }
166  n++;
167  }
168 }
std::map< RPCDetId, float > _bxmap
Definition: RPCSimSetUp.h:56
std::map< uint32_t, std::vector< double > > _mapDetClsMapLegacy
Definition: RPCSimSetUp.h:59
std::map< uint32_t, std::vector< float > > _mapDetIdEff
Definition: RPCSimSetUp.h:55
std::map< uint32_t, std::vector< double > > _mapDetClsMap
Definition: RPCSimSetUp.h:58
std::map< uint32_t, std::vector< float > > _mapDetIdNoise
Definition: RPCSimSetUp.h:54

Member Data Documentation

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

Definition at line 56 of file RPCSimSetUp.h.

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

Definition at line 57 of file RPCSimSetUp.h.

std::vector<double> RPCSimSetUp::_DetAsymmetryForCls

Definition at line 61 of file RPCSimSetUp.h.

std::vector<double> RPCSimSetUp::_DetClsAsymmetric

Definition at line 60 of file RPCSimSetUp.h.

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

Definition at line 58 of file RPCSimSetUp.h.

std::map<uint32_t, std::vector<double> > RPCSimSetUp::_mapDetClsMapLegacy

Definition at line 59 of file RPCSimSetUp.h.

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

Definition at line 55 of file RPCSimSetUp.h.

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

Definition at line 54 of file RPCSimSetUp.h.

const RPCGeometry* RPCSimSetUp::theGeometry

Definition at line 52 of file RPCSimSetUp.h.

Referenced by getGeometry(), and setGeometry().