CMS 3D CMS Logo

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< StripDigiSimLinkDigiSimLinks
 
typedef edm::DetSet< RPCDigiSimLinkRPCDigiSimLinks
 
- 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::RPCSimAverageNoise ( const edm::ParameterSet config)

Definition at line 37 of file RPCSimAverageNoise.cc.

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

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

◆ ~RPCSimAverageNoise()

RPCSimAverageNoise::~RPCSimAverageNoise ( )
override

Definition at line 66 of file RPCSimAverageNoise.cc.

References _rpcSync.

66 { delete _rpcSync; }
RPCSynchronizer * _rpcSync

Member Function Documentation

◆ getClSize()

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

Definition at line 68 of file RPCSimAverageNoise.cc.

References clsMap, EcalMonitorTask_cff::func, RPCSimSetUp::getClsMap(), RPCSim::getRPCSimSetUp(), SiStripPI::min, RecoTauValidation_cfi::posX, and sum_clsize.

Referenced by simulate().

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

◆ init()

void RPCSimAverageNoise::init ( void  )
inlineoverrideprivatevirtual

Implements RPCSim.

Definition at line 39 of file RPCSimAverageNoise.h.

39 {};

◆ simulate()

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

Implements RPCSim.

Definition at line 109 of file RPCSimAverageNoise.cc.

References _rpcSync, aveEff, haddnano::cl, edm::DetSet< T >::clear(), getClSize(), RPCSim::getRPCSimSetUp(), RPCSynchronizer::getSimHitBx(), mps_fire::i, RecoTauValidation_cfi::posX, nano_mu_digi_cff::roll, RPCSynchronizer::setRPCSimSetUp(), RPCSim::strips, RPCSim::theDetectorHitMap, RPCSim::theRpcDigiSimLinks, HLT_2024v14_cff::topology, and PV3DBase< T, PVType, FrameType >::x().

111  {
114  theDetectorHitMap.clear();
115  theRpcDigiSimLinks = RPCDigiSimLinks(roll->id().rawId());
116 
117  const Topology& topology = roll->specs()->topology();
118 
119  for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin(); _hit != rpcHits.end(); ++_hit) {
120  // Here I hould check if the RPC are up side down;
121  const LocalPoint& entr = _hit->entryPoint();
122  int time_hit = _rpcSync->getSimHitBx(&(*_hit), engine);
123  float posX = roll->strip(_hit->localPosition()) - static_cast<int>(roll->strip(_hit->localPosition()));
124 
125  // Effinciecy
126 
127  if (CLHEP::RandFlat::shoot(engine) < aveEff) {
128  int centralStrip = topology.channel(entr) + 1;
129  int fstrip = centralStrip;
130  int lstrip = centralStrip;
131  // Compute the cluster size
132  //double w = CLHEP::RandFlat::shoot(engine);
133  //if (w < 1.e-10) w=1.e-10;
134  int clsize = this->getClSize(posX, engine);
135 
136  std::vector<int> cls;
137  cls.push_back(centralStrip);
138  if (clsize > 1) {
139  for (int cl = 0; cl < (clsize - 1) / 2; cl++) {
140  if (centralStrip - cl - 1 >= 1) {
141  fstrip = centralStrip - cl - 1;
142  cls.push_back(fstrip);
143  }
144  if (centralStrip + cl + 1 <= roll->nstrips()) {
145  lstrip = centralStrip + cl + 1;
146  cls.push_back(lstrip);
147  }
148  }
149  if (clsize % 2 == 0) {
150  // insert the last strip according to the
151  // simhit position in the central strip
152  double deltaw = roll->centreOfStrip(centralStrip).x() - entr.x();
153  if (deltaw < 0.) {
154  if (lstrip < roll->nstrips()) {
155  lstrip++;
156  cls.push_back(lstrip);
157  }
158  } else {
159  if (fstrip > 1) {
160  fstrip--;
161  cls.push_back(fstrip);
162  }
163  }
164  }
165  }
166 
167  for (std::vector<int>::iterator i = cls.begin(); i != cls.end(); i++) {
168  // Check the timing of the adjacent strip
169  std::pair<int, int> digi(*i, time_hit);
170 
171  theDetectorHitMap.insert(DetectorHitMap::value_type(digi, &(*_hit)));
172  strips.insert(digi);
173  }
174  }
175  }
176 }
DetectorHitMap theDetectorHitMap
Definition: RPCSim.h:68
void setRPCSimSetUp(RPCSimSetUp *simsetup)
RPCSimSetUp * getRPCSimSetUp()
Definition: RPCSim.h:45
int getSimHitBx(const PSimHit *, CLHEP::HepRandomEngine *)
int getClSize(float posX, CLHEP::HepRandomEngine *)
T x() const
Definition: PV3DBase.h:59
edm::DetSet< RPCDigiSimLink > RPCDigiSimLinks
Definition: RPCSim.h:33
std::set< std::pair< int, int > > strips
Definition: RPCSim.h:55
RPCSynchronizer * _rpcSync
void clear()
Definition: DetSet.h:71
RPCDigiSimLinks theRpcDigiSimLinks
Definition: RPCSim.h:70

◆ simulateNoise()

void RPCSimAverageNoise::simulateNoise ( const RPCRoll roll,
CLHEP::HepRandomEngine *  engine 
)
overridevirtual

Implements RPCSim.

Definition at line 178 of file RPCSimAverageNoise.cc.

References custom_jme_cff::area, frate, gate, RPCSim::getRPCSimSetUp(), mps_fire::i, dqmiolumiharvest::j, RectangularStripTopology::localPosition(), TrapezoidalStripTopology::localPosition(), N_hits, nbxing, DetId::rawId(), RPCDetId::region(), nano_mu_digi_cff::roll, RectangularStripTopology::stripLength(), TrapezoidalStripTopology::stripLength(), RPCSim::strips, x, TrackerOfflineValidation_Dqm_cff::xmax, and TrackerOfflineValidation_Dqm_cff::xmin.

178  {
179  RPCDetId rpcId = roll->id();
180  std::vector<float> vnoise = (getRPCSimSetUp())->getNoise(rpcId.rawId());
181  unsigned int nstrips = roll->nstrips();
182 
183  double area = 0.0;
184 
185  if (rpcId.region() == 0) {
186  const RectangularStripTopology* top_ = dynamic_cast<const RectangularStripTopology*>(&(roll->topology()));
187  float xmin = (top_->localPosition(0.)).x();
188  float xmax = (top_->localPosition((float)roll->nstrips())).x();
189  float striplength = (top_->stripLength());
190  area = striplength * (xmax - xmin);
191  } else {
192  const TrapezoidalStripTopology* top_ = dynamic_cast<const TrapezoidalStripTopology*>(&(roll->topology()));
193  float xmin = (top_->localPosition(0.)).x();
194  float xmax = (top_->localPosition((float)roll->nstrips())).x();
195  float striplength = (top_->stripLength());
196  area = striplength * (xmax - xmin);
197  }
198  for (unsigned int j = 0; j < vnoise.size(); ++j) {
199  if (j >= nstrips)
200  break;
201 
202  double ave = frate * vnoise[j] * nbxing * gate * area * 1.0e-9;
203  CLHEP::RandPoissonQ randPoissonQ(*engine, ave);
204  N_hits = randPoissonQ.fire();
205 
206  for (int i = 0; i < N_hits; i++) {
207  int time_hit = (static_cast<int>(CLHEP::RandFlat::shoot(engine, (nbxing * gate) / gate))) - nbxing / 2;
208  std::pair<int, int> digi(j + 1, time_hit);
209  strips.insert(digi);
210  }
211  }
212 }
LocalPoint localPosition(float strip) const override
RPCSimSetUp * getRPCSimSetUp()
Definition: RPCSim.h:45
float stripLength() const override
std::set< std::pair< int, int > > strips
Definition: RPCSim.h:55
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:53
float stripLength() const override
det heigth (strip length in the middle)
LocalPoint localPosition(float strip) const override

Member Data Documentation

◆ _rpcSync

RPCSynchronizer* RPCSimAverageNoise::_rpcSync
private

Definition at line 62 of file RPCSimAverageNoise.h.

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

◆ aveCls

double RPCSimAverageNoise::aveCls
private

Definition at line 43 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

◆ aveEff

double RPCSimAverageNoise::aveEff
private

Definition at line 39 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise(), and simulate().

◆ clsMap

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

Definition at line 58 of file RPCSimAverageNoise.h.

Referenced by getClSize().

◆ dtimCs

double RPCSimAverageNoise::dtimCs
private

Definition at line 46 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

◆ frate

double RPCSimAverageNoise::frate
private

Definition at line 56 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise(), and simulateNoise().

◆ gate

double RPCSimAverageNoise::gate
private

Definition at line 55 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise(), and simulateNoise().

◆ infile

std::ifstream* RPCSimAverageNoise::infile
private

Definition at line 60 of file RPCSimAverageNoise.h.

◆ lbGate

double RPCSimAverageNoise::lbGate
private

Definition at line 49 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

◆ N_hits

int RPCSimAverageNoise::N_hits
private

Definition at line 52 of file RPCSimAverageNoise.h.

Referenced by simulateNoise().

◆ nbxing

int RPCSimAverageNoise::nbxing
private

Definition at line 53 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise(), and simulateNoise().

◆ rate

double RPCSimAverageNoise::rate
private

Definition at line 54 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

◆ resEle

double RPCSimAverageNoise::resEle
private

Definition at line 47 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

◆ resRPC

double RPCSimAverageNoise::resRPC
private

Definition at line 44 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

◆ rpcdigiprint

bool RPCSimAverageNoise::rpcdigiprint
private

Definition at line 50 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

◆ sspeed

double RPCSimAverageNoise::sspeed
private

Definition at line 48 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

◆ sum_clsize

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

Definition at line 59 of file RPCSimAverageNoise.h.

Referenced by getClSize().

◆ timOff

double RPCSimAverageNoise::timOff
private

Definition at line 45 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().