CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
RPCSimAverageNoiseEffCls Class Reference

#include <RPCSimAverageNoiseEffCls.h>

Inheritance diagram for RPCSimAverageNoiseEffCls:
RPCSim

Public Member Functions

int getClSize (float posX, CLHEP::HepRandomEngine *)
 
int getClSize (uint32_t id, float posX, CLHEP::HepRandomEngine *)
 
 RPCSimAverageNoiseEffCls (const edm::ParameterSet &config)
 
void simulate (const RPCRoll *roll, const edm::PSimHitContainer &rpcHits, CLHEP::HepRandomEngine *) override
 
void simulateNoise (const RPCRoll *, CLHEP::HepRandomEngine *) override
 
 ~RPCSimAverageNoiseEffCls () 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 ()
 

Protected Member Functions

void init () override
 
- Protected Member Functions inherited from RPCSim
virtual void addLinks (unsigned int strip, int bx)
 
 RPCSim (const edm::ParameterSet &config)
 

Protected Attributes

RPCSynchronizer_rpcSync
 
double aveCls
 
double aveEff
 
std::vector< double > clsForDetId
 
std::map< int, std::vector< double > > clsMap
 
double dtimCs
 
bool eledig
 
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
 
- Protected Attributes inherited from RPCSim
std::set< RPCDigiirpc_digis
 
std::set< std::pair< int, int > > strips
 
DetectorHitMap theDetectorHitMap
 
DigiSimLinks theDigiSimLinks
 
RPCDigiSimLinks theRpcDigiSimLinks
 
RPCSimSetUptheSimSetUp
 

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
 

Detailed Description

Definition at line 29 of file RPCSimAverageNoiseEffCls.h.

Constructor & Destructor Documentation

◆ RPCSimAverageNoiseEffCls()

RPCSimAverageNoiseEffCls::RPCSimAverageNoiseEffCls ( const edm::ParameterSet config)

Definition at line 41 of file RPCSimAverageNoiseEffCls.cc.

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

41  : RPCSim(config) {
42  aveEff = config.getParameter<double>("averageEfficiency");
43  aveCls = config.getParameter<double>("averageClusterSize");
44  resRPC = config.getParameter<double>("timeResolution");
45  timOff = config.getParameter<double>("timingRPCOffset");
46  dtimCs = config.getParameter<double>("deltatimeAdjacentStrip");
47  resEle = config.getParameter<double>("timeJitter");
48  sspeed = config.getParameter<double>("signalPropagationSpeed");
49  lbGate = config.getParameter<double>("linkGateWidth");
50  rpcdigiprint = config.getParameter<bool>("printOutDigitizer");
51  eledig = config.getParameter<bool>("digitizeElectrons"); //flag to turn on/off electron digitization
52 
53  rate = config.getParameter<double>("Rate");
54  nbxing = config.getParameter<int>("Nbxing");
55  gate = config.getParameter<double>("Gate");
56  frate = config.getParameter<double>("Frate");
57 
58  if (rpcdigiprint) {
59  edm::LogInfo("RPC digitizer parameters") << "Average Efficiency = " << aveEff << '\n'
60  << "Average Cluster Size = " << aveCls << " strips" << '\n'
61  << "RPC Time Resolution = " << resRPC << " ns" << '\n'
62  << "RPC Signal formation time = " << timOff << " ns" << '\n'
63  << "RPC adjacent strip delay = " << dtimCs << " ns" << '\n'
64  << "Electronic Jitter = " << resEle << " ns" << '\n'
65  << "Signal propagation time = " << sspeed << " x c" << '\n'
66  << "Link Board Gate Width = " << lbGate << " ns" << '\n';
67  }
68 
70 }
Definition: config.py:1
RPCSim(const edm::ParameterSet &config)
Definition: RPCSim.cc:5
Log< level::Info, false > LogInfo

◆ ~RPCSimAverageNoiseEffCls()

RPCSimAverageNoiseEffCls::~RPCSimAverageNoiseEffCls ( )
override

Definition at line 72 of file RPCSimAverageNoiseEffCls.cc.

References _rpcSync.

72 { delete _rpcSync; }

Member Function Documentation

◆ getClSize() [1/2]

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

Definition at line 120 of file RPCSimAverageNoiseEffCls.cc.

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

Referenced by simulate().

120  {
121  std::map<int, std::vector<double> > clsMap = getRPCSimSetUp()->getClsMap();
122 
123  int cnt = 1;
124  int min = 1;
125  double func = 0.0;
126  std::vector<double> sum_clsize;
127 
128  double rr_cl = CLHEP::RandFlat::shoot(engine);
129  if (0.0 <= posX && posX < 0.2) {
130  func = (clsMap[1])[(clsMap[1]).size() - 1] * (rr_cl);
131  sum_clsize = clsMap[1];
132  }
133  if (0.2 <= posX && posX < 0.4) {
134  func = (clsMap[2])[(clsMap[2]).size() - 1] * (rr_cl);
135  sum_clsize = clsMap[2];
136  }
137  if (0.4 <= posX && posX < 0.6) {
138  func = (clsMap[3])[(clsMap[3]).size() - 1] * (rr_cl);
139  sum_clsize = clsMap[3];
140  }
141  if (0.6 <= posX && posX < 0.8) {
142  func = (clsMap[4])[(clsMap[4]).size() - 1] * (rr_cl);
143  sum_clsize = clsMap[4];
144  }
145  if (0.8 <= posX && posX < 1.0) {
146  func = (clsMap[5])[(clsMap[5]).size() - 1] * (rr_cl);
147  sum_clsize = clsMap[5];
148  }
149 
150  for (vector<double>::iterator iter = sum_clsize.begin(); iter != sum_clsize.end(); ++iter) {
151  cnt++;
152  if (func > (*iter)) {
153  min = cnt;
154  } else if (func < (*iter)) {
155  break;
156  }
157  }
158  return min;
159 }
RPCSimSetUp * getRPCSimSetUp()
Definition: RPCSim.h:45
std::map< int, std::vector< double > > clsMap
std::vector< double > sum_clsize
const std::map< int, std::vector< double > > & getClsMap()
Definition: RPCSimSetUp.cc:454

◆ getClSize() [2/2]

int RPCSimAverageNoiseEffCls::getClSize ( uint32_t  id,
float  posX,
CLHEP::HepRandomEngine *  engine 
)

Definition at line 74 of file RPCSimAverageNoiseEffCls.cc.

References clsForDetId, EcalMonitorTask_cff::func, RPCSimSetUp::getCls(), RPCSim::getRPCSimSetUp(), mps_fire::i, SiStripPI::min, RecoTauValidation_cfi::posX, and sum_clsize.

74  {
75  std::vector<double> clsForDetId = getRPCSimSetUp()->getCls(id);
76 
77  int cnt = 1;
78  int min = 1;
79  double func = 0.0;
80  std::vector<double> sum_clsize;
81 
82  sum_clsize.clear();
84  int vectOffset(0);
85 
86  double rr_cl = CLHEP::RandFlat::shoot(engine);
87 
88  if (0.0 <= posX && posX < 0.2) {
89  func = clsForDetId[19] * (rr_cl);
90  vectOffset = 0;
91  }
92  if (0.2 <= posX && posX < 0.4) {
93  func = clsForDetId[39] * (rr_cl);
94  vectOffset = 20;
95  }
96  if (0.4 <= posX && posX < 0.6) {
97  func = clsForDetId[59] * (rr_cl);
98  vectOffset = 40;
99  }
100  if (0.6 <= posX && posX < 0.8) {
101  func = clsForDetId[79] * (rr_cl);
102  vectOffset = 60;
103  }
104  if (0.8 <= posX && posX < 1.0) {
105  func = clsForDetId[89] * (rr_cl);
106  vectOffset = 80;
107  }
108 
109  for (int i = vectOffset; i < (vectOffset + 20); i++) {
110  cnt++;
111  if (func > clsForDetId[i]) {
112  min = cnt;
113  } else if (func < clsForDetId[i]) {
114  break;
115  }
116  }
117  return min;
118 }
RPCSimSetUp * getRPCSimSetUp()
Definition: RPCSim.h:45
std::vector< double > clsForDetId
std::vector< double > sum_clsize
const std::vector< double > & getCls(uint32_t id)
Definition: RPCSimSetUp.cc:462

◆ init()

void RPCSimAverageNoiseEffCls::init ( void  )
inlineoverrideprotectedvirtual

Implements RPCSim.

Definition at line 43 of file RPCSimAverageNoiseEffCls.h.

43 {};

◆ simulate()

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

Implements RPCSim.

Definition at line 161 of file RPCSimAverageNoiseEffCls.cc.

References _rpcSync, haddnano::cl, edm::DetSet< T >::clear(), eledig, 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_2024v11_cff::topology, and PV3DBase< T, PVType, FrameType >::x().

163  {
166  theDetectorHitMap.clear();
167  theRpcDigiSimLinks = RPCDigiSimLinks(roll->id().rawId());
168 
169  RPCDetId rpcId = roll->id();
170  RPCGeomServ RPCname(rpcId);
171  //std::string nameRoll = RPCname.name();
172 
173  const Topology& topology = roll->specs()->topology();
174 
175  for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin(); _hit != rpcHits.end(); ++_hit) {
176  if (!eledig && _hit->particleType() == 11)
177  continue;
178  // Here I hould check if the RPC are up side down;
179  const LocalPoint& entr = _hit->entryPoint();
180 
181  int time_hit = _rpcSync->getSimHitBx(&(*_hit), engine);
182  float posX = roll->strip(_hit->localPosition()) - static_cast<int>(roll->strip(_hit->localPosition()));
183 
184  std::vector<float> veff = (getRPCSimSetUp())->getEff(rpcId.rawId());
185 
186  // Effinciecy
187  int centralStrip = topology.channel(entr) + 1;
188  ;
189  float fire = CLHEP::RandFlat::shoot(engine);
190 
191  if (fire < veff[centralStrip - 1]) {
192  int fstrip = centralStrip;
193  int lstrip = centralStrip;
194 
195  // Compute the cluster size
196  int clsize = this->getClSize(rpcId.rawId(), posX, engine); // This is for cluster size chamber by chamber
197  std::vector<int> cls;
198  cls.push_back(centralStrip);
199  if (clsize > 1) {
200  for (int cl = 0; cl < (clsize - 1) / 2; cl++) {
201  if (centralStrip - cl - 1 >= 1) {
202  fstrip = centralStrip - cl - 1;
203  cls.push_back(fstrip);
204  }
205  if (centralStrip + cl + 1 <= roll->nstrips()) {
206  lstrip = centralStrip + cl + 1;
207  cls.push_back(lstrip);
208  }
209  }
210  if (clsize % 2 == 0) {
211  // insert the last strip according to the
212  // simhit position in the central strip
213  double deltaw = roll->centreOfStrip(centralStrip).x() - entr.x();
214  if (deltaw < 0.) {
215  if (lstrip < roll->nstrips()) {
216  lstrip++;
217  cls.push_back(lstrip);
218  }
219  } else {
220  if (fstrip > 1) {
221  fstrip--;
222  cls.push_back(fstrip);
223  }
224  }
225  }
226  }
227 
228  for (std::vector<int>::iterator i = cls.begin(); i != cls.end(); i++) {
229  // Check the timing of the adjacent strip
230  if (*i != centralStrip) {
231  if (CLHEP::RandFlat::shoot(engine) < veff[*i - 1]) {
232  std::pair<int, int> digi(*i, time_hit);
233  strips.insert(digi);
234 
235  theDetectorHitMap.insert(DetectorHitMap::value_type(digi, &(*_hit)));
236  }
237  } else {
238  std::pair<int, int> digi(*i, time_hit);
239  theDetectorHitMap.insert(DetectorHitMap::value_type(digi, &(*_hit)));
240 
241  strips.insert(digi);
242  }
243  }
244  }
245  }
246 }
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
void clear()
Definition: DetSet.h:71
RPCDigiSimLinks theRpcDigiSimLinks
Definition: RPCSim.h:70

◆ simulateNoise()

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

Implements RPCSim.

Definition at line 248 of file RPCSimAverageNoiseEffCls.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, 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.

248  {
249  RPCDetId rpcId = roll->id();
250 
251  RPCGeomServ RPCname(rpcId);
252 
253  std::vector<float> vnoise = (getRPCSimSetUp())->getNoise(rpcId.rawId());
254  std::vector<float> veff = (getRPCSimSetUp())->getEff(rpcId.rawId());
255 
256  unsigned int nstrips = roll->nstrips();
257  double area = 0.0;
258 
259  if (rpcId.region() == 0) {
260  const RectangularStripTopology* top_ = dynamic_cast<const RectangularStripTopology*>(&(roll->topology()));
261  float xmin = (top_->localPosition(0.)).x();
262  float xmax = (top_->localPosition((float)roll->nstrips())).x();
263  float striplength = (top_->stripLength());
264  area = striplength * (xmax - xmin);
265  } else {
266  const TrapezoidalStripTopology* top_ = dynamic_cast<const TrapezoidalStripTopology*>(&(roll->topology()));
267  float xmin = (top_->localPosition(0.)).x();
268  float xmax = (top_->localPosition((float)roll->nstrips())).x();
269  float striplength = (top_->stripLength());
270  area = striplength * (xmax - xmin);
271  }
272 
273  for (unsigned int j = 0; j < vnoise.size(); ++j) {
274  if (j >= nstrips)
275  break;
276 
277  // The efficiency of 0% does not imply on the noise rate.
278  // If the strip is masked the noise rate should be 0 Hz/cm^2
279  // if(veff[j] == 0) continue;
280 
281  // double ave = vnoise[j]*nbxing*gate*area*1.0e-9*frate;
282  // The vnoise is the noise rate per strip, so we shout multiply not
283  // by the chamber area,
284  // but the strip area which is area/((float)roll->nstrips()));
285  double ave = vnoise[j] * nbxing * gate * area * 1.0e-9 * frate / ((float)roll->nstrips());
286 
287  CLHEP::RandPoissonQ randPoissonQ(*engine, ave);
288  N_hits = randPoissonQ.fire();
289 
290  for (int i = 0; i < N_hits; i++) {
291  int time_hit = (static_cast<int>(CLHEP::RandFlat::shoot(engine, (nbxing * gate) / gate))) - nbxing / 2;
292  std::pair<int, int> digi(j + 1, time_hit);
293  strips.insert(digi);
294  }
295  }
296 }
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* RPCSimAverageNoiseEffCls::_rpcSync
protected

◆ aveCls

double RPCSimAverageNoiseEffCls::aveCls
protected

Definition at line 46 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls().

◆ aveEff

double RPCSimAverageNoiseEffCls::aveEff
protected

Definition at line 43 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls().

◆ clsForDetId

std::vector<double> RPCSimAverageNoiseEffCls::clsForDetId
protected

Definition at line 64 of file RPCSimAverageNoiseEffCls.h.

Referenced by getClSize().

◆ clsMap

std::map<int, std::vector<double> > RPCSimAverageNoiseEffCls::clsMap
protected

Definition at line 62 of file RPCSimAverageNoiseEffCls.h.

Referenced by getClSize().

◆ dtimCs

double RPCSimAverageNoiseEffCls::dtimCs
protected

Definition at line 49 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls().

◆ eledig

bool RPCSimAverageNoiseEffCls::eledig
protected

Definition at line 54 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls(), and simulate().

◆ frate

double RPCSimAverageNoiseEffCls::frate
protected

Definition at line 60 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls(), and simulateNoise().

◆ gate

double RPCSimAverageNoiseEffCls::gate
protected

Definition at line 59 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls(), and simulateNoise().

◆ infile

std::ifstream* RPCSimAverageNoiseEffCls::infile
protected

Definition at line 65 of file RPCSimAverageNoiseEffCls.h.

◆ lbGate

double RPCSimAverageNoiseEffCls::lbGate
protected

Definition at line 52 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls().

◆ N_hits

int RPCSimAverageNoiseEffCls::N_hits
protected

Definition at line 56 of file RPCSimAverageNoiseEffCls.h.

Referenced by simulateNoise().

◆ nbxing

int RPCSimAverageNoiseEffCls::nbxing
protected

Definition at line 57 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls(), and simulateNoise().

◆ rate

double RPCSimAverageNoiseEffCls::rate
protected

Definition at line 58 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls().

◆ resEle

double RPCSimAverageNoiseEffCls::resEle
protected

Definition at line 50 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls().

◆ resRPC

double RPCSimAverageNoiseEffCls::resRPC
protected

Definition at line 47 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls().

◆ rpcdigiprint

bool RPCSimAverageNoiseEffCls::rpcdigiprint
protected

Definition at line 53 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls().

◆ sspeed

double RPCSimAverageNoiseEffCls::sspeed
protected

Definition at line 51 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls().

◆ sum_clsize

std::vector<double> RPCSimAverageNoiseEffCls::sum_clsize
protected

Definition at line 63 of file RPCSimAverageNoiseEffCls.h.

Referenced by getClSize().

◆ timOff

double RPCSimAverageNoiseEffCls::timOff
protected

Definition at line 48 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls().