CMS 3D CMS Logo

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 559 of file RPCSimSetUp.cc.

559 {}

Member Function Documentation

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

Definition at line 426 of file RPCSimSetUp.cc.

References Exception, mps_fire::i, and LogDebug.

Referenced by RPCSimAsymmetricCls::getClSize().

426  {
427 
428  LogDebug ("RPCSimSetupChecks")<<"RPCSimSetUp::getAsymmetricClsDistribution"<<std::endl;
429 
430  map<uint32_t,std::vector<double> >::const_iterator iter = _mapDetClsMap.find(id);
431  if(iter == _mapDetClsMap.end()){
432  throw cms::Exception("DataCorrupt")
433  << "Exception from RPCSimSetUp - _mapDetClsMap - no cluster size information for DetId\t"<<id<< std::endl;
434  }
435  if((iter->second).size() != 120){
436  throw cms::Exception("DataCorrupt")
437  << "Exception from RPCSimSetUp - _mapDetClsMap - cluster size information in a wrong format for DetId\t"<<id<< std::endl;
438  }
439  // return iter->second;
440 
441  std::vector<double> dataForAsymmCls = iter->second;
442  if(slice>4){
443  throw cms::Exception("DataCorrupt")
444  << "Exception from RPCSimSetUp - slice variable not in the range"<< std::endl;
445  }
446 
447  _DetClsAsymmetric.clear();
448 
449 
450  vector<double> clsFewStripsDistribution;
451  vector<double> clsDistribution;
452  vector<double> clsAccumulativeDistribution;
453 
454  std::map< int, std::vector<double> > mapSliceVsDistribution;
455 
456  const int slices=5;
457  const int distributionFewStrips=24;
458 
459  double sliceVsFewStripsDistribution[slices][distributionFewStrips];
460 
461  for(int j = 0; j < distributionFewStrips; j++){
462  for(int i = 0; i < slices; i++){
463  sliceVsFewStripsDistribution[i][j]=dataForAsymmCls[j*slices+i];
464  }
465  }
466 
467 double control=0;
468 for(int j = 0 ; j < distributionFewStrips; j++){
469 control+=sliceVsFewStripsDistribution[0][j];
470 }
471 
472 double control1=0;
473  for(int j = 0; j < distributionFewStrips; j++){
474  for(int i = 0; i < slices; i++){
475  control1+=dataForAsymmCls[j*slices+i];
476  }
477  }
478 
479  int i = slice;
480  double sum=0;
481  int counter = 0 ;
482  for(int j = 0; j < distributionFewStrips; j++){
483  counter++;
484  sum+=sliceVsFewStripsDistribution[i][j];
485  if(counter%4==0){
486  _DetClsAsymmetric.push_back(sum);
487  }
488  }
489  return _DetClsAsymmetric;
490 }
#define LogDebug(id)
std::vector< double > _DetClsAsymmetric
Definition: RPCSimSetUp.h:60
std::map< uint32_t, std::vector< double > > _mapDetClsMap
Definition: RPCSimSetUp.h:58
const std::vector< double > & RPCSimSetUp::getAsymmetryForCls ( uint32_t  id,
uint32_t  slice,
uint32_t  cls 
)

Definition at line 492 of file RPCSimSetUp.cc.

References Exception, mps_fire::i, LogDebug, findQualityFiles::size, and relativeConstraints::value.

Referenced by RPCSimAsymmetricCls::simulate().

492  {
493 
494  LogDebug ("RPCSimSetupChecks")<<"RPCSimSetUp::getAsymmetryForCls"<<std::endl;
495 
496  map<uint32_t,std::vector<double> >::const_iterator iter = _mapDetClsMap.find(id);
497  if(iter == _mapDetClsMap.end()){
498  throw cms::Exception("DataCorrupt")
499  << "Exception from RPCSimSetUp - _mapDetClsMap - no cluster size information for DetId\t"<<id<< std::endl;
500  }
501  if((iter->second).size() != 120){
502  throw cms::Exception("DataCorrupt")
503  << "Exception from RPCSimSetUp - _mapDetClsMap - cluster size information in a wrong format for DetId\t"<<id<<'\t'<<(iter->second).size()<< std::endl;
504  }
505 
506 std::vector<double> dataForAsymmCls = iter->second;
507 
508 if(slice>4){
509  throw cms::Exception("DataCorrupt")
510  << "Exception from RPCSimSetUp - slice variable not in the range"<< std::endl;
511  }
512 
513  _DetAsymmetryForCls.clear();
514 
515  vector<double> clsFewStripsDistribution;
516  vector<double> clsDistribution;
517  vector<double> clsAccumulativeDistribution;
518 vector<double> clsDetAsymmetryForCls;
519  clsDetAsymmetryForCls.clear();
520 
521  std::map< int, std::vector<double> > mapSliceVsDistribution;
522 
523  const int slices=5;
524  const int distributionFewStrips=24;
525 
526  double sliceVsFewStripsDistribution[slices][distributionFewStrips];
527 
528  for(int j = 0; j < distributionFewStrips; j++){
529  for(int i = 0; i < slices; i++){
530  sliceVsFewStripsDistribution[i][j]=dataForAsymmCls[j*slices+i];
531  }
532  }
533 
534  int vector_lenght;
535  switch(cls){
536  case 1: case 3: case 5: vector_lenght =3; break;
537  case 2: case 4: vector_lenght =4; break;
538  case 6: default: vector_lenght = 1; break;
539  }
540 
541  float sum=0;
542  float value;
543  for(int i = 0; i < vector_lenght ; i ++){
544  value = sliceVsFewStripsDistribution[slice][(cls-1)*4+i];
545  clsDetAsymmetryForCls.push_back(value);
546  sum +=value;
547  // LogDebug ("RPCSimSetup")<<"value\t"<<value<<std::endl;
548  // LogDebug ("RPCSimSetup")<<"sum\t"<<sum<<std::endl;
549  }
550 
551  float accum=0;
552  for(int i = clsDetAsymmetryForCls.size()-1; i>-1; i--){
553  accum += clsDetAsymmetryForCls[i];
554  _DetAsymmetryForCls.push_back(accum/sum);
555  }
556 return _DetAsymmetryForCls;
557 }
#define LogDebug(id)
size
Write out results.
std::vector< double > _DetAsymmetryForCls
Definition: RPCSimSetUp.h:61
std::map< uint32_t, std::vector< double > > _mapDetClsMap
Definition: RPCSimSetUp.h:58
const std::vector< double > & RPCSimSetUp::getCls ( uint32_t  id)

Definition at line 408 of file RPCSimSetUp.cc.

References Exception, and LogDebug.

Referenced by RPCSimModelTiming::getClSize(), and RPCSimAverageNoiseEffCls::getClSize().

409 {
410 
411  LogDebug ("RPCSimSetupChecks")<<"RPCSimSetUp::getCls"<<std::endl;
412 
413  map<uint32_t,std::vector<double> >::iterator iter = _mapDetClsMapLegacy.find(id);
414  if(iter == _mapDetClsMapLegacy.end()){
415  throw cms::Exception("DataCorrupt")
416  << "Exception from RPCSimSetUp - no cluster size information for DetId\t"<<id<< std::endl;
417  }
418  if((iter->second).size() != 100){
419  throw cms::Exception("DataCorrupt")
420  << "Exception from RPCSimSetUp - _mapDetClsMapLegacy - cluster size information in a wrong format for DetId\t"<<id<< std::endl;
421  }
422  LogDebug ("RPCSimSetupChecks")<< "All OK from RPCSimSetUp - _mapDetClsMapLegacy - cluster size information for DetId\t"<<id<< std::endl;
423  return iter->second;
424 }
#define LogDebug(id)
std::map< uint32_t, std::vector< double > > _mapDetClsMapLegacy
Definition: RPCSimSetUp.h:59
const std::map< int, std::vector< double > > & RPCSimSetUp::getClsMap ( )

Definition at line 397 of file RPCSimSetUp.cc.

References Exception.

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

398 {
399  if(_clsMap.size()!=5){
400  throw cms::Exception("DataCorrupt")
401  << "Exception from RPCSimSetUp - cluster size - a wrong format "<< std::endl;
402  }
403  return _clsMap;
404 }
std::map< int, std::vector< double > > _clsMap
Definition: RPCSimSetUp.h:57
const std::vector< float > & RPCSimSetUp::getEff ( uint32_t  id)

Definition at line 364 of file RPCSimSetUp.cc.

References Exception, LogDebug, RPCRoll::nstrips(), and findQualityFiles::size.

365 {
366  map<uint32_t,std::vector<float> >::iterator iter = _mapDetIdEff.find(id);
367  if(iter == _mapDetIdEff.end()){
368  throw cms::Exception("DataCorrupt")
369  << "Exception from RPCSimSetUp - no efficiency information for DetId\t"<<id<< std::endl;
370  }
371 
372  RPCDetId rpcId = RPCDetId(id);
373  const RPCRoll* roll = theGeometry->roll(rpcId);
374  unsigned int numbStrips = roll->nstrips();
375 
376  if((iter->second).size() < numbStrips){
377  LogDebug ("RPCSimSetup")<< "Exception from RPCSimSetUp - efficiency information in a wrong format for DetId\t"<<id<<" aka "<<RPCDetId(id)<<std::endl;
378  LogDebug ("RPCSimSetup")<<" number of strips in Conditions\t"<<(iter->second).size()<<" number of strips in Geometry\t"<<numbStrips<<std::endl;
379  throw cms::Exception("DataCorrupt")
380  << "Exception from RPCSimSetUp - efficiency information in a wrong format for DetId\t"<<id<< std::endl;
381  }
382 
383  return iter->second;
384 }
#define LogDebug(id)
size
Write out results.
int nstrips() const
Definition: RPCRoll.cc:46
const RPCGeometry * theGeometry
Definition: RPCSimSetUp.h:52
std::map< uint32_t, std::vector< float > > _mapDetIdEff
Definition: RPCSimSetUp.h:55
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
Definition: RPCGeometry.cc:75
const RPCGeometry* RPCSimSetUp::getGeometry ( )
inline

Definition at line 50 of file RPCSimSetUp.h.

References theGeometry.

Referenced by RPCSynchronizer::getSimHitBx(), and RPCSynchronizer::getSimHitBxAndTimingForIRPC().

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

Definition at line 353 of file RPCSimSetUp.cc.

References Exception, and LogDebug.

354 {
355  map<uint32_t,std::vector<float> >::iterator iter = _mapDetIdNoise.find(id);
356  if(iter == _mapDetIdNoise.end()){
357  throw cms::Exception("DataCorrupt")
358  << "Exception from RPCSimSetUp - no noise information for DetId\t"<<id<< std::endl;
359  }
360  LogDebug ("RPCSimSetupChecks")<< "All OK from RPCSimSetUp - noise information for DetId\t"<<id<< std::endl;
361  return iter->second;
362 }
#define LogDebug(id)
std::map< uint32_t, std::vector< float > > _mapDetIdNoise
Definition: RPCSimSetUp.h:54
float RPCSimSetUp::getTime ( uint32_t  id)

Definition at line 386 of file RPCSimSetUp.cc.

References Exception, and DetId::rawId().

Referenced by RPCSynchronizer::getSimHitBx(), and RPCSynchronizer::getSimHitBxAndTimingForIRPC().

387 {
388  RPCDetId rpcid(id);
389  std::map<RPCDetId, float>::iterator iter = _bxmap.find(rpcid);
390  if(iter == _bxmap.end()){
391  throw cms::Exception("DataCorrupt")
392  << "Exception from RPCSimSetUp - no timing information for rpcid.rawId()\t"<<rpcid.rawId()<< std::endl;
393  }
394  return iter->second;
395 }
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.

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 gen::n, and groupFilesInBlocks::temp.

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
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 LogDebug, RPCRoll::nstrips(), and AlCaHLTBitMon_QueryRunRegistry::string.

102  {
103 
104  LogDebug ("RPCSimSetup")<<"RPCSimSetUp::setRPCSetUp(vector<NoiseItem>, vector<ClusterSizeItem>)"<<std::endl;
105 
106  uint32_t detId = 0, current_detId, this_detId;
107  RPCDetId rpcId, current_rpcId, this_rpcId;
108  const RPCRoll * current_roll = nullptr;
109  const RPCRoll * this_roll = nullptr;
110  unsigned int current_nStrips;
111 
112  LogDebug ("RPCSimSetup")<<"RPCSimSetUp::setRPCSetUp :: ClusterSizeItem :: begin"<<std::endl;
113  std::stringstream sslogclsitem;
114  // ### ClusterSizeItem #######################################################
115  std::vector<RPCClusterSize::ClusterSizeItem>::const_iterator itCls;
116  int clsCounter(1);
117  std::vector<double> clsVect;
118  // ### loop for New Format (120 entries)
119  for(itCls = vClusterSize.begin(); itCls != vClusterSize.end(); ++itCls){
120  sslogclsitem<<" Push back clustersize = "<<itCls->clusterSize<<std::endl;
121  clsVect.push_back(((double)(itCls->clusterSize)));
122  sslogclsitem<<"Filling cls in _mapDetCls[detId,clsVect] :: detId = "<<detId;
123  sslogclsitem<<" --> will it be accepted? clsCounter = "<<clsCounter<<" accepted?";
124  sslogclsitem<<" New Format ::"<<((!(clsCounter%120)) && (clsCounter!=0)); // <<std::endl;
125  sslogclsitem<<" Old Format ::"<<((!(clsCounter%100)) && (clsCounter!=0)); // <<std::endl;
126  sslogclsitem<<std::endl;
127 
128  // New Format :: loop until 120
129  if((!(clsCounter%120)) && (clsCounter!=0)){
130  detId=itCls->dpid;
131  _mapDetClsMap[detId]=clsVect;
132  std::stringstream LogDebugClsVectString;
133  LogDebugClsVectString<<"[";
134  for(std::vector<double>::iterator itClsVect = clsVect.begin(); itClsVect != clsVect.end(); ++itClsVect) {
135  LogDebugClsVectString<<*itClsVect<<",";
136  }
137  LogDebugClsVectString<<"]";
138  std::string LogDebugClsVectStr = LogDebugClsVectString.str();
139  LogDebug ("RPCSimSetup")<<"Filling clsVect in _mapDetCls[detId,clsVect] :: detId = "<<RPCDetId(detId)<<" = "<<detId<<" clsVec = "<<LogDebugClsVectStr;
140 
141  sslogclsitem<<" --> New Method ";
142  sslogclsitem<<" --> saved in map "<<std::endl;
143  sslogclsitem<<"Filling cls in _mapDetClsMap[detId,clsVect] :: detId = "<<detId;
144  sslogclsitem<<" --> will it be accepted? clsCounter = "<<clsCounter<<" accepted? "<<((!(clsCounter%120)) && (clsCounter!=0))<<std::endl;
145  clsVect.clear();
146  clsCounter=0;
147  }
148  else{
149  sslogclsitem<<" --> not saved in map "<<std::endl;
150  }
151  ++clsCounter;
152  }
153  // ### loop for Old Format (100 entries)
154  for(itCls = vClusterSize.begin(); itCls != vClusterSize.end(); ++itCls){
155  sslogclsitem<<" Push back clustersize = "<<itCls->clusterSize<<std::endl;
156  clsVect.push_back(((double)(itCls->clusterSize)));
157  sslogclsitem<<"Filling cls in _mapDetClsMapLegacy[detId,clsVect] :: detId = "<<detId;
158  sslogclsitem<<" --> will it be accepted? clsCounter = "<<clsCounter<<" accepted?";
159  sslogclsitem<<" New Format ::"<<((!(clsCounter%120)) && (clsCounter!=0)); // <<std::endl;
160  sslogclsitem<<" Old Format ::"<<((!(clsCounter%100)) && (clsCounter!=0)); // <<std::endl;
161  sslogclsitem<<std::endl;
162 
163  // Old Format :: same until 100
164  if((!(clsCounter%100)) && (clsCounter!=0)){
165  detId=itCls->dpid;
166  _mapDetClsMapLegacy[detId]=clsVect;
167  std::stringstream LogDebugClsVectString;
168  LogDebugClsVectString<<"[";
169  for(std::vector<double>::iterator itClsVect = clsVect.begin(); itClsVect != clsVect.end(); ++itClsVect) {
170  LogDebugClsVectString<<*itClsVect<<",";
171  }
172  LogDebugClsVectString<<"]";
173  std::string LogDebugClsVectStr = LogDebugClsVectString.str();
174  LogDebug ("RPCSimSetup")<<"Filling clsVect in _mapDetClsLegacy[detId,clsVect] :: detId = "<<RPCDetId(detId)<<" = "<<detId<<" clsVec = "<<LogDebugClsVectStr;
175 
176  sslogclsitem<<" --> Old Method ";
177  sslogclsitem<<" --> saved in map "<<std::endl;
178  sslogclsitem<<"Filling cls in _mapDetClsMapLegacy[detId,clsVect] :: detId = "<<detId;
179  sslogclsitem<<" --> will it be accepted? clsCounter = "<<clsCounter<<" accepted? "<<((!(clsCounter%120)) && (clsCounter!=0))<<std::endl;
180  clsVect.clear();
181  clsCounter=0;
182  }
183  else{
184  sslogclsitem<<" --> not saved in map "<<std::endl;
185  }
186  ++clsCounter;
187  }
188  // ###########################################################################
189  std::string logclsitem = sslogclsitem.str(); sslogclsitem.clear();
190  LogDebug ("RPCSimSetupClsLoopDetails")<<logclsitem<<std::endl;
191  LogDebug ("RPCSimSetup")<<"RPCSimSetUp::setRPCSetUp :: ClusterSizeItem :: end"<<std::endl;
192 
193  LogDebug ("RPCSimSetup")<<"RPCSimSetUp::setRPCSetUp :: NoiseItem :: begin"<<std::endl;
194  std::stringstream sslognoiseitem;
195  // ### NoiseItem #############################################################
196  unsigned int count_strips = 1;
197  unsigned int count_all = 1;
198  std::vector<float> vveff, vvnoise;
199 
200  // DetId to start with needs to be a DetId inside the Geometry used
201  // Therefore loop on the NoiseItems and search for the first valid roll in the Geometry
202  // Assign this as the DetId to start with (so called current_roll) and quit the loop
203  bool quitLoop = false;
204  current_detId = 0; current_nStrips = 0; // current_rpcId = 0; current_roll = 0;
205  for(std::vector<RPCStripNoises::NoiseItem>::const_iterator it = vnoise.begin(); it != vnoise.end() && !quitLoop; ++it) {
206  // roll associated to the conditions of this strip (iterator)
207  current_detId = it->dpid;
208  current_rpcId = RPCDetId(current_detId);
209  // Test whether this roll (picked up from the conditions) is inside the RPC Geometry
210  const RPCRoll* roll = theGeometry->roll(current_rpcId);
211  if(roll==nullptr) {
212  sslognoiseitem <<"Searching for first valid detid :: current_detId = "<<current_detId;
213  sslognoiseitem <<" aka "<<current_rpcId<<" is not in current Geometry --> Skip "<<std::endl;
214  continue;
215  }
216  else {
217  sslognoiseitem <<"Searching for first valid detid :: current_detId = "<<current_detId;
218  sslognoiseitem <<" aka "<<current_rpcId<<" is the first (valid) roll in the current Geometry --> Accept, Assign & Quit Loop"<<std::endl;
219  current_roll = theGeometry->roll(current_rpcId);
220  current_nStrips = current_roll->nstrips();
221  quitLoop = true;
222  }
223  }
224 
225  sslognoiseitem <<"Start Position :: current_detId = "<<current_detId<<" aka "<<current_rpcId;
226  sslognoiseitem <<" is a valid roll with pointer "<<current_roll<<" and has "<<(current_roll?current_roll->nstrips():0)<<" strips"<<std::endl;
227  sslognoiseitem <<" ------------------------------------------------------------------------------------------------------------------------------------- "<<std::endl;
228  for(std::vector<RPCStripNoises::NoiseItem>::const_iterator it = vnoise.begin(); it != vnoise.end(); ++it) {
229 
230  // roll associated to the conditions of this strip (iterator)
231  this_detId = it->dpid;
232  this_rpcId = RPCDetId(this_detId);
233  // Test whether this roll (picked up from the conditions) is inside the RPC Geometry
234  const RPCRoll* roll = theGeometry->roll(this_rpcId);
235  if(roll==nullptr) {
236  sslognoiseitem <<"Inside Loop :: ["<<std::setw(6)<<count_all<<"]["<<std::setw(3)<<count_strips<<"] :: this_detId = "<<this_detId<<" aka "<<this_rpcId<<" which is not in current Geometry --> Skip "<<std::endl;
237  continue;
238  }
239 
240  // Case 1 :: FIRST ENTRY
241  // ---------------------
242  if(this_detId == current_detId && count_strips == 1) {
243  sslognoiseitem<<"RPCSimSetUp::setRPCSetUp :: NoiseItem :: case 1"<<std::endl;
244  sslognoiseitem<<this_detId<<" = "<<this_rpcId<<" with "<<roll->nstrips()<<" strips"<<std::endl;
245  // fill bx in map
246  _bxmap[current_detId] = it->time;
247  sslognoiseitem<<"[NoiseItem :: n = "<<count_all<<"] Filling time in _bxmap[detId] :: detId = "<<RPCDetId(it->dpid)<<" time = "<<it->time<<std::endl;
248  // clear vectors
249  vveff.clear();
250  vvnoise.clear();
251  // fill the vectors
252  vvnoise.push_back((it->noise));
253  vveff.push_back((it->eff));
254  sslognoiseitem <<"First Value :: ["<<std::setw(6)<<count_all<<"]["<<std::setw(3)<<count_strips<<"] :: this_detId = "<<this_detId<<" aka "<<this_rpcId;
255  sslognoiseitem <<" Strip "<<std::setw(3)<<count_strips<<" Noise = "<<it->noise<<" Hz/cm2"<<std::endl;
256  // update counter
257  ++count_strips;
258  ++count_all;
259  }
260  // Case 2 :: 2ND ENTRY --> LAST-1 ENTRY
261  // ------------------------------------
262  else if(this_detId == current_detId && count_strips > 1 && count_strips < current_nStrips) {
263  sslognoiseitem<<"RPCSimSetUp::setRPCSetUp :: NoiseItem :: case 2"<<std::endl;
264  sslognoiseitem <<"Inside Loop :: ["<<std::setw(6)<<count_all<<"]["<<std::setw(3)<<count_strips<<"] :: this_detId = "<<this_detId<<" aka "<<this_rpcId;
265  sslognoiseitem <<" Strip "<<std::setw(3)<<count_strips<<" Noise = "<<it->noise<<" Hz/cm2"<<std::endl;
266  // fill the vectors
267  vvnoise.push_back((it->noise));
268  vveff.push_back((it->eff));
269  // update counter
270  ++count_strips;
271  ++count_all;
272  }
273 
274  // Case 3 :: LAST ENTRY
275  // --------------------
276  else if(this_detId == current_detId && count_strips == current_nStrips) {
277  sslognoiseitem<<"RPCSimSetUp::setRPCSetUp :: NoiseItem :: case 3"<<std::endl;
278  // fill last value in the vector
279  sslognoiseitem <<"Last Value :: ["<<std::setw(6)<<count_all<<"]["<<std::setw(3)<<count_strips<<"] :: this_detId = "<<this_detId<<" aka "<<this_rpcId;
280  sslognoiseitem <<" Strip "<<std::setw(3)<<count_strips<<" Noise = "<<it->noise<<" Hz/cm2"<<std::endl;
281  vvnoise.push_back((it->noise));
282  vveff.push_back((it->eff));
283  // update counter
284  ++count_strips;
285  ++count_all;
286  // fill vectors into map
287  sslognoiseitem <<" fill vectors into map"<<std::endl;
288  _mapDetIdNoise[current_detId]= vvnoise;
289  _mapDetIdEff[current_detId] = vveff;
290 
291  std::stringstream LogDebugNoiVectString, LogDebugEffVectString;
292  LogDebugNoiVectString<<"[";
293  for(std::vector<float>::iterator itNoiVect = vvnoise.begin(); itNoiVect != vvnoise.end(); ++itNoiVect) {
294  LogDebugNoiVectString<<(*itNoiVect)<<",";
295  }
296  LogDebugNoiVectString<<"]";
297  std::string LogDebugNoiVectStr = LogDebugNoiVectString.str();
298  LogDebugEffVectString<<"[";
299  for(std::vector<float>::iterator itEffVect = vveff.begin(); itEffVect != vveff.end(); ++itEffVect) {
300  LogDebugEffVectString<<(*itEffVect)<<",";
301  }
302  LogDebugEffVectString<<"]";
303  std::string LogDebugEffVectStr = LogDebugEffVectString.str();
304  LogDebug ("RPCSimSetup")<<"Filling vvnoise in _mapDetIdNoise[detId] :: detId = "<<RPCDetId(it->dpid)<<" = "<<(RPCDetId(it->dpid)).rawId()<<" vvnoise = "<<LogDebugNoiVectStr;
305  LogDebug ("RPCSimSetup")<<"Filling veff in _mapDetIdEff[detId] :: detId = "<<RPCDetId(it->dpid)<<" = "<<(RPCDetId(it->dpid)).rawId()<<" veff = "<<LogDebugEffVectStr;
306 
307  // look for next different detId and rename it to the current_detId
308  // at this point we skip all the conditions for the strips that are not in this roll
309  // and we will go to the conditions for the first strip of the next roll
310  bool next_detId_found = false;
311  sslognoiseitem <<"look for next different detId"<<std::endl;
312  while(next_detId_found==0 && it != vnoise.end()-1) {
313  ++it;
314  this_detId = it->dpid;
315  this_rpcId = RPCDetId(this_detId);
316  this_roll = theGeometry->roll(this_rpcId);
317  if(!this_roll) continue;
318  sslognoiseitem <<"Inside While:: ["<<std::setw(6)<<count_all<<"]["<<std::setw(3)<<count_strips<<"] :: this_detId = "<<this_detId<<" aka "<<this_rpcId<<" Noise = "<<it->noise<<" Hz/cm2"<<std::endl;
319  ++count_strips;
320  // ++count_all;
321  if(this_detId != current_detId) {
322  sslognoiseitem <<"Different detId is found :: "<<this_detId<<" aka "<<this_rpcId<<" Noise = "<<it->noise<<" Hz/cm2";
323  // next roll is found. update current_detId to this newly found detId
324  // and update also the number of strips
325  current_detId = this_detId;
326  current_rpcId = RPCDetId(current_detId);
327  next_detId_found = true;
328  current_nStrips = (theGeometry->roll(current_rpcId))->nstrips();
329  sslognoiseitem <<" with "<<current_nStrips<<" strips"<<std::endl;
330  --it; // subtract one, because at the end of the loop the iterator will be increased with one
331  // in fact the treatment for roll N stops when we find the first occurence of roll N+1
332  // however we want to start the treatment for roll N+1 with the first occurence of roll N+1
333  // so the first entry of each new roll N+1 is manipulated twice in the loop (once as a stop, once as a start)
334  // therefore we have to manipulate the iterator here, subtracting one, to treat again this entry
335  }
336  }
337  // reset count_strips
338  count_strips = 1;
339  }
340  // There should be no Case 4
341  // -------------------------
342  else {}
343  }
344  // ###########################################################################
345  std::string lognoiseitem = sslognoiseitem.str(); sslognoiseitem.clear();
346  LogDebug ("RPCSimSetupNoiseLoopDetails")<<lognoiseitem<<std::endl;
347  LogDebug ("RPCSimSetup")<<"RPCSimSetUp::setRPCSetUp :: NoiseItem :: end"<<std::endl;
348 
349  LogDebug ("RPCSimSetup")<<"RPCSimSetUp::setRPCSetUp :: end"<<std::endl;
350 }
#define LogDebug(id)
std::map< RPCDetId, float > _bxmap
Definition: RPCSimSetUp.h:56
int nstrips() const
Definition: RPCRoll.cc:46
std::map< uint32_t, std::vector< double > > _mapDetClsMapLegacy
Definition: RPCSimSetUp.h:59
const RPCGeometry * theGeometry
Definition: RPCSimSetUp.h:52
std::map< uint32_t, std::vector< float > > _mapDetIdEff
Definition: RPCSimSetUp.h:55
std::map< uint32_t, std::vector< double > > _mapDetClsMap
Definition: RPCSimSetUp.h:58
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
Definition: RPCGeometry.cc:75
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().