CMS 3D CMS Logo

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< 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 29 of file RPCSimAverageNoiseEff.h.

Constructor & Destructor Documentation

◆ RPCSimAverageNoiseEff()

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

Definition at line 39 of file RPCSimAverageNoiseEff.cc.

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

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

◆ ~RPCSimAverageNoiseEff()

RPCSimAverageNoiseEff::~RPCSimAverageNoiseEff ( )
override

Definition at line 69 of file RPCSimAverageNoiseEff.cc.

References _rpcSync.

69 { delete _rpcSync; }
RPCSynchronizer * _rpcSync

Member Function Documentation

◆ getClSize()

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

Definition at line 71 of file RPCSimAverageNoiseEff.cc.

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

Referenced by simulate().

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

◆ init()

void RPCSimAverageNoiseEff::init ( void  )
inlineoverrideprivatevirtual

Implements RPCSim.

Definition at line 41 of file RPCSimAverageNoiseEff.h.

41 {};

◆ simulate()

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

Implements RPCSim.

Definition at line 112 of file RPCSimAverageNoiseEff.cc.

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

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

Implements RPCSim.

Definition at line 203 of file RPCSimAverageNoiseEff.cc.

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

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

Definition at line 64 of file RPCSimAverageNoiseEff.h.

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

◆ aveCls

double RPCSimAverageNoiseEff::aveCls
private

Definition at line 45 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff().

◆ aveEff

double RPCSimAverageNoiseEff::aveEff
private

Definition at line 41 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff().

◆ clsMap

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

Definition at line 60 of file RPCSimAverageNoiseEff.h.

Referenced by getClSize().

◆ dtimCs

double RPCSimAverageNoiseEff::dtimCs
private

Definition at line 48 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff().

◆ frate

double RPCSimAverageNoiseEff::frate
private

Definition at line 58 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff(), and simulateNoise().

◆ gate

double RPCSimAverageNoiseEff::gate
private

Definition at line 57 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff(), and simulateNoise().

◆ infile

std::ifstream* RPCSimAverageNoiseEff::infile
private

Definition at line 62 of file RPCSimAverageNoiseEff.h.

◆ lbGate

double RPCSimAverageNoiseEff::lbGate
private

Definition at line 51 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff().

◆ N_hits

int RPCSimAverageNoiseEff::N_hits
private

Definition at line 54 of file RPCSimAverageNoiseEff.h.

Referenced by simulateNoise().

◆ nbxing

int RPCSimAverageNoiseEff::nbxing
private

Definition at line 55 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff(), and simulateNoise().

◆ rate

double RPCSimAverageNoiseEff::rate
private

Definition at line 56 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff().

◆ resEle

double RPCSimAverageNoiseEff::resEle
private

Definition at line 49 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff().

◆ resRPC

double RPCSimAverageNoiseEff::resRPC
private

Definition at line 46 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff().

◆ rpcdigiprint

bool RPCSimAverageNoiseEff::rpcdigiprint
private

Definition at line 52 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff().

◆ sspeed

double RPCSimAverageNoiseEff::sspeed
private

Definition at line 50 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff().

◆ sum_clsize

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

Definition at line 61 of file RPCSimAverageNoiseEff.h.

Referenced by getClSize().

◆ timOff

double RPCSimAverageNoiseEff::timOff
private

Definition at line 47 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff().