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 ( const edm::ParameterSet config)

Definition at line 43 of file RPCSimAverageNoiseEffCls.cc.

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

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

Definition at line 78 of file RPCSimAverageNoiseEffCls.cc.

References _rpcSync.

79 {
80  delete _rpcSync;
81 }

Member Function Documentation

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

Definition at line 133 of file RPCSimAverageNoiseEffCls.cc.

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

Referenced by simulate().

134 {
135 
136  std::map< int, std::vector<double> > clsMap = getRPCSimSetUp()->getClsMap();
137 
138  int cnt = 1;
139  int min = 1;
140  double func=0.0;
141  std::vector<double> sum_clsize;
142 
143  double rr_cl = CLHEP::RandFlat::shoot(engine);
144  if(0.0 <= posX && posX < 0.2) {
145  func = (clsMap[1])[(clsMap[1]).size()-1]*(rr_cl);
146  sum_clsize = clsMap[1];
147  }
148  if(0.2 <= posX && posX < 0.4) {
149  func = (clsMap[2])[(clsMap[2]).size()-1]*(rr_cl);
150  sum_clsize = clsMap[2];
151  }
152  if(0.4 <= posX && posX < 0.6) {
153  func = (clsMap[3])[(clsMap[3]).size()-1]*(rr_cl);
154  sum_clsize = clsMap[3];
155  }
156  if(0.6 <= posX && posX < 0.8) {
157  func = (clsMap[4])[(clsMap[4]).size()-1]*(rr_cl);
158  sum_clsize = clsMap[4];
159  }
160  if(0.8 <= posX && posX < 1.0) {
161  func = (clsMap[5])[(clsMap[5]).size()-1]*(rr_cl);
162  sum_clsize = clsMap[5];
163  }
164 
165  for(vector<double>::iterator iter = sum_clsize.begin();
166  iter != sum_clsize.end(); ++iter){
167  cnt++;
168  if(func > (*iter)){
169  min = cnt;
170  }
171  else if(func < (*iter)){
172  break;
173  }
174  }
175  return min;
176 }
RPCSimSetUp * getRPCSimSetUp()
Definition: RPCSim.h:50
std::vector< double > sum_clsize
const std::map< int, std::vector< double > > & getClsMap()
Definition: RPCSimSetUp.cc:397
T min(T a, T b)
Definition: MathUtil.h:58
std::map< int, std::vector< double > > clsMap
int RPCSimAverageNoiseEffCls::getClSize ( uint32_t  id,
float  posX,
CLHEP::HepRandomEngine *  engine 
)

Definition at line 84 of file RPCSimAverageNoiseEffCls.cc.

References clsForDetId, patCandidates_cff::func, RPCSimSetUp::getCls(), RPCSim::getRPCSimSetUp(), mps_fire::i, min(), and sum_clsize.

85 {
86  std::vector<double> clsForDetId = getRPCSimSetUp()->getCls(id);
87 
88  int cnt = 1;
89  int min = 1;
90  double func=0.0;
91  std::vector<double> sum_clsize;
92 
93  sum_clsize.clear();
94  sum_clsize = clsForDetId;
95  int vectOffset(0);
96 
97  double rr_cl = CLHEP::RandFlat::shoot(engine);
98 
99  if(0.0 <= posX && posX < 0.2) {
100  func = clsForDetId[19]*(rr_cl);
101  vectOffset = 0;
102  }
103  if(0.2 <= posX && posX < 0.4) {
104  func = clsForDetId[39]*(rr_cl);
105  vectOffset = 20;
106  }
107  if(0.4 <= posX && posX < 0.6) {
108  func = clsForDetId[59]*(rr_cl);
109  vectOffset = 40;
110  }
111  if(0.6 <= posX && posX < 0.8) {
112  func = clsForDetId[79]*(rr_cl);
113  vectOffset = 60;
114  }
115  if(0.8 <= posX && posX < 1.0) {
116  func = clsForDetId[89]*(rr_cl);
117  vectOffset = 80;
118  }
119 
120 
121  for(int i = vectOffset; i<(vectOffset+20); i++){
122  cnt++;
123  if(func > clsForDetId[i]){
124  min = cnt;
125  }
126  else if(func < clsForDetId[i]){
127  break;
128  }
129  }
130  return min;
131 }
RPCSimSetUp * getRPCSimSetUp()
Definition: RPCSim.h:50
std::vector< double > clsForDetId
std::vector< double > sum_clsize
const std::vector< double > & getCls(uint32_t id)
Definition: RPCSimSetUp.cc:408
T min(T a, T b)
Definition: MathUtil.h:58
void RPCSimAverageNoiseEffCls::init ( void  )
inlineoverrideprotectedvirtual

Implements RPCSim.

Definition at line 47 of file RPCSimAverageNoiseEffCls.h.

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

Implements RPCSim.

Definition at line 179 of file RPCSimAverageNoiseEffCls.cc.

References _rpcSync, RPCRoll::centreOfStrip(), Topology::channel(), GetRecoTauVFromDQM_MC_cff::cl, edm::DetSet< T >::clear(), eledig, getClSize(), RPCSim::getRPCSimSetUp(), RPCSynchronizer::getSimHitBx(), mps_fire::i, RPCRoll::id(), RPCRoll::nstrips(), objects.autophobj::particleType, RecoTauValidation_cfi::posX, DetId::rawId(), RPCSynchronizer::setRPCSimSetUp(), RPCRoll::specs(), RPCRoll::strip(), RPCSim::strips, RPCSim::theDetectorHitMap, RPCSim::theRpcDigiSimLinks, RPCRollSpecs::topology(), ecaldqm::topology(), and PV3DBase< T, PVType, FrameType >::x().

182 {
185  theDetectorHitMap.clear();
187 
188  RPCDetId rpcId = roll->id();
189  RPCGeomServ RPCname(rpcId);
190  //std::string nameRoll = RPCname.name();
191 
192  const Topology& topology=roll->specs()->topology();
193 
194  for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin();
195  _hit != rpcHits.end(); ++_hit){
196 
197  if(!eledig && _hit-> particleType() == 11) continue;
198  // Here I hould check if the RPC are up side down;
199  const LocalPoint& entr=_hit->entryPoint();
200 
201  int time_hit = _rpcSync->getSimHitBx(&(*_hit), engine);
202  float posX = roll->strip(_hit->localPosition()) - static_cast<int>(roll->strip(_hit->localPosition()));
203 
204  std::vector<float> veff = (getRPCSimSetUp())->getEff(rpcId.rawId());
205 
206  // Effinciecy
207  int centralStrip = topology.channel(entr)+1;;
208  float fire = CLHEP::RandFlat::shoot(engine);
209 
210  if (fire < veff[centralStrip-1]) {
211 
212  int fstrip=centralStrip;
213  int lstrip=centralStrip;
214 
215  // Compute the cluster size
216  int clsize = this->getClSize(rpcId.rawId(),posX, engine); // This is for cluster size chamber by chamber
217  std::vector<int> cls;
218  cls.push_back(centralStrip);
219  if (clsize > 1){
220  for (int cl = 0; cl < (clsize-1)/2; cl++){
221  if (centralStrip - cl -1 >= 1 ){
222  fstrip = centralStrip-cl-1;
223  cls.push_back(fstrip);
224  }
225  if (centralStrip + cl + 1 <= roll->nstrips() ){
226  lstrip = centralStrip+cl+1;
227  cls.push_back(lstrip);
228  }
229  }
230  if (clsize%2 == 0 ){
231  // insert the last strip according to the
232  // simhit position in the central strip
233  double deltaw=roll->centreOfStrip(centralStrip).x()-entr.x();
234  if (deltaw<0.) {
235  if (lstrip < roll->nstrips() ){
236  lstrip++;
237  cls.push_back(lstrip);
238  }
239  }else{
240  if (fstrip > 1 ){
241  fstrip--;
242  cls.push_back(fstrip);
243  }
244  }
245  }
246  }
247 
248  for (std::vector<int>::iterator i=cls.begin(); i!=cls.end();i++){
249  // Check the timing of the adjacent strip
250  if(*i != centralStrip){
251  if(CLHEP::RandFlat::shoot(engine) < veff[*i-1]){
252  std::pair<int, int> digi(*i,time_hit);
253  strips.insert(digi);
254 
255  theDetectorHitMap.insert(DetectorHitMap::value_type(digi,&(*_hit)));
256  }
257  }
258  else {
259  std::pair<int, int> digi(*i,time_hit);
260  theDetectorHitMap.insert(DetectorHitMap::value_type(digi,&(*_hit)));
261 
262  strips.insert(digi);
263  }
264  }
265  }
266  }
267 }
float strip(const LocalPoint &lp) const
Definition: RPCRoll.cc:71
int getClSize(float posX, CLHEP::HepRandomEngine *)
const Topology & topology() const override
Definition: RPCRollSpecs.cc:43
LocalPoint centreOfStrip(int strip) const
Definition: RPCRoll.cc:52
CaloTopology const * topology(0)
DetectorHitMap theDetectorHitMap
Definition: RPCSim.h:72
void setRPCSimSetUp(RPCSimSetUp *simsetup)
int nstrips() const
Definition: RPCRoll.cc:46
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
RPCSimSetUp * getRPCSimSetUp()
Definition: RPCSim.h:50
const RPCRollSpecs * specs() const
Definition: RPCRoll.cc:18
int getSimHitBx(const PSimHit *, CLHEP::HepRandomEngine *)
std::set< std::pair< int, int > > strips
Definition: RPCSim.h:60
edm::DetSet< RPCDigiSimLink > RPCDigiSimLinks
Definition: RPCSim.h:35
RPCDetId id() const
Definition: RPCRoll.cc:24
virtual int channel(const LocalPoint &p) const =0
void clear()
Definition: DetSet.h:69
T x() const
Definition: PV3DBase.h:62
RPCDigiSimLinks theRpcDigiSimLinks
Definition: RPCSim.h:74
void RPCSimAverageNoiseEffCls::simulateNoise ( const RPCRoll roll,
CLHEP::HepRandomEngine *  engine 
)
overridevirtual

Implements RPCSim.

Definition at line 269 of file RPCSimAverageNoiseEffCls.cc.

References jets_cff::area, objects.autophobj::float, frate, gate, RPCSim::getRPCSimSetUp(), mps_fire::i, RPCRoll::id(), RectangularStripTopology::localPosition(), TrapezoidalStripTopology::localPosition(), N_hits, nbxing, RPCRoll::nstrips(), DetId::rawId(), RPCDetId::region(), RectangularStripTopology::stripLength(), TrapezoidalStripTopology::stripLength(), RPCSim::strips, RPCRoll::topology(), x, TrackerOfflineValidation_Dqm_cff::xmax, and TrackerOfflineValidation_Dqm_cff::xmin.

271 {
272 
273  RPCDetId rpcId = roll->id();
274 
275  RPCGeomServ RPCname(rpcId);
276 
277  std::vector<float> vnoise = (getRPCSimSetUp())->getNoise(rpcId.rawId());
278  std::vector<float> veff = (getRPCSimSetUp())->getEff(rpcId.rawId());
279 
280  unsigned int nstrips = roll->nstrips();
281  double area = 0.0;
282 
283  if ( rpcId.region() == 0 )
284  {
285  const RectangularStripTopology* top_ = dynamic_cast<const
286  RectangularStripTopology*>(&(roll->topology()));
287  float xmin = (top_->localPosition(0.)).x();
288  float xmax = (top_->localPosition((float)roll->nstrips())).x();
289  float striplength = (top_->stripLength());
290  area = striplength*(xmax-xmin);
291  }
292  else
293  {
294  const TrapezoidalStripTopology* top_=dynamic_cast<const TrapezoidalStripTopology*>(&(roll->topology()));
295  float xmin = (top_->localPosition(0.)).x();
296  float xmax = (top_->localPosition((float)roll->nstrips())).x();
297  float striplength = (top_->stripLength());
298  area = striplength*(xmax-xmin);
299  }
300 
301  for(unsigned int j = 0; j < vnoise.size(); ++j){
302 
303  if(j >= nstrips) break;
304 
305  // The efficiency of 0% does not imply on the noise rate.
306  // If the strip is masked the noise rate should be 0 Hz/cm^2
307  // if(veff[j] == 0) continue;
308 
309  // double ave = vnoise[j]*nbxing*gate*area*1.0e-9*frate;
310  // The vnoise is the noise rate per strip, so we shout multiply not
311  // by the chamber area,
312  // but the strip area which is area/((float)roll->nstrips()));
313  double ave =
314  vnoise[j]*nbxing*gate*area*1.0e-9*frate/((float)roll->nstrips());
315 
316  CLHEP::RandPoissonQ randPoissonQ(*engine, ave);
317  N_hits = randPoissonQ.fire();
318 
319  for (int i = 0; i < N_hits; i++ ){
320 
321  int time_hit = (static_cast<int>(CLHEP::RandFlat::shoot(engine, (nbxing*gate)/gate))) - nbxing/2;
322  std::pair<int, int> digi(j+1,time_hit);
323  strips.insert(digi);
324  }
325  }
326 }
LocalPoint localPosition(float strip) const override
int nstrips() const
Definition: RPCRoll.cc:46
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
LocalPoint localPosition(float strip) const override
RPCSimSetUp * getRPCSimSetUp()
Definition: RPCSim.h:50
const Topology & topology() const override
Definition: RPCRoll.cc:30
std::set< std::pair< int, int > > strips
Definition: RPCSim.h:60
RPCDetId id() const
Definition: RPCRoll.cc:24
float stripLength() const override
det heigth (strip length in the middle)
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:63
float stripLength() const override

Member Data Documentation

RPCSynchronizer* RPCSimAverageNoiseEffCls::_rpcSync
protected
double RPCSimAverageNoiseEffCls::aveCls
protected

Definition at line 50 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls().

double RPCSimAverageNoiseEffCls::aveEff
protected

Definition at line 47 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls().

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

Definition at line 68 of file RPCSimAverageNoiseEffCls.h.

Referenced by getClSize().

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

Definition at line 66 of file RPCSimAverageNoiseEffCls.h.

Referenced by getClSize().

double RPCSimAverageNoiseEffCls::dtimCs
protected

Definition at line 53 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls().

bool RPCSimAverageNoiseEffCls::eledig
protected

Definition at line 58 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls(), and simulate().

double RPCSimAverageNoiseEffCls::frate
protected

Definition at line 64 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls(), and simulateNoise().

double RPCSimAverageNoiseEffCls::gate
protected

Definition at line 63 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls(), and simulateNoise().

std::ifstream* RPCSimAverageNoiseEffCls::infile
protected

Definition at line 69 of file RPCSimAverageNoiseEffCls.h.

double RPCSimAverageNoiseEffCls::lbGate
protected

Definition at line 56 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls().

int RPCSimAverageNoiseEffCls::N_hits
protected

Definition at line 60 of file RPCSimAverageNoiseEffCls.h.

Referenced by simulateNoise().

int RPCSimAverageNoiseEffCls::nbxing
protected

Definition at line 61 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls(), and simulateNoise().

double RPCSimAverageNoiseEffCls::rate
protected

Definition at line 62 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls().

double RPCSimAverageNoiseEffCls::resEle
protected

Definition at line 54 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls().

double RPCSimAverageNoiseEffCls::resRPC
protected

Definition at line 51 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls().

bool RPCSimAverageNoiseEffCls::rpcdigiprint
protected

Definition at line 57 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls().

double RPCSimAverageNoiseEffCls::sspeed
protected

Definition at line 55 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls().

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

Definition at line 67 of file RPCSimAverageNoiseEffCls.h.

Referenced by getClSize().

double RPCSimAverageNoiseEffCls::timOff
protected

Definition at line 52 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls().