CMS 3D CMS Logo

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

#include <GEMSimSetUp.h>

Public Member Functions

 GEMSimSetUp (const edm::ParameterSet &ps)
 
const std::vector< float > & getCluster (uint32_t id)
 
const std::map< int,
std::vector< float > > & 
getClusterMap ()
 
const std::vector< float > & getEfficiency (uint32_t id)
 
const GEMGeometrygetGeometry ()
 
const std::vector< float > & getNoise (uint32_t id)
 
float getTime (uint32_t id)
 
void setGeometry (const GEMGeometry *geom)
 
void setup ()
 
void setup (std::vector< RPCStripNoises::NoiseItem > &vnoise, std::vector< float > &vcluster)
 
void setup (std::vector< RPCStripNoises::NoiseItem > &vnoise, std::vector< RPCClusterSize::ClusterSizeItem > &vClusterSize)
 
virtual ~GEMSimSetUp ()
 

Private Member Functions

void setupNoiseAndEfficiency (std::vector< RPCStripNoises::NoiseItem > &vnoise)
 
void setupTimeCalibration (GEMDetId id, float timing)
 

Private Attributes

double averageEfficiency_
 
double averageNoiseRate_
 
std::map< GEMDetId, float > bxmap_
 
std::map< int, std::vector
< float > > 
clusterMap_
 
const GEMGeometrygeometry_
 
std::map< uint32_t,
std::vector< float > > 
mapDetClusterMap_
 
std::map< uint32_t,
std::vector< float > > 
mapDetIdEfficiency_
 
std::map< uint32_t,
std::vector< float > > 
mapDetIdNoise_
 
int numberOfStripsPerPartition_
 
double timeCalibrationOffset_
 

Detailed Description

Definition at line 15 of file GEMSimSetUp.h.

Constructor & Destructor Documentation

GEMSimSetUp::GEMSimSetUp ( const edm::ParameterSet ps)

Definition at line 5 of file GEMSimSetUp.cc.

References averageEfficiency_, averageNoiseRate_, edm::ParameterSet::getParameter(), numberOfStripsPerPartition_, and timeCalibrationOffset_.

6 {
7  auto pset = config.getParameter<edm::ParameterSet>("digiModelConfig");
8 
9  averageEfficiency_ = pset.getParameter<double>("averageEfficiency");
10  averageNoiseRate_ = pset.getParameter<double>("averageNoiseRate");
11  timeCalibrationOffset_ = pset.getParameter<double>("timeCalibrationOffset");
12  numberOfStripsPerPartition_ = pset.getParameter<int>("numberOfStripsPerPartition");
13 }
double averageEfficiency_
Definition: GEMSimSetUp.h:58
int numberOfStripsPerPartition_
Definition: GEMSimSetUp.h:61
double averageNoiseRate_
Definition: GEMSimSetUp.h:59
double timeCalibrationOffset_
Definition: GEMSimSetUp.h:60
virtual GEMSimSetUp::~GEMSimSetUp ( )
inlinevirtual

Definition at line 21 of file GEMSimSetUp.h.

21 {}

Member Function Documentation

const std::vector< float > & GEMSimSetUp::getCluster ( uint32_t  id)

Definition at line 164 of file GEMSimSetUp.cc.

References edm::hlt::Exception, and mapDetClusterMap_.

165 {
166  auto iter = mapDetClusterMap_.find(id);
167  if(iter == mapDetClusterMap_.end())
168  {
169  throw cms::Exception("DataCorrupt")
170  << "GEMSimSetUp::getCluster() - no cluster size information for DetId "<<id<< "\n";
171  }
172  if((iter->second).size() != 100)
173  {
174  throw cms::Exception("DataCorrupt")
175  << "GEMSimSetUp::getCluster() - cluster size information in a wrong format for DetId "<<id<< "\n";
176  }
177  return iter->second;
178 }
std::map< uint32_t, std::vector< float > > mapDetClusterMap_
Definition: GEMSimSetUp.h:56
const std::map< int, std::vector< float > > & GEMSimSetUp::getClusterMap ( )

Definition at line 153 of file GEMSimSetUp.cc.

References clusterMap_, and edm::hlt::Exception.

154 {
155  if(clusterMap_.size() != 5)
156  {
157  throw cms::Exception("DataCorrupt")
158  << "GEMSimSetUp::getClusterMap() - cluster size has the wrong format.\n";
159  }
160  return clusterMap_;
161 }
std::map< int, std::vector< float > > clusterMap_
Definition: GEMSimSetUp.h:55
const std::vector< float > & GEMSimSetUp::getEfficiency ( uint32_t  id)

Definition at line 123 of file GEMSimSetUp.cc.

References edm::hlt::Exception, mapDetIdEfficiency_, and numberOfStripsPerPartition_.

124 {
125  auto iter = mapDetIdEfficiency_.find(id);
126  if(iter == mapDetIdEfficiency_.end())
127  {
128  throw cms::Exception("DataCorrupt")
129  << "GEMSimSetUp::getEfficiency() - no efficiency information for DetId "<<id<< "\n";
130  }
131  if((iter->second).size() != (unsigned) numberOfStripsPerPartition_)
132  {
133  throw cms::Exception("DataCorrupt")
134  << "GEMSimSetUp::getEfficiency() - efficiency information in a wrong format for DetId "<<id<< "\n";
135  }
136  return iter->second;
137 }
int numberOfStripsPerPartition_
Definition: GEMSimSetUp.h:61
std::map< uint32_t, std::vector< float > > mapDetIdEfficiency_
Definition: GEMSimSetUp.h:53
const GEMGeometry* GEMSimSetUp::getGeometry ( )
inline

Definition at line 43 of file GEMSimSetUp.h.

References geometry_.

Referenced by GEMSynchronizer::getSimHitBx().

43 { return geometry_; }
const GEMGeometry * geometry_
Definition: GEMSimSetUp.h:50
const std::vector< float > & GEMSimSetUp::getNoise ( uint32_t  id)

Definition at line 111 of file GEMSimSetUp.cc.

References edm::hlt::Exception, and mapDetIdNoise_.

112 {
113  auto iter = mapDetIdNoise_.find(id);
114  if(iter == mapDetIdNoise_.end())
115  {
116  throw cms::Exception("DataCorrupt")
117  << "GEMSimSetUp::getNoise() - no noise information for DetId "<<id<< "\n";
118  }
119  return iter->second;
120 }
std::map< uint32_t, std::vector< float > > mapDetIdNoise_
Definition: GEMSimSetUp.h:52
float GEMSimSetUp::getTime ( uint32_t  id)

Definition at line 140 of file GEMSimSetUp.cc.

References bxmap_, cond::rpcobgas::detid, edm::hlt::Exception, and DetId::rawId().

Referenced by GEMSynchronizer::getSimHitBx().

141 {
142  GEMDetId detid(id);
143  auto iter = bxmap_.find(detid);
144  if(iter == bxmap_.end())
145  {
146  throw cms::Exception("DataCorrupt")
147  << "GEMSimSetUp::getTime() - no timing information for gemid.rawId() "<<detid.rawId()<< "\n";
148  }
149  return iter->second;
150 }
std::map< GEMDetId, float > bxmap_
Definition: GEMSimSetUp.h:54
void GEMSimSetUp::setGeometry ( const GEMGeometry geom)
inline

Definition at line 41 of file GEMSimSetUp.h.

References relativeConstraints::geom, and geometry_.

Referenced by GEMDigiProducer::beginRun().

41 {geometry_ = geom;}
const GEMGeometry * geometry_
Definition: GEMSimSetUp.h:50
void GEMSimSetUp::setup ( void  )

Definition at line 63 of file GEMSimSetUp.cc.

References averageEfficiency_, averageNoiseRate_, GEMGeometry::dets(), RPCStripNoises::NoiseItem::dpid, RPCStripNoises::NoiseItem::eff, edm::hlt::Exception, geometry_, GEMEtaPartition::id(), RPCStripNoises::NoiseItem::noise, GEMEtaPartition::nstrips(), numberOfStripsPerPartition_, setupNoiseAndEfficiency(), setupTimeCalibration(), RPCStripNoises::NoiseItem::time, and timeCalibrationOffset_.

Referenced by GEMDigiProducer::beginRun().

64 {
65  /*
66  Container for the noise items. Its total size is 331776
67  - 2 stations
68  - 2 layers/station
69  - 36 chambers/layer
70  - 6 eta partitions/chamber
71  - 384 strips/eta partition
72  */
73  std::vector<RPCStripNoises::NoiseItem> vnoise;
74  vnoise.reserve(geometry_->dets().size() * numberOfStripsPerPartition_);
75 
76  // Loop over the detIds
77  for(const auto &det: geometry_->dets())
78  {
79  GEMEtaPartition* roll = dynamic_cast< GEMEtaPartition* >( det );
80 
81  // check for valid rolls
82  if(roll == nullptr) continue;
83 
84  const int nStrips = roll->nstrips();
85  if (numberOfStripsPerPartition_ != nStrips)
86  {
87  throw cms::Exception("DataCorrupt")
88  << "GEMSimSetUp::setup() - numberOfStripsPerPartition given in configuration "
89  <<numberOfStripsPerPartition_ <<" is not the same as in geometry "<<nStrips;
90  }
91 
92  // Loop over the strips
93  for(int iStrip=0; iStrip <= nStrips-1; ++iStrip)
94  {
95  // construct noise item for each strip
97  noise.dpid = roll->id();
98  noise.eff = averageEfficiency_;
99  noise.noise = averageNoiseRate_;
101 
102  // add noise item to noise vector
103  vnoise.push_back(noise);
104  }
105  setupTimeCalibration(det->geographicalId(),timeCalibrationOffset_);
106  }
107  setupNoiseAndEfficiency(vnoise);
108 }
double averageEfficiency_
Definition: GEMSimSetUp.h:58
int numberOfStripsPerPartition_
Definition: GEMSimSetUp.h:61
void setupNoiseAndEfficiency(std::vector< RPCStripNoises::NoiseItem > &vnoise)
Definition: GEMSimSetUp.cc:181
double averageNoiseRate_
Definition: GEMSimSetUp.h:59
void setupTimeCalibration(GEMDetId id, float timing)
Definition: GEMSimSetUp.cc:237
GEMDetId id() const
int nstrips() const
Return the chamber this roll belongs to.
virtual const DetContainer & dets() const
Returm a vector of all GeomDet (including all GeomDetUnits)
Definition: GEMGeometry.cc:25
double timeCalibrationOffset_
Definition: GEMSimSetUp.h:60
const GEMGeometry * geometry_
Definition: GEMSimSetUp.h:50
void GEMSimSetUp::setup ( std::vector< RPCStripNoises::NoiseItem > &  vnoise,
std::vector< float > &  vcluster 
)

Definition at line 15 of file GEMSimSetUp.cc.

References clusterMap_, gather_cfg::cout, n, and setupNoiseAndEfficiency().

17 {
18  std::cout << "GEMSimSetUp::setup()" << std::endl;
19  unsigned int counter = 1;
20  unsigned int row = 1;
21  std::vector<float> sum_clsize;
22 
23  for(unsigned int n = 0; n < vcluster.size(); ++n)
24  {
25  sum_clsize.push_back(vcluster[n]);
26 
27  if(counter == row * 20)
28  {
29  clusterMap_[row] = sum_clsize;
30  row++;
31  sum_clsize.clear();
32  }
33  counter++;
34  }
35 
37 }
void setupNoiseAndEfficiency(std::vector< RPCStripNoises::NoiseItem > &vnoise)
Definition: GEMSimSetUp.cc:181
std::map< int, std::vector< float > > clusterMap_
Definition: GEMSimSetUp.h:55
tuple cout
Definition: gather_cfg.py:121
void GEMSimSetUp::setup ( std::vector< RPCStripNoises::NoiseItem > &  vnoise,
std::vector< RPCClusterSize::ClusterSizeItem > &  vClusterSize 
)

Definition at line 40 of file GEMSimSetUp.cc.

References mapDetClusterMap_, and setupNoiseAndEfficiency().

42 {
43  int clusterCounter = 1;
44  std::vector<float> clusterVect;
45 
46  for(auto cluster: vClusterSize)
47  {
48  clusterVect.push_back(cluster.clusterSize);
49  if( !(clusterCounter % 100) && clusterCounter != 0 )
50  {
51  mapDetClusterMap_[cluster.dpid] = clusterVect;
52  clusterVect.clear();
53  clusterCounter = 0;
54  }
55  ++clusterCounter;
56  }
57 
59 }
void setupNoiseAndEfficiency(std::vector< RPCStripNoises::NoiseItem > &vnoise)
Definition: GEMSimSetUp.cc:181
std::map< uint32_t, std::vector< float > > mapDetClusterMap_
Definition: GEMSimSetUp.h:56
void GEMSimSetUp::setupNoiseAndEfficiency ( std::vector< RPCStripNoises::NoiseItem > &  vnoise)
private

Definition at line 181 of file GEMSimSetUp.cc.

References mapDetIdEfficiency_, mapDetIdNoise_, and numberOfStripsPerPartition_.

Referenced by setup().

182 {
183  unsigned int iStrip = 0;
184  uint32_t roll = 0;
185  std::vector<float> vEfficiency, vNoise;
186  vEfficiency.clear();
187  vNoise.clear();
188 
189  // loop over the noise vector
190  for(auto noise: vnoise)
191  {
192  if(iStrip % numberOfStripsPerPartition_ == 0)
193  {
194  // the first strip of new chamber
195  if(iStrip > 0)
196  {
197  // fill map with noise and efficiency vectors of the previous chamber
198  mapDetIdNoise_[roll] = vNoise;
199  mapDetIdEfficiency_[roll] = vEfficiency;
200  // clear the vectors and start over
201  vEfficiency.clear();
202  vNoise.clear();
203  vNoise.push_back(noise.noise);
204  vEfficiency.push_back(noise.eff);
205  }
206  // the very first strip in the collection
207  else if (iStrip == 0 )
208  {
209  // nothing to add to map yet
210  vNoise.push_back(noise.noise);
211  vEfficiency.push_back(noise.eff);
212  }
213  }
214  // the very last strip in the collection
215  else if (iStrip == vnoise.size() - 1 )
216  {
217  roll = noise.dpid;
218  vNoise.push_back(noise.noise);
219  vEfficiency.push_back(noise.eff);
220  // fill map with noise and efficiency vectors of the last chamber
221  mapDetIdNoise_[roll]= vNoise;
222  mapDetIdEfficiency_[roll] = vEfficiency;
223  }
224  // a regular strip
225  else
226  {
227  roll = noise.dpid;
228  vNoise.push_back(noise.noise);
229  vEfficiency.push_back(noise.eff);
230  }
231  iStrip++;
232  }
233 }
int numberOfStripsPerPartition_
Definition: GEMSimSetUp.h:61
std::map< uint32_t, std::vector< float > > mapDetIdEfficiency_
Definition: GEMSimSetUp.h:53
std::map< uint32_t, std::vector< float > > mapDetIdNoise_
Definition: GEMSimSetUp.h:52
void GEMSimSetUp::setupTimeCalibration ( GEMDetId  id,
float  timing 
)
private

Definition at line 237 of file GEMSimSetUp.cc.

References bxmap_.

Referenced by setup().

238 {
239  bxmap_[id] = timing;
240 }
std::map< GEMDetId, float > bxmap_
Definition: GEMSimSetUp.h:54

Member Data Documentation

double GEMSimSetUp::averageEfficiency_
private

Definition at line 58 of file GEMSimSetUp.h.

Referenced by GEMSimSetUp(), and setup().

double GEMSimSetUp::averageNoiseRate_
private

Definition at line 59 of file GEMSimSetUp.h.

Referenced by GEMSimSetUp(), and setup().

std::map< GEMDetId, float> GEMSimSetUp::bxmap_
private

Definition at line 54 of file GEMSimSetUp.h.

Referenced by getTime(), and setupTimeCalibration().

std::map< int, std::vector<float> > GEMSimSetUp::clusterMap_
private

Definition at line 55 of file GEMSimSetUp.h.

Referenced by getClusterMap(), and setup().

const GEMGeometry* GEMSimSetUp::geometry_
private

Definition at line 50 of file GEMSimSetUp.h.

Referenced by getGeometry(), setGeometry(), and setup().

std::map< uint32_t, std::vector<float> > GEMSimSetUp::mapDetClusterMap_
private

Definition at line 56 of file GEMSimSetUp.h.

Referenced by getCluster(), and setup().

std::map< uint32_t, std::vector<float> > GEMSimSetUp::mapDetIdEfficiency_
private

Definition at line 53 of file GEMSimSetUp.h.

Referenced by getEfficiency(), and setupNoiseAndEfficiency().

std::map< uint32_t, std::vector<float> > GEMSimSetUp::mapDetIdNoise_
private

Definition at line 52 of file GEMSimSetUp.h.

Referenced by getNoise(), and setupNoiseAndEfficiency().

int GEMSimSetUp::numberOfStripsPerPartition_
private

Definition at line 61 of file GEMSimSetUp.h.

Referenced by GEMSimSetUp(), getEfficiency(), setup(), and setupNoiseAndEfficiency().

double GEMSimSetUp::timeCalibrationOffset_
private

Definition at line 60 of file GEMSimSetUp.h.

Referenced by GEMSimSetUp(), and setup().