CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
- 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
 
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
< 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
 

Detailed Description

Definition at line 29 of file RPCSimAverageNoiseEffCls.h.

Constructor & Destructor Documentation

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

Definition at line 41 of file RPCSimAverageNoiseEffCls.cc.

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

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

Definition at line 75 of file RPCSimAverageNoiseEffCls.cc.

References _rpcSync.

76 {
77  delete _rpcSync;
78 }

Member Function Documentation

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

Definition at line 130 of file RPCSimAverageNoiseEffCls.cc.

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

Referenced by simulate().

131 {
132 
133  std::map< int, std::vector<double> > clsMap = getRPCSimSetUp()->getClsMap();
134 
135  int cnt = 1;
136  int min = 1;
137  double func=0.0;
138  std::vector<double> sum_clsize;
139 
140  double rr_cl = CLHEP::RandFlat::shoot(engine);
141  if(0.0 <= posX && posX < 0.2) {
142  func = (clsMap[1])[(clsMap[1]).size()-1]*(rr_cl);
143  sum_clsize = clsMap[1];
144  }
145  if(0.2 <= posX && posX < 0.4) {
146  func = (clsMap[2])[(clsMap[2]).size()-1]*(rr_cl);
147  sum_clsize = clsMap[2];
148  }
149  if(0.4 <= posX && posX < 0.6) {
150  func = (clsMap[3])[(clsMap[3]).size()-1]*(rr_cl);
151  sum_clsize = clsMap[3];
152  }
153  if(0.6 <= posX && posX < 0.8) {
154  func = (clsMap[4])[(clsMap[4]).size()-1]*(rr_cl);
155  sum_clsize = clsMap[4];
156  }
157  if(0.8 <= posX && posX < 1.0) {
158  func = (clsMap[5])[(clsMap[5]).size()-1]*(rr_cl);
159  sum_clsize = clsMap[5];
160  }
161 
162  for(vector<double>::iterator iter = sum_clsize.begin();
163  iter != sum_clsize.end(); ++iter){
164  cnt++;
165  if(func > (*iter)){
166  min = cnt;
167  }
168  else if(func < (*iter)){
169  break;
170  }
171  }
172  return min;
173 }
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 81 of file RPCSimAverageNoiseEffCls.cc.

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

82 {
83  std::vector<double> clsForDetId = getRPCSimSetUp()->getCls(id);
84 
85  int cnt = 1;
86  int min = 1;
87  double func=0.0;
88  std::vector<double> sum_clsize;
89 
90  sum_clsize.clear();
91  sum_clsize = clsForDetId;
92  int vectOffset(0);
93 
94  double rr_cl = CLHEP::RandFlat::shoot(engine);
95 
96  if(0.0 <= posX && posX < 0.2) {
97  func = clsForDetId[19]*(rr_cl);
98  vectOffset = 0;
99  }
100  if(0.2 <= posX && posX < 0.4) {
101  func = clsForDetId[39]*(rr_cl);
102  vectOffset = 20;
103  }
104  if(0.4 <= posX && posX < 0.6) {
105  func = clsForDetId[59]*(rr_cl);
106  vectOffset = 40;
107  }
108  if(0.6 <= posX && posX < 0.8) {
109  func = clsForDetId[79]*(rr_cl);
110  vectOffset = 60;
111  }
112  if(0.8 <= posX && posX < 1.0) {
113  func = clsForDetId[89]*(rr_cl);
114  vectOffset = 80;
115  }
116 
117 
118  for(int i = vectOffset; i<(vectOffset+20); i++){
119  cnt++;
120  if(func > clsForDetId[i]){
121  min = cnt;
122  }
123  else if(func < clsForDetId[i]){
124  break;
125  }
126  }
127  return min;
128 }
int i
Definition: DBlmapReader.cc:9
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 176 of file RPCSimAverageNoiseEffCls.cc.

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

179 {
182  theDetectorHitMap.clear();
184 
185  RPCDetId rpcId = roll->id();
186  RPCGeomServ RPCname(rpcId);
187  //std::string nameRoll = RPCname.name();
188 
189  const Topology& topology=roll->specs()->topology();
190 
191  for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin();
192  _hit != rpcHits.end(); ++_hit){
193 
194  if(_hit-> particleType() == 11) continue;
195  // Here I hould check if the RPC are up side down;
196  const LocalPoint& entr=_hit->entryPoint();
197 
198  int time_hit = _rpcSync->getSimHitBx(&(*_hit), engine);
199  float posX = roll->strip(_hit->localPosition()) - static_cast<int>(roll->strip(_hit->localPosition()));
200 
201  std::vector<float> veff = (getRPCSimSetUp())->getEff(rpcId.rawId());
202 
203  // Effinciecy
204  int centralStrip = topology.channel(entr)+1;;
205  float fire = CLHEP::RandFlat::shoot(engine);
206 
207  if (fire < veff[centralStrip-1]) {
208 
209  int fstrip=centralStrip;
210  int lstrip=centralStrip;
211 
212  // Compute the cluster size
213  // double w = CLHEP::RandFlat::shoot(engine);
214  //if (w < 1.e-10) w=1.e-10;
215 // int clsize = this->getClSize(posX, engine); // This is for one and the same cls for all the chambers
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 *)
int i
Definition: DBlmapReader.cc:9
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
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
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
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
tuple particleType
const Topology & topology() const
Definition: RPCRollSpecs.cc:43
void RPCSimAverageNoiseEffCls::simulateNoise ( const RPCRoll roll,
CLHEP::HepRandomEngine *  engine 
)
overridevirtual

Implements RPCSim.

Definition at line 269 of file RPCSimAverageNoiseEffCls.cc.

References edmStreamStallGrapher::const, frate, gate, RPCSim::getRPCSimSetUp(), i, RPCRoll::id(), 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.

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

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 67 of file RPCSimAverageNoiseEffCls.h.

Referenced by getClSize().

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

Definition at line 65 of file RPCSimAverageNoiseEffCls.h.

Referenced by getClSize().

double RPCSimAverageNoiseEffCls::dtimCs
protected

Definition at line 53 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls().

double RPCSimAverageNoiseEffCls::frate
protected

Definition at line 63 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls(), and simulateNoise().

double RPCSimAverageNoiseEffCls::gate
protected

Definition at line 62 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls(), and simulateNoise().

std::ifstream* RPCSimAverageNoiseEffCls::infile
protected

Definition at line 68 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 59 of file RPCSimAverageNoiseEffCls.h.

Referenced by simulateNoise().

int RPCSimAverageNoiseEffCls::nbxing
protected

Definition at line 60 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls(), and simulateNoise().

double RPCSimAverageNoiseEffCls::rate
protected

Definition at line 61 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 66 of file RPCSimAverageNoiseEffCls.h.

Referenced by getClSize().

double RPCSimAverageNoiseEffCls::timOff
protected

Definition at line 52 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls().