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
RPCSimAverageNoise Class Reference

#include <RPCSimAverageNoise.h>

Inheritance diagram for RPCSimAverageNoise:
RPCSim

Public Member Functions

int getClSize (float posX, CLHEP::HepRandomEngine *)
 
 RPCSimAverageNoise (const edm::ParameterSet &config)
 
void simulate (const RPCRoll *roll, const edm::PSimHitContainer &rpcHits, CLHEP::HepRandomEngine *) override
 
void simulateNoise (const RPCRoll *, CLHEP::HepRandomEngine *) override
 
 ~RPCSimAverageNoise () 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 27 of file RPCSimAverageNoise.h.

Constructor & Destructor Documentation

RPCSimAverageNoise::RPCSimAverageNoise ( const edm::ParameterSet config)

Definition at line 38 of file RPCSimAverageNoise.cc.

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

38  : RPCSim(config) {
39  aveEff = config.getParameter<double>("averageEfficiency");
40  aveCls = config.getParameter<double>("averageClusterSize");
41  resRPC = config.getParameter<double>("timeResolution");
42  timOff = config.getParameter<double>("timingRPCOffset");
43  dtimCs = config.getParameter<double>("deltatimeAdjacentStrip");
44  resEle = config.getParameter<double>("timeJitter");
45  sspeed = config.getParameter<double>("signalPropagationSpeed");
46  lbGate = config.getParameter<double>("linkGateWidth");
47  rpcdigiprint = config.getParameter<bool>("printOutDigitizer");
48  rate = config.getParameter<double>("Rate");
49  nbxing = config.getParameter<int>("Nbxing");
50  gate = config.getParameter<double>("Gate");
51  frate = config.getParameter<double>("Frate");
52 
53  if (rpcdigiprint) {
54  std::cout << "Average Efficiency = " << aveEff << std::endl;
55  std::cout << "Average Cluster Size = " << aveCls << " strips" << std::endl;
56  std::cout << "RPC Time Resolution = " << resRPC << " ns" << std::endl;
57  std::cout << "RPC Signal formation time = " << timOff << " ns" << std::endl;
58  std::cout << "RPC adjacent strip delay = " << dtimCs << " ns" << std::endl;
59  std::cout << "Electronic Jitter = " << resEle << " ns" << std::endl;
60  std::cout << "Signal propagation time = " << sspeed << " x c" << std::endl;
61  std::cout << "Link Board Gate Width = " << lbGate << " ns" << std::endl;
62  }
63 
64  _rpcSync = new RPCSynchronizer(config);
65 }
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
RPCSimAverageNoise::~RPCSimAverageNoise ( )
override

Definition at line 67 of file RPCSimAverageNoise.cc.

References _rpcSync.

67 { delete _rpcSync; }
RPCSynchronizer * _rpcSync

Member Function Documentation

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

Definition at line 69 of file RPCSimAverageNoise.cc.

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

Referenced by simulate().

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

Implements RPCSim.

Definition at line 39 of file RPCSimAverageNoise.h.

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

Implements RPCSim.

Definition at line 110 of file RPCSimAverageNoise.cc.

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

112  {
115  theDetectorHitMap.clear();
117 
118  const Topology& topology = roll->specs()->topology();
119 
120  for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin(); _hit != rpcHits.end(); ++_hit) {
121  // Here I hould check if the RPC are up side down;
122  const LocalPoint& entr = _hit->entryPoint();
123  int time_hit = _rpcSync->getSimHitBx(&(*_hit), engine);
124  float posX = roll->strip(_hit->localPosition()) - static_cast<int>(roll->strip(_hit->localPosition()));
125 
126  // Effinciecy
127 
128  if (CLHEP::RandFlat::shoot(engine) < aveEff) {
129  int centralStrip = topology.channel(entr) + 1;
130  int fstrip = centralStrip;
131  int lstrip = centralStrip;
132  // Compute the cluster size
133  //double w = CLHEP::RandFlat::shoot(engine);
134  //if (w < 1.e-10) w=1.e-10;
135  int clsize = this->getClSize(posX, engine);
136 
137  std::vector<int> cls;
138  cls.push_back(centralStrip);
139  if (clsize > 1) {
140  for (int cl = 0; cl < (clsize - 1) / 2; cl++) {
141  if (centralStrip - cl - 1 >= 1) {
142  fstrip = centralStrip - cl - 1;
143  cls.push_back(fstrip);
144  }
145  if (centralStrip + cl + 1 <= roll->nstrips()) {
146  lstrip = centralStrip + cl + 1;
147  cls.push_back(lstrip);
148  }
149  }
150  if (clsize % 2 == 0) {
151  // insert the last strip according to the
152  // simhit position in the central strip
153  double deltaw = roll->centreOfStrip(centralStrip).x() - entr.x();
154  if (deltaw < 0.) {
155  if (lstrip < roll->nstrips()) {
156  lstrip++;
157  cls.push_back(lstrip);
158  }
159  } else {
160  if (fstrip > 1) {
161  fstrip--;
162  cls.push_back(fstrip);
163  }
164  }
165  }
166  }
167 
168  for (std::vector<int>::iterator i = cls.begin(); i != cls.end(); i++) {
169  // Check the timing of the adjacent strip
170  std::pair<int, int> digi(*i, time_hit);
171 
172  theDetectorHitMap.insert(DetectorHitMap::value_type(digi, &(*_hit)));
173  strips.insert(digi);
174  }
175  }
176  }
177 }
float strip(const LocalPoint &lp) const
Definition: RPCRoll.cc:35
LocalPoint centreOfStrip(int strip) const
Definition: RPCRoll.cc:26
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
int getClSize(float posX, CLHEP::HepRandomEngine *)
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
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 RPCSimAverageNoise::simulateNoise ( const RPCRoll roll,
CLHEP::HepRandomEngine *  engine 
)
overridevirtual

Implements RPCSim.

Definition at line 179 of file RPCSimAverageNoise.cc.

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

179  {
180  RPCDetId rpcId = roll->id();
181  std::vector<float> vnoise = (getRPCSimSetUp())->getNoise(rpcId.rawId());
182  unsigned int nstrips = roll->nstrips();
183 
184  double area = 0.0;
185 
186  if (rpcId.region() == 0) {
187  const RectangularStripTopology* top_ = dynamic_cast<const RectangularStripTopology*>(&(roll->topology()));
188  float xmin = (top_->localPosition(0.)).x();
189  float xmax = (top_->localPosition((float)roll->nstrips())).x();
190  float striplength = (top_->stripLength());
191  area = striplength * (xmax - xmin);
192  } else {
193  const TrapezoidalStripTopology* top_ = dynamic_cast<const TrapezoidalStripTopology*>(&(roll->topology()));
194  float xmin = (top_->localPosition(0.)).x();
195  float xmax = (top_->localPosition((float)roll->nstrips())).x();
196  float striplength = (top_->stripLength());
197  area = striplength * (xmax - xmin);
198  }
199  for (unsigned int j = 0; j < vnoise.size(); ++j) {
200  if (j >= nstrips)
201  break;
202 
203  double ave = frate * vnoise[j] * nbxing * gate * area * 1.0e-9;
204  CLHEP::RandPoissonQ randPoissonQ(*engine, ave);
205  N_hits = randPoissonQ.fire();
206 
207  for (int i = 0; i < N_hits; i++) {
208  int time_hit = (static_cast<int>(CLHEP::RandFlat::shoot(engine, (nbxing * gate) / gate))) - nbxing / 2;
209  std::pair<int, int> digi(j + 1, time_hit);
210  strips.insert(digi);
211  }
212  }
213 }
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* RPCSimAverageNoise::_rpcSync
private

Definition at line 62 of file RPCSimAverageNoise.h.

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

double RPCSimAverageNoise::aveCls
private

Definition at line 43 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

double RPCSimAverageNoise::aveEff
private

Definition at line 39 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise(), and simulate().

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

Definition at line 58 of file RPCSimAverageNoise.h.

Referenced by getClSize().

double RPCSimAverageNoise::dtimCs
private

Definition at line 46 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

double RPCSimAverageNoise::frate
private

Definition at line 56 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise(), and simulateNoise().

double RPCSimAverageNoise::gate
private

Definition at line 55 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise(), and simulateNoise().

std::ifstream* RPCSimAverageNoise::infile
private

Definition at line 60 of file RPCSimAverageNoise.h.

double RPCSimAverageNoise::lbGate
private

Definition at line 49 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

int RPCSimAverageNoise::N_hits
private

Definition at line 52 of file RPCSimAverageNoise.h.

Referenced by simulateNoise().

int RPCSimAverageNoise::nbxing
private

Definition at line 53 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise(), and simulateNoise().

double RPCSimAverageNoise::rate
private

Definition at line 54 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

double RPCSimAverageNoise::resEle
private

Definition at line 47 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

double RPCSimAverageNoise::resRPC
private

Definition at line 44 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

bool RPCSimAverageNoise::rpcdigiprint
private

Definition at line 50 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

double RPCSimAverageNoise::sspeed
private

Definition at line 48 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

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

Definition at line 59 of file RPCSimAverageNoise.h.

Referenced by getClSize().

double RPCSimAverageNoise::timOff
private

Definition at line 45 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().