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  _mapDetIdNoise.clear();
39  _mapDetIdEff.clear();
40  _bxmap.clear();
41  _clsMap.clear();
42 }
std::map< RPCDetId, float > _bxmap
Definition: RPCSimSetUp.h:55
std::map< uint32_t, std::vector< float > > _mapDetIdEff
Definition: RPCSimSetUp.h:54
std::map< int, std::vector< double > > _clsMap
Definition: RPCSimSetUp.h:56
std::map< uint32_t, std::vector< float > > _mapDetIdNoise
Definition: RPCSimSetUp.h:53
RPCSimSetUp::~RPCSimSetUp ( )
virtual

Definition at line 580 of file RPCSimSetUp.cc.

580 {}

Member Function Documentation

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

Definition at line 440 of file RPCSimSetUp.cc.

References Exception, mps_fire::i, dqmiolumiharvest::j, LogDebug, and mergeAndRegister::slice.

Referenced by RPCSimAsymmetricCls::getClSize().

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

Definition at line 504 of file RPCSimSetUp.cc.

References Exception, mps_fire::i, dqmiolumiharvest::j, LogDebug, findQualityFiles::size, mergeAndRegister::slice, and relativeConstraints::value.

Referenced by RPCSimAsymmetricCls::simulate().

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

Definition at line 421 of file RPCSimSetUp.cc.

References Exception, and LogDebug.

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

422 {
423  LogDebug("RPCSimSetupChecks") << "RPCSimSetUp::getCls" << std::endl;
424 
425  map<uint32_t, std::vector<double> >::iterator iter = _mapDetClsMapLegacy.find(id);
426  if (iter == _mapDetClsMapLegacy.end()) {
427  throw cms::Exception("DataCorrupt") << "Exception from RPCSimSetUp - no cluster size information for DetId\t" << id
428  << std::endl;
429  }
430  if ((iter->second).size() != 100) {
431  throw cms::Exception("DataCorrupt")
432  << "Exception from RPCSimSetUp - _mapDetClsMapLegacy - cluster size information in a wrong format for DetId\t"
433  << id << std::endl;
434  }
435  LogDebug("RPCSimSetupChecks")
436  << "All OK from RPCSimSetUp - _mapDetClsMapLegacy - cluster size information for DetId\t" << id << std::endl;
437  return iter->second;
438 }
#define LogDebug(id)
std::map< uint32_t, std::vector< double > > _mapDetClsMapLegacy
Definition: RPCSimSetUp.h:58
const std::map< int, std::vector< double > > & RPCSimSetUp::getClsMap ( )

Definition at line 413 of file RPCSimSetUp.cc.

References Exception.

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

413  {
414  if (_clsMap.size() != 5) {
415  throw cms::Exception("DataCorrupt") << "Exception from RPCSimSetUp - cluster size - a wrong format " << std::endl;
416  }
417  return _clsMap;
418 }
std::map< int, std::vector< double > > _clsMap
Definition: RPCSimSetUp.h:56
const std::vector< float > & RPCSimSetUp::getEff ( uint32_t  id)

Definition at line 380 of file RPCSimSetUp.cc.

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

380  {
381  map<uint32_t, std::vector<float> >::iterator iter = _mapDetIdEff.find(id);
382  if (iter == _mapDetIdEff.end()) {
383  throw cms::Exception("DataCorrupt") << "Exception from RPCSimSetUp - no efficiency information for DetId\t" << id
384  << std::endl;
385  }
386 
387  RPCDetId rpcId = RPCDetId(id);
388  const RPCRoll* roll = theGeometry->roll(rpcId);
389  unsigned int numbStrips = roll->nstrips();
390 
391  if ((iter->second).size() < numbStrips) {
392  LogDebug("RPCSimSetup") << "Exception from RPCSimSetUp - efficiency information in a wrong format for DetId\t" << id
393  << " aka " << RPCDetId(id) << std::endl;
394  LogDebug("RPCSimSetup") << " number of strips in Conditions\t" << (iter->second).size()
395  << " number of strips in Geometry\t" << numbStrips << std::endl;
396  throw cms::Exception("DataCorrupt")
397  << "Exception from RPCSimSetUp - efficiency information in a wrong format for DetId\t" << id << std::endl;
398  }
399 
400  return iter->second;
401 }
#define LogDebug(id)
size
Write out results.
int nstrips() const
Definition: RPCRoll.cc:24
const RPCGeometry * theGeometry
Definition: RPCSimSetUp.h:51
std::map< uint32_t, std::vector< float > > _mapDetIdEff
Definition: RPCSimSetUp.h:54
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
Definition: RPCGeometry.cc:50
const RPCGeometry* RPCSimSetUp::getGeometry ( )
inline

Definition at line 49 of file RPCSimSetUp.h.

References theGeometry.

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

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

Definition at line 370 of file RPCSimSetUp.cc.

References Exception, and LogDebug.

370  {
371  map<uint32_t, std::vector<float> >::iterator iter = _mapDetIdNoise.find(id);
372  if (iter == _mapDetIdNoise.end()) {
373  throw cms::Exception("DataCorrupt") << "Exception from RPCSimSetUp - no noise information for DetId\t" << id
374  << std::endl;
375  }
376  LogDebug("RPCSimSetupChecks") << "All OK from RPCSimSetUp - noise information for DetId\t" << id << std::endl;
377  return iter->second;
378 }
#define LogDebug(id)
std::map< uint32_t, std::vector< float > > _mapDetIdNoise
Definition: RPCSimSetUp.h:53
float RPCSimSetUp::getTime ( uint32_t  id)

Definition at line 403 of file RPCSimSetUp.cc.

References Exception, and DetId::rawId().

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

403  {
404  RPCDetId rpcid(id);
405  std::map<RPCDetId, float>::iterator iter = _bxmap.find(rpcid);
406  if (iter == _bxmap.end()) {
407  throw cms::Exception("DataCorrupt") << "Exception from RPCSimSetUp - no timing information for rpcid.rawId()\t"
408  << rpcid.rawId() << std::endl;
409  }
410  return iter->second;
411 }
std::map< RPCDetId, float > _bxmap
Definition: RPCSimSetUp.h:55
void RPCSimSetUp::setGeometry ( const RPCGeometry geom)
inline

sets geometry

Definition at line 47 of file RPCSimSetUp.h.

References relativeConstraints::geom, and theGeometry.

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

Definition at line 44 of file RPCSimSetUp.cc.

References dqmiodumpmetadata::n, and groupFilesInBlocks::temp.

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

Definition at line 97 of file RPCSimSetUp.cc.

References LogDebug, RPCRoll::nstrips(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

Member Data Documentation

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

Definition at line 55 of file RPCSimSetUp.h.

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

Definition at line 56 of file RPCSimSetUp.h.

std::vector<double> RPCSimSetUp::_DetAsymmetryForCls

Definition at line 60 of file RPCSimSetUp.h.

std::vector<double> RPCSimSetUp::_DetClsAsymmetric

Definition at line 59 of file RPCSimSetUp.h.

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

Definition at line 57 of file RPCSimSetUp.h.

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

Definition at line 58 of file RPCSimSetUp.h.

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

Definition at line 54 of file RPCSimSetUp.h.

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

Definition at line 53 of file RPCSimSetUp.h.

const RPCGeometry* RPCSimSetUp::theGeometry

Definition at line 51 of file RPCSimSetUp.h.

Referenced by getGeometry(), and setGeometry().