CMS 3D CMS Logo

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

#include <RPCSimAverageNoiseEff.h>

Inheritance diagram for RPCSimAverageNoiseEff:
RPCSim

Public Member Functions

int getClSize (float posX, CLHEP::HepRandomEngine *)
 
 RPCSimAverageNoiseEff (const edm::ParameterSet &config)
 
void simulate (const RPCRoll *roll, const edm::PSimHitContainer &rpcHits, CLHEP::HepRandomEngine *) override
 
void simulateNoise (const RPCRoll *, CLHEP::HepRandomEngine *) override
 
 ~RPCSimAverageNoiseEff () override
 
- Public Member Functions inherited from RPCSim
const DigiSimLinksdigiSimLinks () const
 
virtual void fillDigis (int rollDetId, RPCDigiCollection &digis)
 
RPCSimSetUpgetRPCSimSetUp ()
 
const RPCDigiSimLinksrpcDigiSimLinks () const
 
void setRPCSimSetUp (RPCSimSetUp *setup)
 
virtual ~RPCSim ()
 

Private Member Functions

void init () override
 

Private Attributes

RPCSynchronizer_rpcSync
 
double aveCls
 
double aveEff
 
std::map< int, std::vector
< double > > 
clsMap
 
double dtimCs
 
double frate
 
double gate
 
std::ifstream * infile
 
double lbGate
 
int N_hits
 
int nbxing
 
double rate
 
double resEle
 
double resRPC
 
bool rpcdigiprint
 
double sspeed
 
std::vector< double > sum_clsize
 
double timOff
 

Additional Inherited Members

- Public Types inherited from RPCSim
typedef edm::DetSet
< StripDigiSimLink
DigiSimLinks
 
typedef edm::DetSet
< RPCDigiSimLink
RPCDigiSimLinks
 
- Protected Types inherited from RPCSim
typedef std::multimap
< std::pair< unsigned int, int >
, const PSimHit *, std::less
< std::pair< unsigned int, int > > > 
DetectorHitMap
 
- Protected Member Functions inherited from RPCSim
virtual void addLinks (unsigned int strip, int bx)
 
 RPCSim (const edm::ParameterSet &config)
 
- Protected Attributes inherited from RPCSim
std::set< RPCDigiirpc_digis
 
std::set< std::pair< int, int > > strips
 
DetectorHitMap theDetectorHitMap
 
DigiSimLinks theDigiSimLinks
 
RPCDigiSimLinks theRpcDigiSimLinks
 
RPCSimSetUptheSimSetUp
 

Detailed Description

Definition at line 29 of file RPCSimAverageNoiseEff.h.

Constructor & Destructor Documentation

RPCSimAverageNoiseEff::RPCSimAverageNoiseEff ( const edm::ParameterSet config)

Definition at line 40 of file RPCSimAverageNoiseEff.cc.

References _rpcSync, aveCls, aveEff, gather_cfg::cout, dtimCs, frate, gate, edm::ParameterSet::getParameter(), lbGate, nbxing, rate, resEle, resRPC, rpcdigiprint, sspeed, and timOff.

40  : RPCSim(config) {
41  aveEff = config.getParameter<double>("averageEfficiency");
42  aveCls = config.getParameter<double>("averageClusterSize");
43  resRPC = config.getParameter<double>("timeResolution");
44  timOff = config.getParameter<double>("timingRPCOffset");
45  dtimCs = config.getParameter<double>("deltatimeAdjacentStrip");
46  resEle = config.getParameter<double>("timeJitter");
47  sspeed = config.getParameter<double>("signalPropagationSpeed");
48  lbGate = config.getParameter<double>("linkGateWidth");
49  rpcdigiprint = config.getParameter<bool>("printOutDigitizer");
50 
51  rate = config.getParameter<double>("Rate");
52  nbxing = config.getParameter<int>("Nbxing");
53  gate = config.getParameter<double>("Gate");
54  frate = config.getParameter<double>("Frate");
55 
56  if (rpcdigiprint) {
57  std::cout << "Average Efficiency = " << aveEff << std::endl;
58  std::cout << "Average Cluster Size = " << aveCls << " strips" << std::endl;
59  std::cout << "RPC Time Resolution = " << resRPC << " ns" << std::endl;
60  std::cout << "RPC Signal formation time = " << timOff << " ns" << std::endl;
61  std::cout << "RPC adjacent strip delay = " << dtimCs << " ns" << std::endl;
62  std::cout << "Electronic Jitter = " << resEle << " ns" << std::endl;
63  std::cout << "Signal propagation time = " << sspeed << " x c" << std::endl;
64  std::cout << "Link Board Gate Width = " << lbGate << " ns" << std::endl;
65  }
66 
67  _rpcSync = new RPCSynchronizer(config);
68 }
RPCSim(const edm::ParameterSet &config)
Definition: RPCSim.cc:5
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
RPCSynchronizer * _rpcSync
tuple cout
Definition: gather_cfg.py:144
RPCSimAverageNoiseEff::~RPCSimAverageNoiseEff ( )
override

Definition at line 70 of file RPCSimAverageNoiseEff.cc.

References _rpcSync.

70 { delete _rpcSync; }
RPCSynchronizer * _rpcSync

Member Function Documentation

int RPCSimAverageNoiseEff::getClSize ( float  posX,
CLHEP::HepRandomEngine *  engine 
)

Definition at line 72 of file RPCSimAverageNoiseEff.cc.

References clsMap, cms::cuda::func, RPCSimSetUp::getClsMap(), RPCSim::getRPCSimSetUp(), min(), and sum_clsize.

Referenced by simulate().

72  {
73  std::map<int, std::vector<double> > clsMap = getRPCSimSetUp()->getClsMap();
74 
75  int cnt = 1;
76  int min = 1;
77  double func = 0.0;
78  std::vector<double> sum_clsize;
79 
80  double rr_cl = CLHEP::RandFlat::shoot(engine);
81  if (0.0 <= posX && posX < 0.2) {
82  func = (clsMap[1])[(clsMap[1]).size() - 1] * (rr_cl);
83  sum_clsize = clsMap[1];
84  }
85  if (0.2 <= posX && posX < 0.4) {
86  func = (clsMap[2])[(clsMap[2]).size() - 1] * (rr_cl);
87  sum_clsize = clsMap[2];
88  }
89  if (0.4 <= posX && posX < 0.6) {
90  func = (clsMap[3])[(clsMap[3]).size() - 1] * (rr_cl);
91  sum_clsize = clsMap[3];
92  }
93  if (0.6 <= posX && posX < 0.8) {
94  func = (clsMap[4])[(clsMap[4]).size() - 1] * (rr_cl);
95  sum_clsize = clsMap[4];
96  }
97  if (0.8 <= posX && posX < 1.0) {
98  func = (clsMap[5])[(clsMap[5]).size() - 1] * (rr_cl);
99  sum_clsize = clsMap[5];
100  }
101 
102  for (vector<double>::iterator iter = sum_clsize.begin(); iter != sum_clsize.end(); ++iter) {
103  cnt++;
104  if (func > (*iter)) {
105  min = cnt;
106  } else if (func < (*iter)) {
107  break;
108  }
109  }
110  return min;
111 }
std::vector< double > sum_clsize
RPCSimSetUp * getRPCSimSetUp()
Definition: RPCSim.h:45
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t Func __host__ __device__ V int Func func
const std::map< int, std::vector< double > > & getClsMap()
Definition: RPCSimSetUp.cc:450
T min(T a, T b)
Definition: MathUtil.h:58
std::map< int, std::vector< double > > clsMap
void RPCSimAverageNoiseEff::init ( void  )
inlineoverrideprivatevirtual

Implements RPCSim.

Definition at line 41 of file RPCSimAverageNoiseEff.h.

41 {};
void RPCSimAverageNoiseEff::simulate ( const RPCRoll roll,
const edm::PSimHitContainer rpcHits,
CLHEP::HepRandomEngine *  engine 
)
overridevirtual

Implements RPCSim.

Definition at line 113 of file RPCSimAverageNoiseEff.cc.

References _rpcSync, RPCRoll::centreOfStrip(), Topology::channel(), haddnano::cl, edm::DetSet< T >::clear(), getClSize(), RPCSim::getRPCSimSetUp(), RPCSynchronizer::getSimHitBx(), mps_fire::i, RPCRoll::id(), RPCGeomServ::name(), RPCRoll::nstrips(), DetId::rawId(), RPCSynchronizer::setRPCSimSetUp(), RPCRoll::specs(), AlCaHLTBitMon_QueryRunRegistry::string, RPCRoll::strip(), RPCSim::strips, RPCSim::theDetectorHitMap, RPCSim::theRpcDigiSimLinks, RPCRollSpecs::topology(), and PV3DBase< T, PVType, FrameType >::x().

115  {
118  theDetectorHitMap.clear();
120 
121  RPCDetId rpcId = roll->id();
122  RPCGeomServ RPCname(rpcId);
123  std::string nameRoll = RPCname.name();
124 
125  const Topology& topology = roll->specs()->topology();
126 
127  for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin(); _hit != rpcHits.end(); ++_hit) {
128  if (_hit->particleType() == 11)
129  continue;
130 
131  // Here I hould check if the RPC are up side down;
132  const LocalPoint& entr = _hit->entryPoint();
133 
134  int time_hit = _rpcSync->getSimHitBx(&(*_hit), engine);
135  float posX = roll->strip(_hit->localPosition()) - static_cast<int>(roll->strip(_hit->localPosition()));
136 
137  std::vector<float> veff = (getRPCSimSetUp())->getEff(rpcId.rawId());
138 
139  // Effinciecy
140  int centralStrip = topology.channel(entr) + 1;
141  ;
142  float fire = CLHEP::RandFlat::shoot(engine);
143 
144  if (fire < veff[centralStrip - 1]) {
145  int fstrip = centralStrip;
146  int lstrip = centralStrip;
147 
148  // Compute the cluster size
149  //double w = CLHEP::RandFlat::shoot(engine);
150  //if (w < 1.e-10) w=1.e-10;
151  int clsize = this->getClSize(posX, engine);
152 
153  std::vector<int> cls;
154  cls.push_back(centralStrip);
155  if (clsize > 1) {
156  for (int cl = 0; cl < (clsize - 1) / 2; cl++) {
157  if (centralStrip - cl - 1 >= 1) {
158  fstrip = centralStrip - cl - 1;
159  cls.push_back(fstrip);
160  }
161  if (centralStrip + cl + 1 <= roll->nstrips()) {
162  lstrip = centralStrip + cl + 1;
163  cls.push_back(lstrip);
164  }
165  }
166  if (clsize % 2 == 0) {
167  // insert the last strip according to the
168  // simhit position in the central strip
169  double deltaw = roll->centreOfStrip(centralStrip).x() - entr.x();
170  if (deltaw < 0.) {
171  if (lstrip < roll->nstrips()) {
172  lstrip++;
173  cls.push_back(lstrip);
174  }
175  } else {
176  if (fstrip > 1) {
177  fstrip--;
178  cls.push_back(fstrip);
179  }
180  }
181  }
182  }
183 
184  for (std::vector<int>::iterator i = cls.begin(); i != cls.end(); i++) {
185  // Check the timing of the adjacent strip
186  if (*i != centralStrip) {
187  if (CLHEP::RandFlat::shoot(engine) < veff[*i - 1]) {
188  std::pair<int, int> digi(*i, time_hit);
189  strips.insert(digi);
190 
191  theDetectorHitMap.insert(DetectorHitMap::value_type(digi, &(*_hit)));
192  }
193  } else {
194  std::pair<int, int> digi(*i, time_hit);
195  theDetectorHitMap.insert(DetectorHitMap::value_type(digi, &(*_hit)));
196 
197  strips.insert(digi);
198  }
199  }
200  }
201  }
202 }
float strip(const LocalPoint &lp) const
Definition: RPCRoll.cc:35
LocalPoint centreOfStrip(int strip) const
Definition: RPCRoll.cc:26
int getClSize(float posX, CLHEP::HepRandomEngine *)
DetectorHitMap theDetectorHitMap
Definition: RPCSim.h:68
void setRPCSimSetUp(RPCSimSetUp *simsetup)
int nstrips() const
Definition: RPCRoll.cc:24
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
RPCSimSetUp * getRPCSimSetUp()
Definition: RPCSim.h:45
const RPCRollSpecs * specs() const
Definition: RPCRoll.cc:14
int getSimHitBx(const PSimHit *, CLHEP::HepRandomEngine *)
tuple cl
Definition: haddnano.py:49
edm::DetSet< RPCDigiSimLink > RPCDigiSimLinks
Definition: RPCSim.h:33
RPCDetId id() const
Definition: RPCRoll.cc:16
std::set< std::pair< int, int > > strips
Definition: RPCSim.h:55
virtual int channel(const LocalPoint &p) const =0
const Topology & topology() const override
Definition: RPCRollSpecs.cc:36
RPCSynchronizer * _rpcSync
void clear()
Definition: DetSet.h:71
T x() const
Definition: PV3DBase.h:59
RPCDigiSimLinks theRpcDigiSimLinks
Definition: RPCSim.h:70
void RPCSimAverageNoiseEff::simulateNoise ( const RPCRoll roll,
CLHEP::HepRandomEngine *  engine 
)
overridevirtual

Implements RPCSim.

Definition at line 204 of file RPCSimAverageNoiseEff.cc.

References frate, gate, RPCSim::getRPCSimSetUp(), mps_fire::i, RPCRoll::id(), dqmiolumiharvest::j, RectangularStripTopology::localPosition(), TrapezoidalStripTopology::localPosition(), N_hits, RPCGeomServ::name(), nbxing, RPCRoll::nstrips(), DetId::rawId(), RPCDetId::region(), AlCaHLTBitMon_QueryRunRegistry::string, RectangularStripTopology::stripLength(), TrapezoidalStripTopology::stripLength(), RPCSim::strips, RPCRoll::topology(), x, hlt_dqm_clientPB-live_cfg::xmax, and hlt_dqm_clientPB-live_cfg::xmin.

204  {
205  RPCDetId rpcId = roll->id();
206 
207  RPCGeomServ RPCname(rpcId);
208  std::string nameRoll = RPCname.name();
209 
210  std::vector<float> vnoise = (getRPCSimSetUp())->getNoise(rpcId.rawId());
211  std::vector<float> veff = (getRPCSimSetUp())->getEff(rpcId.rawId());
212 
213  unsigned int nstrips = roll->nstrips();
214  double area = 0.0;
215 
216  if (rpcId.region() == 0) {
217  const RectangularStripTopology* top_ = dynamic_cast<const RectangularStripTopology*>(&(roll->topology()));
218  float xmin = (top_->localPosition(0.)).x();
219  float xmax = (top_->localPosition((float)roll->nstrips())).x();
220  float striplength = (top_->stripLength());
221  area = striplength * (xmax - xmin);
222  } else {
223  const TrapezoidalStripTopology* top_ = dynamic_cast<const TrapezoidalStripTopology*>(&(roll->topology()));
224  float xmin = (top_->localPosition(0.)).x();
225  float xmax = (top_->localPosition((float)roll->nstrips())).x();
226  float striplength = (top_->stripLength());
227  area = striplength * (xmax - xmin);
228  }
229 
230  for (unsigned int j = 0; j < vnoise.size(); ++j) {
231  if (j >= nstrips)
232  break;
233 
234  // The efficiency of 0% does not imply on the noise rate.
235  // If the strip is masked the noise rate should be 0 Hz/cm^2
236  // if(veff[j] == 0) continue;
237 
238  // double ave = vnoise[j]*nbxing*gate*area*1.0e-9*frate;
239  // The vnoise is the noise rate per strip, so we shout multiply not
240  // by the chamber area,
241  // but the strip area which is area/((float)roll->nstrips()));
242  double ave = vnoise[j] * nbxing * gate * area * 1.0e-9 * frate / ((float)roll->nstrips());
243 
244  CLHEP::RandPoissonQ randPoissonQ(*engine, ave);
245  N_hits = randPoissonQ.fire();
246 
247  for (int i = 0; i < N_hits; i++) {
248  int time_hit = (static_cast<int>(CLHEP::RandFlat::shoot(engine, (nbxing * gate) / gate))) - nbxing / 2;
249  std::pair<int, int> digi(j + 1, time_hit);
250  strips.insert(digi);
251  }
252  }
253 }
LocalPoint localPosition(float strip) const override
int nstrips() const
Definition: RPCRoll.cc:24
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
RPCSimSetUp * getRPCSimSetUp()
Definition: RPCSim.h:45
float stripLength() const override
RPCDetId id() const
Definition: RPCRoll.cc:16
std::set< std::pair< int, int > > strips
Definition: RPCSim.h:55
const Topology & topology() const override
Definition: RPCRoll.cc:18
float stripLength() const override
det heigth (strip length in the middle)
LocalPoint localPosition(float strip) const override
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:53

Member Data Documentation

RPCSynchronizer* RPCSimAverageNoiseEff::_rpcSync
private

Definition at line 64 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff(), simulate(), and ~RPCSimAverageNoiseEff().

double RPCSimAverageNoiseEff::aveCls
private

Definition at line 45 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff().

double RPCSimAverageNoiseEff::aveEff
private

Definition at line 41 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff().

std::map<int, std::vector<double> > RPCSimAverageNoiseEff::clsMap
private

Definition at line 60 of file RPCSimAverageNoiseEff.h.

Referenced by getClSize().

double RPCSimAverageNoiseEff::dtimCs
private

Definition at line 48 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff().

double RPCSimAverageNoiseEff::frate
private

Definition at line 58 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff(), and simulateNoise().

double RPCSimAverageNoiseEff::gate
private

Definition at line 57 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff(), and simulateNoise().

std::ifstream* RPCSimAverageNoiseEff::infile
private

Definition at line 62 of file RPCSimAverageNoiseEff.h.

double RPCSimAverageNoiseEff::lbGate
private

Definition at line 51 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff().

int RPCSimAverageNoiseEff::N_hits
private

Definition at line 54 of file RPCSimAverageNoiseEff.h.

Referenced by simulateNoise().

int RPCSimAverageNoiseEff::nbxing
private

Definition at line 55 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff(), and simulateNoise().

double RPCSimAverageNoiseEff::rate
private

Definition at line 56 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff().

double RPCSimAverageNoiseEff::resEle
private

Definition at line 49 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff().

double RPCSimAverageNoiseEff::resRPC
private

Definition at line 46 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff().

bool RPCSimAverageNoiseEff::rpcdigiprint
private

Definition at line 52 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff().

double RPCSimAverageNoiseEff::sspeed
private

Definition at line 50 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff().

std::vector<double> RPCSimAverageNoiseEff::sum_clsize
private

Definition at line 61 of file RPCSimAverageNoiseEff.h.

Referenced by getClSize().

double RPCSimAverageNoiseEff::timOff
private

Definition at line 47 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff().